2
0
forked from Wavyzz/dolibarr

Fix: Tooltip is visible on picto hover

This commit is contained in:
Laurent Destailleur
2011-07-04 07:28:11 +00:00
parent cb2cb01d38
commit 1001532c2d
2 changed files with 16 additions and 19 deletions

View File

@@ -31,7 +31,7 @@
* \file htdocs/core/class/html.form.class.php * \file htdocs/core/class/html.form.class.php
* \ingroup core * \ingroup core
* \brief File of class with all html predefined components * \brief File of class with all html predefined components
* \version $Id: html.form.class.php,v 1.184 2011/06/29 15:48:03 grandoc Exp $ * \version $Id: html.form.class.php,v 1.185 2011/07/04 07:28:11 eldy Exp $
*/ */
@@ -163,19 +163,14 @@ class Form
if ($incbefore) $text = $incbefore.$text; if ($incbefore) $text = $incbefore.$text;
if (! $htmltext) return $text; if (! $htmltext) return $text;
$paramfortooltip ='';
// Sanitize tooltip // Sanitize tooltip
$htmltext=str_replace("\\","\\\\",$htmltext); $htmltext=str_replace("\\","\\\\",$htmltext);
//$htmltext=str_replace("'","\'",$htmltext);
//$htmltext=str_replace("'","\'",$htmltext);
$htmltext=str_replace("\r","",$htmltext); $htmltext=str_replace("\r","",$htmltext);
$htmltext=str_replace("<br>\n","<br>",$htmltext);
$htmltext=str_replace("\n","",$htmltext); $htmltext=str_replace("\n","",$htmltext);
$htmltext=str_replace('"',"&quot;",$htmltext); $htmltext=str_replace('"',"&quot;",$htmltext);
$extracss = (!empty($extracss) ? ' '.$extracss : ''); $paramfortooltipimg=' class="classfortooltip'.($extracss?' '.$extracss:'').'" title="'.dol_escape_htmltag($htmltext,1).'"'; // Attribut to put on td img tag to store tooltip
$paramfortooltip.=' class="classfortooltip'.$extracss.'" title="'.$htmltext.'"'; // Attribut to put on td tag to store tooltip $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag
$s=""; $s="";
if (empty($notabs)) $s.='<table class="nobordernopadding" summary=""><tr>'; if (empty($notabs)) $s.='<table class="nobordernopadding" summary=""><tr>';
@@ -183,18 +178,18 @@ class Form
{ {
if ($text != '') if ($text != '')
{ {
$s.='<td'.$paramfortooltip.'>'.$text; $s.='<td'.$paramfortooltiptd.'>'.$text;
if ($direction) $s.='&nbsp;'; if ($direction) $s.='&nbsp;';
$s.='</td>'; $s.='</td>';
} }
if ($direction) $s.='<td'.$paramfortooltip.' valign="top" width="14">'.$img.'</td>'; if ($direction) $s.='<td'.$paramfortooltipimg.' valign="top" width="14">'.$img.'</td>';
} }
else else
{ {
if ($direction) $s.='<td'.$paramfortooltip.' valign="top" width="14">'.$img.'</td>'; if ($direction) $s.='<td'.$paramfortooltipimg.' valign="top" width="14">'.$img.'</td>';
if ($text != '') if ($text != '')
{ {
$s.='<td'.$paramfortooltip.'>'; $s.='<td'.$paramfortooltiptd.'>';
if ($direction) $s.='&nbsp;'; if ($direction) $s.='&nbsp;';
$s.=$text.'</td>'; $s.=$text.'</td>';
} }
@@ -210,6 +205,7 @@ class Form
* @param htmltooltip Content of tooltip * @param htmltooltip Content of tooltip
* @param direction 1=Icon is after text, -1=Icon is before text * @param direction 1=Icon is after text, -1=Icon is before text
* @param type Type of picto (info, help, warning, superadmin...) * @param type Type of picto (info, help, warning, superadmin...)
* @param extracss Add a CSS style to td tags
* @return string HTML code of text, picto, tooltip * @return string HTML code of text, picto, tooltip
*/ */
function textwithpicto($text,$htmltext,$direction=1,$type='help',$extracss='') function textwithpicto($text,$htmltext,$direction=1,$type='help',$extracss='')

View File

@@ -29,7 +29,7 @@
* \file htdocs/lib/functions.lib.php * \file htdocs/lib/functions.lib.php
* \brief A set of functions for Dolibarr * \brief A set of functions for Dolibarr
* This file contains all frequently used functions. * This file contains all frequently used functions.
* \version $Id: functions.lib.php,v 1.534 2011/07/03 18:31:13 eldy Exp $ * \version $Id: functions.lib.php,v 1.535 2011/07/04 07:28:36 eldy Exp $
*/ */
// For compatibility during upgrade // For compatibility during upgrade
@@ -319,19 +319,20 @@ function dol_escape_js($stringtoescape)
/** /**
* \brief Returns text escaped for inclusion in HTML alt or title tags * Returns text escaped for inclusion in HTML alt or title tags
* \param $stringtoescape String to escape * @param $stringtoescape String to escape
* \return string Escaped string * @param $keepb Do not clean <b> tags
* @return string Escaped string
*/ */
function dol_escape_htmltag($stringtoescape) function dol_escape_htmltag($stringtoescape,$keepb=0)
{ {
// escape quotes and backslashes, newlines, etc. // escape quotes and backslashes, newlines, etc.
$tmp=dol_html_entity_decode($stringtoescape,ENT_COMPAT,'UTF-8'); $tmp=dol_html_entity_decode($stringtoescape,ENT_COMPAT,'UTF-8');
$tmp=strtr($tmp, array('"'=>'',"\r"=>'\\r',"\n"=>'\\n',"<b>"=>'','</b>'=>'')); if ($keepb) $tmp=strtr($tmp, array('"'=>'',"\r"=>'\\r',"\n"=>'\\n'));
else $tmp=strtr($tmp, array('"'=>'',"\r"=>'\\r',"\n"=>'\\n',"<b>"=>'','</b>'=>''));
return dol_htmlentities($tmp,ENT_COMPAT,'UTF-8'); return dol_htmlentities($tmp,ENT_COMPAT,'UTF-8');
} }
/* For backward compatiblity */ /* For backward compatiblity */
function dolibarr_syslog($message, $level=LOG_INFO) function dolibarr_syslog($message, $level=LOG_INFO)
{ {