From 3b4ea82741faf3207dd8e537218191dd99d323d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Mar 2019 11:49:10 +0100 Subject: [PATCH] Some fix on MAIN_TOP_MENU_DROPDOWN option --- htdocs/main.inc.php | 100 +++++++++++++++-------------- htdocs/theme/eldy/dropdown.css.php | 8 +-- htdocs/theme/eldy/global.inc.php | 4 +- 3 files changed, 59 insertions(+), 53 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 7bd083cd682..bb7401d334b 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1583,8 +1583,8 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead } $loginBlockMoreClass = ''; - if(!empty($conf->global->MAIN_TOP_MENU_DROPDOWN)){ $loginBlockMoreClass = 'usedropdown'; } - + if (!empty($conf->global->MAIN_TOP_MENU_DROPDOWN)) { $loginBlockMoreClass = 'usedropdown'; } + print '
'."\n"; // Add login user link @@ -1593,11 +1593,11 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead // Login name with photo and tooltip $mode=-1; $toprightmenu.='
'; @@ -1692,7 +1692,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead } } - + // Logout link $toprightmenu.=@Form::textwithtooltip('', $logouthtmltext, 2, 1, $logouttext, 'login_block_elem logout-btn', 2); @@ -1712,30 +1712,35 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead } - -function top_menu_user(user $user, $langs){ +/** + * Build the tooltip on user login + * + * @param user $user User object + * @param Translate $langs Language object + * @return string HTML content + */ +function top_menu_user(User $user, Translate $langs) +{ global $langs, $conf, $db, $hookmanager, $user; global $dolibarr_main_authentication, $dolibarr_main_demo; global $menumanager; - + $userImage = $userDropDownImage = ''; if (! empty($user->photo)) { $userImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'photouserphoto userphoto', 'small', 0, 1); $userDropDownImage = Form::showphoto('userphoto', $user, 0, 0, 0, 'dropdown-user-image', 'small', 0, 1); } - + $dropdownBody = ''; - - $dropdownBody.= ' '.$langs->trans("ShowMoreInfos").''; $dropdownBody.= '
'; - + // login infos - if (!empty($user->admin)){ + if (!empty($user->admin)) { $dropdownBody.= '
' . $langs->trans("Administrator").': '.yn($user->admin); } - if (! empty($user->socid) ) // Add thirdparty for external users + if (! empty($user->socid)) // Add thirdparty for external users { $thirdpartystatic = new Societe($db); $thirdpartystatic->fetch($user->socid); @@ -1745,7 +1750,8 @@ function top_menu_user(user $user, $langs){ $type=($user->socid?$langs->trans("External").$company:$langs->trans("Internal")); $dropdownBody.= '
' . $langs->trans("Type") . ': ' . $type; $dropdownBody.= '
' . $langs->trans("Status").': '.$user->getLibStatut(0); - + $dropdownBody.= '
'; + $dropdownBody.= '
'.$langs->trans("Connection").''; $dropdownBody.= '
'.$langs->trans("IPAddress").': '.$_SERVER["REMOTE_ADDR"]; if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $dropdownBody.= '
'.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$user->entity.')'; @@ -1762,7 +1768,7 @@ function top_menu_user(user $user, $langs){ if ($conf->browser->layout == 'phone') $dropdownBody.= '
'.$langs->trans("Phone").': '.$langs->trans("Yes"); if (! empty($_SESSION["disablemodules"])) $dropdownBody.= '
'.$langs->trans("DisabledModules").':
'.join(', ', explode(',', $_SESSION["disablemodules"])); $dropdownBody.= '
'; - + // Execute hook $parameters=array('user'=>$user, 'langs' => $langs); $result=$hookmanager->executeHooks('printTopRightMenuLoginDropdownBody', $parameters); // Note that $action and $object may have been modified by some hooks @@ -1773,26 +1779,26 @@ function top_menu_user(user $user, $langs){ } else{ $dropdownBody = $hookmanager->resPrint; // replace - } + } } - - - + + + $logoutLink =' '.$langs->trans("Logout").''; $profilLink =' '.$langs->trans("Card").''; - - + + $profilName = $user->getFullName($langs).' ('.$user->login.')'; - + if($user->admin){ $profilName = ' '.$profilName; } - + $btnUser = '