[Tableaux] Problème avec un arbre de sélection
Bonjour,
J'ai un probleme, mais je n'ai aucune idées pour le résoudre.
Je travaille (en gros j'améliore un outil open-source) sur un outil dans lequel apparait sur le coté gauche un arbre de sélection. exemple:
.arbre
|_arbre1
|_arbre2
| |_test1
| |_test2
|_arbre3
|_ ....
enfin bref. Mon probleme vient du fait qu'a partir du moment ou le listing devient trop important, à chaque fois que je clique sur "une branche", l'outil me renvoie en haut de la page.
je m'explique: si il y a 20 sous menu au dessus de "arbre3", lorsque je vais cliquer sur ce dernier, l'outil me renvoie en haut de la page m'obligeant à utiliser la barre déroulante pour revenir à "arbre3".
Question : comment puis je faire pour "figer" l'outil, c'est à dire pour empecher se retour en haut de page. Normalement, la fonction responsable est:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
function printFolderTree($path, $level = 0, $activeObj, $isFolder)
{
GLOBAL $user;
$folder = $path[$level];
$subFolders = $folder->getSubFolders();
$subFolders = filterAccess($subFolders, $user, M_READ);
if ($level == count($path)-1)
{
$documents = $folder->getDocuments();
$documents = filterAccess($documents, $user, M_READ);
}
else
$documents = array();
if ($level+1 < count($path))
$nextFolderID = $path[$level+1]->getID();
else
$nextFolderID = -1;
print "<table cellpadding=0 cellspacing=0>\n";
print " <tr>\n";
print " <td valign=\"top\"";
if (count($subFolders) > 0 || count ($documents) > 0)
print " background=\"".getImgPath("down.gif")."\"";
print "><img src=\"";
if ($level == 0) printImgPath("to_down.gif");
else if ((count($subFolders) > 0) || (count($documents) > 0)) printImgPath("right_in_to_down.gif");
else printImgPath("right_in.gif");
print "\" border=0></td>\n";
if (($folder->getID() == $activeObj->getID()) && $isFolder)
print " <td class=\"foldertree_active\"><a href=\"out.ViewFolder.php?folderid=".$folder->getID()."\" class=\"foldertree_active\"><img src=\"".getImgPath("folder_opened.gif")."\" width=18 height=18 border=0>".$folder->getName()."</a></td>\n";
else
print " <td class=\"foldertree_inpath\"><a href=\"out.ViewFolder.php?folderid=".$folder->getID()."\" class=\"foldertree_inpath\"><img src=\"".getImgPath("folder_opened.gif")."\" width=18 height=18 border=0>".$folder->getName()."</a></td>\n";
print " </tr>\n";
for ($i = 0; $i < count($subFolders); $i++)
{
print "<tr>";
if (($i +1 < count($subFolders)) || (count($documents) != 0))
print "<td background=\"".getImgPath("down.gif")."\" valign=\"top\"><img src=\"".getImgPath("right.gif")."\" border=0></td>";
else
print "<td valign=\"top\"><img src=\"".getImgPath("right_last.gif")."\" border=0></td>";
print "<td>";
if ($subFolders[$i]->getID() == $nextFolderID)
printFolderTree($path, $level+1, $activeObj, $isFolder);
else
print "<table cellpadding=0 cellspacing=0><tr><td valign=\"top\"><img src=\"".getImgPath("right_in.gif")."\"></td><td class=\"foldertree\" valign=\"top\"><a href=\"out.ViewFolder.php?folderid=".$subFolders[$i]->getID()."\" class=\"foldertree\"><img src=\"".getImgPath("folder_closed.gif")."\" width=18 height=18 border=0>".$subFolders[$i]->getName()."</a></td></tr></table>";
print "</td>";
print "</tr>";
}
for ($i = 0; $i < count($documents); $i++)
{
print "<tr>";
if ($i +1 < count($documents))
print "<td background=\"".getImgPath("down.gif")."\" valign=\"top\"><img src=\"".getImgPath("right.gif")."\" border=0></td>";
else
print "<td valign=\"top\"><img src=\"".getImgPath("right_last.gif")."\" border=0></td>";
print "<td>";
if (!$isFolder && $documents[$i]->getID() == $activeObj->getID())
print "<table cellpadding=0 cellspacing=0><tr><td valign=\"top\"><img src=\"".getImgPath("right_in.gif")."\"></td><td class=\"foldertree_active\"><a href=\"out.ViewDocument.php?documentid=".$documents[$i]->getID()."\" class=\"foldertree_active\"><img src=\"".getImgPath("file.gif")."\" width=18 height=18 border=0>".$documents[$i]->getName()."</a></td></tr></table>";
else
print "<table cellpadding=0 cellspacing=0><tr><td valign=\"top\"><img src=\"".getImgPath("right_in.gif")."\"></td><td class=\"foldertree\"><a href=\"out.ViewDocument.php?documentid=".$documents[$i]->getID()."\" class=\"foldertree\"><img src=\"".getImgPath("file.gif")."\" width=18 height=18 border=0>".$documents[$i]->getName()."</a></td></tr></table>";
print "</td>";
print "</tr>";
}
print "</table>\n";
} |
Merci de m'aider.