NEW More mode for THEME_TOPMENU_DISABLE_IMAGE

This commit is contained in:
Laurent Destailleur 2022-05-02 20:10:42 +02:00
parent 5dfd38c8f9
commit 1dd8cfe559
11 changed files with 61 additions and 117 deletions

View File

@ -7417,7 +7417,7 @@ class Form
// Bom:bom/class/bom.class.php:0:t.status=1:ref
// Bom:bom/class/bom.class.php:0:(t.status:=:1):ref
$InfoFieldList = explode(":", $objectdesc, 4);
$vartmp = $InfoFieldList[3];
$vartmp = (empty($InfoFieldList[3]) ? '' : $InfoFieldList[3]);
$reg = array();
if (preg_match('/^.*:(\w*)$/', $vartmp, $reg)) {
$InfoFieldList[4] = $reg[1]; // take the sort field

View File

@ -1083,12 +1083,14 @@ class FormOther
* @param int $invert Invert
* @param string $option Option
* @param string $morecss More CSS
* @param bool $addjscombo Add js combo
* @return string
* @deprecated
*/
public function select_year($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle maxwidth75imp')
public function select_year($selected = '', $htmlname = 'yearid', $useempty = 0, $min_year = 10, $max_year = 5, $offset = 0, $invert = 0, $option = '', $morecss = 'valignmiddle maxwidth75imp', $addjscombo = false)
{
// phpcs:enable
print $this->selectyear($selected, $htmlname, $useempty, $min_year, $max_year, $offset, $invert, $option, $morecss);
print $this->selectyear($selected, $htmlname, $useempty, $min_year, $max_year, $offset, $invert, $option, $morecss, $addjscombo);
}
/**

View File

@ -64,10 +64,10 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout
// Show/Hide vertical menu. The hamburger icon for .menuhider action.
if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$showmode = 1;
$classname = 'class="tmenu menuhider"';
$classname = 'class="tmenu menuhider nohover"';
$idsel = 'menu';
$menu->add('#', (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE) ? '<span class="fa fa-bars"></span>' : ''), 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
$menu->add('#', (getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE') == 1 ? '<span class="fa fa-bars"></span>' : ''), 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
}
$num = count($newTabMenu);
@ -236,7 +236,7 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla
if ($showmode == 1) {
print '<a '.$classnametxt.' tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimageforpng" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</a>';
if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
print '<a '.$classnameimg.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
@ -246,9 +246,9 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla
print '</a>';
}
} elseif ($showmode == 2) {
print '<span '.$classnameimg.' title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
print '<div class="'.$id.' '.$idsel.' topmenuimage tmenudisabled"><span class="'.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</span>';
print '<div '.$classnameimg.' title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
print '<div class="'.$id.' '.$idsel.' topmenuimage tmenudisabled"><span class="'.$id.' tmenuimageforpng tmenudisabled" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</div>';
if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
print '<span '.$classnametxt.' id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
print '<span class="mainmenuaspan">';

View File

@ -64,10 +64,10 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout =
// Show/Hide vertical menu. The hamburger icon for .menuhider action.
if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$showmode = 1;
$classname = 'class="tmenu menuhider"';
$classname = 'class="tmenu menuhider nohover"';
$idsel = 'menu';
$menu->add('#', (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE) ? '<span class="fa fa-bars"></span>' : ''), 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
$menu->add('#', (getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE') == 1 ? '<span class="fa fa-bars"></span>' : ''), 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
}
$menu_arr = array();
@ -632,7 +632,7 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname,
//$conf->global->THEME_TOPMENU_DISABLE_TEXT=1;
if ($showmode == 1) {
print '<a '.$classnameimg.' tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimageforpng" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</a>';
if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
print '<a '.$classnametxt.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
@ -642,9 +642,9 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname,
print '</a>';
}
} elseif ($showmode == 2) {
print '<span '.$classnameimg.' title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
print '<div class="'.$id.' '.$idsel.' topmenuimage tmenudisabled"><span class="'.$id.' tmenuimage tmenudisabled" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</span>';
print '<div '.$classnameimg.' title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
print '<div class="'.$id.' '.$idsel.' topmenuimage tmenudisabled"><span class="'.$id.' tmenuimageforpng tmenudisabled" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</div>';
if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
print '<span '.$classnametxt.' id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
print '<span class="mainmenuaspan tmenudisabled">';

View File

@ -102,7 +102,7 @@ class MenuManager
// Show/Hide vertical menu
if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$showmode = 1;
$classname = 'class="tmenu menuhider"';
$classname = 'class="tmenu menuhider nohover"';
$idsel = 'menu';
$this->menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
@ -517,8 +517,8 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class
$classnametxt = str_replace('class="', 'class="tmenulabel ', $classname);
if ($showmode == 1) {
print '<a '.$classnameimg.' tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').'>';
print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
print '<a '.$classnameimg.' tabindex="-1" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').' title="'.dol_escape_htmltag($text).'">';
print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimageforpng" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</a>';
if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
print '<a '.$classnametxt.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget ? ' target="'.$atarget.'"' : '').'>';
@ -529,15 +529,15 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class
}
}
if ($showmode == 2) {
print '<span '.$classnameimg.' title="'.dol_escape_htmltag($text).'">';
print '<div class="'.$id.' '.$idsel.' tmenudisabled"><span class="'.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</span>';
print '<div '.$classnameimg.' title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
print '<div class="'.$id.' '.$idsel.' topmenuimage tmenudisabled"><span class="'.$id.' tmenuimageforpng tmenudisabled" id="mainmenuspan_'.$idsel.'"></span></div>';
print '</div>';
if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) {
print '<a '.$classnametxt.' id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">';
print '<span '.$classnametxt.' id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($text.' - '.$langs->trans("NotAllowed")).'">';
print '<span class="mainmenuaspan">';
print $text;
print '</span>';
print '</a>';
print '</span>';
}
}
}

View File

@ -151,7 +151,7 @@ if ($action == 'create') {
print '<table class="border" width="100%">';
// Label
print '<tr><td class="titlefieldcreate">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" class="minwidth200" name="label" autofocus="autofocus"></td></tr>';
// Declaration
print '<tr><td class="fieldrequired">'.$langs->trans("Declaration")."</td><td>\n";
@ -164,8 +164,8 @@ if ($action == 'create') {
print $langs->trans("AnalysisPeriod");
print '</td>';
print '<td>';
print $formother->select_month($month ? date('M') : $month, 'month', 0, 1, 'widthauto valignmiddle ');
print $formother->select_year($year ? date('Y') : $year, 'year', 0, 3, 3);
print $formother->select_month($month ? date('M') : $month, 'month', 0, 1, 'widthauto valignmiddle ', true);
print $formother->selectyear($year ? date('Y') : $year, 'year', 0, 3, 3, 0, 0, '', '', true);
print '</td>';
print '</tr>';

View File

@ -197,7 +197,7 @@ button.dropdown-item.global-search-item {
}
div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown, div#topmenu-quickadd-dropdown {
<?php if (empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { ?>
<?php if (!getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE')) { ?>
line-height: 46px;
<?php } ?>
}

View File

@ -2587,8 +2587,7 @@ button.ui-button.ui-corner-all.ui-widget:focus {
/* For mainmenu, we always load the img */
div.mainmenu.menu {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/menu.png', 1) ?>);
<?php print $disableimages ? '' : 'top: 7px'; ?>
<?php print $disableimages ? '' : 'top: 10px'; ?>
}
#mainmenutd_menu a.tmenuimage {
display: unset;
@ -2601,20 +2600,40 @@ a.tmenuimage:hover{
text-decoration: none;
}
/*
/* To show text of top menu on hover only (THEME_TOPMENU_DISABLE_IMAGE == 2) */
<?php if (in_array(getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE'), array(2, 3, 4))) { ?>
.tmenulabel:not(.menuhider), .tmenulabel:not(.menuhider):before {
display: none;
}
.tmenuimage:not(.menuhider), .tmenuimage:not(.menuhider):before {
font-size: 1.5em;
a.tmenuimage:not(.menuhider), a.tmenuimage:not(.menuhider):before,
div.tmenuimage:not(.menuhider), div.tmenuimage:not(.menuhider):before,
span.tmenuimage:not(.menuhider), span.tmenuimage:not(.menuhider):before {
font-size: 1.3em;
margin-top: 10px !important;
}
<?php } ?>
<?php if (getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE') == 2) { ?>
.tmenudiv:hover .tmenulabel:not(.menuhider), .tmenudiv:hover .tmenulabel:not(.menuhider):before {
display: initial !important;
}
.tmenudiv:hover .tmenuimage:not(.menuhider), .tmenudiv:hover .tmenulabel:not(.menuhider):before {
.tmenudiv:hover .tmenuimage:not(.menuhider), .tmenudiv:hover .tmenuimage:not(.menuhider):before {
font-size: 1.1em !important;
margin-top: 0px !important;
}
*/
<?php } ?>
<?php if (getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE') == 3) { ?>
li.tmenu:hover .tmenulabel:not(.menuhider), li.tmenu:hover .tmenulabel:not(.menuhider):before {
display: initial !important;
}
li.tmenu:hover .tmenuimage:not(.menuhider), li.tmenu:hover .tmenuimage:not(.menuhider):before {
font-size: 1.1em !important;
margin-top: 0px !important;
}
<?php } ?>
/* Do not load menu img for other if hidden to save bandwidth */

View File

@ -276,7 +276,7 @@ $heightmenu = 50; /* height of top menu, part with image */
$heightmenu2 = 49; /* height of top menu, part with login */
$disableimages = 0;
$maxwidthloginblock = 180;
if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) {
if (getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE') == 1) {
$disableimages = 1; $maxwidthloginblock = $maxwidthloginblock + 50; $minwidthtmenu = 0;
}

View File

@ -201,7 +201,7 @@ button.dropdown-item.global-search-item {
}
div#topmenu-global-search-dropdown, div#topmenu-quickadd-dropdown, div#topmenu-bookmark-dropdown {
line-height: <?php echo (empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE) ? '46' : '35' ); ?>px;
line-height: <?php echo (getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE') == 1 ? '35' : '46' ); ?>px;
}
a.top-menu-dropdown-link {
padding: 8px;

View File

@ -2438,7 +2438,7 @@ $heightmenu = 48; /* height of top menu, part with image */
$heightmenu2 = 48; /* height of top menu, ârt with login */
$disableimages = 0;
$maxwidthloginblock = 110;
if (!empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) {
if (getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE') == 1) {
$heightmenu = 30; $disableimages = 1; $maxwidthloginblock = 180; $minwidthtmenu = 0;
}
?>
@ -2623,98 +2623,21 @@ a.tmenuimage:focus, .mainmenu.topmenuimage:focus {
outline: none;
}
/* Do not load menu img if hidden to save bandwidth */
<?php if (empty($dol_hide_topmenu)) { ?>
<?php if (!defined('DISABLE_FONT_AWSOME')) { ?>
<?php include dol_buildpath($path.'/theme/'.$theme.'/main_menu_fa_icons.inc.php', 0); ?>
<?php } ?>
div.mainmenu.home{
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/home.png', 1) ?>);
background-position-x: center;
}
div.mainmenu.billing {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/money.png', 1) ?>);
}
div.mainmenu.accountancy {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/money.png', 1) ?>);
}
div.mainmenu.agenda {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/agenda.png', 1) ?>);
}
div.mainmenu.bank {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/bank.png', 1) ?>);
}
div.mainmenu.cashdesk {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/pointofsale.png', 1) ?>);
}
div.mainmenu.takepos {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/pointofsale.png', 1) ?>);
}
div.mainmenu.companies {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/company.png', 1) ?>);
}
div.mainmenu.commercial {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/commercial.png', 1) ?>);
}
div.mainmenu.ecm {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/ecm.png', 1) ?>);
}
div.mainmenu.externalsite {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/externalsite.png', 1) ?>);
}
div.mainmenu.ftp {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png', 1) ?>);
}
div.mainmenu.hrm {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/holiday.png', 1) ?>);
}
div.mainmenu.members {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/members.png', 1) ?>);
}
div.mainmenu.menu {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/menu.png', 1) ?>);
top: 10px;
left: 1px;
}
div.mainmenu.products {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products.png', 1) ?>);
}
div.mainmenu.mrp {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/products.png', 1) ?>);
}
div.mainmenu.project {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/project.png', 1) ?>);
}
div.mainmenu.ticket {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/ticket.png', 1) ?>);
}
div.mainmenu.tools {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/tools.png', 1) ?>);
}
div.mainmenu.website {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/menus/externalsite.png', 1) ?>);
}
/* Do not load menu img if hidden to save bandwidth */
<?php if (empty($dol_hide_topmenu)) { ?>
<?php include dol_buildpath($path.'/theme/'.$theme.'/main_menu_fa_icons.inc.php', 0); ?>
<?php
// Add here more div for other menu entries. moduletomainmenu=array('module name'=>'name of class for div')