Fonction pour afficher un tooltip plus gnrique.

This commit is contained in:
Laurent Destailleur 2007-05-21 18:21:43 +00:00
parent 5ec448f89a
commit 96b7c31b11
5 changed files with 86 additions and 78 deletions

View File

@ -65,46 +65,75 @@ class Form
/**
\brief Affiche un texte+picto avec tooltip sur texte ou sur picto
\param text Texte à afficher
\param htmltext Contenu html du tooltip
\param tooltipon 1=tooltip sur texte, 2=tooltip sur picto, 3=tooltip sur les 2
\param direction -1=Le picto est avant, 0=pas de picto, 1=le picto est après
\param img Code img du picto
\return string Code html du texte,picto
*/
function textwithtooltip($text,$htmltext,$tooltipon=1,$direction=0,$img='')
{
global $conf;
if (! $htmltext) return $text;
$paramfortooltiptext ='';
$paramfortooltippicto ='';
if ($conf->use_javascript)
{
// Sanitize tooltip
$htmltext=ereg_replace("'","\'",$htmltext);
if ($tooltipon==1 || $tooltipon==3)
{
$paramfortooltiptext.=' onmouseover="showtip(\''.$htmltext.'\')"';
$paramfortooltiptext.=' onMouseout="hidetip()"';
}
if ($tooltipon==2 || $tooltipon==3)
{
$paramfortooltippicto.=' onmouseover="showtip(\''.$htmltext.'\')"';
$paramfortooltippicto.=' onMouseout="hidetip()"';
}
}
$s="";
$s.='<table class="nobordernopadding"><tr>';
if ($direction > 0)
{
if ($text)
{
$s.='<td'.$paramfortooltiptext.'>'.$text;
$s.='&nbsp;';
$s.='</td>';
}
if ($direction) $s.='<td'.$paramfortooltippicto.' valign="top" width="14">'.$img.'</td>';
}
else
{
if ($direction) $s.='<td'.$paramfortooltippicto.' valign="top" width="14">'.$img.'</td>';
if ($text)
{
$s.='<td'.$paramfortooltiptext.'>';
$s.='&nbsp;';
$s.=$text.'</td>';
}
}
$s.='</tr></table>';
return $s;
}
/**
\brief Affiche un texte avec picto help qui affiche un tooltip
\param text Texte à afficher
\param htmltooltip Contenu html du tooltip
\param direction 1=Le picto est après, -1=le picto est avant
\param usehelpcursor 1=Utilise curseur help, 0=Curseur par defaut
\return string Code html du texte,picto
*/
function textwithhelp($text,$htmltext,$direction=1,$usehelpcursor=1)
*/
function textwithhelp($text,$htmltext,$direction=1,$usehelpcursor=1)
{
global $conf;
if (! $htmltext)
{
return $text;
}
$s="";
// Sanitize tooltip
$paramfortooltip ='';
if ($conf->use_javascript)
{
$htmltext=ereg_replace("'","\'",$htmltext);
$paramfortooltip.=' onmouseover="showtip(\''.$htmltext.'\')"';
$paramfortooltip.=' onMouseout="hidetip()"';
}
$s.='<table class="nobordernopadding"><tr>';
if ($direction > 0)
{
if ($text) $s.='<td>'.$text.'&nbsp;</td>';
$s.='<td'.$paramfortooltip.' valign="top" width="14">'.img_help($usehelpcursor,0).'</td>';
}
else
{
$s.='<td'.$paramfortooltip.' valign="top" width="14">'.img_help($usehelpcursor,0).'</td>';
if ($text) $s.='<td>&nbsp;'.$text.'</td>';
}
$s.='</tr></table>';
return $s;
return $this->textwithtooltip($text,$htmltext,2,$direction,img_help($usehelpcursor,0));
}
/**
@ -113,40 +142,10 @@ class Form
\param htmltooltip Contenu html du tooltip
\param direction 1=Le picto est après, -1=le picto est avant
\return string Code html du texte,picto
*/
function textwithwarning($text,$htmltext,$direction=1)
*/
function textwithwarning($text,$htmltext,$direction=1)
{
global $conf;
if (! $htmltext)
{
return $text;
}
$s="";
// Sanitize tooltip
$paramfortooltip ='';
if ($conf->use_javascript)
{
$htmltext=ereg_replace("'","\'",$htmltext);
$paramfortooltip.=' onmouseover="showtip(\''.$htmltext.'\')"';
$paramfortooltip.=' onMouseout="hidetip()"';
}
$s.='<table class="nobordernopadding"><tr>';
if ($direction > 0)
{
if ($text) $s.='<td>'.$text.'&nbsp;</td>';
$s.='<td'.$paramfortooltip.' valign="top" width="14">'.img_warning("default").'</td>';
}
else
{
$s.='<td'.$paramfortooltip.' valign="top" width="14">'.img_warning("default").'</td>';
if ($text) $s.='<td>&nbsp;'.$text.'</td>';
}
$s.='</tr></table>';
return $s;
return $this->textwithtooltip($text,$htmltext,2,$direction,img_warning("default"));
}

