check if folder for jstree is actually accesible

This commit is contained in:
Uwe Steinmann 2020-12-18 10:19:49 +01:00
parent 7d37ef3ae2
commit 760265d136

View File

@ -1899,8 +1899,7 @@ $(document).ready(function() {
} /* }}} */
$orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc');
if($folderid) {
$folder = $this->params['dms']->getFolder($folderid);
if($folderid && ($folder = $this->params['dms']->getFolder($folderid))) {
if(!$partialtree) {
$path = $folder->getPath();
/* Get the first folder (root folder) of path */
@ -1930,8 +1929,10 @@ $(document).ready(function() {
}
} else {
$root = $this->params['dms']->getFolder($this->params['rootfolderid']);
if($root = $this->params['dms']->getFolder($this->params['rootfolderid']))
$tree = array(array('label'=>$root->getName(), 'id'=>$root->getID(), 'load_on_demand'=>false, 'is_folder'=>true));
else
$tree = array();
}
?>
var data = <?php echo json_encode($tree); ?>;