diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index ed5f56954c0..5fb19b0b5ec 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -289,11 +289,11 @@ if ($conf->use_javascript_ajax) - la chaine a afficher ie: data[]= array (index, index parent, chaine ) */ - + //il faut d'abord declarer un element racine de l'arbre $data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); - + //puis tous les elements enfants $sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.module"; @@ -313,6 +313,7 @@ if ($conf->use_javascript_ajax) { if (! empty($menu['langs'])) $langs->load($menu['langs']); $titre = $langs->trans($menu['titre']); + $data[] = array( 'rowid'=>$menu['rowid'], 'module'=>$menu['module'], @@ -329,28 +330,33 @@ if ($conf->use_javascript_ajax) ''.img_edit_add('default').' '. ''.img_delete('default').' '. '     '. - ''.img_picto("Monter","1uparrow").''.img_picto("Descendre","1downarrow").''. - '' + ''.img_picto("Up","1uparrow").''.img_picto("Down","1downarrow").''. + '', + 'buttons'=>''.img_edit('default',0,'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. + ''.img_edit_add('default').' '. + ''.img_delete('default').' '. + '     '. + ''.img_picto("Up","1uparrow").''.img_picto("Down","1downarrow").'' ); $i++; } } global $tree_recur_alreadyadded; // This var was def into tree_recur - + // Appelle de la fonction recursive (ammorce) // avec recherche depuis la racine. //var_dump($data); tree_recur($data, $data[0], 0, 'iddivjstree'); // $data[0] is virtual record 'racine' - + print ''; - + print ''; - + print ''; - - + + // Process remaining records (records that are not linked to root by any path) $remainingdata = array(); foreach($data as $datar) @@ -358,30 +364,30 @@ if ($conf->use_javascript_ajax) if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) continue; $remainingdata[] = $datar; } - + if (count($remainingdata)) { print ''; - + print ''; print ''; print ''; print ''; - + print ''; - print ''; - + print ''; - + print '
'.$langs->trans("NotTopTreeMenuPersonalized").'
'; - + print ''; + foreach($remainingdata as $datar) { $father = array('rowid'=>$datar['rowid'],'title'=>"???",'mainmenu'=>$datar['fk_mainmenu'],'leftmenu'=>$datar['fk_leftmenu'],'fk_mainmenu'=>'','fk_leftmenu'=>''); //print 'Start with rowid='.$datar['rowid'].' mainmenu='.$father ['mainmenu'].' leftmenu='.$father ['leftmenu'].'
'."\n"; tree_recur($data, $father, 0, 'iddivjstree'.$datar['rowid'], 1, 1); } - + print '
'; } diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index db0fcd07fae..944520d04d5 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -110,15 +110,15 @@ function tree_showpad(&$fulltree,$key,$silent=0) * @param int $rang Level of element * @param string $iddivjstree Id to use for parent ul element * @param int $donoresetalreadyloaded Do not reset global array $donoresetalreadyloaded used to avoid to go down on an aleady processed record - * @param int $showfk Show fk links to parent into label + * @param int $showfk 1=show fk_links to parent into label (used by menu editor only) * @return void */ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetalreadyloaded=0, $showfk=0) { global $tree_recur_alreadyadded; - + if ($rang == 0 && empty($donoresetalreadyloaded)) $tree_recur_alreadyadded=array(); - + if ($rang == 0) { // Test also done with jstree and dynatree (not able to have inside label) @@ -138,8 +138,8 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal print '