mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 23:42:11 +00:00
fix tree behaviour, do not load all sub nodes
This commit is contained in:
parent
679fb1a349
commit
39217037b8
|
@ -1593,15 +1593,19 @@ $(document).ready(function() {
|
|||
function printNewTreeNavigationJs($folderid=0, $accessmode=M_READ, $showdocs=0, $formid='form1', $expandtree=0, $orderby='', $partialtree=false) { /* {{{ */
|
||||
function jqtree($path, $folder, $user, $accessmode, $showdocs=1, $expandtree=0, $orderby='', $level=0) {
|
||||
$orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc');
|
||||
if($path || $expandtree>=$level) {
|
||||
if($path/* || $expandtree>=$level*/) {
|
||||
if($path)
|
||||
$pathfolder = array_shift($path);
|
||||
$children = array();
|
||||
$subfolders = $folder->getSubFolders(isset($orderby[0]) ? $orderby[0] : '', $orderdir);
|
||||
$subfolders = SeedDMS_Core_DMS::filterAccess($subfolders, $user, $accessmode);
|
||||
if($expandtree) {
|
||||
$subfolders = $folder->getSubFolders(isset($orderby[0]) ? $orderby[0] : '', $orderdir);
|
||||
$subfolders = SeedDMS_Core_DMS::filterAccess($subfolders, $user, $accessmode);
|
||||
} else {
|
||||
$subfolders = array($pathfolder);
|
||||
}
|
||||
foreach($subfolders as $subfolder) {
|
||||
$node = array('label'=>$subfolder->getName(), 'id'=>$subfolder->getID(), 'load_on_demand'=>($subfolder->hasSubFolders() || ($subfolder->hasDocuments() && $showdocs)) ? true : false, 'is_folder'=>true);
|
||||
if($expandtree>=$level || $pathfolder->getID() == $subfolder->getID()) {
|
||||
if(/*$expandtree>=$level ||*/ $pathfolder->getID() == $subfolder->getID()) {
|
||||
$node['children'] = jqtree($path, $subfolder, $user, $accessmode, $showdocs, $expandtree, $orderby, $level+1);
|
||||
if($showdocs) {
|
||||
$documents = $subfolder->getDocuments(isset($orderby[0]) ? $orderby[0] : '', $orderdir);
|
||||
|
@ -1669,7 +1673,7 @@ $(function() {
|
|||
const $tree = $('#jqtree<?php echo $formid ?>');
|
||||
$tree.tree({
|
||||
// saveState: true,
|
||||
selectable: false,
|
||||
selectable: true,
|
||||
data: data,
|
||||
saveState: 'jqtree<?php echo $formid; ?>',
|
||||
openedIcon: $('<i class="icon-minus-sign"></i>'),
|
||||
|
@ -1680,7 +1684,7 @@ $(function() {
|
|||
} else
|
||||
documentSelected<?php echo $formid ?>(node.id, node.name);
|
||||
},
|
||||
autoOpen: true,
|
||||
autoOpen: false,
|
||||
drapAndDrop: true,
|
||||
onCreateLi: function(node, $li) {
|
||||
// Add 'icon' span before title
|
||||
|
|
Loading…
Reference in New Issue
Block a user