From b23304deb8c30c048ec6caf7b828b452c925a257 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Jul 2022 16:14:19 +0200 Subject: [PATCH] Debug v16 --- htdocs/core/get_menudiv.php | 25 +++++++- htdocs/core/menus/standard/auguria.lib.php | 66 ++++++++++++++++----- htdocs/core/menus/standard/auguria_menu.php | 26 ++++++-- htdocs/core/menus/standard/eldy.lib.php | 14 +++-- htdocs/core/menus/standard/eldy_menu.php | 12 ++++ 5 files changed, 115 insertions(+), 28 deletions(-) diff --git a/htdocs/core/get_menudiv.php b/htdocs/core/get_menudiv.php index 597031945f1..c4be69675bb 100644 --- a/htdocs/core/get_menudiv.php +++ b/htdocs/core/get_menudiv.php @@ -121,10 +121,19 @@ print ' display: none; } + ul li.lilevel2 { + padding-left: 42px; + } + a.alilevel0, span.spanlilevel0 { background-image: url(\''.DOL_URL_ROOT.'/theme/'.urlencode($conf->theme).'/img/next.png\') !important; - background-repeat: no-repeat !important; - background-position-x: 10px; + background-repeat: no-repeat !important;'; +if ($langs->trans("DIRECTION") == 'rtl') { + print 'background-position: right;'; +} else { + print 'background-position-x: 10px;'; +} + print ' background-position-y: 16px; padding: 1em 15px 1em 40px; display: block; @@ -152,6 +161,18 @@ print ' li.lilevel1 a { padding-bottom: 5px; } + li.lilevel1 > a, li.lilevel1 > i { + /* background-image: url(\''.DOL_URL_ROOT.'/theme/'.urlencode($conf->theme).'/img/puce.png\') !important; */ + background-repeat: no-repeat !important;'; +if ($langs->trans("DIRECTION") == 'rtl') { + print 'background-position: right;'; +} else { + print 'background-position-x: 10px;'; +} + print 'background-position-y: 1px;'; + print 'padding-left: 20px;'; + print ' + } li.lilevel1 a, li.lilevel1 { color: #000; cursor: pointer; diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index adc4f8d487c..71f399497c7 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2022 Laurent Destailleur * Copyright (C) 2010-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -72,6 +72,7 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout $num = count($newTabMenu); for ($i = 0; $i < $num; $i++) { + //var_dump($type_user.' '.$newTabMenu[$i]['url'].' '.$showmode.' '.$newTabMenu[$i]['perms']); $idsel = (empty($newTabMenu[$i]['mainmenu']) ? 'none' : $newTabMenu[$i]['mainmenu']); $shorturl = ''; @@ -80,9 +81,9 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout if ($showmode == 1) { $newTabMenu[$i]['url'] = make_substitutions($newTabMenu[$i]['url'], $substitarray); + // url = url from host, shorturl = relative path into dolibarr sources $url = $shorturl = $newTabMenu[$i]['url']; - - if (!preg_match("/^(http:\/\/|https:\/\/)/i", $newTabMenu[$i]['url'])) { + if (!preg_match("/^(http:\/\/|https:\/\/)/i", $newTabMenu[$i]['url'])) { // Do not change url content for external links $tmp = explode('?', $newTabMenu[$i]['url'], 2); $url = $shorturl = $tmp[0]; $param = (isset($tmp[1]) ? $tmp[1] : ''); @@ -235,11 +236,11 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla $classnametxt = str_replace('class="', 'class="tmenulabel ', $classname); if ($showmode == 1) { - print ''; - print '
'; + print '
'; + print '
'; print '
'; if (empty($conf->global->THEME_TOPMENU_DISABLE_TEXT)) { - print ''; + print ''; print ''; print $text; print ''; @@ -300,11 +301,13 @@ function print_end_menu_array_auguria() * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session. * @param array $moredata An array with more data to output + * @param int $type_user 0=Menu for backoffice, 1=Menu for front office * @return int Nb of menu entries */ -function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null) +function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0) { - global $user, $conf, $langs, $dolibarr_main_db_name, $mysoc; + global $user, $conf, $langs, $hookmanager; + global $dolibarr_main_db_name, $mysoc; $newmenu = $menu; @@ -472,6 +475,29 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t return 0; } + // Allow the $menu_array of the menu to be manipulated by modules + $parameters = array( + 'mainmenu' => $mainmenu, + ); + $hook_items = $menu_array; + $reshook = $hookmanager->executeHooks('menuLeftMenuItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks + + if (is_numeric($reshook)) { + if ($reshook == 0 && !empty($hookmanager->results)) { + $menu_array[] = $hookmanager->results; // add + } elseif ($reshook == 1) { + $menu_array = $hookmanager->results; // replace + } + + // @todo Sort menu items by 'position' value + // $position = array(); + // foreach ($menu_array as $key => $row) { + // $position[$key] = $row['position']; + // } + // $array1_sort_order = SORT_ASC; + // array_multisort($position, $array1_sort_order, $menu_array); + } + // Show menu $invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert"; if (empty($noout)) { @@ -542,7 +568,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t if ($menu_array[$i]['enabled']) { // Enabled so visible print ''."\n"; $lastlevel0 = 'enabled'; } elseif ($showmenu) { // Not enabled but visible (so greyed) - print ''."\n"; + print ''."\n"; $lastlevel0 = 'greyed'; } else { $lastlevel0 = 'hidden'; @@ -572,10 +602,12 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $menu_array[$i]['url'])); } - if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') { // Enabled so visible, except if parent was not enabled. - print '