Fix menu editor

This commit is contained in:
Laurent Destailleur 2017-07-30 19:38:12 +02:00
parent 837afa0e65
commit bb8d458468
5 changed files with 32 additions and 16 deletions

View File

@ -296,7 +296,7 @@ if ($conf->use_javascript_ajax)
//puis tous les elements enfants //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"; $sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.position, m.module";
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m"; $sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
$sql.= " WHERE menu_handler = '".$db->escape($menu_handler_to_search)."'"; $sql.= " WHERE menu_handler = '".$db->escape($menu_handler_to_search)."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
@ -323,6 +323,7 @@ if ($conf->use_javascript_ajax)
'leftmenu'=>$menu['leftmenu'], 'leftmenu'=>$menu['leftmenu'],
'fk_mainmenu'=>$menu['fk_mainmenu'], 'fk_mainmenu'=>$menu['fk_mainmenu'],
'fk_leftmenu'=>$menu['fk_leftmenu'], 'fk_leftmenu'=>$menu['fk_leftmenu'],
'position'=>$menu['position'],
'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'. 'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'.
'<strong> &nbsp; <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.$titre.'</a></strong>'. '<strong> &nbsp; <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.$titre.'</a></strong>'.
'</td><td align="right">'. '</td><td align="right">'.
@ -344,10 +345,11 @@ if ($conf->use_javascript_ajax)
global $tree_recur_alreadyadded; // This var was def into tree_recur 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); //var_dump($data);
tree_recur($data, $data[0], 0, 'iddivjstree'); // $data[0] is virtual record 'racine'
// Appelle de la fonction recursive (ammorce) avec recherche depuis la racine.
//tree_recur($data, $data[0], 0, 'iddivjstree', 0, 1); // use this to get info on name and foreign keys of menu entry
tree_recur($data, $data[0], 0, 'iddivjstree', 0, 0); // $data[0] is virtual record 'racine'
print '</td>'; print '</td>';
@ -376,7 +378,6 @@ if ($conf->use_javascript_ajax)
print '<tr>'; print '<tr>';
print '<td colspan="2">'; print '<td colspan="2">';
foreach($remainingdata as $datar) foreach($remainingdata as $datar)
{ {
$father = array('rowid'=>$datar['rowid'],'title'=>"???",'mainmenu'=>$datar['fk_mainmenu'],'leftmenu'=>$datar['fk_leftmenu'],'fk_mainmenu'=>'','fk_leftmenu'=>''); $father = array('rowid'=>$datar['rowid'],'title'=>"???",'mainmenu'=>$datar['fk_mainmenu'],'leftmenu'=>$datar['fk_leftmenu'],'fk_mainmenu'=>'','fk_leftmenu'=>'');

View File

@ -182,7 +182,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal
//print ' -> A '.$tab[$x]['rowid'].' mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].'<br>'."\n"; //print ' -> A '.$tab[$x]['rowid'].' mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].'<br>'."\n";
$tree_recur_alreadyadded[$tab[$x]['rowid']]=($rang + 1); $tree_recur_alreadyadded[$tab[$x]['rowid']]=($rang + 1);
// And now we search all its sons of lower level // And now we search all its sons of lower level
tree_recur($tab,$tab[$x],$rang+1); tree_recur($tab, $tab[$x], $rang+1, 'iddivjstree', 0, $showfk);
print '</li>'; print '</li>';
} }
elseif (! empty($tab[$x]['rowid']) && $tab[$x]['fk_menu'] == -1 && $tab[$x]['fk_mainmenu'] == $pere['mainmenu'] && $tab[$x]['fk_leftmenu'] == $pere['leftmenu']) elseif (! empty($tab[$x]['rowid']) && $tab[$x]['fk_menu'] == -1 && $tab[$x]['fk_mainmenu'] == $pere['mainmenu'] && $tab[$x]['fk_leftmenu'] == $pere['leftmenu'])
@ -206,7 +206,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal
print '<strong> &nbsp; <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'; print '<strong> &nbsp; <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">';
print $tab[$x]['title']; print $tab[$x]['title'];
print '</a></strong>'; print '</a></strong>';
print '&nbsp; (fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')'; print '&nbsp; (mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' - fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].')';
print '</td><td align="right">'; print '</td><td align="right">';
print $tab[$x]['buttons']; print $tab[$x]['buttons'];
print '</td></tr></table>'; print '</td></tr></table>';
@ -219,7 +219,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetal
$tree_recur_alreadyadded[$tab[$x]['rowid']]=($rang + 1); $tree_recur_alreadyadded[$tab[$x]['rowid']]=($rang + 1);
// And now we search all its sons of lower level // And now we search all its sons of lower level
//print 'Call tree_recur for x='.$x.' rowid='.$tab[$x]['rowid']." fk_mainmenu pere = ".$tab[$x]['fk_mainmenu']." fk_leftmenu pere = ".$tab[$x]['fk_leftmenu']."<br>\n"; //print 'Call tree_recur for x='.$x.' rowid='.$tab[$x]['rowid']." fk_mainmenu pere = ".$tab[$x]['fk_mainmenu']." fk_leftmenu pere = ".$tab[$x]['fk_leftmenu']."<br>\n";
tree_recur($tab,$tab[$x],$rang+1); tree_recur($tab, $tab[$x], $rang+1, 'iddivjstree', 0, $showfk);
print '</li>'; print '</li>';
} }
} }

