From 481e10a18dc7d57d8f3ce638e78fb017248c7914 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Oct 2008 15:00:27 +0000 Subject: [PATCH] Enhancement in ecm file navigation --- htdocs/ecm/ecmdirectory.class.php | 2 +- htdocs/ecm/index.php | 4 ++-- htdocs/lib/treeview.lib.php | 39 ++++++++++++++++++++++++------- 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/htdocs/ecm/ecmdirectory.class.php b/htdocs/ecm/ecmdirectory.class.php index fd483a61488..28cb4f9f7e8 100644 --- a/htdocs/ecm/ecmdirectory.class.php +++ b/htdocs/ecm/ecmdirectory.class.php @@ -377,7 +377,7 @@ class EcmDirectory // extends CommonObject $result=''; $lien = ''; - if ($option == 'index') $lien = ''; + if ($option == 'index') $lien = ''; if ($option == 'indexexpanded') $lien = ''; if ($option == 'indexnotexpanded') $lien = ''; $lienfin=''; diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 0af37171a01..90a01ce4910 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -342,7 +342,7 @@ if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $ // Section print ''; print '
'; - print tree_showpad($sectionauto,$key); + tree_showpad($sectionauto,$key); print ''; print img_picto('','object_dir'); print ' '; @@ -486,7 +486,7 @@ if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $ // Show tree graph pictos print ''; print ''; // Show picto print '
'; - print tree_showpad($fulltree,$key); + tree_showpad($fulltree,$key); print ''; diff --git a/htdocs/lib/treeview.lib.php b/htdocs/lib/treeview.lib.php index b39ecaa5c1e..17340b41229 100644 --- a/htdocs/lib/treeview.lib.php +++ b/htdocs/lib/treeview.lib.php @@ -76,29 +76,52 @@ function is_in_subtree($fulltree,$parentid,$childid) /** * Show picto of a tree view * - * @param unknown_type $tab Array of entries in correct order - * @param unknown_type $key Key of value to show picto + * @param fulltree Array of entries in correct order + * @param key Key of value to show picto + * @return int 1 */ -function tree_showpad(&$tab,$key,$selected=0) +function tree_showpad(&$fulltree,$key,$selected=0) { $pos=1; - while ($pos <= $tab[$key]['level'] && $tab[$key]['level'] > 0) + while ($pos <= $fulltree[$key]['level'] && $fulltree[$key]['level'] > 0) { // Process picto for column $pos - // \TODO If at least one of this level - $atleastonofthislevelafter=1; + + $atleastonofthislevelafter=0; + $found=0; + //print 'x'.$key; + foreach($fulltree as $key2 => $val2) + { + if ($found == 1) + { + if ($fulltree[$key2]['level'] == $pos) + { + $atleastonofthislevelafter=1; + break; + } + if ($fulltree[$key2]['level'] < $pos) + { + break; + } + } + if ($key2 == $key) $found=1; + } + //print $atleastonofthislevelafter; + if ($atleastonofthislevelafter) { - if ($tab[$key]['level'] == $pos) print img_picto_common('','treemenu/branch.gif'); + if ($fulltree[$key]['level'] == $pos) print img_picto_common('','treemenu/branch.gif'); else print img_picto_common('','treemenu/line.gif'); } else { - if ($tab[$key]['level'] == $pos) print img_picto_common('','treemenu/branchbottom.gif'); + if ($fulltree[$key]['level'] == $pos) print img_picto_common('','treemenu/branchbottom.gif'); else print img_picto_common('','treemenu/linebottom.gif'); } $pos++; } + + return 1; }