From d2037bd72a9116e1ff88c6859cc40fa5344878b9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 20 Aug 2006 02:17:52 +0000 Subject: [PATCH] Qual: Nouvelle fonction textwithhelp pour afficher des tooltips HTML --- htdocs/admin/commande.php | 13 +++++--- htdocs/admin/company.php | 4 +-- htdocs/admin/expedition.php | 13 +++++--- htdocs/admin/facture.php | 13 +++++--- htdocs/admin/fichinter.php | 15 ++++++--- htdocs/admin/fournisseur.php | 15 ++++++--- htdocs/admin/ihm.php | 5 +-- htdocs/admin/livraison.php | 18 +++++++---- htdocs/admin/propale.php | 13 +++++--- htdocs/html.form.class.php | 63 ++++++++++++++++++++---------------- 10 files changed, 104 insertions(+), 68 deletions(-) diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 080f3aa0e03..44e50652731 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -202,8 +202,8 @@ if ($handle) { $htmltooltip=''.$langs->trans("NextValue").': '.$nextval; } - print 'tooltip_properties($htmltooltip).'>'; - print ($htmltooltip?img_help(0):''); + print ''; + $html->textwithhelp('',$htmltooltip,1,0); print ''; print ''; @@ -250,7 +250,7 @@ print ' '.$langs->trans("Name")."\n"; print " ".$langs->trans("Description")."\n"; print ''.$langs->trans("Activated")."\n"; print ''.$langs->trans("Default")."\n"; -print ''.$langs->trans("Info").''; +print ''.$langs->trans("Info").''; print "\n"; clearstatcache(); @@ -318,8 +318,11 @@ while (($file = readdir($handle))!==false) $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg); $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg); $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang); - print 'tooltip_properties($htmltooltip).'>'; - print ''.img_help(0,0).''; + print ''; + $html->textwithhelp('',$htmltooltip,1,0); + print ''; + print ''; + print ''.img_object($langs->trans("Preview"),'order').''; print ''; print "\n"; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 35d2b136add..b33a22903c1 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -199,7 +199,7 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit') } else { - print ''; + print ''; } print ''; print ''; @@ -430,7 +430,7 @@ else } else { - print ''; + print ''; } print ''; diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 03404001492..a3e74e94dea 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -280,7 +280,7 @@ print ''.$langs->trans("Name").''; print ''.$langs->trans("Description").''; print ''.$langs->trans("Activated").''; print ''.$langs->trans("Default").''; -print ''.$langs->trans("Info").''; +print ''.$langs->trans("Info").''; print "\n"; clearstatcache(); @@ -348,11 +348,16 @@ if(is_dir($dir)) $htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='
'.$langs->trans("Width").': '.$module->page_largeur; $htmltooltip.='
'.$langs->trans("Height").': '.$module->page_hauteur; - $htmltooltip.='
'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo); - print 'tooltip_properties($htmltooltip).'>'.img_help(0).''; + print ''; + $html->textwithhelp('',$htmltooltip,1,0); + print ''; + print ''; + print ''.img_object($langs->trans("Preview"),'sending').''; + print ''; - print ''; + print ''; } } closedir($handle); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 1d896f0144b..4e8089066c7 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -244,8 +244,8 @@ while (($file = readdir($handle))!==false) { $htmltooltip=''.$langs->trans("NextValue").': '.$nextval; } - print 'tooltip_properties($htmltooltip).'>'; - print ($htmltooltip?img_help(0):''); + print ''; + $html->textwithhelp('',$htmltooltip,1,0); print ''; print "\n"; @@ -291,7 +291,7 @@ print ''.$langs->trans("Name").''; print ''.$langs->trans("Description").''; print ''.$langs->trans("Activated").''; print ''.$langs->trans("Default").''; -print ''.$langs->trans("Info").''; +print ''.$langs->trans("Info").''; print "\n"; clearstatcache(); @@ -360,8 +360,11 @@ while (($file = readdir($handle))!==false) $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg); $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg); $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang); - print 'tooltip_properties($htmltooltip).'>'; - print ''.img_help(0,0).''; + print ''; + $html->textwithhelp('',$htmltooltip,1,0); + print ''; + print ''; + print ''.img_object($langs->trans("Preview"),'bill').''; print ''; print "\n"; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 1c8ceaf4994..0518a53d0c2 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -171,8 +171,8 @@ if ($handle) { $htmltooltip=''.$langs->trans("NextValue").': '.$nextval; } - print 'tooltip_properties($htmltooltip).'>'; - print ($htmltooltip?img_help(0):''); + print ''; + $html->textwithhelp('',$htmltooltip,1,0); print ''; print ''; @@ -217,7 +217,7 @@ print ''.$langs->trans("Name").''; print ''.$langs->trans("Description").''; print ''.$langs->trans("Activated")."\n"; print ''.$langs->trans("Default")."\n"; -print ''.$langs->trans("Info").''; +print ''.$langs->trans("Info").''; print "\n"; clearstatcache(); @@ -281,9 +281,14 @@ while (($file = readdir($handle))!==false) $htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='
'.$langs->trans("Width").': '.$module->page_largeur; $htmltooltip.='
'.$langs->trans("Height").': '.$module->page_hauteur; - $htmltooltip.='
'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo); - print 'tooltip_properties($htmltooltip).'>'.img_help(0).''; + print ''; + $html->textwithhelp('',$htmltooltip,1,0); + print ''; + print ''; + print ''.img_object($langs->trans("Preview"),'intervention').''; + print ''; print ''; } diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php index d527eab4b71..fd6f7679104 100644 --- a/htdocs/admin/fournisseur.php +++ b/htdocs/admin/fournisseur.php @@ -170,8 +170,8 @@ if ($handle) { $htmltooltip=''.$langs->trans("NextValue").': '.$nextval; } - print 'tooltip_properties($htmltooltip).'>'; - print ($htmltooltip?img_help(0):''); + print ''; + $html->textwithhelp('',$htmltooltip,1,0); print ''; print ''; @@ -218,7 +218,7 @@ print ' '.$langs->trans("Name")."\n"; print " ".$langs->trans("Description")."\n"; print ''.$langs->trans("Activated")."\n"; print ''.$langs->trans("Default")."\n"; -print ''.$langs->trans("Info").''; +print ''.$langs->trans("Info").''; print "\n"; clearstatcache(); @@ -281,11 +281,16 @@ while (($file = readdir($handle))!==false) $htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='
'.$langs->trans("Width").': '.$module->page_largeur; $htmltooltip.='
'.$langs->trans("Height").': '.$module->page_hauteur; - $htmltooltip.='
'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo); $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg); $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg); - print 'tooltip_properties($htmltooltip).'>'.img_help(0).''; + print ''; + $html->textwithhelp('',$htmltooltip,1,0); + print ''; + print ''; + print ''.img_object($langs->trans("Preview"),'order').''; + print ''; print "\n"; } diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index bc4230350b2..8cb449b923d 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -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 ''; $file=$dirtheme."/".$subdir."/thumb.png"; - if (! file_exists($file)) $file=$dirtheme."/nophoto.jpg"; + if (! file_exists($file)) $file=$dirtheme."/common/nophoto.jpg"; print ''; print ''; @@ -239,7 +239,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; clearstatcache(); @@ -307,12 +307,16 @@ if(is_dir($dir)) $htmltooltip = ''.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='
'.$langs->trans("Width").': '.$module->page_largeur; $htmltooltip.='
'.$langs->trans("Height").': '.$module->page_hauteur; - $htmltooltip.='
'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo); + print ''; + print ''; - print ''; - - print ''; + print ''; } } closedir($handle); diff --git a/htdocs/admin/propale.php b/htdocs/admin/propale.php index fc621a447a7..f8c2be11f81 100644 --- a/htdocs/admin/propale.php +++ b/htdocs/admin/propale.php @@ -223,8 +223,8 @@ if ($handle) { $htmltooltip=''.$langs->trans("NextValue").': '.$nextval; } - print ''; print "\n"; @@ -271,7 +271,7 @@ print " \n"; print " \n"; print '\n"; print '\n"; -print ''; +print ''; print "\n"; clearstatcache(); @@ -339,8 +339,11 @@ while (($file = readdir($handle))!==false) $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg); $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg); $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang); - print ''; + print ''; print "\n"; diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index c38ce1b829f..11c202000d4 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -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 '
'; if ($subdir == $conf->global->MAIN_THEME) { diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 9572d213c64..feef6a4165c 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -192,8 +192,8 @@ if ($handle) { $htmltooltip=''.$langs->trans("NextValue").': '.$nextval; } - print 'tooltip_properties($htmltooltip).'>'; - print ($htmltooltip?img_help(0):''); + print ''; + $html->textwithhelp('',$htmltooltip,1,0); print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Action").''.$langs->trans("Default").''.$langs->trans("Info").''.$langs->trans("Info").'
'; + $html->textwithhelp('',$htmltooltip,1,0); + print ''; + print ''.img_object($langs->trans("Preview"),'sending').''; + print 'tooltip_properties($htmltooltip).'>'.img_help(0).'
tooltip_properties($htmltooltip).'>'; - print ($htmltooltip?img_help(0):''); + print ''; + $html->textwithhelp('',$htmltooltip,1,0); print '
".$langs->trans("Name")."".$langs->trans("Description")."'.$langs->trans("Activated")."'.$langs->trans("Default")."'.$langs->trans("Info").''.$langs->trans("Info").'
tooltip_properties($htmltooltip).'>'; - print ''.img_help(0,0).''; + print ''; + $html->textwithhelp('',$htmltooltip,1,0); + print ''; + print ''.img_object($langs->trans("Preview"),'propal').''; print '
'; + if ($direction > 0) + { + if ($text) print ''; + print ''.img_help($usehelpcursor,0).''; + } + else + { + print ''.img_help($usehelpcursor,0).''; + if ($text) print ''; + } + print '
'.$text.'  '.$text.'
'; + 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.