View File

@ -600,7 +600,7 @@ function top_htmlhead($head, $title="", $target="")
*/
function top_menu($head, $title="", $target="")
{
global $user, $conf, $langs, $db;
global $user, $conf, $langs, $db, $dolibarr_main_authentication;
if (! $conf->top_menu) $conf->top_menu ='eldy_backoffice.php';
if (! $conf->left_menu) $conf->left_menu='eldy_backoffice.php';
@ -653,15 +653,24 @@ function top_menu($head, $title="", $target="")
// Lien logout
if (! isset($_SERVER["REMOTE_USER"]) || ! $_SERVER["REMOTE_USER"])
{
print '<a href="'.DOL_URL_ROOT.'/user/logout.php"';
print $menutop->atarget?(' target="'.$menutop->atarget.'"'):'';
print '>';
$title=$langs->trans("Logout");
$title.=' ('.$langs->trans("ConnectedSince").': '.dolibarr_print_date($user->datelastlogin,"%d/%m/%Y %H:%M:%S").')';
print '<img class="login" border="0" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/logout.png"';
print ' alt="'.$title.'" title="'.$title.'"';
print '>';
print '</a>';
$title.='<br><b>'.$langs->trans("ConnectedSince").'</b>: '.dolibarr_print_date($user->datelastlogin,"%d/%m/%Y %H:%M:%S");
$title.='<br><b>'.$langs->trans("AuthenticationMode").'</b>: '.$dolibarr_main_authentication;
$text.='<a href="'.DOL_URL_ROOT.'/user/logout.php"';
$text.=$menutop->atarget?(' target="'.$menutop->atarget.'"'):'';
$text.='>';
$text.='<img class="login" border="0" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/logout.png"';
$text.=' alt="" title=""';
$text.='>';
$text.='</a>';
$html=new Form($db);
print $html->textwithtooltip('',$title,2,1,$text);
// print '<img class="login" border="0" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/logout.png"';
// print ' alt="'.$title.'" title="'.$title.'"';
// print '>';
}
print "\n</div>\n<!-- End top horizontal menu -->\n";

View File

@ -780,7 +780,7 @@ tr.nonpayed {
#dhtmltooltip
{
position: absolute;
width: 200px;
width: 300px;
border: 1px solid #444444;
padding: 2px;
background-color: lightyellow;

View File

@ -636,7 +636,7 @@ tr.nonpayed {
#dhtmltooltip
{
position: absolute;
width: 200px;
width: 300px;
border: 1px solid #444444;
padding: 2px;
background-color: lightyellow;

View File

@ -716,7 +716,7 @@ table.valid {
#dhtmltooltip
{
position: absolute;
width: 200px;
width: 300px;
border: 1px solid #444444;
padding: 2px;
background-color: lightyellow;