From 8d75d7b466031db9a35b4a01214b586b46bbaf25 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 6 Apr 2023 21:27:06 +0200 Subject: [PATCH] Debug topmenu search option --- htdocs/core/class/html.form.class.php | 24 +++--- htdocs/langs/en_US/main.lang | 2 - htdocs/langs/fr_FR/main.lang | 2 - htdocs/main.inc.php | 85 +++++++++++++++---- htdocs/theme/eldy/dropdown.inc.php | 34 ++++++-- htdocs/theme/md/dropdown.inc.php | 112 +++++++++++++++++++++++--- htdocs/theme/md/style.css.php | 6 +- 7 files changed, 214 insertions(+), 51 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index cf512d5f173..f5024b5cb71 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8377,18 +8377,18 @@ class Form * Return a HTML select string, built from an array of key+value, but content returned into select is defined into $array parameter. * Note: Do not apply langs->trans function on returned content of Ajax service, content may be entity encoded twice. * - * @param string $htmlname Name of html select area - * @param array $array Array (key=>array('text'=>'A text', 'url'=>'An url'), ...) - * @param string $id Preselected key - * @param string $moreparam Add more parameters onto the select tag - * @param int $disableFiltering If set to 1, results are not filtered with searched string - * @param int $disabled Html select box is disabled - * @param int $minimumInputLength Minimum Input Length - * @param string $morecss Add more class to css styles - * @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected. - * @param string $placeholder String to use as placeholder - * @param integer $acceptdelayedhtml 1 = caller is requesting to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) - * @return string HTML select string + * @param string $htmlname Name of html select area + * @param array $array Array (key=>array('text'=>'A text', 'url'=>'An url'), ...) + * @param string $id Preselected key + * @param string $moreparam Add more parameters onto the select tag + * @param int $disableFiltering If set to 1, results are not filtered with searched string + * @param int $disabled Html select box is disabled + * @param int $minimumInputLength Minimum Input Length + * @param string $morecss Add more class to css styles + * @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected. + * @param string $placeholder String to use as placeholder + * @param integer $acceptdelayedhtml 1 = caller is requesting to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) + * @return string HTML select string * @see selectArrayAjax(), ajax_combobox() in ajax.lib.php */ public static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 0e10bb06f2a..e4263d1a217 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -199,9 +199,7 @@ Hide=Hide ShowCardHere=Show card Search=Search SearchOf=Search -SearchMenuShortCut=Ctrl + shift + f QuickAdd=Quick add -QuickAddMenuShortCut=Ctrl + shift + l Valid=Valid Approve=Approve Disapprove=Disapprove diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 619dde3f5a1..f4ffbb16ff7 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -199,9 +199,7 @@ Hide=Cacher ShowCardHere=Voir la fiche ici Search=Rechercher SearchOf=Recherche de -SearchMenuShortCut=Ctrl + Maj + f QuickAdd=Création rapide -QuickAddMenuShortCut=Ctrl + Maj + l Valid=Valider Approve=Approuver Disapprove=Désapprouver diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 817c7cae698..f71955af2aa 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2081,12 +2081,21 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') { $logouthtmltext .= $langs->trans("Logout").'
'; + $stringforfirstkey = $langs->trans("KeyboardShortcut"); + if ($conf->browser->name == 'chrome') { + $stringforfirstkey .= ' ALT +'; + } elseif ($conf->browser->name == 'firefox') { + $stringforfirstkey .= ' ALT + SHIFT +'; + } else { + $stringforfirstkey .= ' CTL +'; + } + $logouttext .= ''; - $logouttext .= img_picto($langs->trans('Logout'), 'sign-out', '', false, 0, 0, '', 'atoplogin valignmiddle'); + $logouttext .= img_picto($langs->trans('Logout').' ('.$stringforfirstkey.' l)', 'sign-out', '', false, 0, 0, '', 'atoplogin valignmiddle'); $logouttext .= ''; } else { $logouthtmltext .= $langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]); - $logouttext .= img_picto($langs->trans('Logout'), 'sign-out', '', false, 0, 0, '', 'atoplogin valignmiddle opacitymedium'); + $logouttext .= img_picto($langs->trans('Logout').' ('.$stringforfirstkey.' l)', 'sign-out', '', false, 0, 0, '', 'atoplogin valignmiddle opacitymedium'); } } @@ -2368,11 +2377,22 @@ function top_menu_user($hideloginname = 0, $urllogout = '') $urllogout = DOL_URL_ROOT.'/user/logout.php?token='.newToken(); } + // accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox + // accesskey is for Mac: CTRL + key for all browsers + $stringforfirstkey = $langs->trans("KeyboardShortcut"); + if ($conf->browser->name == 'chrome') { + $stringforfirstkey .= ' ALT +'; + } elseif ($conf->browser->name == 'firefox') { + $stringforfirstkey .= ' ALT + SHIFT +'; + } else { + $stringforfirstkey .= ' CTL +'; + } + // Defined the links for bottom of card - $profilLink = ' '.$langs->trans("Card").''; + $profilLink = ' '.$langs->trans("Card").''; $urltovirtualcard = '/user/virtualcard.php?id='.((int) $user->id); - $virtuelcardLink = dolButtonToOpenUrlInDialogPopup('publicvirtualcardmenu', $langs->trans("PublicVirtualCardUrl").(is_object($user) ? ' - '.$user->getFullName($langs) : ''), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', ''), $urltovirtualcard, '', 'button-top-menu-dropdown marginleftonly nohover', "closeTopMenuLoginDropdown()", '', 'v'); - $logoutLink = ''.$langs->trans("Logout").''; + $virtuelcardLink = dolButtonToOpenUrlInDialogPopup('publicvirtualcardmenu', $langs->trans("PublicVirtualCardUrl").(is_object($user) ? ' - '.$user->getFullName($langs) : '').' ('.$stringforfirstkey.' v)', img_picto($langs->trans("PublicVirtualCardUrl").' ('.$stringforfirstkey.' v)', 'card', ''), $urltovirtualcard, '', 'button-top-menu-dropdown marginleftonly nohover', "closeTopMenuLoginDropdown()", '', 'v'); + $logoutLink = ''.$langs->trans("Logout").''; $profilName = $user->getFullName($langs).' ('.$user->login.')'; if (!empty($user->admin)) { @@ -2525,9 +2545,20 @@ function top_menu_quickadd() $html = ''; + // accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox + // accesskey is for Mac: CTRL + key for all browsers + $stringforfirstkey = $langs->trans("KeyboardShortcut"); + if ($conf->browser->name == 'chrome') { + $stringforfirstkey .= ' ALT +'; + } elseif ($conf->browser->name == 'firefox') { + $stringforfirstkey .= ' ALT + SHIFT +'; + } else { + $stringforfirstkey .= ' CTL +'; + } + $html .= ' '; $html .= ' @@ -2544,6 +2575,7 @@ function top_menu_quickadd() console.log("Click on #topmenu-quickadd-dropdown .dropdown-toggle"); openQuickAddDropDown(); }); + // Key map shortcut $(document).keydown(function(e){ if( e.which === 76 && e.ctrlKey && e.shiftKey ){ @@ -2552,7 +2584,6 @@ function top_menu_quickadd() } }); - var openQuickAddDropDown = function() { event.preventDefault(); $("#topmenu-quickadd-dropdown").toggleClass("open"); @@ -2759,6 +2790,17 @@ function top_menu_bookmark() return $html; } + // accesskey is for Windows or Linux: ALT + key for chrome, ALT + SHIFT + KEY for firefox + // accesskey is for Mac: CTRL + key for all browsers + $stringforfirstkey = $langs->trans("KeyboardShortcut"); + if ($conf->browser->name == 'chrome') { + $stringforfirstkey .= ' ALT +'; + } elseif ($conf->browser->name == 'firefox') { + $stringforfirstkey .= ' ALT + SHIFT +'; + } else { + $stringforfirstkey .= ' CTL +'; + } + if (!defined('JS_JQUERY_DISABLE_DROPDOWN') && !empty($conf->use_javascript_ajax)) { // This may be set by some pages that use different jquery version to avoid errors include_once DOL_DOCUMENT_ROOT.'/bookmarks/bookmarks.lib.php'; $langs->load("bookmarks"); @@ -2770,7 +2812,7 @@ function top_menu_bookmark() } else { $html .= '