diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 93b8fa3d9d2..fe919b1fcba 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -269,7 +269,8 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $out.= img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone cursormove"'); $out.= img_picto($langs->trans("CloseBox",$this->box_id),'close_title','class="boxclose cursorpointer" rel="x:y" id="imgclose'.$this->box_id.'"'); $label=$head['text']; - if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')'; + //if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')'; + if (! empty($head['graph'])) $label.=' '; $out.= ''; $out.= ''; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8f813510081..f1a16df9375 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5370,7 +5370,9 @@ class Form } } - $out.='id])) continue; // Already visible for user $label=$langs->transnoentitiesnoconv($box->boxlabel); - if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')'; - //$label = ''.$label; KO with select2. No html rendering. + //if (preg_match('/graph/',$box->class)) $label.=' ('.$langs->trans("Graph").')'; + if (preg_match('/graph/',$box->class)) $label=$label.' '; $arrayboxtoactivatelabel[$box->id]=$label; // We keep only boxes not shown for user, to show into combo list } foreach($boxidactivatedforuser as $boxid) @@ -1014,6 +1014,7 @@ class FormOther //var_dump($boxidactivatedforuser); // Class Form must have been already loaded + $selectboxlist.=''."\n"; $selectboxlist.='
'; $selectboxlist.=''; $selectboxlist.=''; @@ -1086,6 +1087,7 @@ class FormOther var self = this; // because JQuery can modify this var boxid=self.id.substring(8); var label=jQuery(\'#boxlabelentry\'+boxid).val(); + console.log("We close box "+boxid); jQuery(\'#boxto_\'+boxid).remove(); if (boxid > 0) jQuery(\'#boxcombo\').append(new Option(label, boxid)); updateBoxOrder(1); /* 1 to avoid message after a remove */ diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index ddfe5d257e1..6cda0a6a219 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -427,6 +427,28 @@ function urlencode(s) { return news; } +/* + * ================================================================= + * Purpose: Clean string to have it url encoded + * Input: s + * Author: Laurent Destailleur + * Licence: GPL + * ================================================================== + */ +function htmlEntityDecodeJs(inp){ + var replacements = {'<':'<','>':'>','/':'/','"':'"',''':'\'','&':'&',' ':' '}; + if (inp) + { + for(var r in replacements){ + inp = inp.replace(new RegExp(r,'g'),replacements[r]); + } + return inp.replace(/&#(\d+);/g, function(match, dec) { + return String.fromCharCode(dec); + }); + } + else { return ''; } +} + /* * ================================================================= diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 1ce4e887cb2..825f99d6e98 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -418,11 +418,16 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ $(container).addClass($(data.element).attr("class")); } + //console.log(data.html); + if ($(data.element).attr("html") != undefined) return htmlEntityDecodeJs($(data.element).attr("html")); // If property html set, we decode html entities and use this return data.text; }, templateSelection: function (selection) { /* Format visible output of selected value */ return selection.text; }, + escapeMarkup: function(markup) { + return markup; + } })'; if ($forcefocus) $msg.= '.select2(\'focus\')'; $msg.= ';'."\n";