From 9d3cf8f21712ab2bbd35b79b86e2fdf3fdc151b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Nov 2017 18:50:15 +0100 Subject: [PATCH] Fix can use tooltip with popup even for column titles --- htdocs/admin/defaultvalues.php | 2 +- htdocs/admin/mails_templates.php | 2 +- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/js/lib_foot.js.php | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index e4ba112511e..790445f7032 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -276,7 +276,7 @@ if ($mode != 'focus') { $texthelp.=$key.' -> '.$val.'
'; } - $textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); // No tooltip on click, this also triggers the sort click + $textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, 'subsitutiontooltip'); } else { diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 8c1cb138bc3..ef06806a5d2 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -708,7 +708,7 @@ if ($resql) { if (! empty($tabhelp[$id][$value])) { - if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover + if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value); // Tooltip on hover else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover } print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7df1fd1f4a2..2274701644f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -534,7 +534,7 @@ class Form elseif ($type == 'warning') $img = img_warning($alt); else $img = img_picto($alt, $type); - return $this->textwithtooltip($text, $htmltext, ($tooltiptrigger?3:2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger); + return $this->textwithtooltip($text, $htmltext, (($tooltiptrigger && ! $img)?3:2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger); } /** diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index aa3359e088f..c133e0014f1 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -65,7 +65,7 @@ if (empty($conf->dol_no_mouse_hover)) { obj=$("#idfortooltiponclick_"+$(this).attr(\'dolid\')); /* obj is a div component */ obj.dialog("open"); - + return false; } }); }); @@ -79,15 +79,14 @@ if (! defined('JS_JQUERY_DISABLE_DROPDOWN')) print ' jQuery(document).ready(function () { $(".dropdown dt a").on(\'click\', function () { + console.log("We click on dropdown"); //console.log($(this).parent().parent().find(\'dd ul\')); $(this).parent().parent().find(\'dd ul\').slideToggle(\'fast\'); // Note: Did not find a way to get exact height (value is update at exit) so i calculate a generic from nb of lines heigthofcontent = 21 * $(this).parent().parent().find(\'dd div ul li\').length; if (heigthofcontent > 300) heigthofcontent = 300; // limited by max-height on css .dropdown dd ul posbottom = $(this).parent().parent().find(\'dd\').offset().top + heigthofcontent + 8; - //console.log(posbottom); var scrollBottom = $(window).scrollTop() + $(window).height(); - //console.log(scrollBottom); diffoutsidebottom = (posbottom - scrollBottom); console.log("heigthofcontent="+heigthofcontent+", diffoutsidebottom (posbottom="+posbottom+" - scrollBottom="+scrollBottom+") = "+diffoutsidebottom); if (diffoutsidebottom > 0) @@ -104,6 +103,7 @@ if (! defined('JS_JQUERY_DISABLE_DROPDOWN')) }); $(document).bind(\'click\', function (e) { + // TODO Use a bind on elements in dropdown only to avoid to bind/code all clicks var $clicked = $(e.target); if (!$clicked.parents().hasClass("dropdown")) $(".dropdown dd ul").hide(); }); @@ -135,7 +135,7 @@ print ' jQuery(".reposition").click(function() { var page_y = $(document).scrollTop(); this.href=this.href+\'&page_y=\'+page_y; - console.log("this.ref is now "+this.href) + console.log("We click on tag with .reposition class. this.ref is now "+this.href) }); });'."\n";