diff --git a/include/manager.php b/include/manager.php index d908578c8..e027b9195 100644 --- a/include/manager.php +++ b/include/manager.php @@ -155,11 +155,11 @@ if (!empty($module_options) && $module_options != 'menu' && $module_options != ' $data = is_array($value) ? $value['data'] : []; $extra = []; foreach ($data as $k => $v) { - $extra[] = 'data-'.$k.'="'.$v.'"'; + $extra[] = 'data-'.$k.'="'.prepareToField($v).'"'; } echo ' -
  • '.$text.'
  • '; +
  • '.$text.'
  • '; } echo ' diff --git a/lib/functions.js b/lib/functions.js index 4568fd259..132787a30 100644 --- a/lib/functions.js +++ b/lib/functions.js @@ -429,8 +429,8 @@ function start_widgets($widgets) { // Modal function launch_modal(title, href, init_modal, id) { - //Fix - Select2 does not function properly when I use it inside a Bootstrap modal. - $.fn.modal.Constructor.prototype.enforceFocus = function() {}; + //Fix - Select2 does not function properly when I use it inside a Bootstrap modal. + $.fn.modal.Constructor.prototype.enforceFocus = function () {}; if (id == null) { id = '#bs-popup'; @@ -445,7 +445,7 @@ function launch_modal(title, href, init_modal, id) { $(id).on('hidden.bs.modal', function () { - if ($('.modal-backdrop').length < 1 ) { + if ($('.modal-backdrop').length < 1) { $('html').removeClass('modal-open'); $(this).html(''); $(this).data('modal', null); @@ -547,7 +547,7 @@ function start_datatables() { var sum; var tempo; - var tempo_attesa_ricerche = (globals.tempo_attesa_ricerche*1000); + var tempo_attesa_ricerche = (globals.tempo_attesa_ricerche * 1000); var table = $this.DataTable({ language: { @@ -582,8 +582,7 @@ function start_datatables() { style: 'multi', selector: 'td:first-child' }, - buttons: [ - { + buttons: [{ extend: 'csv', fieldSeparator: ";", exportOptions: { @@ -602,21 +601,21 @@ function start_datatables() { }, { extend: 'print', - autoPrint: true, - customize: function ( win ) { - $(win.document.body) - .css( 'font-size', '10pt' ) - .append( - '
    '+$('#summable').text()+'
    ', - ); - $(win.document.body).find( 'table' ) - .addClass( 'compact' ) - .css( 'font-size', 'inherit' ); - $(win.document.body).find( 'td:first-child' ) - .addClass( 'hide' ); - $(win.document.body).find( 'th:first-child' ) - .addClass( 'hide' ); - }, + autoPrint: true, + customize: function (win) { + $(win.document.body) + .css('font-size', '10pt') + .append( + '
    ' + $('#summable').text() + '
    ', + ); + $(win.document.body).find('table') + .addClass('compact') + .css('font-size', 'inherit'); + $(win.document.body).find('td:first-child') + .addClass('hide'); + $(win.document.body).find('th:first-child') + .addClass('hide'); + }, exportOptions: { modifier: { selected: true @@ -678,15 +677,15 @@ function start_datatables() { idx1 = 'module_' + $this.data('idmodule'); //+ "-" + $this.data('idplugin'); idx2 = 'search_' + $(this).parent().attr('id').replace('th_', ''); - function start_search(search_value){ + function start_search(search_value) { session_set(idx1 + ',' + idx2, search_value, 0); column.search(search_value).draw(); } // Imposto delle sessioni per le ricerche del modulo e del campo specificatsi - if(e.keyCode == 13 || $(this).val()==''){ + if (e.keyCode == 13 || $(this).val() == '') { start_search($(this).val()); - }else{ + } else { tempo = window.setTimeout(start_search, tempo_attesa_ricerche, $(this).val()); } }); @@ -776,7 +775,7 @@ function start_datatables() { this.api().columns().every(function () { if (sum.summable[i] != undefined) { $(this.footer()).addClass("text-right"); - $(this.footer()).attr("id", "summable"); + $(this.footer()).attr("id", "summable"); $(this.footer()).html(sum.summable[i]); } else $(this.footer()).html(" "); i++; @@ -1035,7 +1034,7 @@ jQuery.fn.selectData = function () { // Inputmask function start_inputmask(element) { - if( element == undefined ){ + if (element == undefined) { element = ''; } else { element = element + ' '; @@ -1043,24 +1042,24 @@ function start_inputmask(element) { var date = moment.localeData().longDateFormat('L').toLowerCase(); - $(element+".date-mask").inputmask(date, { + $(element + ".date-mask").inputmask(date, { "placeholder": date }); - $(element+'.email-mask').inputmask('Regex', { + $(element + '.email-mask').inputmask('Regex', { regex: "^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^-]+(?:\\.[a-zA-Z0-9_!#$%&'*+/=?`{|}~^-]+)*@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$", }); - $(element+'.alphanumeric-mask').inputmask('Regex', { + $(element + '.alphanumeric-mask').inputmask('Regex', { regex: "[A-Za-z0-9#_|\/\\-.]*", }); if (isMobile.any()) { - $(element+'.inputmask-decimal, '+element+'.date-mask, '+element+'.timestamp-mask').each(function () { + $(element + '.inputmask-decimal, ' + element + '.date-mask, ' + element + '.timestamp-mask').each(function () { $(this).attr('type', 'tel'); }); } else { - $(element+'.inputmask-decimal').each(function () { + $(element + '.inputmask-decimal').each(function () { var $this = $(this); var min = $this.attr('min-value'); @@ -1068,7 +1067,7 @@ function start_inputmask(element) { min = false; } - var max = $this.attr('max-value'); + var max = $this.attr('max-value'); if (max == 'undefined') { max = false; } @@ -1076,8 +1075,8 @@ function start_inputmask(element) { $this.inputmask("decimal", { min: min ? min : undefined, allowMinus: !min || min < 0 ? true : false, - max: max ? max : undefined, - allowPlus: !max || max < 0 ? true : false, + max: max ? max : undefined, + allowPlus: !max || max < 0 ? true : false, digits: $this.attr('decimals') ? $this.attr('decimals') : globals.cifre_decimali, digitsOptional: true, // Necessario per un problema di inputmask con i numeri negativi durante l'init enforceDigitsOnBlur: true, @@ -1162,9 +1161,9 @@ function session_set(session_array, value, clear, reload) { reload = 0; } - return $.get(globals.rootdir + "/ajax.php?op=session_set&session=" + session_array + "&value=" + value + "&clear=" + clear, function(data, status){ + return $.get(globals.rootdir + "/ajax.php?op=session_set&session=" + session_array + "&value=" + value + "&clear=" + clear, function (data, status) { - if (reload==1) + if (reload == 1) location.reload(); }); @@ -1261,7 +1260,7 @@ function message(element) { if (data["title"] != undefined) title = data["title"]; var msg = globals.translations.deleteMessage; - if (data["msg"] != undefined) msg = data["msg"]; + if (data["msg"] != undefined) msg = '
    ' + data["msg"] + '
    '; var button = globals.translations.delete; if (data["button"] != undefined) button = data["button"]; @@ -1271,11 +1270,21 @@ function message(element) { swal({ title: title, - text: msg, + html: msg, type: "warning", showCancelButton: true, confirmButtonText: button, confirmButtonClass: btn_class, + preConfirm: function () { + $('#swal-form').find(':input').each(function () { + data[$(this).attr('name')] = $(this).val(); + console.log($(this).attr('name')); + }); + + return new Promise(function (resolve) { + resolve([]); + }); + } }).then( function (result) { if (data["op"] == undefined) data["op"] = "delete"; @@ -1344,8 +1353,8 @@ function redirect(href, data, method, blank) { function setCookie(cname, cvalue, exdays) { var d = new Date(); - d.setTime(d.getTime() + (exdays*24*60*60*1000)); - var expires = "expires="+ d.toUTCString(); + d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); + var expires = "expires=" + d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } @@ -1353,7 +1362,7 @@ function getCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); - for(var i = 0; i