Enhancement in ecm file navigation

This commit is contained in:
Laurent Destailleur 2008-10-13 15:00:27 +00:00
parent c0aba753ef
commit 481e10a18d
3 changed files with 34 additions and 11 deletions

View File

@ -377,7 +377,7 @@ class EcmDirectory // extends CommonObject
$result='';
$lien = '<a href="'.DOL_URL_ROOT.'/ecm/docmine.php?section='.$this->id.'">';
if ($option == 'index') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'">';
if ($option == 'index') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true">';
if ($option == 'indexexpanded') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=false">';
if ($option == 'indexnotexpanded') $lien = '<a href="'.DOL_URL_ROOT.'/ecm/index.php?section='.$this->id.'&amp;sectionexpand=true">';
$lienfin='</a>';

View File

@ -342,7 +342,7 @@ if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $
// Section
print '<td align="left">';
print '<table class="nobordernopadding"><tr class="nobordernopadding"><td>';
print tree_showpad($sectionauto,$key);
tree_showpad($sectionauto,$key);
print '</td><td valign="top">';
print img_picto('','object_dir');
print '</td><td valign="middle">&nbsp;';
@ -486,7 +486,7 @@ if (empty($action) || $action == 'file_manager' || eregi('refresh',$action) || $
// Show tree graph pictos
print '<td align="left">';
print '<table class="nobordernopadding"><tr class="nobordernopadding"><td>';
print tree_showpad($fulltree,$key);
tree_showpad($fulltree,$key);
print '</td>';
// Show picto
print '<td valign="top">';

View File

@ -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;
}