From b1e01b50f58651e02e22b52167cc44d3ad02eee1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 13 Sep 2012 09:52:03 +0200 Subject: [PATCH 1/4] Fix: use warning icon for limit size of tab Fix: optimizing textwithtooltip method --- htdocs/admin/modules.php | 5 ++-- htdocs/core/class/html.form.class.php | 33 +++++++++------------------ htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 3 ++- 4 files changed, 17 insertions(+), 25 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index a1f1d0724c6..bc3c0d53760 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -250,9 +250,10 @@ if (! empty($categ[$categidx])) if ($conf->global->MAIN_FEATURES_LEVEL >= 1) { + $form = new Form($db); $categidx='expdev'; - $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; - $head[$h][1] = $langs->trans("ModuleFamilyExperimental"); + $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx; + $head[$h][1] = $form->textwithpicto($langs->trans("ModuleFamilyExperimental"), $langs->trans('DoNotUseInProduction'), 1, 'warning', '', 0, 3); $head[$h][2] = 'expdev'; $h++; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c6ec1d5d151..94cb20fafaa 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -371,26 +371,14 @@ class Form $s=""; if (empty($notabs)) $s.=''; - if ($direction > 0) - { - if ($text != '') - { - $s.=''.$text; - if ($direction) $s.=' '; - $s.=''; - } - if ($direction) $s.=''.$img.''; - } - else - { - if ($direction) $s.=''.$img.''; - if ($text != '') - { - $s.='<'.$tag.$paramfortooltiptd.'>'; - if ($direction) $s.=' '; - $s.=$text.''; - } - } + if ($direction < 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.''; + if ($text != '') + { + $s.='<'.$tag.$paramfortooltiptd.'>'.$text; + if ($direction) $s.=' '; + $s.=''; + } + if ($direction > 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.''; if (empty($notabs)) $s.='
'; return $s; @@ -405,9 +393,10 @@ class Form * @param string $type Type of picto (info, help, warning, superadmin...) * @param string $extracss Add a CSS style to td tags * @param int $noencodehtmltext Do not encode into html entity the htmltext + * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span * @return string HTML code of text, picto, tooltip */ - function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0) + function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 0) { global $conf; @@ -439,7 +428,7 @@ class Form elseif ($type == 'admin') $img = img_picto($alt, 'star'); elseif ($type == 'warning') $img = img_warning($alt); - return $this->textwithtooltip($text, $htmltext, 2, $direction, $img, $extracss, 0, '', $noencodehtmltext); + return $this->textwithtooltip($text, $htmltext, 2, $direction, $img, $extracss, $notabs, '', $noencodehtmltext); } /** diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 00ecf965b1d..34801a65ab0 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -262,6 +262,7 @@ ModuleFamilyFinancial=Financial Modules (Accounting/Treasury) ModuleFamilyECM=Electronic Content Management (ECM) MenuHandlers=Menu handlers MenuAdmin=Menu editor +DoNotUseInProduction=Do not use in production ThisIsProcessToFollow=This is setup to process: StepNb=Step %s FindPackageFromWebSite=Find a package that provides feature you want (for example on official web site %s). diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 66dddcea493..6eeb2c2380c 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -257,11 +257,12 @@ ModuleFamilyHr= Ressources humaines ModuleFamilyProjects= Projets/Travail collaboratif ModuleFamilyOther= Autre ModuleFamilyTechnic= Outils multi-modules -ModuleFamilyExperimental= Modules expérimentaux (ne pas utiliser en production) +ModuleFamilyExperimental= Modules expérimentaux ModuleFamilyFinancial= Modules financiers (Compta/trésorerie) ModuleFamilyECM= Gestion Électronique de Documents (GED) MenuHandlers= Gestionnaires menu MenuAdmin= Edition menu +DoNotUseInProduction=Ne pas utiliser en production ThisIsProcessToFollow= Voici la procédure à suivre: StepNb= Etape %s FindPackageFromWebSite=Recherche le package qui répond à votre besoin (par exemple sur le site web %s). From 9130dbda4e969ca247bf4d5437174b2aff7362e7 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 13 Sep 2012 09:57:12 +0200 Subject: [PATCH 2/4] Fix: wrong space --- htdocs/core/class/html.form.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 94cb20fafaa..8f196c85eab 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -374,8 +374,10 @@ class Form if ($direction < 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.''; if ($text != '') { - $s.='<'.$tag.$paramfortooltiptd.'>'.$text; - if ($direction) $s.=' '; + $s.='<'.$tag.$paramfortooltiptd.'>'; + if ($direction < 0) $s.=' '; + $s.=$text; + if ($direction > 0) $s.=' '; $s.=''; } if ($direction > 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.''; From 1fa84aa92bd433429f369041fa0099aa1264f1e9 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 13 Sep 2012 10:02:45 +0200 Subject: [PATCH 3/4] Fix: better --- htdocs/core/class/html.form.class.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8f196c85eab..5340083141a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -370,18 +370,11 @@ class Form else $paramfortooltiptd =($extracss?' class="'.$extracss.'"':''); // Attribut to put on td text tag $s=""; - if (empty($notabs)) $s.=''; - if ($direction < 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.''; - if ($text != '') - { - $s.='<'.$tag.$paramfortooltiptd.'>'; - if ($direction < 0) $s.=' '; - $s.=$text; - if ($direction > 0) $s.=' '; - $s.=''; - } - if ($direction > 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.''; - if (empty($notabs)) $s.='
'; + if (empty($notabs)) $s.=''; + if ($direction < 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14"> '.$img.''; + if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.''; + if ($direction > 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14"> '.$img.''; + if (empty($notabs)) $s.='
'; return $s; } From 65616946582b5bbea72e5a2a01017296197c9c04 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 13 Sep 2012 10:03:58 +0200 Subject: [PATCH 4/4] Fix: invert space --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5340083141a..ed1193e696e 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -371,7 +371,7 @@ class Form $s=""; if (empty($notabs)) $s.=''; - if ($direction < 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14"> '.$img.''; + if ($direction < 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14">'.$img.' '; if ($text != '') $s.='<'.$tag.$paramfortooltiptd.'>'.$text.''; if ($direction > 0) $s.='<'.$tag.$paramfortooltipimg.' valign="top" width="14"> '.$img.''; if (empty($notabs)) $s.='
';