Test to try a fix

This commit is contained in:
Laurent Destailleur 2009-01-29 21:04:00 +00:00
parent ce6f8a1c81
commit 1ec3fb6aa9

View File

@ -114,7 +114,7 @@ print '<br>';
// Charge tableau des categories // Charge tableau des categories
$cate_arbo = $c->get_full_arbo($_GET['type']); $cate_arbo = $c->get_full_arbo($_GET['type']);
/* /*
* Catégories en javascript * Catégories en javascript
*/ */
@ -142,11 +142,11 @@ if ($conf->use_javascript_ajax)
if (sizeof($cate_arbo)) if (sizeof($cate_arbo))
{ {
require_once(DOL_DOCUMENT_ROOT.'/includes/treemenu/TreeMenu.php'); require_once(DOL_DOCUMENT_ROOT.'/includes/treemenu/TreeMenu.php');
$menu = new HTML_TreeMenu(); $menu = new HTML_TreeMenu();
$icon = 'folder.gif'; $icon = 'folder.gif';
$expandedIcon = 'folder-expanded.gif'; $expandedIcon = 'folder-expanded.gif';
// Création noeud racine // Création noeud racine
$node=array(); $node=array();
$rootnode='-1'; $rootnode='-1';
@ -158,7 +158,7 @@ if ($conf->use_javascript_ajax)
'expanded' => true) 'expanded' => true)
//,array('onclick' => "alert('foo'); return false", 'onexpand' => "alert('Expanded')") //,array('onclick' => "alert('foo'); return false", 'onexpand' => "alert('Expanded')")
); );
// Ajoute id_mere sur tableau cate_arbo // Ajoute id_mere sur tableau cate_arbo
$i=0; $i=0;
foreach ($cate_arbo as $key => $val) foreach ($cate_arbo as $key => $val)
@ -182,19 +182,22 @@ if ($conf->use_javascript_ajax)
if ($_GET["expand"] == 'all' || $level <= $_GET["expand"]) { if ($_GET["expand"] == 'all' || $level <= $_GET["expand"]) {
$newelement['expanded']=true; $newelement['expanded']=true;
} }
if ($_GET["expand"] == 'none') if ($_GET["expand"] == 'none')
{ {
$newelement['expanded']=false; $newelement['expanded']=false;
} }
} }
//echo $nodeparent."|"; //echo $nodeparent."|";
//print 'x'.$cate_arbo[$key]['fullpath'].' expand='.$newelement['expanded'].'<br>'; //print 'x'.$cate_arbo[$key]['fullpath'].' expand='.$newelement['expanded'].'<br>';
$node[$cate_arbo[$key]['fullpath']]=&$node[$nodeparent]->addItem(new HTML_TreeNode($newelement)); if (is_object($node[$nodeparent])) // Should not happen but occurs on some users.
//print 'Resultat: noeud '.$cate_arbo[$key]['fullpath']." créé<br>\n"; {
$node[$cate_arbo[$key]['fullpath']]=&$node[$nodeparent]->addItem(new HTML_TreeNode($newelement));
//print 'Resultat: noeud '.$cate_arbo[$key]['fullpath']." créé<br>\n";
}
} }
$menu->addItem($node[$rootnode]); $menu->addItem($node[$rootnode]);
// Affiche arbre // Affiche arbre
print '<script src="'.DOL_URL_ROOT.'/includes/treemenu/TreeMenu.js" language="JavaScript" type="text/javascript"></script>'; print '<script src="'.DOL_URL_ROOT.'/includes/treemenu/TreeMenu.js" language="JavaScript" type="text/javascript"></script>';
$treeMenu = new HTML_TreeMenu_DHTML($menu, $treeMenu = new HTML_TreeMenu_DHTML($menu,
@ -207,18 +210,18 @@ if ($conf->use_javascript_ajax)
), ),
true); true);
$treeMenu->printMenu(); $treeMenu->printMenu();
//$listBox = new HTML_TreeMenu_Listbox($menu, array('linkTarget' => '_self')); //$listBox = new HTML_TreeMenu_Listbox($menu, array('linkTarget' => '_self'));
//$listBox->printMenu(); //$listBox->printMenu();
} }
else else
{ {
print $langs->trans("NoneCategory"); print $langs->trans("NoneCategory");
} }
print '</td></tr>'; print '</td></tr>';
print "</table>"; print "</table>";
print '<br>'; print '<br>';
} }
@ -244,7 +247,7 @@ else
print "\t</tr>\n"; print "\t</tr>\n";
} }
} }
} }
print "</table>"; print "</table>";