From dbcf3ddbe8b95b2c30911f5b5a59527ceb989896 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 21 Oct 2017 19:05:24 +0200 Subject: [PATCH] NEW Upgrade jquery select2 to 4.0.4 --- COPYRIGHT | 8 +- htdocs/core/ajax/selectsearchbox.php | 2 +- htdocs/core/class/html.form.class.php | 41 +- htdocs/core/js/lib_head.js.php | 335 +- htdocs/core/lib/ajax.lib.php | 16 +- .../jquery/plugins/select2/.gitignore | 2 - .../jquery/plugins/select2/CHANGELOG.md | 254 + .../jquery/plugins/select2/CONTRIBUTING.md | 107 - .../jquery/plugins/select2/Gruntfile.js | 370 ++ .../includes/jquery/plugins/select2/LICENSE | 18 - .../jquery/plugins/select2/LICENSE.md | 21 + .../includes/jquery/plugins/select2/README.md | 149 +- .../jquery/plugins/select2/bower.json | 13 +- .../jquery/plugins/select2/component.json | 61 +- .../jquery/plugins/select2/composer.json | 26 +- .../plugins/select2/dist/css/select2.css | 484 ++ .../plugins/select2/dist/css/select2.min.css | 1 + .../jquery/plugins/select2/dist/js/select2.js | 5746 +++++++++++++++++ .../plugins/select2/dist/js/select2.min.js | 1 + .../jquery/plugins/select2/package.json | 83 +- .../jquery/plugins/select2/release.sh | 79 - .../plugins/select2/select2-bootstrap.css | 87 - .../plugins/select2/select2-spinner.gif | Bin 1849 -> 0 bytes .../jquery/plugins/select2/select2.css | 704 -- .../plugins/select2/select2.jquery.json | 24 +- .../jquery/plugins/select2/select2.js | 3541 ---------- .../jquery/plugins/select2/select2.min.js | 23 - .../jquery/plugins/select2/select2.png | Bin 613 -> 0 bytes .../plugins/select2/select2_locale_ar.js | 19 - .../plugins/select2/select2_locale_az.js | 20 - .../plugins/select2/select2_locale_bg.js | 20 - .../plugins/select2/select2_locale_ca.js | 19 - .../plugins/select2/select2_locale_cs.js | 51 - .../plugins/select2/select2_locale_da.js | 19 - .../plugins/select2/select2_locale_de.js | 18 - .../plugins/select2/select2_locale_el.js | 19 - .../select2/select2_locale_en.js.template | 20 - .../plugins/select2/select2_locale_es.js | 19 - .../plugins/select2/select2_locale_et.js | 19 - .../plugins/select2/select2_locale_eu.js | 45 - .../plugins/select2/select2_locale_fa.js | 21 - .../plugins/select2/select2_locale_fi.js | 30 - .../plugins/select2/select2_locale_fr.js | 18 - .../plugins/select2/select2_locale_gl.js | 45 - .../plugins/select2/select2_locale_he.js | 19 - .../plugins/select2/select2_locale_hr.js | 24 - .../plugins/select2/select2_locale_hu.js | 17 - .../plugins/select2/select2_locale_id.js | 19 - .../plugins/select2/select2_locale_is.js | 17 - .../plugins/select2/select2_locale_it.js | 17 - .../plugins/select2/select2_locale_ja.js | 17 - .../plugins/select2/select2_locale_ka.js | 19 - .../plugins/select2/select2_locale_ko.js | 19 - .../plugins/select2/select2_locale_lt.js | 26 - .../plugins/select2/select2_locale_lv.js | 19 - .../plugins/select2/select2_locale_mk.js | 19 - .../plugins/select2/select2_locale_ms.js | 19 - .../plugins/select2/select2_locale_nb.js | 22 - .../plugins/select2/select2_locale_nl.js | 17 - .../plugins/select2/select2_locale_pl.js | 54 - .../plugins/select2/select2_locale_pt-BR.js | 18 - .../plugins/select2/select2_locale_pt-PT.js | 17 - .../plugins/select2/select2_locale_ro.js | 17 - .../plugins/select2/select2_locale_rs.js | 19 - .../plugins/select2/select2_locale_ru.js | 23 - .../plugins/select2/select2_locale_sk.js | 50 - .../plugins/select2/select2_locale_sv.js | 19 - .../plugins/select2/select2_locale_th.js | 19 - .../plugins/select2/select2_locale_tr.js | 19 - .../plugins/select2/select2_locale_ug-CN.js | 16 - .../plugins/select2/select2_locale_uk.js | 25 - .../plugins/select2/select2_locale_vi.js | 20 - .../plugins/select2/select2_locale_zh-CN.js | 16 - .../plugins/select2/select2_locale_zh-TW.js | 16 - .../jquery/plugins/select2/select2x2.png | Bin 845 -> 0 bytes htdocs/main.inc.php | 4 +- htdocs/theme/eldy/style.css.php | 40 +- 77 files changed, 7170 insertions(+), 6110 deletions(-) delete mode 100644 htdocs/includes/jquery/plugins/select2/.gitignore create mode 100644 htdocs/includes/jquery/plugins/select2/CHANGELOG.md delete mode 100644 htdocs/includes/jquery/plugins/select2/CONTRIBUTING.md create mode 100644 htdocs/includes/jquery/plugins/select2/Gruntfile.js delete mode 100644 htdocs/includes/jquery/plugins/select2/LICENSE create mode 100644 htdocs/includes/jquery/plugins/select2/LICENSE.md create mode 100644 htdocs/includes/jquery/plugins/select2/dist/css/select2.css create mode 100644 htdocs/includes/jquery/plugins/select2/dist/css/select2.min.css create mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/select2.js create mode 100644 htdocs/includes/jquery/plugins/select2/dist/js/select2.min.js delete mode 100755 htdocs/includes/jquery/plugins/select2/release.sh delete mode 100644 htdocs/includes/jquery/plugins/select2/select2-bootstrap.css delete mode 100644 htdocs/includes/jquery/plugins/select2/select2-spinner.gif delete mode 100644 htdocs/includes/jquery/plugins/select2/select2.css delete mode 100644 htdocs/includes/jquery/plugins/select2/select2.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2.min.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2.png delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_ar.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_az.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_bg.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_ca.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_cs.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_da.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_de.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_el.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_en.js.template delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_es.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_et.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_eu.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_fa.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_fi.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_fr.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_gl.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_he.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_hr.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_hu.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_id.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_is.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_it.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_ja.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_ka.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_ko.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_lt.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_lv.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_mk.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_ms.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_nb.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_nl.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_pl.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_pt-BR.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_pt-PT.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_ro.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_rs.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_ru.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_sk.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_sv.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_th.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_tr.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_ug-CN.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_uk.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_vi.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_zh-CN.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2_locale_zh-TW.js delete mode 100644 htdocs/includes/jquery/plugins/select2/select2x2.png diff --git a/COPYRIGHT b/COPYRIGHT index 95cc95fcf47..0de4c6c90c5 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -34,12 +34,12 @@ Swift Mailer 5.4.2-DEV MIT license Yes Stripe 4.7.0 MIT licence Yes Library for Stripe module JS libraries: -jQuery 1.11.3 MIT License Yes JS library -jQuery UI 1.11.4 GPL and MIT License Yes JS library plugin UI -jQuery select2 3.5.2 GPL and Apache License Yes JS library plugin for sexier multiselect +jQuery 3.1.1 MIT License Yes JS library +jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI +jQuery select2 4.0.4 GPL and Apache License Yes JS library plugin for sexier multiselect jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors -jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files +jQuery FileUpload 5.13 GPL and MIT License Yes JS library to upload files jQuery Flot 0.8.3 MIT License Yes JS library to build graph jQuery JCrop 0.9.8 GPL and MIT License Yes JS library plugin Crop (to crop images) jQuery Jeditable 1.7.1 GPL and MIT License Yes JS library plugin jeditable (to edit in place) diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 89f362a0253..0861ef160b6 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -49,7 +49,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; //global $hookmanager; $hookmanager->initHooks(array('searchform')); -$search_boxvalue=GETPOST('q'); +$search_boxvalue=GETPOST('q', 'none'); $arrayresult=array(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d5118d66824..aef8f98648f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5252,6 +5252,7 @@ class Form * @param string $placeholder String to use as placeholder * @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @return string HTML select string + * @see ajax_combobox in ajax.lib.php */ static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0) { @@ -5261,7 +5262,7 @@ class Form // TODO Use an internal dolibarr component instead of select2 if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ! defined('REQUIRE_JQUERY_MULTISELECT')) return ''; - $out=''; + $out=''; $tmpplugin='select2'; $outdelayed="\n".' @@ -5276,44 +5277,40 @@ class Form url: "'.$url.'", dataType: \'json\', delay: 250, - data: function (searchTerm, pageNumber, context) { + data: function (params) { return { - q: searchTerm, // search term - page: pageNumber + q: params.term, // search term + page: params.page }; }, - results: function (remoteData, pageNumber, query) { - console.log(remoteData); - saveRemoteData = remoteData; + processResults: function (data) { + // parse the results into the format expected by Select2. + // since we are using custom formatting functions we do not need to alter the remote JSON data + //console.log(data); + saveRemoteData = data; /* format json result for select2 */ result = [] - $.each( remoteData, function( key, value ) { + $.each( data, function( key, value ) { result.push({id: key, text: value.text}); }); //return {results:[{id:\'none\', text:\'aa\'}, {id:\'rrr\', text:\'Red\'},{id:\'bbb\', text:\'Search a into projects\'}], more:false} - return {results: result, more:false} - }, - /*processResults: function (data, page) { - // parse the results into the format expected by Select2. - // since we are using custom formatting functions we do not need to - // alter the remote JSON data - console.log(data); - return { - results: data.items - }; - },*/ + //console.log(result); + return {results: result, more: false} + }, cache: true }, - dropdownCssClass: "css-'.$htmlname.'", + language: select2arrayoflanguage, + /* dropdownCssClass: "css-'.$htmlname.'", */ placeholder: "'.dol_escape_js($placeholder).'", - escapeMarkup: function (markup) { return markup; }, // let our custom formatter work + escapeMarkup: function (markup) { return markup; }, // let our custom formatter work minimumInputLength: '.$minimumInputLength.', formatResult: function(result, container, query, escapeMarkup) { return escapeMarkup(result.text); - } + }, }); '.($callurlonselect ? ' + /* Code to execute a GET when we select a value */ $(".'.$htmlname.'").change(function() { var selected = $(".'.$htmlname.'").select2("val"); $(".'.$htmlname.'").select2("val",""); /* reset visible combo value */ diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index a68995e5eeb..ddfe5d257e1 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -152,237 +152,27 @@ jQuery(function($){ /** - * Set select2 translations (if module was loaded). + * Set array used for select2 translations */ -(function ($) { - "use strict"; - if (typeof $.fn.select2 != "undefined") { - /* console.log($.fn.select2); - console.log("ok"); */ - - $.fn.select2.locales['xx'] = { - formatMatches: function (matches) { return matches + " trans("Select2ResultFoundUseArrows")); ?>"; }, - formatNoMatches: function () { return "trans("Select2NotFound")); ?>"; }, - formatInputTooShort: function (input, min) { var n = min - input.length; - if (n > 1) return "trans("Select2Enter")); ?> " + n + " trans("Select2MoreCharacters")); ?>"; - else return "trans("Select2Enter")); ?> " + n + " trans("Select2MoreCharacter")); ?>" - }, - formatLoadMore: function (pageNumber) { return "trans("Select2LoadingMoreResults")); ?>"; }, - formatSearching: function () { return "trans("Select2SearchInProgress")); ?>"; } - }; - - $.extend($.fn.select2.defaults, $.fn.select2.locales['xx']); - - } -})(jQuery); +var select2arrayoflanguage = { + matches: function (matches) { return matches + " transnoentitiesnoconv("Select2ResultFoundUseArrows")); ?>"; }, + noResults: function () { return "transnoentitiesnoconv("Select2NotFound")); ?>"; }, + inputTooShort: function (input) { + var n = input.minimum; + console.log(input); + console.log(input.minimum); + if (n > 1) return "transnoentitiesnoconv("Select2Enter")); ?> " + n + " transnoentitiesnoconv("Select2MoreCharacters")); ?>"; + else return "transnoentitiesnoconv("Select2Enter")); ?> " + n + " transnoentitiesnoconv("Select2MoreCharacter")); ?>" + }, + loadMore: function (pageNumber) { return "transnoentitiesnoconv("Select2LoadingMoreResults")); ?>"; }, + searching: function () { return "transnoentitiesnoconv("Select2SearchInProgress")); ?>"; } +}; -/* - * ================================================================= - * Purpose: - * Pour la saisie des dates par calendrier Input: base "/theme/eldy" dateFieldID - * "dateo" Nom du champ format "dd/MM/yyyy" Format issu de Dolibarr de - * SimpleDateFormat a utiliser pour retour - * ================================================================== +/** + * For calendar input */ - /* -function showDP(base,dateFieldID,format,codelang) -{ - // check to see if another box is already showing - var alreadybox=getObjectFromID("DPCancel"); - if (alreadybox) closeDPBox(); // This erase value of showDP.datefieldID - - // alert("showDP "+codelang); - showDP.datefieldID=dateFieldID; // Must be after the close - - var dateField=getObjectFromID(dateFieldID); - - // get positioning - var thetop=getTop(dateField)+dateField.offsetHeight; - -// var xxx=getObjectFromID('bottompage'); -// alert(xxx.style.pixelTop); -// alert(document.body.clientHeight); -// alert(document.body.style.offsetTop); -// alert(thetop); -// alert(window.innerHeight); - if (thetop+160 > window.innerHeight) - thetop=thetop-160-20; - var theleft=getLeft(dateField); - if (theleft+140 > window.innerWidth) - theleft= theleft-140+dateField.offsetWidth-15; - - showDP.box=document.createElement("div"); - showDP.box.className="bodyline"; - showDP.box.style.display="block"; - showDP.box.style.zIndex="1000"; - showDP.box.style.position="absolute"; - showDP.box.style.top=thetop + "px"; - showDP.box.style.left=theleft + "px"; - - if (dateField.value) // Si il y avait valeur initiale dans champ - { - selDate=getDateFromFormat(dateField.value,format); - if (selDate) - { - // Success to parse value in field according to format - year=selDate.getFullYear(); - month=selDate.getMonth()+1; - day=selDate.getDate(); - datetime=selDate.getTime(); - ymd=formatDate(selDate,'yyyyMMdd'); - } - else - { - // Failed to parse value in field according to format - selDate=new Date(); - year=selDate.getFullYear(); - month=selDate.getUTCMonth()+1; - day=selDate.getDate(); - datetime=selDate.getTime(); - ymd=formatDate(selDate,'yyyyMMdd'); - } - } - else - { - selDate=new Date(); - year=selDate.getFullYear(); - month=selDate.getUTCMonth()+1; - day=selDate.getDate(); - datetime=selDate.getTime(); - ymd=formatDate(selDate,'yyyyMMdd'); - } - loadMonth(base,month,year,ymd,codelang); - hideSelectBoxes(); - document.body.appendChild(showDP.box); -} - -function resetDP(base,dateFieldID,format,codelang) -{ - var dateField=getObjectFromID(dateFieldID); - dateField.value = formatDate(new Date(), format); - dpChangeDay(dateFieldID,format); - - var alreadybox=getObjectFromID("DPCancel"); - if (alreadybox) showDP(base,dateFieldID,format,codelang); -} - -function loadMonth(base,month,year,ymd,codelang) -{ - // showDP.box.innerHTML="Loading..."; - // alert(codelang); - var theURL=base+"datepicker.php?cm=shw&lang="+codelang; - theURL+="&m="+encodeURIComponent(month); - theURL+="&y="+encodeURIComponent(year); - if (selDate) - { - theURL+="&sd="+ymd; - } - - var req=null; - - req=loadXMLDoc(theURL,null,false); - if (req.responseText == '') alert('Failed to get URL '.theURL); - // alert(theURL+' - '+req.responseText); // L'url doit avoir la meme racine - // que la pages et elements sinon pb de securite. - showDP.box.innerHTML=req.responseText; -} - -function closeDPBox() -{ - document.body.removeChild(showDP.box); - displaySelectBoxes(); - showDP.box=null; - showDP.datefieldID=null; -} - -function dpClickDay(year,month,day,format) -{ - var thefield=getObjectFromID(showDP.datefieldID); - var thefieldday=getObjectFromID(showDP.datefieldID+"day"); - var thefieldmonth=getObjectFromID(showDP.datefieldID+"month"); - var thefieldyear=getObjectFromID(showDP.datefieldID+"year"); - - var dt = new Date(year, month-1, day); - - thefield.value=formatDate(dt,format); - if(thefield.onchange) thefield.onchange.call(thefield); - - thefieldday.value=day; - if(thefieldday.onchange) thefieldday.onchange.call(thefieldday); - thefieldmonth.value=month; - if(thefieldmonth.onchange) thefieldmonth.onchange.call(thefieldmonth); - thefieldyear.value=year; - if(thefieldyear.onchange) thefieldyear.onchange.call(thefieldyear); - - closeDPBox(); -} - -function dpHighlightDay(year,month,day,months){ - var displayinfo=getObjectFromID("dpExp"); - displayinfo.innerHTML=months[month-1]+" "+day+", "+year; -} - -// This Function returns the top position of an object -function getTop(theitem){ - var offsetTrail = theitem; - var offsetTop = 0; - while (offsetTrail) { - offsetTop += offsetTrail.offsetTop; - offsetTrail = offsetTrail.offsetParent; - } - if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined") - offsetTop += document.body.TopMargin; - return offsetTop; -} - -// This Function returns the left position of an object -function getLeft(theitem){ - var offsetTrail = theitem; - var offsetLeft = 0; - while (offsetTrail) { - offsetLeft += offsetTrail.offsetLeft; - offsetTrail = offsetTrail.offsetParent; - } - if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined") - offsetLeft += document.body.leftMargin; - return offsetLeft; -} - -// To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and -// not put popup completely on the front) -// Used only bu popup calendar -function hideSelectBoxes() { - var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10); - if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1) - { - for(var i = 0; i < document.all.length; i++) - { - if(document.all[i].tagName) - if(document.all[i].tagName == "SELECT") - document.all[i].style.visibility="hidden"; - } - } -} -// To hide/show select Boxes with IE6 (and only IE6 because IE6 has a bug and -// not put popup completely on the front) -// Used only bu popup calendar -function displaySelectBoxes() { - var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10); - if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1) - { - for(var i = 0; i < document.all.length; i++) - { - if(document.all[i].tagName) - if(document.all[i].tagName == "SELECT") - document.all[i].style.visibility="visible"; - } - } -} - -*/ - // Returns an object given an id function getObjectFromID(id){ @@ -426,69 +216,6 @@ function dpChangeDay(dateFieldID,format) } } - - - - -// Create XMLHttpRequest object and load url -// Used by calendar or other ajax processes -// Return req built or false if error -function loadXMLDoc(url,readyStateFunction,async) -{ - // req must be defined by caller with - // var req = false; - - // branch for native XMLHttpRequest object (Mozilla, Safari...) - if (window.XMLHttpRequest) - { - req = new XMLHttpRequest(); - -// if (req.overrideMimeType) { -// req.overrideMimeType('text/xml'); -// } - } - // branch for IE/Windows ActiveX version - else if (window.ActiveXObject) - { - try - { - req = new ActiveXObject("Msxml2.XMLHTTP"); - } - catch (e) - { - try { - req = new ActiveXObject("Microsoft.XMLHTTP"); - } catch (e) {} - } - } - - // If XMLHttpRequestObject req is ok, call URL - if (! req) - { - alert('Cannot create XMLHTTP instance'); - return false; - } - - if (readyStateFunction) req.onreadystatechange = readyStateFunction; - // Exemple of function for readyStateFuncyion: - // function () - // { - // if ( (req.readyState == 4) && (req.status == 200) ) { - // if (req.responseText == 1) { newStatus = 'AAA'; } - // if (req.responseText == 0) { newStatus = 'BBB'; } - // if (currentStatus != newStatus) { - // if (newStatus == "AAA") { obj.innerHTML = 'AAA'; } - // else { obj.innerHTML = 'BBB'; } - // currentStatus = newStatus; - // } - // } - // } - req.open("GET", url, async); - req.send(null); - return req; -} - - /* * ================================================================= * Function: @@ -552,9 +279,9 @@ function formatDate(date,format) /* * ================================================================= - * Function: - * getDateFromFormat(date_string, format_string) Purpose: This function takes a - * date string and a format string. It parses the date string with format and it + * Function: getDateFromFormat(date_string, format_string) + * Purpose: This function takes a date string and a format string. + * It parses the date string with format and it * returns the date as a javascript Date() object. If date does not match * format, it returns 0. The format string can use the following tags: * Field | Tags @@ -650,9 +377,8 @@ function getDateFromFormat(val,format) /* * ================================================================= - * Function: - * stringIsInteger(string) - * Purpose: Return true if string is an integer + * Function: stringIsInteger(string) + * Purpose: Return true if string is an integer * ================================================================== */ function stringIsInteger(str) @@ -670,9 +396,8 @@ function stringIsInteger(str) /* * ================================================================= - * Function: - * getIntegerInString(string,pos,minlength,maxlength) - * Purpose: Return part of string from position i that is integer + * Function: getIntegerInString(string,pos,minlength,maxlength) + * Purpose: Return part of string from position i that is integer * ================================================================== */ function getIntegerInString(str,i,minlength,maxlength) @@ -689,10 +414,9 @@ function getIntegerInString(str,i,minlength,maxlength) /* * ================================================================= - * Purpose: - * Clean string to have it url encoded - * Input: s - * Author: Laurent Destailleur + * Purpose: Clean string to have it url encoded + * Input: s + * Author: Laurent Destailleur * Licence: GPL * ================================================================== */ @@ -706,8 +430,7 @@ function urlencode(s) { /* * ================================================================= - * Purpose: - * Applique un delai avant execution. Used for autocompletion of companies. + * Purpose: Applique un delai avant execution. Used for autocompletion of companies. * Input: funct, delay * Author: Regis Houssin * Licence: GPL @@ -955,6 +678,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, } } + /* * ================================================================= * This is to allow to transform all select box into ajax autocomplete box @@ -1070,6 +794,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, })( jQuery ); + /** * Function to output a dialog bog for copy/paste * @@ -1303,7 +1028,7 @@ function price2numjs(amount) { // If rounding higher than max shown if (rounding > main_max_dec_shown) rounding = main_max_dec_shown; if (thousand != ',' && thousand != '.') amount = amount.replace(',', '.'); - amount = amount.replace(' ', ''); // To avoid spaces + amount = amount.replace(' ', ''); // To avoid spaces amount = amount.replace(thousand, ''); // Replace of thousand before replace of dec to avoid pb if thousand is . amount = amount.replace(dec, '.'); //console.log("amount before="+amount+" rouding="+rounding) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 500bbbb3ffb..0ee1ea98a5b 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -387,6 +387,7 @@ function ajax_autoselect($htmlname, $addlink='') * @param int $forcefocus Force focus on field * @param string $widthTypeOfAutocomplete 'resolve' or 'off' * @return string Return html string to convert a select field into a combo, or '' if feature has been disabled for some reason. + * @see selectArrayAjax of html.form.class */ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve') { @@ -404,10 +405,23 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ $msg="\n".' '."\n"; + print ''."\n"; } } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index d5489a432db..c631fd16c74 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -399,7 +399,7 @@ select.flat, form.flat select { font-weight: normal; } .optionblue { - color: rgb() !important; + color: rgb(); } .select2-results .select2-highlighted.optionblue { color: #FFF !important; @@ -4225,10 +4225,39 @@ div.dataTables_length select { .select2-drop.select2-drop-above { box-shadow: none !important; } +.select2-container--open .select2-dropdown--above { + border-bottom: solid 1px rgba(0,0,0,.2); +} .select2-drop.select2-drop-above.select2-drop-active { border-top: 1px solid #ccc; border-bottom: solid 1px rgba(0,0,0,.2); } +.select2-container--default .select2-selection--single +{ + outline: none; + border-top: none; + border-left: none; + border-right: none; + border-bottom: solid 1px rgba(0,0,0,.2); + -webkit-box-shadow: none !important; + box-shadow: none !important; + border-radius: 0 !important; +} +.select2-container--default .select2-selection--multiple { + border: solid 1px rgba(0,0,0,.2); + border-radius: 0 !important; +} +.select2-search__field +{ + outline: none; + border-top: none !important; + border-left: none !important; + border-right: none !important; + border-bottom: solid 1px rgba(0,0,0,.2) !important; + -webkit-box-shadow: none !important; + box-shadow: none !important; + border-radius: 0 !important; +} .select2-container-active .select2-choice, .select2-container-active .select2-choices { outline: none; @@ -4322,9 +4351,16 @@ a span.select2-chosen /* Special case for the select2 add widget */ #addbox .select2-container .select2-choice > .select2-chosen, #actionbookmark .select2-container .select2-choice > .select2-chosen { - text-align: left; + text-align: ; opacity: 0.4; } +span#select2-boxbookmark-container, span#select2-boxcombo-container { + text-align: ; + opacity: 0.5; +} +.select2-container .select2-selection--single .select2-selection__rendered { + padding-left: 6px; +} /* Style used before the select2 js is executed on boxcombo */ #boxbookmark.boxcombo, #boxcombo.boxcombo { text-align: left;