Better position for username

This commit is contained in:
Laurent Destailleur 2015-02-01 01:43:19 +01:00
parent 52222ecdfe
commit 968b2b433b
2 changed files with 5 additions and 41 deletions

View File

@ -1401,43 +1401,6 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
$form=new Form($db);
// Define link to login card
/*
$loginhtmltext=''; $logintext='';
if ($user->societe_id)
{
$thirdpartystatic=new Societe($db);
$thirdpartystatic->fetch($user->societe_id);
$companylink=' ('.$thirdpartystatic->getNomUrl('','').')';
$company=' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')';
}
$logintext='<div class="login"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'"';
$logintext.=$target?(' target="'.$target.'"'):'';
$logintext.='>'.$user->login.'</a>';
if ($user->societe_id) $logintext.=$companylink;
$logintext.='</div>';
$loginhtmltext.='<u>'.$langs->trans("User").'</u>';
$loginhtmltext.='<br><b>'.$langs->trans("Name").'</b>: '.$user->getFullName($langs);
$loginhtmltext.='<br><b>'.$langs->trans("Login").'</b>: '.$user->login;
$loginhtmltext.='<br><b>'.$langs->trans("EMail").'</b>: '.$user->email;
$loginhtmltext.='<br><b>'.$langs->trans("Administrator").'</b>: '.yn($user->admin);
$type=($user->societe_id?$langs->trans("External").$company:$langs->trans("Internal"));
$loginhtmltext.='<br><b>'.$langs->trans("Type").'</b>: '.$type;
$loginhtmltext.='<br>';
$loginhtmltext.='<br><u>'.$langs->trans("Connection").'</u>';
$loginhtmltext.='<br><b>'.$langs->trans("IPAddress").'</b>: '.$_SERVER["REMOTE_ADDR"];
if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $loginhtmltext.='<br><b>'.$langs->trans("ConnectedOnMultiCompany").'</b>: '.$conf->entity.' (user entity '.$user->entity.')';
$loginhtmltext.='<br><b>'.$langs->trans("AuthenticationMode").'</b>: '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo)?'':' (demo)');
$loginhtmltext.='<br><b>'.$langs->trans("ConnectedSince").'</b>: '.dol_print_date($user->datelastlogin,"dayhour");
$loginhtmltext.='<br><b>'.$langs->trans("PreviousConnexion").'</b>: '.dol_print_date($user->datepreviouslogin,"dayhour");
$loginhtmltext.='<br><b>'.$langs->trans("CurrentTheme").'</b>: '.$conf->theme;
$loginhtmltext.='<br><b>'.$langs->trans("CurrentMenuManager").'</b>: '.$menumanager->name;
$s=picto_from_langcode($langs->getDefaultLang());
$loginhtmltext.='<br><b>'.$langs->trans("CurrentUserLanguage").'</b>: '.($s?$s.' ':'').$langs->getDefaultLang();
$loginhtmltext.='<br><b>'.$langs->trans("Browser").'</b>: '.$conf->browser->name.($conf->browser->version?' '.$conf->browser->version:'').' ('.$_SERVER['HTTP_USER_AGENT'].')';
if (! empty($conf->browser->phone)) $loginhtmltext.='<br><b>'.$langs->trans("Phone").'</b>: '.$conf->browser->phone;
if (! empty($_SESSION["disablemodules"])) $loginhtmltext.='<br><b>'.$langs->trans("DisabledModules").'</b>: <br>'.join(', ',explode(',',$_SESSION["disablemodules"]));
*/
$appli='Dolibarr';
if (! empty($conf->global->MAIN_APPLICATION_TITLE))
{
@ -1471,7 +1434,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
$toprightmenu.='<div class="login_block_user">';
// Add login user link
//$toprightmenu.=$form->textwithtooltip('',$loginhtmltext,2,1,$logintext,'login_block_elem2',2); // This include div class="login"
$toprightmenu.= $user->getNomurl(0, '', 1);
$toprightmenu.= $user->getNomurl(0, '', true, 0, 11);
$toprightmenu.='</div>';
$toprightmenu.='<div class="login_block_other">';

View File

@ -1779,9 +1779,10 @@ class User extends CommonObject
* @param string $option On what the link point to
* @param boolean $infologin Add connection info to the tooltip
* @param string $notooltip 1=Disable tooltip
* @param int $maxlen Max length of visible user name
* @return string String with URL
*/
function getNomUrl($withpicto=0, $option='', $infologin=0, $notooltip=0)
function getNomUrl($withpicto=0, $option='', $infologin=0, $notooltip=0, $maxlen=24)
{
global $langs, $conf, $db;
global $dolibarr_main_authentication, $dolibarr_main_demo;
@ -1792,7 +1793,7 @@ class User extends CommonObject
$label = '<u>' . $langs->trans("User") . '</u>';
$label.= '<div width="100%">';
$label .= '<b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs,'','',24);
$label .= '<b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs,'','');
if (! empty($this->login))
$label .= '<br><b>' . $langs->trans('Login') . ':</b> ' . $this->login;
if (! empty($this->email))
@ -1845,7 +1846,7 @@ class User extends CommonObject
$result.=($lien.img_object(($notooltip?'':$label), 'user', ($notooltip?'':'class="classfortooltip"')).$lienfin);
if ($withpicto != 2) $result.=' ';
}
$result.= $lien . $this->getFullName($langs,'','',24) . $companylink . $lienfin;
$result.= $lien . $this->getFullName($langs,'','',$maxlen) . $companylink . $lienfin;
return $result;
}