From 5dfd38c8f9d7c01f02fd7ca0771d055c4c7befce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 May 2022 16:47:28 +0200 Subject: [PATCH] Clean code for top menu --- htdocs/core/menus/standard/auguria.lib.php | 29 ++++++++++++------- htdocs/core/menus/standard/eldy.lib.php | 17 +++++++---- htdocs/core/menus/standard/empty.php | 27 ++++++++++++----- htdocs/public/recruitment/index.php | 2 +- htdocs/public/recruitment/view.php | 2 +- .../recruitmentjobposition_list.php | 5 ++-- htdocs/theme/eldy/global.inc.php | 16 ++++++++-- htdocs/theme/md/dropdown.inc.php | 2 +- 8 files changed, 69 insertions(+), 31 deletions(-) diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 6b415aec7a2..87a68f081b4 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -231,22 +231,31 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla { global $langs; + $classnameimg = str_replace('class="', 'class="tmenuimage ', $classname); + $classnametxt = str_replace('class="', 'class="tmenulabel ', $classname); + if ($showmode == 1) { - print ''; + print ''; print '
'; print '
'; - print ''; - print ''; - print $text; - print ''; - print ''; + if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) { + print ''; + print ''; + print $text; + print ''; + print ''; + } } elseif ($showmode == 2) { + print ''; print '
'; - print ''; - print ''; - print $text; print ''; - print ''; + if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) { + print ''; + print ''; + print $text; + print ''; + print ''; + } } } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7d7317979cd..9d84faca7b2 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -626,26 +626,31 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname, { global $conf, $langs; + $classnameimg = str_replace('class="', 'class="tmenuimage ', $classname); + $classnametxt = str_replace('class="', 'class="tmenulabel ', $classname); + //$conf->global->THEME_TOPMENU_DISABLE_TEXT=1; if ($showmode == 1) { - print ''; + print ''; print '
'; print '
'; if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) { - print ''; + print ''; print ''; print $text; print ''; print ''; } } elseif ($showmode == 2) { - print '
'; + print ''; + print '
'; + print '
'; if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) { - print ''; - print ''; + print ''; + print ''; print $text; print ''; - print ''; + print '
'; } } } diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 9a45a9b7fc2..48b94462130 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -513,19 +513,32 @@ function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $class { global $conf, $langs; + $classnameimg = str_replace('class="', 'class="tmenuimage ', $classname); + $classnametxt = str_replace('class="', 'class="tmenulabel ', $classname); + if ($showmode == 1) { - print ''; + print ''; print '
'; print '
'; - print ''; - print ''; - print $text; - print ''; - print ''; + if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) { + print ''; + print ''; + print $text; + print ''; + print ''; + } } if ($showmode == 2) { + print ''; print '
'; - print ''; + print '
'; + if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) { + print ''; + print ''; + print $text; + print ''; + print ''; + } } } diff --git a/htdocs/public/recruitment/index.php b/htdocs/public/recruitment/index.php index 286b5af55ba..ce30306eb2f 100644 --- a/htdocs/public/recruitment/index.php +++ b/htdocs/public/recruitment/index.php @@ -199,7 +199,7 @@ if (is_array($results)) { $text .= '   -   '.$mysoc->name.''; $text .= '   -   '.dol_print_date($object->date_creation).''; $text .= ''."\n"; - $text .= '

'.$object->label.'

'."\n"; + $text .= '

'.$object->label.'

'."\n"; } print $text; diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index 955dbd4b586..97997830150 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -250,7 +250,7 @@ if (empty($text)) { $text .= '   -   '.$mysoc->name.''; $text .= '   -   '.dol_print_date($object->date_creation).''; $text .= ''."\n"; - $text .= '

'.$object->label.'


'."\n"; + $text .= '

'.$object->label.'


'."\n"; } print $text; diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index 3bf5fb94073..395449649d5 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -125,11 +125,10 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // Default sort order (if not yet defined by previous GETPOST) if (!$sortfield) { - reset($object->fields); // Reset is required to avoid key() to return null. - $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. + $sortfield = "t.ref"; } if (!$sortorder) { - $sortorder = "ASC"; + $sortorder = "DESC"; } // Initialize array of search criterias diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 5fc9ea92c5b..68bad918155 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2601,8 +2601,20 @@ a.tmenuimage:hover{ text-decoration: none; } - - +/* +.tmenulabel:not(.menuhider), .tmenulabel:not(.menuhider):before { + display: none; +} +.tmenuimage:not(.menuhider), .tmenuimage:not(.menuhider):before { + font-size: 1.5em; +} +.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 { + font-size: 1.1em !important; +} +*/ /* Do not load menu img for other if hidden to save bandwidth */ diff --git a/htdocs/theme/md/dropdown.inc.php b/htdocs/theme/md/dropdown.inc.php index 25cbbb28ea9..a95f8a0be34 100644 --- a/htdocs/theme/md/dropdown.inc.php +++ b/htdocs/theme/md/dropdown.inc.php @@ -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: 46px; + line-height: global->THEME_TOPMENU_DISABLE_IMAGE) ? '46' : '35' ); ?>px; } a.top-menu-dropdown-link { padding: 8px;