From f67962a049aa43bddb43dc42cb5ccd3643cee98b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Oct 2008 00:28:11 +0000 Subject: [PATCH] Enhancement in ecm module --- htdocs/ecm/index.php | 12 ++++++++---- htdocs/lib/treeview.lib.php | 16 +++++++++++----- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 80101297ac3..629a5152324 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -480,19 +480,23 @@ if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $ if (in_array($val['id'],$expandedsectionarray)) $option='indexexpanded'; else $option='indexnotexpanded'; //print $option; - + print ''; // Show tree graph pictos print ''; print ''; // Show picto print '
'; - tree_showpad($fulltree,$key); + $resarray=tree_showpad($fulltree,$key); + $a=$resarray[0]; + $b=$resarray[1]; print ''; //print $val['fullpath']."(".$showline.")"; - if (! in_array($val['id'],$expandedsectionarray)) $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/plustop2.gif','',1); - else $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop2.gif','',1); + $n='2'; + if ($b == 0 || ! in_array($val['id'],$expandedsectionarray)) $n='3'; + if (! in_array($val['id'],$expandedsectionarray)) $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/plustop'.$n.'.gif','',1); + else $ref=img_picto('',DOL_URL_ROOT.'/theme/common/treemenu/minustop'.$n.'.gif','',1); $oldref=$ecmdirstatic->ref; $ecmdirstatic->ref=$ref; print $ecmdirstatic->getNomUrl(0,$option); diff --git a/htdocs/lib/treeview.lib.php b/htdocs/lib/treeview.lib.php index 17340b41229..35c43b1fc03 100644 --- a/htdocs/lib/treeview.lib.php +++ b/htdocs/lib/treeview.lib.php @@ -78,28 +78,34 @@ function is_in_subtree($fulltree,$parentid,$childid) * * @param fulltree Array of entries in correct order * @param key Key of value to show picto - * @return int 1 + * @return array (0 or 1 if at least one of this level after, 0 or 1 if at least one of higher level after) */ function tree_showpad(&$fulltree,$key,$selected=0) { $pos=1; + + // Loop on each pos, because we will output an img for each pos while ($pos <= $fulltree[$key]['level'] && $fulltree[$key]['level'] > 0) { // Process picto for column $pos $atleastonofthislevelafter=0; + $nbofhigherlevelafter=0; $found=0; //print 'x'.$key; foreach($fulltree as $key2 => $val2) { - if ($found == 1) + if ($found == 1) // We are after the entry to show { + if ($fulltree[$key2]['level'] > $pos) + { + $nbofhigherlevelafter++; + } if ($fulltree[$key2]['level'] == $pos) { $atleastonofthislevelafter=1; - break; } - if ($fulltree[$key2]['level'] < $pos) + if ($fulltree[$key2]['level'] <= $pos) { break; } @@ -121,7 +127,7 @@ function tree_showpad(&$fulltree,$key,$selected=0) $pos++; } - return 1; + return array($atleastonofthislevelafter,$nbofhigherlevelafter); }