Qual: Nouvelle fonction textwithhelp pour afficher des tooltips HTML
This commit is contained in:
parent
e322dda35e
commit
d2037bd72a
@ -202,8 +202,8 @@ if ($handle)
|
||||
{
|
||||
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
|
||||
}
|
||||
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
|
||||
print ($htmltooltip?img_help(0):'');
|
||||
print '<td align="center">';
|
||||
$html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
@ -250,7 +250,7 @@ print ' <td width="100">'.$langs->trans("Name")."</td>\n";
|
||||
print " <td>".$langs->trans("Description")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Activated")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
|
||||
print '<td align="center" width="32" colspan="2">'.$langs->trans("Info").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
@ -318,8 +318,11 @@ while (($file = readdir($handle))!==false)
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("MultiLanguage").'</b>: '.yn($module->option_multilang);
|
||||
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'" alt="" title="">'.img_help(0,0).'</a>';
|
||||
print '<td align="center">';
|
||||
$html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
@ -199,7 +199,7 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<img height="30" src="'.DOL_URL_ROOT.'/theme/nophoto.jpg">';
|
||||
print '<img height="30" src="'.DOL_URL_ROOT.'/theme/common/nophoto.jpg">';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td></tr>';
|
||||
@ -430,7 +430,7 @@ else
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<img height="30" src="'.DOL_URL_ROOT.'/theme/nophoto.jpg">';
|
||||
print '<img height="30" src="'.DOL_URL_ROOT.'/theme/common/nophoto.jpg">';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
@ -280,7 +280,7 @@ print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Default").'</td>';
|
||||
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
|
||||
print '<td align="center" width="32" colspan="2">'.$langs->trans("Info").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
@ -348,11 +348,16 @@ if(is_dir($dir))
|
||||
$htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$module->page_largeur;
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Height").'</b>: '.$module->page_hauteur;
|
||||
$htmltooltip.='<br>'.$langs->trans("FeaturesSupported").':';
|
||||
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
|
||||
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>'.img_help(0).'</td>';
|
||||
print '<td align="center">';
|
||||
$html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'sending').'</a>';
|
||||
print '</td>';
|
||||
|
||||
print '</td></tr>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
@ -244,8 +244,8 @@ while (($file = readdir($handle))!==false)
|
||||
{
|
||||
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
|
||||
}
|
||||
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
|
||||
print ($htmltooltip?img_help(0):'');
|
||||
print '<td align="center">';
|
||||
$html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
@ -291,7 +291,7 @@ print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Default").'</td>';
|
||||
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
|
||||
print '<td align="center" width="32" colspan="2">'.$langs->trans("Info").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
@ -360,8 +360,11 @@ while (($file = readdir($handle))!==false)
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("MultiLanguage").'</b>: '.yn($module->option_multilang);
|
||||
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'" alt="" title="">'.img_help(0,0).'</a>';
|
||||
print '<td align="center">';
|
||||
$html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
@ -171,8 +171,8 @@ if ($handle)
|
||||
{
|
||||
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
|
||||
}
|
||||
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
|
||||
print ($htmltooltip?img_help(0):'');
|
||||
print '<td align="center">';
|
||||
$html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
@ -217,7 +217,7 @@ print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Activated")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
|
||||
print '<td align="center" width="32" colspan="2">'.$langs->trans("Info").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
@ -281,9 +281,14 @@ while (($file = readdir($handle))!==false)
|
||||
$htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$module->page_largeur;
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Height").'</b>: '.$module->page_hauteur;
|
||||
$htmltooltip.='<br>'.$langs->trans("FeaturesSupported").':';
|
||||
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
|
||||
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>'.img_help(0).'</td>';
|
||||
print '<td align="center">';
|
||||
$html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'intervention').'</a>';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -170,8 +170,8 @@ if ($handle)
|
||||
{
|
||||
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
|
||||
}
|
||||
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
|
||||
print ($htmltooltip?img_help(0):'');
|
||||
print '<td align="center">';
|
||||
$html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
@ -218,7 +218,7 @@ print ' <td width="100">'.$langs->trans("Name")."</td>\n";
|
||||
print " <td>".$langs->trans("Description")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Activated")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
|
||||
print '<td align="center" width="32" colspan="2">'.$langs->trans("Info").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
@ -281,11 +281,16 @@ while (($file = readdir($handle))!==false)
|
||||
$htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$module->page_largeur;
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Height").'</b>: '.$module->page_hauteur;
|
||||
$htmltooltip.='<br>'.$langs->trans("FeaturesSupported").':';
|
||||
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
|
||||
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>'.img_help(0).'</td>';
|
||||
print '<td align="center">';
|
||||
$html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'order').'</a>';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -346,7 +346,8 @@ function show_theme($edit=0)
|
||||
$i=0;
|
||||
while (($subdir = readdir($handle))!==false)
|
||||
{
|
||||
if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.' && substr($subdir, 0, 3) <> 'CVS')
|
||||
if (is_dir($dirtheme."/".$subdir) && substr($subdir, 0, 1) <> '.'
|
||||
&& substr($subdir, 0, 3) <> 'CVS' && ! eregi('common',$subdir))
|
||||
{
|
||||
if ($i % $thumbsbyrow == 0)
|
||||
{
|
||||
@ -355,7 +356,7 @@ function show_theme($edit=0)
|
||||
|
||||
print '<td align="center">';
|
||||
$file=$dirtheme."/".$subdir."/thumb.png";
|
||||
if (! file_exists($file)) $file=$dirtheme."/nophoto.jpg";
|
||||
if (! file_exists($file)) $file=$dirtheme."/common/nophoto.jpg";
|
||||
print '<table><tr><td><img src="'.$file.'" width="80" height="60"></td></tr><tr><td align="center">';
|
||||
if ($subdir == $conf->global->MAIN_THEME)
|
||||
{
|
||||
|
||||
@ -192,8 +192,8 @@ if ($handle)
|
||||
{
|
||||
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
|
||||
}
|
||||
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
|
||||
print ($htmltooltip?img_help(0):'');
|
||||
print '<td align="center">';
|
||||
$html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
@ -239,7 +239,7 @@ print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Action").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Default").'</td>';
|
||||
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
|
||||
print '<td align="center" width="32" colspan="2">'.$langs->trans("Info").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
@ -307,12 +307,16 @@ if(is_dir($dir))
|
||||
$htmltooltip = '<b>'.$langs->trans("Type").'</b>: '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Width").'</b>: '.$module->page_largeur;
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Height").'</b>: '.$module->page_hauteur;
|
||||
$htmltooltip.='<br>'.$langs->trans("FeaturesSupported").':';
|
||||
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
|
||||
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
|
||||
print '<td align="center">';
|
||||
$html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'sending').'</a>';
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>'.img_help(0).'</td>';
|
||||
|
||||
print '</td></tr>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
@ -223,8 +223,8 @@ if ($handle)
|
||||
{
|
||||
$htmltooltip='<b>'.$langs->trans("NextValue").'</b>: '.$nextval;
|
||||
}
|
||||
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
|
||||
print ($htmltooltip?img_help(0):'');
|
||||
print '<td align="center">';
|
||||
$html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
@ -271,7 +271,7 @@ print " <td width=\"140\">".$langs->trans("Name")."</td>\n";
|
||||
print " <td>".$langs->trans("Description")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Activated")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td align="center" width="16">'.$langs->trans("Info").'</td>';
|
||||
print '<td align="center" width="32" colspan="2">'.$langs->trans("Info").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
@ -339,8 +339,11 @@ while (($file = readdir($handle))!==false)
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentMode").'</b>: '.yn($module->option_modereg);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("PaymentConditions").'</b>: '.yn($module->option_condreg);
|
||||
$htmltooltip.='<br><b>'.$langs->trans("MultiLanguage").'</b>: '.yn($module->option_multilang);
|
||||
print '<td align="center" '.$html->tooltip_properties($htmltooltip).'>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'" alt="" title="">'.img_help(0,0).'</a>';
|
||||
print '<td align="center">';
|
||||
$html->textwithhelp('',$htmltooltip,1,0);
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'propal').'</a>';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
@ -60,41 +60,48 @@ class Form
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Retourne propriétés pour affichae d'un tooltip
|
||||
\param htmltooltip Contenu html du tooltip
|
||||
\return string Chaine des propriétés de declenchement du tooltip
|
||||
\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
|
||||
*/
|
||||
function tooltip_properties($htmltooltip='Text for tooltip')
|
||||
function textwithhelp($text,$htmltext,$direction=1,$usehelpcursor=1)
|
||||
{
|
||||
global $conf;
|
||||
$s ='';
|
||||
if ($conf->use_javascript && $htmltooltip)
|
||||
{
|
||||
$htmltooltip=ereg_replace("'","\'",$htmltooltip);
|
||||
$s.=' onmouseover="showtip(\''.$htmltooltip.'\')"';
|
||||
$s.=' onMouseout="hidetip()"';
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Efface champ alt et title pour permettre utiliser dans un tooltip
|
||||
\param string Chaine a nettoyer
|
||||
\return string Chaine nettoyé
|
||||
*/
|
||||
function tooltip_sanitize($string)
|
||||
{
|
||||
global $conf;
|
||||
global $conf;
|
||||
if (! $htmltext)
|
||||
{
|
||||
print $text;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Sanitize tooltip
|
||||
$paramfortooltip ='';
|
||||
if ($conf->use_javascript)
|
||||
{
|
||||
// Supprime alt et title de text pour eviter conflit avec tooltip
|
||||
$string=eregi_replace('alt="[^"]+"','',$string);
|
||||
$string=eregi_replace('title="[^"]+"','',$string);
|
||||
$htmltext=ereg_replace("'","\'",$htmltext);
|
||||
$paramfortooltip.=' onmouseover="showtip(\''.$htmltext.'\')"';
|
||||
$paramfortooltip.=' onMouseout="hidetip()"';
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
print '<table class="nobordernopadding"><tr>';
|
||||
if ($direction > 0)
|
||||
{
|
||||
if ($text) print '<td>'.$text.' </td>';
|
||||
print '<td'.$paramfortooltip.'>'.img_help($usehelpcursor,0).'</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td'.$paramfortooltip.'>'.img_help($usehelpcursor,0).'</td>';
|
||||
if ($text) print '<td> '.$text.'</td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Retourne la liste déroulante des départements/province/cantons tout pays confondu ou pour un pays donné.
|
||||
* \remarks Dans le cas d'une liste tout pays confondus, l'affichage fait une rupture sur le pays.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user