View File

@ -235,7 +235,7 @@ class modMyModule extends DolibarrModules
'leftmenu'=>'', 'leftmenu'=>'',
'url'=>'/mymodule/mymoduleindex.php', 'url'=>'/mymodule/mymoduleindex.php',
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1000, 'position'=>1000+$r,
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. 'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'', 'target'=>'',
@ -252,7 +252,7 @@ class modMyModule extends DolibarrModules
'leftmenu'=>'mymodule', 'leftmenu'=>'mymodule',
'url'=>'/mymodule/myobject_list.php', 'url'=>'/mymodule/myobject_list.php',
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1100, 'position'=>1000+$r,
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'', 'target'=>'',
@ -264,7 +264,7 @@ class modMyModule extends DolibarrModules
'leftmenu'=>'mymodule', 'leftmenu'=>'mymodule',
'url'=>'/mymodule/myobject_page.php?action=create', 'url'=>'/mymodule/myobject_page.php?action=create',
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1101, 'position'=>1000+$r,
'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'enabled'=>'$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'', 'target'=>'',

View File

@ -2653,7 +2653,6 @@ div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_se
} }
tr.liste_titre th, tr.liste_titre td, th.liste_titre tr.liste_titre th, tr.liste_titre td, th.liste_titre
{ {
/* border-bottom: 1px solid #<?php echo ($colorbacktitle1 == '255,255,255'?'BBBBBB':'ddd'); ?>; */
border-bottom: 1px solid #888; border-bottom: 1px solid #888;
} }
tr.liste_titre:first-child th, tr:first-child th.liste_titre { tr.liste_titre:first-child th, tr:first-child th.liste_titre {
@ -2779,6 +2778,13 @@ div.tabBar .noborder {
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
} }
ul.noborder li:nth-child(even):not(.liste_titre) {
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
}
/* /*

View File

@ -2623,6 +2623,15 @@ div.pagination li.paginationafterarrows {
} }
*/ */
ul.noborder li:nth-child(odd):not(.liste_titre) {
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
background-color: rgb(<?php echo $colorbacklinepair2; ?>) !important;
}
/* Set the color for hover lines */ /* Set the color for hover lines */
.oddeven:hover, .evenodd:hover, .impair:hover, .pair:hover .oddeven:hover, .evenodd:hover, .impair:hover, .pair:hover
{ {
@ -2723,19 +2732,19 @@ tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, tabl
{ {
height: 26px !important; height: 26px !important;
} }
div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr
{ {
background: rgb(<?php echo $colorbacktitle1; ?>); background: rgb(<?php echo $colorbacktitle1; ?>);
font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>; font-weight: <?php echo $useboldtitle?'bold':'normal'; ?>;
border-bottom: 1px solid #FDFFFF;
color: rgb(<?php echo $colortexttitle; ?>); color: rgb(<?php echo $colortexttitle; ?>);
font-family: <?php print $fontlist ?>; font-family: <?php print $fontlist ?>;
border-bottom: 1px solid #FDFFFF;
text-align: <?php echo $left; ?>; text-align: <?php echo $left; ?>;
} }
tr.liste_titre th, tr.liste_titre td, th.liste_titre, form.liste_titre div, div.liste_titre tr.liste_titre th, tr.liste_titre td, th.liste_titre
{ {
border-bottom: 1px solid #<?php echo ($colorbacktitle1 == '255,255,255'?'BBBBBB':'FDFFFF'); ?>; border-bottom: 1px solid #aaa;
} }
/* TODO Once title line is moved under title search, make border bottom of all th black and force to whit when it's first tr */ /* TODO Once title line is moved under title search, make border bottom of all th black and force to whit when it's first tr */
tr:first-child th.liste_titre { tr:first-child th.liste_titre {