Debug v23. Bad balance ul/li in menu.
This commit is contained in:
parent
8b98a5a019
commit
c5ddb76fd7
7 changed files with 142 additions and 75 deletions
|
|
@ -1637,7 +1637,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month
|
|||
|
||||
print '<div class="div-table-responsive-no-min sectioncalendarbymonth maxscreenheightless300">';
|
||||
print '<table class="centpercent noborder nocellnopadd cal_pannel cal_month listwithfilterbefore">';
|
||||
print ' <tr class="liste_titre">';
|
||||
print ' <tr class="liste_titre sticky">';
|
||||
// Column title of weeks numbers
|
||||
echo ' <td class="center">#</td>';
|
||||
$i = 0;
|
||||
|
|
|
|||
|
|
@ -130,23 +130,14 @@ print '
|
|||
display: none;
|
||||
}
|
||||
|
||||
ul li.lilevel2 {
|
||||
padding-'.$left.': 60px; /* width = 20 for level0, 20 for level1 */
|
||||
}
|
||||
ul li.lilevel3 {
|
||||
padding-'.$left.': 60px; /* width = 20 for level0, 20 for level1 */
|
||||
}
|
||||
ul li.lilevel4 {
|
||||
padding-'.$left.': 60px; /* width = 20 for level0, 20 for level1 */
|
||||
}
|
||||
ul li.lilevel5 {
|
||||
padding-'.$left.': 60px; /* width = 20 for level0, 20 for level1 */
|
||||
}
|
||||
|
||||
.getmenudiv a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.ulmenu li.lilevel0 {
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.pictofixedwidth {
|
||||
text-align: left;
|
||||
padding-'.$right.': 8px !important;
|
||||
|
|
@ -159,10 +150,13 @@ print '
|
|||
padding-'.$left.': 60px !important;
|
||||
}
|
||||
li.lilevel3 a {
|
||||
padding-'.$left.': 85px !important;
|
||||
padding-'.$left.': 40px !important;
|
||||
}
|
||||
li.lilevel4 a {
|
||||
padding-'.$left.': 105px !important;
|
||||
padding-'.$left.': 0px !important;
|
||||
}
|
||||
li.lilevel5 a {
|
||||
padding-'.$left.': 0px !important;
|
||||
}
|
||||
|
||||
a.alilevel0, span.spanlilevel0 {
|
||||
|
|
@ -263,12 +257,12 @@ print ' background-position-y: 1px;
|
|||
|
||||
<script nonce="'.getNonce().'" type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$("body ul").click(function(){
|
||||
console.log("We click on body ul");
|
||||
$("body li").click(function(){
|
||||
console.log("We click on a li");
|
||||
|
||||
$(this).siblings().find("li ul").slideUp(0);
|
||||
$(this).siblings().find("ul").slideUp(0);
|
||||
|
||||
$(this).find("li ul").slideToggle(200);
|
||||
$(this).find("ul").slideToggle(200);
|
||||
|
||||
var target = $(this);
|
||||
$(\'html, body\').animate({
|
||||
|
|
|
|||
|
|
@ -198,10 +198,11 @@ class MenuManager
|
|||
$lastlevel = array();
|
||||
$showmenu = true; // Is current menu shown - define here to keep static code checker happy
|
||||
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
|
||||
print '<ul class="ulmenu ullevel0" data-inset="true">'."\n";
|
||||
foreach ($this->menu->liste as $key => $val) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
|
||||
print '<ul class="ulmenu" data-inset="true">';
|
||||
print '<li class="lilevel0">';
|
||||
if ($val['enabled'] == 1) {
|
||||
print '<li class="lilevel0">';
|
||||
|
||||
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||
$val['url'] = make_substitutions($val['url'], $substitarray);
|
||||
|
|
@ -209,11 +210,17 @@ class MenuManager
|
|||
$relurl = dol_buildpath($val['url'], 1);
|
||||
$canonurl = preg_replace('/\?.*$/', '', $val['url']);
|
||||
|
||||
// Label li level 0
|
||||
print '<a class="alilevel0" href="#">';
|
||||
|
||||
// Add font-awesome
|
||||
if ($val['level'] == 0 && !empty($val['prefix'])) {
|
||||
print str_replace('<span class="', '<span class="paddingright pictofixedwidth ', $val['prefix']);
|
||||
$reg = array();
|
||||
if (preg_match('/^(fa[rsb]? )?fa-/', $val['prefix'], $reg)) {
|
||||
print '<span class="'.(empty($reg[1]) ? 'fa ' : '').$val['prefix'].' paddingright pictofixedwidth"></span>';
|
||||
} else {
|
||||
print str_replace('<span class="', '<span class="paddingright pictofixedwidth ', $val['prefix']);
|
||||
}
|
||||
}
|
||||
|
||||
print $val['titre'];
|
||||
|
|
@ -234,11 +241,15 @@ class MenuManager
|
|||
$canonnexturl = preg_replace('/\?.*$/', '', $nexturl);
|
||||
//var_dump($canonrelurl);
|
||||
//var_dump($canonnexturl);
|
||||
print '<ul>'."\n";
|
||||
|
||||
// Start a new ul level 1
|
||||
$level = 1;
|
||||
print str_pad('', $level).'<ul class="ullevel1">'."\n";
|
||||
|
||||
// Do we have to add an extra entry that is not into menu array ?
|
||||
if (($canonrelurl != $canonnexturl && !in_array($val['mainmenu'], array('tools')))
|
||||
|| (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false)) {
|
||||
// We add sub entry
|
||||
print str_pad('', 1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
print str_pad('', $level).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
print '<a href="'.$relurl.'">';
|
||||
|
||||
if ($val['level'] == 0) {
|
||||
|
|
@ -269,12 +280,21 @@ class MenuManager
|
|||
}
|
||||
|
||||
$lastlevel2 = array();
|
||||
$lastlinelevel = $level;
|
||||
|
||||
'@phan-var-force array<string> $lastlevel2';
|
||||
foreach ($submenu->liste as $key2 => $val2) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
|
||||
$showmenu = true;
|
||||
if (getDolGlobalString('MAIN_MENU_HIDE_UNAUTHORIZED') && empty($val2['enabled'])) {
|
||||
$showmenu = false;
|
||||
}
|
||||
|
||||
$newlinelevel = ($val2['level'] + 1);
|
||||
if ($newlinelevel > $lastlinelevel) {
|
||||
print str_pad('', $newlinelevel).'<ul class="ullevel'.$newlinelevel.'" xx>'."\n";
|
||||
}
|
||||
$lastlinelevel = ($val2['level'] + 1);
|
||||
|
||||
// If at least one parent is not enabled, we do not show any menu of all children
|
||||
if ($val2['level'] > 0) {
|
||||
$levelcursor = $val2['level'] - 1;
|
||||
|
|
@ -308,20 +328,22 @@ class MenuManager
|
|||
$disabled = " vsmenudisabled";
|
||||
}
|
||||
|
||||
// Show entry li level $val2['level']+1
|
||||
|
||||
// @phan-suppress-next-line PhanParamSuspiciousOrder
|
||||
print str_pad('', $val2['level'] + 1);
|
||||
print str_pad('', ($val2['level'] + 1));
|
||||
print '<li class="lilevel'.($val2['level'] + 1);
|
||||
if ($val2['level'] == 0) {
|
||||
print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic
|
||||
}
|
||||
print $disabled.'">'; // ui-btn to highlight on clic
|
||||
if ($relurl2) {
|
||||
if ($val2['enabled']) { // Allowed
|
||||
print '<a href="'.$relurl2.'"';
|
||||
//print ' data-ajax="false"';
|
||||
print '>';
|
||||
if ($val2['enabled']) {
|
||||
// Allowed
|
||||
print '<a href="'.$relurl2.'">';
|
||||
$lastlevel2[$val2['level']] = 'enabled';
|
||||
} else { // Not allowed but visible (greyed)
|
||||
} else {
|
||||
// Not allowed but visible (greyed)
|
||||
print '<a href="#" class="vsmenudisabled">';
|
||||
$lastlevel2[$val2['level']] = 'greyed';
|
||||
}
|
||||
|
|
@ -335,22 +357,44 @@ class MenuManager
|
|||
|
||||
// Add font-awesome for level 0 and 1 (if $val2['level'] == 1, we are on level2, if $val2['level'] == 2, we are on level 3...)
|
||||
if ($val2['level'] == 0 && !empty($val2['prefix'])) {
|
||||
print $val2['prefix'];
|
||||
print $val2['prefix']; // the picto must have class="pictofixedwidth paddingright"
|
||||
} else {
|
||||
print '<i class="fa fa-does-not-exists fa-fw paddingright pictofixedwidth"></i>';
|
||||
print '<i class="fa fa-does-not-exists fa-fw paddingright pictofixedwidth level'.($val2['level']+1).'"></i>';
|
||||
}
|
||||
|
||||
print $val2['titre'];
|
||||
if ($relurl2) {
|
||||
print '</a>';
|
||||
}
|
||||
print '</li>'."\n";
|
||||
|
||||
|
||||
$currentlevel = (empty($submenu->liste[$key2]) ? 1 : $submenu->liste[$key2]['level'] + 1);
|
||||
$nextlevel = (empty($submenu->liste[$key2 + 1]) ? 1 : $submenu->liste[$key2 + 1]['level'] + 1);
|
||||
// If there is no lower level
|
||||
if ($nextlevel > $currentlevel) {
|
||||
// There is a submenu with a lower level, we do not close the li
|
||||
print "\n";
|
||||
} elseif ($nextlevel < $currentlevel) {
|
||||
// Next menu is lower
|
||||
print '</li>'."\n";
|
||||
$fromcursor = 0;
|
||||
while ($fromcursor < ($currentlevel - $nextlevel)) {
|
||||
print str_pad('', $currentlevel - $fromcursor).'</ul>'."\n";
|
||||
print str_pad('', $currentlevel - $fromcursor - 1).'</li>'."\n"; // end level $val2['level']+1
|
||||
$fromcursor++;
|
||||
}
|
||||
} else {
|
||||
print '</li>'."\n"; // end level $val2['level']+1
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($submenu);
|
||||
print '</ul>';
|
||||
}
|
||||
if ($val['enabled'] == 2) {
|
||||
|
||||
print str_pad('', $level).'</ul>'."\n"; // end ul level 1
|
||||
print str_pad('', $level - 1).'</li>'."\n"; // end ul level 1
|
||||
} elseif ($val['enabled'] == 2) {
|
||||
print '<li class="lilevel0">';
|
||||
|
||||
// Label li level 0
|
||||
print '<span class="spanlilevel0 vsmenudisabled">';
|
||||
|
||||
// Add font-awesome
|
||||
|
|
@ -360,10 +404,11 @@ class MenuManager
|
|||
|
||||
print $val['titre'];
|
||||
print '</span>';
|
||||
|
||||
print '</li>'."\n"; // close entry level 0
|
||||
}
|
||||
print '</li>';
|
||||
print '</ul>'."\n";
|
||||
}
|
||||
print '</ul>'."\n"; // close entry level 0
|
||||
}
|
||||
|
||||
unset($this->menu);
|
||||
|
|
|
|||
|
|
@ -196,11 +196,11 @@ class MenuManager
|
|||
//var_dump($this->menu->liste);exit;
|
||||
$lastlevel = array();
|
||||
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
|
||||
print '<ul class="ulmenu ullevel0" data-inset="true">'."\n";
|
||||
foreach ($this->menu->liste as $key => $val) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
|
||||
print '<ul class="ulmenu" data-inset="true">';
|
||||
print '<li class="lilevel0">';
|
||||
|
||||
if ($val['enabled'] == 1) {
|
||||
print '<li class="lilevel0">';
|
||||
|
||||
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||
$val['url'] = make_substitutions($val['url'], $substitarray);
|
||||
|
|
@ -211,10 +211,8 @@ class MenuManager
|
|||
$relurl = $val['url'];
|
||||
}
|
||||
|
||||
$canonurl = preg_replace('/\?.*$/', '', $val['url']);
|
||||
|
||||
// Label li level 0
|
||||
print '<a class="alilevel0" href="#">';
|
||||
|
||||
// Add font-awesome
|
||||
if ($val['level'] == 0 && !empty($val['prefix'])) {
|
||||
$reg = array();
|
||||
|
|
@ -246,11 +244,14 @@ class MenuManager
|
|||
//var_dump($canonrelurl);
|
||||
//var_dump($canonnexturl);
|
||||
|
||||
print '<ul>'."\n";
|
||||
// Start a new ul level 1
|
||||
$level = 1;
|
||||
print str_pad('', $level).'<ul class="ullevel1">'."\n";
|
||||
|
||||
// Do we have to add an extra entry that is not into menu array ?
|
||||
if (($canonrelurl != $canonnexturl && !in_array($val['mainmenu'], array('tools')))
|
||||
|| (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false)) {
|
||||
// We add sub entry
|
||||
print str_pad('', 1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
print str_pad('', $level).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
|
||||
print '<a href="'.$relurl.'">';
|
||||
|
||||
if ($val['level'] == 0) {
|
||||
|
|
@ -270,20 +271,9 @@ class MenuManager
|
|||
print '</li>'."\n";
|
||||
}
|
||||
|
||||
/*
|
||||
if ($val['level'] == 0) {
|
||||
if ($val['enabled']) {
|
||||
$lastlevel[0] = 'enabled';
|
||||
} elseif ($showmenu) {
|
||||
// Not enabled but visible (so greyed)
|
||||
$lastlevel[0] = 'greyed';
|
||||
} else {
|
||||
$lastlevel[0] = 'hidden';
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
$lastlevel2 = array();
|
||||
$lastlinelevel = $level;
|
||||
|
||||
'@phan-var-force array<string> $lastlevel2';
|
||||
foreach ($submenu->liste as $key2 => $val2) { // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu','prefix']
|
||||
$showmenu = true;
|
||||
|
|
@ -291,6 +281,12 @@ class MenuManager
|
|||
$showmenu = false;
|
||||
}
|
||||
|
||||
$newlinelevel = ($val2['level'] + 1);
|
||||
if ($newlinelevel > $lastlinelevel) {
|
||||
print str_pad('', $newlinelevel).'<ul class="ullevel'.$newlinelevel.'" xx>'."\n";
|
||||
}
|
||||
$lastlinelevel = ($val2['level'] + 1);
|
||||
|
||||
// If at least one parent is not enabled, we do not show any menu of all children
|
||||
if ($val2['level'] > 0) {
|
||||
$levelcursor = $val2['level'] - 1;
|
||||
|
|
@ -323,6 +319,8 @@ class MenuManager
|
|||
$disabled = " vsmenudisabled";
|
||||
}
|
||||
|
||||
// Show entry li level $val2['level']+1
|
||||
|
||||
// @phan-suppress-next-line PhanParamSuspiciousOrder
|
||||
print str_pad('', ($val2['level'] + 1));
|
||||
print '<li class="lilevel'.($val2['level'] + 1);
|
||||
|
|
@ -330,6 +328,7 @@ class MenuManager
|
|||
print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic
|
||||
}
|
||||
print $disabled.'">'; // ui-btn to highlight on clic
|
||||
|
||||
if ($relurl2) {
|
||||
if ($val2['enabled']) {
|
||||
// Allowed
|
||||
|
|
@ -359,13 +358,35 @@ class MenuManager
|
|||
if ($relurl2) {
|
||||
print '</a>';
|
||||
}
|
||||
print '</li>'."\n";
|
||||
|
||||
$currentlevel = (empty($submenu->liste[$key2]) ? 1 : $submenu->liste[$key2]['level'] + 1);
|
||||
$nextlevel = (empty($submenu->liste[$key2 + 1]) ? 1 : $submenu->liste[$key2 + 1]['level'] + 1);
|
||||
// If there is no lower level
|
||||
if ($nextlevel > $currentlevel) {
|
||||
// There is a submenu with a lower level, we do not close the li
|
||||
print "\n";
|
||||
} elseif ($nextlevel < $currentlevel) {
|
||||
// Next menu is lower
|
||||
print '</li>'."\n";
|
||||
$fromcursor = 0;
|
||||
while ($fromcursor < ($currentlevel - $nextlevel)) {
|
||||
print str_pad('', $currentlevel - $fromcursor).'</ul>'."\n";
|
||||
print str_pad('', $currentlevel - $fromcursor - 1).'</li>'."\n"; // end level $val2['level']+1
|
||||
$fromcursor++;
|
||||
}
|
||||
} else {
|
||||
print '</li>'."\n"; // end level $val2['level']+1
|
||||
}
|
||||
}
|
||||
//var_dump($submenu);
|
||||
}
|
||||
//var_dump($submenu);
|
||||
print '</ul>';
|
||||
}
|
||||
if ($val['enabled'] == 2) {
|
||||
|
||||
print str_pad('', $level).'</ul>'."\n"; // end ul level 1
|
||||
print str_pad('', $level - 1).'</li>'."\n"; // end ul level 1
|
||||
} elseif ($val['enabled'] == 2) {
|
||||
print '<li class="lilevel0">';
|
||||
|
||||
// Label li level 0
|
||||
print '<span class="spanlilevel0 vsmenudisabled">';
|
||||
|
||||
// Add font-awesome
|
||||
|
|
@ -375,10 +396,11 @@ class MenuManager
|
|||
|
||||
print $val['titre'];
|
||||
print '</span>';
|
||||
|
||||
print '</li>'."\n"; // close entry level 0
|
||||
}
|
||||
print '</li>';
|
||||
print '</ul>'."\n";
|
||||
}
|
||||
print '</ul>'."\n"; // close entry level 0
|
||||
}
|
||||
|
||||
unset($this->menu);
|
||||
|
|
|
|||
|
|
@ -343,9 +343,9 @@ class Project extends CommonObject
|
|||
*/
|
||||
public $fields = array(
|
||||
'rowid' => array('type' => 'integer', 'label' => 'ID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10),
|
||||
'fk_project' => array('type' => 'integer', 'label' => 'Parent', 'enabled' => 1, 'visible' => 1, 'notnull' => 0, 'position' => 12),
|
||||
'fk_project' => array('type' => 'integer', 'label' => 'Parent', 'enabled' => 1, 'visible' => -1, 'notnull' => 0, 'position' => 12),
|
||||
'ref' => array('type' => 'varchar(50)', 'label' => 'Ref', 'enabled' => 1, 'visible' => 1, 'showoncombobox' => 1, 'position' => 15, 'searchall' => 1),
|
||||
'title' => array('type' => 'varchar(255)', 'label' => 'ProjectLabel', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 17, 'showoncombobox' => 2, 'searchall' => 1),
|
||||
'title' => array('type' => 'varchar(255)', 'label' => 'ProjectLabel', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'position' => 17, 'showoncombobox' => 2, 'searchall' => 1, 'csslist' => 'tdoverflowmax250'),
|
||||
'entity' => array('type' => 'integer', 'label' => 'Entity', 'default' => '1', 'enabled' => 1, 'visible' => 3, 'notnull' => 1, 'position' => 19),
|
||||
'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'enabled' => 1, 'visible' => 0, 'position' => 20),
|
||||
'dateo' => array('type' => 'date', 'label' => 'DateStart', 'enabled' => 1, 'visible' => -1, 'position' => 30),
|
||||
|
|
|
|||
|
|
@ -2107,10 +2107,10 @@ while ($i < $imaxinloop) {
|
|||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
// Title
|
||||
// Project title
|
||||
if (!empty($arrayfields['p.title']['checked'])) {
|
||||
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).'">';
|
||||
print dol_escape_htmltag($obj->title);
|
||||
print '<td class="tdoverflowmax250" title="'.dolPrintHTMLForAttribute($obj->title).'">';
|
||||
print dolPrintHTML($obj->title);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
|
|
|||
|
|
@ -1120,6 +1120,12 @@ textarea.centpercent {
|
|||
.liste_titre .nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.liste_titre.sticky {
|
||||
position: sticky;
|
||||
top:0;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.nowraponall { /* no wrap on all devices */
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue