# HG changeset patch # User Thierry Florac # Date 1567521009 -7200 # Node ID 5f7cda8f9da394025bde586ef57ebceea0cf4b2e # Parent 8f1bc8caffce202b7dfbb41f33dca62410f66375 Updated form's errors handlers diff -r 8f1bc8caffce -r 5f7cda8f9da3 src/pyams_skin/resources/js/myams-form.js --- a/src/pyams_skin/resources/js/myams-form.js Fri Jul 26 19:17:51 2019 +0200 +++ b/src/pyams_skin/resources/js/myams-form.js Tue Sep 03 16:30:09 2019 +0200 @@ -720,7 +720,8 @@ } if (widget.exists()) { // Update widget state - widget.parents('label:first') + widget.parents('label, .input') + .first() .removeClassPrefix('state-') .addClass('state-error') .after('' + widgetData.message + ''); diff -r 8f1bc8caffce -r 5f7cda8f9da3 src/pyams_skin/resources/js/myams-form.min.js --- a/src/pyams_skin/resources/js/myams-form.min.js Fri Jul 26 19:17:51 2019 +0200 +++ b/src/pyams_skin/resources/js/myams-form.min.js Tue Sep 03 16:30:09 2019 +0200 @@ -1,1 +1,1 @@ -!function(e,a){var t=a.MyAMS;t.form={init:function(a){e("FORM",a).each(function(){var a=e(this);e('INPUT.select2[type="hidden"]',a).each(function(){var a=e(this);a.data("ams-select2-input-value",a.val())})});(t.warnOnFormChange?e('FORM[data-ams-warn-on-change!="false"]',a):e('FORM[data-ams-warn-on-change="true"]',a)).each(function(){var a=e(this);e('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',a).each(function(){var a=e(this);if(!0!==a.data("ams-ignore-change")){var r=a.data("ams-changed-event")||"change";a.on(r,function(){t.form.setChanged(e(this).parents("FORM"))})}}),a.on("reset",function(){t.form.resetChanged(e(this))})})},setFocus:function(a){var t=e("[data-ams-focus-target]",a).first();t.exists()||(t=e("input, select",a).first()),t.exists()&&(t.hasClass("select2-input")&&(t=t.parents(".select2")),t.hasClass("select2")?setTimeout(function(){t.select2("focus"),!0===t.data("ams-focus-open")&&t.select2("open")},100):t.focus())},checkBeforeUnload:function(){if(e('FORM[data-ams-form-changed="true"]').exists())return t.i18n.FORM_CHANGED_WARNING},confirmChangedForm:function(r,s,i){"function"==typeof r&&(s=r,r=void 0),e('FORM[data-ams-form-changed="true"]',r).exists()?i?a.confirm(t.i18n.FORM_CHANGED_WARNING,t.i18n.WARNING)?s.call(r):i.call(r):t.skin&&t.skin.bigBox({title:t.i18n.WARNING,content:'  '+t.i18n.FORM_CHANGED_WARNING,buttons:t.i18n.BTN_OK_CANCEL},function(e){e===t.i18n.BTN_OK&&s.call(r)}):s.call(r)},setChanged:function(e){e.attr("data-ams-form-changed",!0)},resetChanged:function(a){void 0!==a&&e(a).removeAttr("data-ams-form-changed")},submit:function(r,s,i){if(!(r=e(r)).exists())return!1;if("object"==typeof s&&(i=s,s=void 0),r.data("submitted"))return r.data("ams-form-hide-submitted")||t.skin&&t.skin.messageBox("warning",{title:t.i18n.WAIT,content:t.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:r.data("ams-form-alert-timeout")||5e3}),!1;if(t.form&&!t.form._checkSubmitValidators(r))return!1;e(".alert-danger, SPAN.state-error",r).not(".persistent").remove(),e(".state-error",r).removeClassPrefix("state-");var n=e(r.data("ams-submit-button"));return n&&!n.data("ams-form-hide-loading")&&(n.data("ams-progress-content",n.html()),n.button("loading")),t.ajax&&t.ajax.check(e.fn.ajaxSubmit,t.baseURL+"ext/jquery-form-3.49"+t.devext+".js",function(){function n(r,n){var o,m,l,u,c,f,d,g,b,h=r.data(),v=h.amsFormOptions;if(i&&(c=i.formDataInitCallback),c?delete i.formDataInitCallback:c=h.amsFormDataInitCallback,c){var p={};if(u=t.executeFunctionByName(c,r,p),p.veto)return(o=r.data("ams-submit-button"))&&o.button("reset"),t.form.finalizeSubmitFooter.call(r),!1}else u=h.amsFormData||{};(o=e(r.data("ams-submit-button")))&&o.exists()?l=(m=o.data()).amsFormSubmitTarget:m={};var x,C=s||m.amsFormHandler||h.amsFormHandler||"";if(C.startsWith(window.location.protocol))x=C;else{var S=m.amsFormAction||r.attr("action").replace(/#/,"");x=S.startsWith(window.location.protocol)?S:t.ajax&&t.ajax.getAddr()+S,x+=C}f=m.amsProgressHandler||h.amsProgressHandler||"",d=m.amsProgressInterval||h.amsProgressInterval||1e3,g=m.amsProgressCallback||h.amsProgressCallback,b=m.amsProgressEndCallback||h.amsProgressEndCallback;var F=null;i&&i.initSubmitTarget?t.executeFunctionByName(i.initSubmitTarget,r):h.amsFormInitSubmitTarget?(F=e(l||h.amsFormSubmitTarget||"#content"),t.executeFunctionByName(h.amsFormInitSubmit||"MyAMS.form.initSubmit",r,F)):h.amsFormHideSubmitFooter||t.executeFunctionByName(h.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",r),i&&(u=e.extend({},u,i.form_data));var R;f?u.progress_id=t.generateUUID():(R=void 0!==n.uuid)&&(x.indexOf("X-Progress-ID")<0&&(x+="?X-Progress-ID="+n.uuid),delete n.uuid);var y={url:x,type:"post",cache:!1,data:u,dataType:h.amsFormDatatype,beforeSerialize:function(){void 0!==a.tinyMCE&&a.tinyMCE.triggerSave()},beforeSubmit:function(e,a){a.data("submitted",!0)},error:function(e,a,r,s){F&&t.executeFunctionByName(h.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",s,F),t.form.resetAfterSubmit(s)},iframe:R},k=i&&i.downloadTarget||h.amsFormDownloadTarget;if(k){var N=e('iframe[name="'+k+'"]');N.exists()||(N=e("").hide().attr("name",k).appendTo(e("body"))),y=e.extend({},y,{iframe:!0,iframeTarget:N,success:function(a,r,s,i){if(e(i).parents(".modal-dialog").exists())t.dialog&&t.dialog.close(i);else{var n,o=i.data("ams-submit-button");o&&(n=o.data("ams-form-submit-callback")),n||(n=t.getFunctionByName(h.amsFormSubmitCallback)||t.form._submitCallback);try{n.call(i,a,r,s,i)}finally{t.form.resetAfterSubmit(i),t.form.resetChanged(i)}}}})}else y=e.extend({},y,{error:function(e,a,r,s){F&&t.executeFunctionByName(h.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",s,F),t.form.resetAfterSubmit(s)},success:function(e,a,r,s){var i,n=s.data("ams-submit-button");n&&(i=n.data("ams-form-submit-callback")),i||(i=t.getFunctionByName(h.amsFormSubmitCallback)||t.form._submitCallback);try{i.call(s,e,a,r,s)}finally{t.form.resetAfterSubmit(s),t.form.resetChanged(s)}},iframe:R});var O=e.extend({},y,n,v,i);if(f&&function(e,a){function s(){clearTimeout(n),t.form.resetAfterSubmit(r,o),o.html(o.data("ams-progress-content")),t.executeFunctionByName(b,r,o),t.form.resetChanged(r)}function i(){t.ajax&&t.ajax.post(e,{progress_id:a},{error:s},t.getFunctionByName(g)||function(e,a){if("success"===a)if("running"===e.status){if(e.message)o.text(e.message);else{var r=o.data("ams-progress-text")||t.i18n.PROGRESS;e.current?r+=": "+e.current+"/ "+(e.length||100):r+="...",o.text(r)}n=setTimeout(i,d)}else"finished"===e.status&&s();else s()})}var n;o.button("loading"),n=setTimeout(i,d)}(f,u.progress_id),e(r).ajaxSubmit(O),k){var E=e(r).parents(".modal-dialog"),A=E.exists()&&o.exists()&&o.data("ams-keep-modal");E.exists()&&!0!==A?t.dialog&&t.dialog.close(r):f||setTimeout(function(){t.form.resetAfterSubmit(r,o),t.form.resetChanged(r)},o.data("ams-form-reset-timeout")||2e3)}}if(!0!==r.data("ams-form-ignore-uploads")&&e('INPUT[type="file"]',r).length>0){t.ajax&&t.ajax.check(e.progressBar,t.baseURL+"ext/jquery-progressbar"+t.devext+".js");var o=e.extend({},{uuid:e.progressBar.submit(r)});n(r,o)}else n(r,{})}),!1},initSubmit:function(a,t){var r=e(this),s='';t||(t=r.data("ams-form-submit-message")),t&&(s+=""+t+""),e(a).html('
'+s+"
"),e(a).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(e){if(e.is(":visible")){var a=e.data("ams-submit-button");a&&a.button("reset"),t.form.finalizeSubmitFooter.call(e)}e.data("submitted",!1),e.removeData("ams-submit-button")},finalizeSubmitOnError:function(a){e("i",a).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(a){var t=e(this),r='';a||(a=e(this).data("ams-form-submit-message")),a&&(r+=''+a+"");var s=e("footer",t);e("button",s).hide(),s.append('
'+r+"
")},finalizeSubmitFooter:function(){var a=e(this),t=e("footer",a);t&&(e(".row",t).remove(),e("button",t).show())},_submitCallback:function(a,r,s,i){var n;i.is(":visible")&&(t.form.finalizeSubmitFooter.call(i),(n=i.data("ams-submit-button"))&&n.button("reset"));var o,m=i.data();if(m.amsFormDatatype)o=m.amsFormDatatype;else{var l=t.ajax&&t.ajax.getResponse(s);l&&(o=l.contentType,a=l.data)}var u;switch(u=e(n?n.data("ams-form-submit-target")||m.amsFormSubmitTarget||"#content":m.amsFormSubmitTarget||"#content"),o){case"json":t.ajax&&t.ajax.handleJSON(a,i,u);break;case"script":case"xml":break;case"html":case"text":default:t.form.resetChanged(i),n&&!0!==n.data("ams-keep-modal")&&t.dialog&&t.dialog.close(i),u.exists()||(u=e("body")),u.parents(".hidden").removeClass("hidden"),e(".alert",u.parents(".alerts-container")).remove(),u.css({opacity:"0.0"}).html(a).delay(50).animate({opacity:"1.0"},300),t.initContent&&t.initContent(u),t.form.setFocus(u)}var c=s.getResponseHeader("X-AMS-Callback");if(c){var f=s.getResponseHeader("X-AMS-Callback-Options");t.executeFunctionByName(c,i,void 0===f?{}:JSON.parse(f),s)}},_getSubmitValidators:function(a){var t=[],r=a.data("ams-form-validator");return r&&t.push([a,r]),e("[data-ams-form-validator]",a).each(function(){var a=e(this);t.push([a,a.data("ams-form-validator")])}),t},_checkSubmitValidators:function(e){var a=t.form._getSubmitValidators(e);if(!a.length)return!0;for(var r=[],s=!0,i=0;i0&&(r=r.concat(s))}if(r.length>0){var u=1===r.length?t.i18n.ERROR_OCCURED:t.i18n.ERRORS_OCCURED;return t.skin&&t.skin.alert(e,"danger",u,r),!1}return s},showErrors:function(a,r){var s;if("string"==typeof r)t.skin&&t.skin.alert(a,"error",t.i18n.ERROR_OCCURED,r);else if(r instanceof Array)s=1===r.length?t.i18n.ERROR_OCCURED:t.i18n.ERRORS_OCCURED,t.skin&&t.skin.alert(a,"error",s,r);else{e(".state-error",a).removeClass("state-error"),s=r.error_header||(r.widgets&&r.widgets.length>1?t.i18n.ERRORS_OCCURED:t.i18n.ERROR_OCCURED);var i,n=[];if(r.messages)for(i=0;i"+o.header+"
"+o.message):n.push(o.message||o)}if(r.widgets)for(i=0;i'+m.message+""):m.label&&n.push(m.label+" : "+m.message);var u=l.parents(".tab-pane").index()+1;if(u>0){var c=e(".nav-tabs",e(l).parents(".tabforms"));e("li:nth-child("+u+")",c).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",a).click()}}t.skin&&t.skin.alert(e(".form-group:first",a),r.error_level||"error",s,n,r.error_message)}}}}(jQuery,this); +!function(e,a){var t=a.MyAMS;t.form={init:function(a){e("FORM",a).each(function(){var a=e(this);e('INPUT.select2[type="hidden"]',a).each(function(){var a=e(this);a.data("ams-select2-input-value",a.val())})});(t.warnOnFormChange?e('FORM[data-ams-warn-on-change!="false"]',a):e('FORM[data-ams-warn-on-change="true"]',a)).each(function(){var a=e(this);e('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',a).each(function(){var a=e(this);if(!0!==a.data("ams-ignore-change")){var r=a.data("ams-changed-event")||"change";a.on(r,function(){t.form.setChanged(e(this).parents("FORM"))})}}),a.on("reset",function(){t.form.resetChanged(e(this))})})},setFocus:function(a){var t=e("[data-ams-focus-target]",a).first();t.exists()||(t=e("input, select",a).first()),t.exists()&&(t.hasClass("select2-input")&&(t=t.parents(".select2")),t.hasClass("select2")?setTimeout(function(){t.select2("focus"),!0===t.data("ams-focus-open")&&t.select2("open")},100):t.focus())},checkBeforeUnload:function(){if(e('FORM[data-ams-form-changed="true"]').exists())return t.i18n.FORM_CHANGED_WARNING},confirmChangedForm:function(r,s,i){"function"==typeof r&&(s=r,r=void 0),e('FORM[data-ams-form-changed="true"]',r).exists()?i?a.confirm(t.i18n.FORM_CHANGED_WARNING,t.i18n.WARNING)?s.call(r):i.call(r):t.skin&&t.skin.bigBox({title:t.i18n.WARNING,content:'  '+t.i18n.FORM_CHANGED_WARNING,buttons:t.i18n.BTN_OK_CANCEL},function(e){e===t.i18n.BTN_OK&&s.call(r)}):s.call(r)},setChanged:function(e){e.attr("data-ams-form-changed",!0)},resetChanged:function(a){void 0!==a&&e(a).removeAttr("data-ams-form-changed")},submit:function(r,s,i){if(!(r=e(r)).exists())return!1;if("object"==typeof s&&(i=s,s=void 0),r.data("submitted"))return r.data("ams-form-hide-submitted")||t.skin&&t.skin.messageBox("warning",{title:t.i18n.WAIT,content:t.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:r.data("ams-form-alert-timeout")||5e3}),!1;if(t.form&&!t.form._checkSubmitValidators(r))return!1;e(".alert-danger, SPAN.state-error",r).not(".persistent").remove(),e(".state-error",r).removeClassPrefix("state-");var n=e(r.data("ams-submit-button"));return n&&!n.data("ams-form-hide-loading")&&(n.data("ams-progress-content",n.html()),n.button("loading")),t.ajax&&t.ajax.check(e.fn.ajaxSubmit,t.baseURL+"ext/jquery-form-3.49"+t.devext+".js",function(){function n(r,n){var o,m,l,u,c,f,d,g,b,h=r.data(),v=h.amsFormOptions;if(i&&(c=i.formDataInitCallback),c?delete i.formDataInitCallback:c=h.amsFormDataInitCallback,c){var p={};if(u=t.executeFunctionByName(c,r,p),p.veto)return(o=r.data("ams-submit-button"))&&o.button("reset"),t.form.finalizeSubmitFooter.call(r),!1}else u=h.amsFormData||{};(o=e(r.data("ams-submit-button")))&&o.exists()?l=(m=o.data()).amsFormSubmitTarget:m={};var x,C=s||m.amsFormHandler||h.amsFormHandler||"";if(C.startsWith(window.location.protocol))x=C;else{var S=m.amsFormAction||r.attr("action").replace(/#/,"");x=S.startsWith(window.location.protocol)?S:t.ajax&&t.ajax.getAddr()+S,x+=C}f=m.amsProgressHandler||h.amsProgressHandler||"",d=m.amsProgressInterval||h.amsProgressInterval||1e3,g=m.amsProgressCallback||h.amsProgressCallback,b=m.amsProgressEndCallback||h.amsProgressEndCallback;var F=null;i&&i.initSubmitTarget?t.executeFunctionByName(i.initSubmitTarget,r):h.amsFormInitSubmitTarget?(F=e(l||h.amsFormSubmitTarget||"#content"),t.executeFunctionByName(h.amsFormInitSubmit||"MyAMS.form.initSubmit",r,F)):h.amsFormHideSubmitFooter||t.executeFunctionByName(h.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",r),i&&(u=e.extend({},u,i.form_data));var R;f?u.progress_id=t.generateUUID():(R=void 0!==n.uuid)&&(x.indexOf("X-Progress-ID")<0&&(x+="?X-Progress-ID="+n.uuid),delete n.uuid);var y={url:x,type:"post",cache:!1,data:u,dataType:h.amsFormDatatype,beforeSerialize:function(){void 0!==a.tinyMCE&&a.tinyMCE.triggerSave()},beforeSubmit:function(e,a){a.data("submitted",!0)},error:function(e,a,r,s){F&&t.executeFunctionByName(h.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",s,F),t.form.resetAfterSubmit(s)},iframe:R},k=i&&i.downloadTarget||h.amsFormDownloadTarget;if(k){var N=e('iframe[name="'+k+'"]');N.exists()||(N=e("").hide().attr("name",k).appendTo(e("body"))),y=e.extend({},y,{iframe:!0,iframeTarget:N,success:function(a,r,s,i){if(e(i).parents(".modal-dialog").exists())t.dialog&&t.dialog.close(i);else{var n,o=i.data("ams-submit-button");o&&(n=o.data("ams-form-submit-callback")),n||(n=t.getFunctionByName(h.amsFormSubmitCallback)||t.form._submitCallback);try{n.call(i,a,r,s,i)}finally{t.form.resetAfterSubmit(i),t.form.resetChanged(i)}}}})}else y=e.extend({},y,{error:function(e,a,r,s){F&&t.executeFunctionByName(h.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",s,F),t.form.resetAfterSubmit(s)},success:function(e,a,r,s){var i,n=s.data("ams-submit-button");n&&(i=n.data("ams-form-submit-callback")),i||(i=t.getFunctionByName(h.amsFormSubmitCallback)||t.form._submitCallback);try{i.call(s,e,a,r,s)}finally{t.form.resetAfterSubmit(s),t.form.resetChanged(s)}},iframe:R});var O=e.extend({},y,n,v,i);if(f&&function(e,a){function s(){clearTimeout(n),t.form.resetAfterSubmit(r,o),o.html(o.data("ams-progress-content")),t.executeFunctionByName(b,r,o),t.form.resetChanged(r)}function i(){t.ajax&&t.ajax.post(e,{progress_id:a},{error:s},t.getFunctionByName(g)||function(e,a){if("success"===a)if("running"===e.status){if(e.message)o.text(e.message);else{var r=o.data("ams-progress-text")||t.i18n.PROGRESS;e.current?r+=": "+e.current+"/ "+(e.length||100):r+="...",o.text(r)}n=setTimeout(i,d)}else"finished"===e.status&&s();else s()})}var n;o.button("loading"),n=setTimeout(i,d)}(f,u.progress_id),e(r).ajaxSubmit(O),k){var E=e(r).parents(".modal-dialog"),A=E.exists()&&o.exists()&&o.data("ams-keep-modal");E.exists()&&!0!==A?t.dialog&&t.dialog.close(r):f||setTimeout(function(){t.form.resetAfterSubmit(r,o),t.form.resetChanged(r)},o.data("ams-form-reset-timeout")||2e3)}}if(!0!==r.data("ams-form-ignore-uploads")&&e('INPUT[type="file"]',r).length>0){t.ajax&&t.ajax.check(e.progressBar,t.baseURL+"ext/jquery-progressbar"+t.devext+".js");var o=e.extend({},{uuid:e.progressBar.submit(r)});n(r,o)}else n(r,{})}),!1},initSubmit:function(a,t){var r=e(this),s='';t||(t=r.data("ams-form-submit-message")),t&&(s+=""+t+""),e(a).html('
'+s+"
"),e(a).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(e){if(e.is(":visible")){var a=e.data("ams-submit-button");a&&a.button("reset"),t.form.finalizeSubmitFooter.call(e)}e.data("submitted",!1),e.removeData("ams-submit-button")},finalizeSubmitOnError:function(a){e("i",a).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(a){var t=e(this),r='';a||(a=e(this).data("ams-form-submit-message")),a&&(r+=''+a+"");var s=e("footer",t);e("button",s).hide(),s.append('
'+r+"
")},finalizeSubmitFooter:function(){var a=e(this),t=e("footer",a);t&&(e(".row",t).remove(),e("button",t).show())},_submitCallback:function(a,r,s,i){var n;i.is(":visible")&&(t.form.finalizeSubmitFooter.call(i),(n=i.data("ams-submit-button"))&&n.button("reset"));var o,m=i.data();if(m.amsFormDatatype)o=m.amsFormDatatype;else{var l=t.ajax&&t.ajax.getResponse(s);l&&(o=l.contentType,a=l.data)}var u;switch(u=e(n?n.data("ams-form-submit-target")||m.amsFormSubmitTarget||"#content":m.amsFormSubmitTarget||"#content"),o){case"json":t.ajax&&t.ajax.handleJSON(a,i,u);break;case"script":case"xml":break;case"html":case"text":default:t.form.resetChanged(i),n&&!0!==n.data("ams-keep-modal")&&t.dialog&&t.dialog.close(i),u.exists()||(u=e("body")),u.parents(".hidden").removeClass("hidden"),e(".alert",u.parents(".alerts-container")).remove(),u.css({opacity:"0.0"}).html(a).delay(50).animate({opacity:"1.0"},300),t.initContent&&t.initContent(u),t.form.setFocus(u)}var c=s.getResponseHeader("X-AMS-Callback");if(c){var f=s.getResponseHeader("X-AMS-Callback-Options");t.executeFunctionByName(c,i,void 0===f?{}:JSON.parse(f),s)}},_getSubmitValidators:function(a){var t=[],r=a.data("ams-form-validator");return r&&t.push([a,r]),e("[data-ams-form-validator]",a).each(function(){var a=e(this);t.push([a,a.data("ams-form-validator")])}),t},_checkSubmitValidators:function(e){var a=t.form._getSubmitValidators(e);if(!a.length)return!0;for(var r=[],s=!0,i=0;i0&&(r=r.concat(s))}if(r.length>0){var u=1===r.length?t.i18n.ERROR_OCCURED:t.i18n.ERRORS_OCCURED;return t.skin&&t.skin.alert(e,"danger",u,r),!1}return s},showErrors:function(a,r){var s;if("string"==typeof r)t.skin&&t.skin.alert(a,"error",t.i18n.ERROR_OCCURED,r);else if(r instanceof Array)s=1===r.length?t.i18n.ERROR_OCCURED:t.i18n.ERRORS_OCCURED,t.skin&&t.skin.alert(a,"error",s,r);else{e(".state-error",a).removeClass("state-error"),s=r.error_header||(r.widgets&&r.widgets.length>1?t.i18n.ERRORS_OCCURED:t.i18n.ERROR_OCCURED);var i,n=[];if(r.messages)for(i=0;i"+o.header+"
"+o.message):n.push(o.message||o)}if(r.widgets)for(i=0;i'+m.message+""):m.label&&n.push(m.label+" : "+m.message);var u=l.parents(".tab-pane").index()+1;if(u>0){var c=e(".nav-tabs",e(l).parents(".tabforms"));e("li:nth-child("+u+")",c).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",a).click()}}t.skin&&t.skin.alert(e(".form-group:first",a),r.error_level||"error",s,n,r.error_message)}}}}(jQuery,this); diff -r 8f1bc8caffce -r 5f7cda8f9da3 src/pyams_skin/resources/js/myams-plugins.js --- a/src/pyams_skin/resources/js/myams-plugins.js Fri Jul 26 19:17:51 2019 +0200 +++ b/src/pyams_skin/resources/js/myams-plugins.js Tue Sep 03 16:30:09 2019 +0200 @@ -919,7 +919,7 @@ errorElement: 'span', errorClass: 'state-error', errorPlacement: function(error, element) { - var label = element.parents('label:first'); + var label = element.parents('label, .input').first(); if (label.length) { error.insertAfter(label); } else { diff -r 8f1bc8caffce -r 5f7cda8f9da3 src/pyams_skin/resources/js/myams-plugins.min.js --- a/src/pyams_skin/resources/js/myams-plugins.min.js Fri Jul 26 19:17:51 2019 +0200 +++ b/src/pyams_skin/resources/js/myams-plugins.min.js Tue Sep 03 16:30:09 2019 +0200 @@ -1,1 +1,1 @@ -!function(e,a){var t=a.MyAMS;e.extend(t.plugins.enabled,{svg:function(a){var t=e(".svg-container",a);t.length>0&&t.each(function(){var a=e(this),t=e("svg",a),n=t.attr("width"),i=t.attr("height");n&&i&&t.get(0).setAttribute("viewBox","0 0 "+Math.round(parseFloat(n))+" "+Math.round(parseFloat(i))),t.attr("width","100%").attr("height","auto")})},hint:function(a){var n=e(".hint:not(:parents(.nohints))",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.tipsy,t.baseURL+"ext/jquery-tipsy"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-tipsy"+t.devext+".css","jquery-tipsy",function(){n.each(function(){var a=e(this),n=a.data(),i={html:void 0===n.amsHintHtml?(a.attr("title")||"").startsWith("<"):n.amsHintHtml,title:t.getFunctionByName(n.amsHintTitleGetter)||function(){var a=e(this),t=a.attr("original-title")||a.attr(n.amsHintTitleAttr||"title")||(n.amsHintHtml?a.html():a.text());return t=t.replace(/\?_="/,"?_="+(new Date).getTime()+'"')},opacity:n.amsHintOpacity||.95,gravity:n.amsHintGravity||"sw",offset:n.amsHintOffset||0},s=e.extend({},i,n.amsHintOptions);s=t.executeFunctionByName(n.amsHintInitCallback,a,s)||s;var r=a.tipsy(s);t.executeFunctionByName(n.amsHintAfterInitCallback,a,r,s)})})})},contextMenu:function(a){var n=e(".context-menu",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={menuSelector:n.amsContextmenuSelector,menuSelected:t.helpers&&t.helpers.contextMenuHandler},s=e.extend({},i,n.amsContextmenuOptions);s=t.executeFunctionByName(n.amsContextmenuInitCallback,a,s)||s;var r=a.contextMenu(s);t.executeFunctionByName(n.amsContextmenuAfterInitCallback,a,r,s)})},switcher:function(a){e("LEGEND.switcher",a).each(function(){var a=e(this),t=a.parent("fieldset"),n=a.data();n.amsSwitcher||(e('').prependTo(e(this)).addClass("open"===n.amsSwitcherState?n.amsSwitcherMinusClass||"fa-minus":n.amsSwitcherPlusClass||"fa-plus"),a.on("click",function(i){i.preventDefault();var s={};if(a.trigger("ams.switcher.before-switch",[a,s]),!s.veto)if(t.hasClass("switched")){t.removeClass("switched"),e(".fa",a).removeClass(n.amsSwitcherPlusClass||"fa-plus").addClass(n.amsSwitcherMinusClass||"fa-minus"),a.trigger("ams.switcher.opened",[a]);var r=a.attr("id");r&&e('legend.switcher[data-ams-switcher-sync="'+r+'"]',t).each(function(){var a=e(this);a.parents("fieldset").hasClass("switched")&&a.click()})}else t.addClass("switched"),e(".fa",a).removeClass(n.amsSwitcherMinusClass||"fa-minus").addClass(n.amsSwitcherPlusClass||"fa-plus"),a.trigger("ams.switcher.closed",[a])}),"open"!==n.amsSwitcherState&&t.addClass("switched"),a.data("ams-switcher","on"))})},checker:function(a){e("LEGEND.checker",a).each(function(){var a=e(this),n=a.parent("fieldset"),i=a.data();if(!i.amsChecker){var s=e(''),r=i.amsCheckerFieldname||"checker_"+t.generateId(),o=r.replace(/\./,"_"),c=i.amsCheckerHiddenPrefix,l=null,m=i.amsCheckerHiddenValueOn||"true",d=i.amsCheckerHiddenValueOff||"false",u=i.amsCheckerMarker||!1;c?l=e('').attr("name",c+r).val("on"===i.amsCheckerState?m:d).prependTo(a):u&&e('').attr("name",u).attr("value",1).prependTo(a);var b=e('').attr("name",r).attr("id",o).data("ams-checker-hidden-input",l).data("ams-checker-init",!0).val(i.amsCheckerValue||!0).attr("checked","on"===i.amsCheckerState?"checked":null);i.amsCheckerReadonly?b.attr("disabled","disabled"):b.on("change",function(s){s.preventDefault();var r={},o=e(this).is(":checked");if(a.trigger("ams.checker.before-switch",[a,r]),r.veto)e(this).prop("checked",!o);else if(t.executeFunctionByName(i.amsCheckerChangeHandler,a,o),!i.amsCheckerCancelDefault){var c=b.data("ams-checker-hidden-input");o?("disable"===i.amsCheckerMode?(n.removeAttr("disabled"),e(".select2",n).removeAttr("disabled")):n.removeClass("switched"),c&&c.val(m),e("[data-required]",n).attr("required","required"),a.trigger("ams.checker.opened",[a])):("disable"===i.amsCheckerMode?(n.prop("disabled","disabled"),e(".select2",n).attr("disabled","disabled")):n.addClass("switched"),c&&c.val(d),e("[data-required]",n).removeAttr("required"),a.trigger("ams.checker.closed",[a]))}}),b.appendTo(s),e(">label",a).attr("for",b.attr("id")),s.append("").prependTo(a);var h=e("[required]",n);h.attr("data-required",!0),"on"===i.amsCheckerState?b.attr("checked",!0):("disable"===i.amsCheckerMode?(n.attr("disabled","disabled"),e(".select2",n).attr("disabled","disabled")):n.addClass("switched"),h.removeAttr("required")),a.data("ams-checker","on")}})},slider:function(a){var n=e(".slider",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.slider,t.baseURL+"ext/bootstrap-slider-2.0.0"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i=e.extend({},{},a.data.amsSliderOptions);i=t.executeFunctionByName(n.amsSliderInitCallback,a,i)||i;var s=a.slider(i);t.executeFunctionByName(n.amsSliderAfterInitCallback,a,s,i)})})},draggable:function(a){var n=e(".draggable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={cursor:n.amsDraggableCursor||"move",containment:n.amsDraggableContainment,handle:n.amsDraggableHandle,connectToSortable:n.amsDraggableConnectSortable,helper:t.getFunctionByName(n.amsDraggableHelper)||n.amsDraggableHelper,start:t.getFunctionByName(n.amsDraggableStart),stop:t.getFunctionByName(n.amsDraggableStop)},s=e.extend({},i,n.amsDraggableOptions);s=t.executeFunctionByName(n.amsDraggableInitCallback,a,s)||s;var r=a.draggable(s);a.disableSelection(),t.executeFunctionByName(n.amsDraggableAfterInitCallback,a,r,s)})},droppable:function(a){var n=e(".droppable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={accept:n.amsdroppableAccept,drop:t.getFunctionByName(n.amsDroppableDrop)},s=e.extend({},i,n.amsDroppableOptions);s=t.executeFunctionByName(n.amsDroppableInitCallback,a,s)||s;var r=a.droppable(s);t.executeFunctionByName(n.amsDroppableAfterInitCallback,a,r,s)})},sortable:function(a){var n=e(".sortable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={items:n.amsSortableItems,handle:n.amsSortableHandle,helper:n.amsSortableHelper,connectWith:n.amsSortableConnectwith,start:t.getFunctionByName(n.amsSortableStart),over:t.getFunctionByName(n.amsSortableOver),containment:n.amsSortableContainment,placeholder:n.amsSortablePlaceholder,stop:t.getFunctionByName(n.amsSortableStop)},s=e.extend({},i,n.amsSortableOptions);s=t.executeFunctionByName(n.amsSortableInitCallback,a,s)||s;var r=a.sortable(s);a.disableSelection(),t.executeFunctionByName(n.amsSortableAfterInitCallback,a,r,s)})},resizable:function(a){var n=e(".resizable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={autoHide:!1===n.amsResizableAutohide||n.amsResizableAutohide,containment:n.amsResizableContainment,grid:n.amsResizableGrid,handles:n.amsResizableHandles,start:t.getFunctionByName(n.amsResizableStart),stop:t.getFunctionByName(n.amsResizableStop)},s=e.extend({},i,n.amsResizableOptions);s=t.executeFunctionByName(n.amsResizableInitCallback,a,s)||s;var r=a.resizable(s);a.disableSelection(),t.executeFunctionByName(n.amsResizableAfterInitCallback,a,r,s)})},typeahead:function(a){var n=e(".typeahead",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.typeahead,t.baseURL+"ext/jquery-typeahead"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i=e.extend({},{},n.amsTypeaheadOptions);i=t.executeFunctionByName(n.amsTypeaheadInitCallback,a,i)||i;var s=a.typeahead(i);t.executeFunctionByName(n.amsTypeaheadAfterInitCallback,a,s,i)})})},treeview:function(a){var n=e(".treeview",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.treview,t.baseURL+"ext/bootstrap-treeview"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/bootstrap-treeview"+t.devext+".css","bootstrap-treeview",function(){n.each(function(){var a=e(this),n=a.data(),i={data:n.amsTreeviewData,levels:n.amsTreeviewLevels,injectStyle:n.amsTreeviewInjectStyle,expandIcon:n.amsTreeviewExpandIcon||"fa fa-fw fa-plus-square-o",collapseIcon:n.amsTreeviewCollaspeIcon||"fa fa-fw fa-minus-square-o",emptyIcon:n.amsTreeviewEmptyIcon||"fa fa-fw",nodeIcon:n.amsTreeviewNodeIcon,selectedIcon:n.amsTreeviewSelectedIcon,checkedIcon:n.amsTreeviewCheckedIcon||"fa fa-fw fa-check-square-o",uncheckedIcon:n.amsTreeviewUncheckedIcon||"fa fa-fw fa-square-o",color:n.amsTreeviewColor,backColor:n.amsTreeviewBackColor,borderColor:n.amsTreeviewBorderColor,onHoverColor:n.amsTreeviewHoverColor,selectedColor:n.amsTreeviewSelectedColor,selectedBackColor:n.amsTreeviewSelectedBackColor,unselectableColor:n.amsTreeviewUnselectableColor||"rgba(1,1,1,0.25)",unselectableBackColor:n.amsTreeviewUnselectableBackColor||"rgba(1,1,1,0.25)",enableLinks:n.amsTreeviewEnableLinks,highlightSelected:n.amsTreeviewHighlightSelected,highlightSearchResults:n.amsTreeviewhighlightSearchResults,showBorder:n.amsTreeviewShowBorder,showIcon:n.amsTreeviewShowIcon,showCheckbox:n.amsTreeviewShowCheckbox,showTags:n.amsTreeviewShowTags,toggleUnselectable:n.amsTreeviewToggleUnselectable,multiSelect:n.amsTreeviewMultiSelect,onNodeChecked:t.getFunctionByName(n.amsTreeviewNodeChecked),onNodeCollapsed:t.getFunctionByName(n.amsTreeviewNodeCollapsed),onNodeDisabled:t.getFunctionByName(n.amsTreeviewNodeDisabled),onNodeEnabled:t.getFunctionByName(n.amsTreeviewNodeEnabled),onNodeExpanded:t.getFunctionByName(n.amsTreeviewNodeExpanded),onNodeSelected:t.getFunctionByName(n.amsTreeviewNodeSelected),onNodeUnchecked:t.getFunctionByName(n.amsTreeviewNodeUnchecked),onNodeUnselected:t.getFunctionByName(n.amsTreeviewNodeUnselected),onSearchComplete:t.getFunctionByName(n.amsTreeviewSearchComplete),onSearchCleared:t.getFunctionByName(n.amsTreeviewSearchCleared)},s=e.extend({},i,n.amsTreeviewOptions);s=t.executeFunctionByName(n.amsTreeviewInitcallback,a,s)||s;var r=a.treeview(s);t.executeFunctionByName(n.amsTreeviewAfterInitCallback,a,r,s)})})})},select2:function(a){var n=e(".select2",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.select2,t.baseURL+"ext/jquery-select2-3.5.4"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data();if(!n.select2){var i={placeholder:n.amsSelect2Placeholder,multiple:n.amsSelect2Multiple,minimumInputLength:n.amsSelect2MinimumInputLength||0,maximumSelectionSize:n.amsSelect2MaximumSelectionSize,openOnEnter:void 0===n.amsSelect2EnterOpen||n.amsSelect2EnterOpen,allowClear:void 0===n.amsSelect2AllowClear||n.amsSelect2AllowClear,width:n.amsSelect2Width||"100%",initSelection:t.getFunctionByName(n.amsSelect2InitSelection),formatSelection:void 0===n.amsSelect2FormatSelection?t.helpers&&t.helpers.select2FormatSelection:t.getFunctionByName(n.amsSelect2FormatSelection),formatResult:t.getFunctionByName(n.amsSelect2FormatResult),formatMatches:void 0===n.amsSelect2FormatMatches?function(e){return 1===e?t.i18n.SELECT2_MATCH:e+t.i18n.SELECT2_MATCHES}:t.getFunctionByName(n.amsSelect2FormatMatches),formatNoMatches:void 0===n.amsSelect2FormatResult?function(e){return t.i18n.SELECT2_NOMATCHES}:t.getFunctionByName(n.amsSelect2FormatResult),formatInputTooShort:void 0===n.amsSelect2FormatInputTooShort?function(e,a){var n=a-e.length;return t.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,n).replace(/\{1\}/,1===n?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatInputTooShort),formatInputTooLong:void 0===n.amsSelect2FormatInputTooLong?function(e,a){var n=e.length-a;return t.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,n).replace(/\{1\}/,1===n?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatInputTooLong),formatSelectionTooBig:void 0===n.amsSelect2FormatSelectionTooBig?function(e){return t.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,e).replace(/\{1\}/,1===e?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatSelectionTooBig),formatLoadMore:void 0===n.amsSelect2FormatLoadMore?function(e){return t.i18n.SELECT2_LOADMORE}:t.getFunctionByName(n.amsSelect2FormatLoadMore),formatSearching:void 0===n.amsSelect2FormatSearching?function(){return t.i18n.SELECT2_SEARCHING}:t.getFunctionByName(n.amsSelect2FormatSearching),separator:n.amsSelect2Separator||",",tokenSeparators:n.amsSelect2TokensSeparators||[","],tokenizer:t.getFunctionByName(n.amsSelect2Tokenizer)};switch(a.context.type){case"text":case"hidden":if(!i.initSelection){var s=a.data("ams-select2-values");s&&(i.initSelection=function(a,t){var n=[];e(a.val().split(i.separator)).each(function(){n.push({id:this,text:s[this]||this})}),t(n)})}}a.attr("readonly")?"hidden"===a.attr("type")&&(i.query=function(){return[]}):n.amsSelect2Query?(i.query=t.getFunctionByName(n.amsSelect2Query),i.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2QueryUrl?(i.ajax={url:n.amsSelect2QueryUrl,quietMillis:n.amsSelect2QuietMillis||200,type:n.amsSelect2QueryType||"POST",dataType:n.amsSelect2QueryDatatype||"json",data:function(a,t,i){var s={};return s[n.amsSelect2QueryParamName||"query"]=a,s[n.amsSelect2PageParamName||"page"]=t,s[n.amsSelect2ContextParamName||"context"]=i,e.extend({},s,n.amsSelect2QueryOptions)},results:t.helpers&&t.helpers.select2QueryUrlResultsCallback},i.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2QueryMethod?(i.query=function(i){var s={id:(new Date).getTime(),params:n.amsSelect2QueryParams||{},success:function(e){return t.helpers&&t.helpers.select2QueryMethodSuccessCallback.call(a,e,"success",i)},error:t.error&&t.error.show};s.params[n.amsSelect2QueryParamName||"query"]=i.term,s.params[n.amsSelect2PageParamName||"page"]=i.page,s.params[n.amsSelect2ContextParamName||"context"]=i.context,s=e.extend({},s,n.amsSelect2QueryOptions),s=t.executeFunctionByName(n.amsSelect2QueryInitCallback,a,s)||s,t.ajax&&t.ajax.check(e.jsonRPC,t.baseURL+"ext/jquery-jsonrpc"+t.devext+".js",function(){e.jsonRPC.withOptions({endPoint:n.amsSelect2MethodTarget||t.jsonrpc&&t.jsonrpc.getAddr(),namespace:n.amsSelect2MethodNamespace,cache:!1},function(){e.jsonRPC.request(n.amsSelect2QueryMethod,s)})})},i.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2Tags?i.tags=n.amsSelect2Tags:n.amsSelect2Data&&(i.data=n.amsSelect2Data),n.amsSelect2EnableFreeTags&&(i.createSearchChoice=function(e){return{id:e,text:(n.amsSelect2FreeTagsPrefix||t.i18n.SELECT2_FREETAG_PREFIX)+e}});var r=e.extend({},i,n.amsSelect2Options);r=t.executeFunctionByName(n.amsSelect2InitCallback,a,r)||r;var o=a.select2(r);t.executeFunctionByName(n.amsSelect2AfterInitCallback,a,o,r),a.hasClass("ordered")&&t.ajax&&t.ajax.check(e.fn.select2Sortable,t.baseURL+"ext/jquery-select2-sortable"+t.devext+".js",function(){a.select2Sortable({bindOrder:"sortableStop"})}),a.on("change",function(){void 0!==e(a.get(0).form).data("validator")&&e(a).valid()})}})})},maskedit:function(a){var n=e("[data-mask]",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.mask,t.baseURL+"ext/jquery-maskedinput-1.4.1"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i={placeholder:void 0===n.amsMaskeditPlaceholder?"X":n.amsMaskeditPlaceholder,complete:t.getFunctionByName(n.amsMaskeditComplete)},s=e.extend({},i,n.amsMaskeditOptions);s=t.executeFunctionByName(n.amsMaskeditInitCallback,a,s)||s;var r=a.mask(a.attr("data-mask"),s);t.executeFunctionByName(n.amsMaskeditAfterInitCallback,a,r,s)})})},inputmask:function(a){var n=e("input[data-input-mask]",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.inputmask,t.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+t.devext+".js",function(){n.each(function(){var a,n=e(this),i=n.data();a="object"==typeof i.inputMask?i.inputMask:{mask:i.inputMask.toString()};var s=e.extend({},a,i.amsInputmaskOptions);s=t.executeFunctionByName(i.amsInputmaskInitCallback,n,s)||s;var r=n.inputmask(s);t.executeFunctionByName(i.amsInputmaskAfterInitCallback,n,r,s)})})},datepicker:function(a){var n=e(".datepicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog&&t.dialog.registerHideCallback(t.helpers&&t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),i={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"d/m/y",datepicker:!0,dayOfWeekStart:1,timepicker:!1,closeOnDateSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,weeks:n.amsDatetimepickerWeeks},s=e.extend({},i,n.amsDatetimepickerOptions);s=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,s)||s;var r=a.datetimepicker(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},datetimepicker:function(a){var n=e(".datetimepicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog&&t.dialog.registerHideCallback(t.helpers&&t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),i={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"d/m/y H:i",datepicker:!0,dayOfWeekStart:1,timepicker:!0,closeOnDateSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,closeOnTimeSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,weeks:n.amsDatetimepickerWeeks},s=e.extend({},i,n.amsDatetimepickerOptions);s=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,s)||s;var r=a.datetimepicker(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},timepicker:function(a){var n=e(".timepicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog&&t.dialog.registerHideCallback(t.helpers&&t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),i={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"H:i",datepicker:!1,timepicker:!0,closeOnTimeSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect},s=e.extend({},i,n.amsDatetimepickerOptions);s=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,s)||s;var r=a.datetimepicker(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},colorpicker:function(a){var n=e(".colorpicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.minicolors,t.baseURL+"ext/jquery-minicolors"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-minicolors"+t.devext+".css","jquery-minicolors",function(){n.each(function(){var a=e(this),n=a.data(),i={position:n.amsColorpickerPosition||a.closest(".input").data("ams-colorpicker-position")||"bottom left"},s=e.extend({},i,n.amsColorpickerOptions);s=t.executeFunctionByName(n.amsColorpickerInitCallback,a,s)||s;var r=a.minicolors(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},dndupload:function(a){var n=e(".dndupload",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.dndupload,t.baseURL+"ext/jquery-dndupload"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-dndupload"+t.devext+".css","jquery-dndupload",function(){n.each(function(){var a=e(this),n=a.data(),i={action:n.amsDnduploadAction||a.attr("action")||"upload-files",fieldname:n.amsDnduploadFieldname||"files",autosubmit:n.amsDnduploadAutosubmit},s=e.extend({},i,n.amsDnduploadOptions);s=t.executeFunctionByName(n.amsDnduploadInitCallback,a,s)||s;var r=a.dndupload(s);t.executeFunctionByName(n.amsDnduploadAfterInitcallback,a,r,s)})})})},validate:function(a){var n=e("FORM:not([novalidate])",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.validate,t.baseURL+"ext/jquery-validate-1.17.0"+t.devext+".js",function(a){if(a&&(e.validator.setDefaults({highlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(e,a){var t=a.parents("label:first");t.length?e.insertAfter(t):e.insertAfter(a)}}),t.plugins&&t.plugins.i18n)){for(var i in t.plugins.i18n.validate)if(t.plugins.i18n.validate.hasOwnProperty(i)){var s=t.plugins.i18n.validate[i];"string"==typeof s&&s.indexOf("{0}")>-1&&(t.plugins.i18n.validate[i]=e.validator.format(s))}e.extend(e.validator.messages,t.plugins.i18n.validate)}n.each(function(){var a=e(this),n=a.data(),i={ignore:null,submitHandler:void 0!==a.attr("data-async")?void 0===n.amsFormSubmitHandler?function(){return e(".state-error",a).removeClass("state-error"),t.ajax&&t.ajax.check(e.fn.ajaxSubmit,t.baseURL+"ext/jquery-form-3.49"+t.devext+".js"),t.form&&t.form.submit(a)}:t.getFunctionByName(n.amsFormSubmitHandler):void 0,invalidHandler:void 0===n.amsFormInvalidHandler?function(t,n){e(".state-error",a).removeClass("state-error");for(var i=0;i0){var o=e(".nav-tabs",e(s.element).parents(".tabforms"));e("li:nth-child("+r+")",o).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",o).click()}}}:t.getFunctionByName(n.amsFormInvalidHandler)};e("[data-ams-validate-rules]",a).each(function(a){0===a&&(i.rules={}),i.rules[e(this).attr("name")]=e(this).data("ams-validate-rules")});var s=e.extend({},i,n.amsValidateOptions);s=t.executeFunctionByName(n.amsValidateInitCallback,a,s)||s;var r=a.validate(s);t.executeFunctionByName(n.amsValidateAfterInitCallback,a,r,s)})})},datatable:function(a){var n=e(".datatable",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.dataTable,t.baseURL+"ext/jquery-dataTables-1.9.4"+t.devext+".js",function(){t.ajax.check(e.fn.dataTableExt.oPagination.bootstrap_full,t.baseURL+"myams-dataTables"+t.devext+".js",function(){e(n).each(function(){var a,n=e(this),i=n.data(),s=(i.amsDatatableExtensions||"").split(/\s+/),r=i.amsDatatableSdom||"W"+(s.indexOf("colreorder")>=0||s.indexOf("colreorderwithresize")>=0?"R":"")+"<'dt-top-row'"+(s.indexOf("colvis")>=0?"C":"")+(!1===i.amsDatatablePagination||!1===i.amsDatatablePaginationSize?"":"L")+(!1===i.amsDatatableGlobalFilter?"":"F")+">r<'dt-wrapper't"+(s.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(!1===i.amsDatatableInformation?"":"i")+"><'col-sm-6 text-right'p>>",o=i.amsDatatableSorting;if("string"==typeof o){var c=o.split(";");for(o=[],a=0;a=0,bPaginate:!1!==i.amsDatatablePagination,bInfo:!1!==i.amsDatatableInfo,bSort:!1!==i.amsDatatableSort,aaSorting:o,aoColumns:d.length>0?d:void 0,bDeferRender:!0,bAutoWidth:!1,iDisplayLength:i.amsDatatableDisplayLength||25,sPaginationType:i.amsDatatablePaginationType||"bootstrap_full",sDom:r,oLanguage:t.plugins&&t.plugins.i18n.datatables,fnInitComplete:function(a,n){e(".ColVis_Button").addClass("btn btn-default btn-sm").html((t.plugins&&t.plugins.i18n.datatables.sColumns||"Columns")+' ')}},g=e.extend({},f,i.amsDatatableOptions),x=[],v=[],y=[];if(s.length>0)for(a=0;a0)for(a=0;a0)for(a=0;a0&&t.ajax&&t.ajax.check(e.fn.tableDnD,t.baseURL+"ext/jquery-tablednd"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data();n.amsTabledndDragHandle?e("tr",a).addClass("no-drag-handle"):e(a).on("mouseover","tr",function(){e(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){e(this.cells[0]).removeClass("drag-handle")});var i={onDragClass:n.amsTabledndDragClass||"dragging-row",onDragStart:t.getFunctionByName(n.amsTabledndDragStart),dragHandle:n.amsTabledndDragHandle,scrollAmount:n.amsTabledndScrollAmount,onAllowDrop:n.amsTabledndAllowDrop,onDrop:t.getFunctionByName(n.amsTabledndDrop)||function(i,s){var r=n.amsTabledndDropTarget;if(r){e(s).data("ams-disabled-handlers","click");try{var o=[];e(i.rows).each(function(){var a=e(this).data("ams-element-name");a&&o.push(a)});var c=t.getFunctionByName(r);if("function"==typeof c)c.call(a,i,o);else{if(!r.startsWith(window.location.protocol)){var l=n.amsLocation;l&&(r=l+"/"+r)}t.ajax&&t.ajax.post(r,{names:JSON.stringify(o)},function(e,a){"success"!==e.status&&t.ajax.handleJSON(e)})}}finally{setTimeout(function(){e(s).removeData("ams-disabled-handlers")},50)}}return!1}},s=e.extend({},i,n.amsTabledndOptions);s=t.executeFunctionByName(n.amsTabledndInitCallback,a,s)||s;var r=a.tableDnD(s);t.executeFunctionByName(n.amsTabledndAfterInitCallback,a,r,s)})})},wizard:function(a){var n=e(".wizard",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.bootstrapWizard,t.baseURL+"ext/bootstrap-wizard-1.4.2"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i={withVisible:void 0===n.amsWizardWithVisible||n.amsWizardWithVisible,tabClass:n.amsWizardTabClass,firstSelector:n.amsWizardFirstSelector,previousSelector:n.amsWizardPreviousSelector,nextSelector:n.amsWizardNextSelector,lastSelector:n.amsWizardLastSelector,finishSelector:n.amsWizardFinishSelector,backSelector:n.amsWizardBackSelector,onInit:t.getFunctionByName(n.amsWizardInit),onShow:t.getFunctionByName(n.amsWizardShow),onNext:t.getFunctionByName(n.amsWizardNext),onPrevious:t.getFunctionByName(n.amsWizardPrevious),onFirst:t.getFunctionByName(n.amsWizardFirst),onLast:t.getFunctionByName(n.amsWizardLast),onBack:t.getFunctionByName(n.amsWizardBack),onFinish:t.getFunctionByName(n.amsWizardFinish),onTabChange:t.getFunctionByName(n.amsWizardTabChange),onTabClick:t.getFunctionByName(n.amsWizardTabClick),onTabShow:t.getFunctionByName(n.amsWizardTabShow)},s=e.extend({},i,n.amsWizardOptions);s=t.executeFunctionByName(n.amsWizardInitCallback,a,s)||s;var r=a.bootstrapWizard(s);t.executeFunctionByName(n.amsWizardAfterInitCallback,a,r,s)})})},tinymce:function(a){function n(){e(".tinymce",e(this)).each(function(){var a=tinymce.get(e(this).attr("id"));a&&a.remove()})}var i=e(".tinymce",a);if(i.length>0){var s=t.baseURL+"ext/tinymce"+(t.devmode?"/dev":"");t.ajax&&t.ajax.check(window.tinymce,s+"/tinymce"+t.devext+".js",function(a){function r(){i.each(function(){var a=e(this),n=a.data(),i={theme:n.amsTinymceTheme||"modern",language:t.lang,menubar:!1!==n.amsTinymceMenubar,statusbar:!1!==n.amsTinymceStatusbar,plugins:n.amsTinymcePlugins||["advlist autosave autolink lists link charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code fullscreen","insertdatetime nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern autoresize"],toolbar:n.amsTinymceToolbar,toolbar1:!1!==n.amsTinymceToolbar1&&(n.amsTinymceToolbar1||"undo redo | pastetext | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),toolbar2:!1!==n.amsTinymceToolbar2&&(n.amsTinymceToolbar2||"forecolor backcolor emoticons | charmap link image media | fullscreen preview print | code"),content_css:n.amsTinymceContentCss,formats:n.amsTinymceFormats,style_formats:n.amsTinymceStyleFormats,block_formats:n.amsTinymceBlockFormats,valid_classes:n.amsTinymceValidClasses,image_advtab:!0,image_list:t.getFunctionByName(n.amsTinymceImageList)||n.amsTinymceImageList,image_class_list:n.amsTinymceImageClassList,link_list:t.getFunctionByName(n.amsTinymceLinkList)||n.amsTinymceLinkList,link_class_list:n.amsTinymceLinkClassList,paste_as_text:void 0===n.amsTinymcePasteAsText||n.amsTinymcePasteAsText,paste_auto_cleanup_on_paste:void 0===n.amsTinymcePasteAutoCleanup||n.amsTinymcePasteAutoCleanup,paste_strip_class_attributes:n.amsTinymcePasteStripClassAttributes||"all",paste_remove_spans:void 0===n.amsTinymcePaseRemoveSpans||n.amsTinymcePasteRemoveSpans,paste_remove_styles:void 0===n.amsTinymcePasteRemoveStyles||n.amsTinymcePasteRemoveStyles,height:n.amsTinymceHeight||50,min_height:50,resize:!0,autoresize_min_height:50,autoresize_max_height:500};if(n.amsTinymceExternalPlugins){var s=n.amsTinymceExternalPlugins.split(/\s+/);for(var r in s)if(s.hasOwnProperty(r)){var o=a.data("ams-tinymce-plugin-"+s[r]);tinymce.PluginManager.load(s[r],t.getSource(o))}}var c=e.extend({},i,n.amsTinymceOptions);c=t.executeFunctionByName(n.amsTinymceInitCallback,a,c)||c;var l=a.tinymce(c);t.executeFunctionByName(n.amsTinymceAfterInitCallback,a,l,c)})}a?t.getScript(s+"/jquery.tinymce"+t.devext+".js",function(){tinymce.baseURL=s,tinymce.suffix=t.devext,t.skin&&t.skin.registerCleanCallback(n),r()}):r()})}},editor:function(n){var i=e(".text-editor textarea",n);i.length>0&&t.ajax&&t.ajax.check(a.ace,t.baseURL+"ext/ace/ace.js",function(n){var s=function(){a.ace_loaded=!0,i.each(function(){var a=e(this),n=a.parents(".text-editor"),i=n.data(),s=ace.require("ace/ext/modelist"),r=i.amsEditorMode||s.getModeForPath(i.amsEditorFilename||"editor.txt").mode,o=e("
",{position:"absolute",width:a.width(),height:a.height(),class:a.attr("class")}).insertBefore(a);a.css("display","none");var c=ace.edit(o[0]),l={mode:r,tabSize:4,useSoftTabs:!1,showGutter:!0,showLineNumbers:!0,printMargin:132,showInvisibles:!0},m=e.extend({},l,i.amsEditorOptions);m=t.executeFunctionByName(i.amsEditorInitCallback,a,m)||m,c.setOptions(m),c.session.setValue(a.val()),c.session.on("change",function(){a.val(c.session.getValue())}),n.data("editor",c),t.executeFunctionByName(i.amsEditorAfterInitCallback,a,c,m)})};n?(ace.config.set("basePath",t.baseURL+"ext/ace"),t.ajax.check(a.ace_loaded,[t.baseURL+"ext/ace/ext-modelist.js"],s)):s()})},imgareaselect:function(a){var n=e(".imgareaselect",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.imgAreaSelect,t.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-imgareaselect"+t.devext+".css","jquery-imgareaselect",function(){n.each(function(){var a=e(this),n=a.data(),i=n.amsImgareaselectParent?a.parents(n.amsImgareaselectParent):"body",s={instance:!0,handles:!0,parent:i,x1:n.amsImgareaselectX1||0,y1:n.amsImgareaselectY1||0,x2:n.amsImgareaselectX2||n.amsImgareaselectImageWidth,y2:n.amsImgareaselectY2||n.amsImgareaselectImageHeight,imageWidth:n.amsImgareaselectImageWidth,imageHeight:n.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:n.amsImgareaselectRatio,onSelectEnd:t.getFunctionByName(n.amsImgareaselectSelectEnd)||function(a,t){var s=n.amsImgareaselectTargetField||"image_";e('input[name="'+s+'x1"]',i).val(t.x1),e('input[name="'+s+'y1"]',i).val(t.y1),e('input[name="'+s+'x2"]',i).val(t.x2),e('input[name="'+s+'y2"]',i).val(t.y2)}},r=e.extend({},s,n.amsImgareaselectOptions);r=t.executeFunctionByName(n.amsImgareaselectInitCallback,a,r)||r;var o=a.imgAreaSelect(r);t.executeFunctionByName(n.amsImgareaselectAfterInitCallback,a,o,r),setTimeout(function(){o.update()},250)})})})},fancybox:function(a){var n=e(".fancybox",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.fancybox,t.baseURL+"ext/jquery-fancybox-2.1.5"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-fancybox-2.1.5"+t.devext+".css","jquery-fancybox",function(){n.each(function(){var a,n=e(this),i=n.data(),s=n;i.amsFancyboxElements&&(s=e(i.amsFancyboxElements,n));var r=(i.amsFancyboxHelpers||"").split(/\s+/);if(r.length>0)for(a=0;a0)for(a=0;a0&&t.ajax&&t.ajax.check(e.fn.plot,t.baseURL+"flot/jquery.flot"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i=(n.amsChartPlugins||"").split(/\s+/);if(i.length>0)for(var s in i)if(i.hasOwnProperty(s)){var r=i[s];(function(a){for(var t in e.plot.plugins)if(e.plot.plugins.hasOwnProperty(t)){var n=e.plot.plugins[t];if(n.name===a)return n}return null})(r)||t.getScript(t.baseURL+"flot/jquery.flot."+r+t.devext+".js")}var o=e.extend({},{},n.amsChartOptions);o=t.executeFunctionByName(n.amsChartInitCallback,a,o)||o;var c=n.amsChartData;c=t.executeFunctionByName(n.amsChartInitData,a,c)||c;var l=a.plot(c,o);t.executeFunctionByName(n.amsChartAfterInitCallback,a,l,o)})})},graphs:function(a){var n=e(".sparkline",a);n.length>0&&t.ajax&&t.ajax.check(t.graphs,t.baseURL+"myams-graphs"+t.devext+".js",function(){t.graphs.init(n)})},scrollbars:function(a){var n=e(".scrollbar",a);n.length>0&&t.ajax&&t.ajax.check(e.event.special.mousewheel,t.baseURL+"ext/jquery-mousewheel.min.js",function(){t.ajax.check(e.fn.mCustomScrollbar,t.baseURL+"ext/jquery-mCustomScrollbar"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar",function(){n.each(function(){var a=e(this),n=a.data(),i={theme:n.amsScrollbarTheme||"light"},s=e.extend({},i,n.amsScrollbarOptions);s=t.executeFunctionByName(n.amsScrollbarInitCallback,a,s)||s;var r=a.mCustomScrollbar(s);t.executeFunctionByName(n.amsScrollbarAfterInitCallback,a,r,s)})})})})}})}(jQuery,this); +!function(e,a){var t=a.MyAMS;e.extend(t.plugins.enabled,{svg:function(a){var t=e(".svg-container",a);t.length>0&&t.each(function(){var a=e(this),t=e("svg",a),n=t.attr("width"),i=t.attr("height");n&&i&&t.get(0).setAttribute("viewBox","0 0 "+Math.round(parseFloat(n))+" "+Math.round(parseFloat(i))),t.attr("width","100%").attr("height","auto")})},hint:function(a){var n=e(".hint:not(:parents(.nohints))",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.tipsy,t.baseURL+"ext/jquery-tipsy"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-tipsy"+t.devext+".css","jquery-tipsy",function(){n.each(function(){var a=e(this),n=a.data(),i={html:void 0===n.amsHintHtml?(a.attr("title")||"").startsWith("<"):n.amsHintHtml,title:t.getFunctionByName(n.amsHintTitleGetter)||function(){var a=e(this),t=a.attr("original-title")||a.attr(n.amsHintTitleAttr||"title")||(n.amsHintHtml?a.html():a.text());return t=t.replace(/\?_="/,"?_="+(new Date).getTime()+'"')},opacity:n.amsHintOpacity||.95,gravity:n.amsHintGravity||"sw",offset:n.amsHintOffset||0},s=e.extend({},i,n.amsHintOptions);s=t.executeFunctionByName(n.amsHintInitCallback,a,s)||s;var r=a.tipsy(s);t.executeFunctionByName(n.amsHintAfterInitCallback,a,r,s)})})})},contextMenu:function(a){var n=e(".context-menu",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={menuSelector:n.amsContextmenuSelector,menuSelected:t.helpers&&t.helpers.contextMenuHandler},s=e.extend({},i,n.amsContextmenuOptions);s=t.executeFunctionByName(n.amsContextmenuInitCallback,a,s)||s;var r=a.contextMenu(s);t.executeFunctionByName(n.amsContextmenuAfterInitCallback,a,r,s)})},switcher:function(a){e("LEGEND.switcher",a).each(function(){var a=e(this),t=a.parent("fieldset"),n=a.data();n.amsSwitcher||(e('').prependTo(e(this)).addClass("open"===n.amsSwitcherState?n.amsSwitcherMinusClass||"fa-minus":n.amsSwitcherPlusClass||"fa-plus"),a.on("click",function(i){i.preventDefault();var s={};if(a.trigger("ams.switcher.before-switch",[a,s]),!s.veto)if(t.hasClass("switched")){t.removeClass("switched"),e(".fa",a).removeClass(n.amsSwitcherPlusClass||"fa-plus").addClass(n.amsSwitcherMinusClass||"fa-minus"),a.trigger("ams.switcher.opened",[a]);var r=a.attr("id");r&&e('legend.switcher[data-ams-switcher-sync="'+r+'"]',t).each(function(){var a=e(this);a.parents("fieldset").hasClass("switched")&&a.click()})}else t.addClass("switched"),e(".fa",a).removeClass(n.amsSwitcherMinusClass||"fa-minus").addClass(n.amsSwitcherPlusClass||"fa-plus"),a.trigger("ams.switcher.closed",[a])}),"open"!==n.amsSwitcherState&&t.addClass("switched"),a.data("ams-switcher","on"))})},checker:function(a){e("LEGEND.checker",a).each(function(){var a=e(this),n=a.parent("fieldset"),i=a.data();if(!i.amsChecker){var s=e(''),r=i.amsCheckerFieldname||"checker_"+t.generateId(),o=r.replace(/\./,"_"),c=i.amsCheckerHiddenPrefix,l=null,m=i.amsCheckerHiddenValueOn||"true",d=i.amsCheckerHiddenValueOff||"false",u=i.amsCheckerMarker||!1;c?l=e('').attr("name",c+r).val("on"===i.amsCheckerState?m:d).prependTo(a):u&&e('').attr("name",u).attr("value",1).prependTo(a);var b=e('').attr("name",r).attr("id",o).data("ams-checker-hidden-input",l).data("ams-checker-init",!0).val(i.amsCheckerValue||!0).attr("checked","on"===i.amsCheckerState?"checked":null);i.amsCheckerReadonly?b.attr("disabled","disabled"):b.on("change",function(s){s.preventDefault();var r={},o=e(this).is(":checked");if(a.trigger("ams.checker.before-switch",[a,r]),r.veto)e(this).prop("checked",!o);else if(t.executeFunctionByName(i.amsCheckerChangeHandler,a,o),!i.amsCheckerCancelDefault){var c=b.data("ams-checker-hidden-input");o?("disable"===i.amsCheckerMode?(n.removeAttr("disabled"),e(".select2",n).removeAttr("disabled")):n.removeClass("switched"),c&&c.val(m),e("[data-required]",n).attr("required","required"),a.trigger("ams.checker.opened",[a])):("disable"===i.amsCheckerMode?(n.prop("disabled","disabled"),e(".select2",n).attr("disabled","disabled")):n.addClass("switched"),c&&c.val(d),e("[data-required]",n).removeAttr("required"),a.trigger("ams.checker.closed",[a]))}}),b.appendTo(s),e(">label",a).attr("for",b.attr("id")),s.append("").prependTo(a);var h=e("[required]",n);h.attr("data-required",!0),"on"===i.amsCheckerState?b.attr("checked",!0):("disable"===i.amsCheckerMode?(n.attr("disabled","disabled"),e(".select2",n).attr("disabled","disabled")):n.addClass("switched"),h.removeAttr("required")),a.data("ams-checker","on")}})},slider:function(a){var n=e(".slider",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.slider,t.baseURL+"ext/bootstrap-slider-2.0.0"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i=e.extend({},{},a.data.amsSliderOptions);i=t.executeFunctionByName(n.amsSliderInitCallback,a,i)||i;var s=a.slider(i);t.executeFunctionByName(n.amsSliderAfterInitCallback,a,s,i)})})},draggable:function(a){var n=e(".draggable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={cursor:n.amsDraggableCursor||"move",containment:n.amsDraggableContainment,handle:n.amsDraggableHandle,connectToSortable:n.amsDraggableConnectSortable,helper:t.getFunctionByName(n.amsDraggableHelper)||n.amsDraggableHelper,start:t.getFunctionByName(n.amsDraggableStart),stop:t.getFunctionByName(n.amsDraggableStop)},s=e.extend({},i,n.amsDraggableOptions);s=t.executeFunctionByName(n.amsDraggableInitCallback,a,s)||s;var r=a.draggable(s);a.disableSelection(),t.executeFunctionByName(n.amsDraggableAfterInitCallback,a,r,s)})},droppable:function(a){var n=e(".droppable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={accept:n.amsdroppableAccept,drop:t.getFunctionByName(n.amsDroppableDrop)},s=e.extend({},i,n.amsDroppableOptions);s=t.executeFunctionByName(n.amsDroppableInitCallback,a,s)||s;var r=a.droppable(s);t.executeFunctionByName(n.amsDroppableAfterInitCallback,a,r,s)})},sortable:function(a){var n=e(".sortable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={items:n.amsSortableItems,handle:n.amsSortableHandle,helper:n.amsSortableHelper,connectWith:n.amsSortableConnectwith,start:t.getFunctionByName(n.amsSortableStart),over:t.getFunctionByName(n.amsSortableOver),containment:n.amsSortableContainment,placeholder:n.amsSortablePlaceholder,stop:t.getFunctionByName(n.amsSortableStop)},s=e.extend({},i,n.amsSortableOptions);s=t.executeFunctionByName(n.amsSortableInitCallback,a,s)||s;var r=a.sortable(s);a.disableSelection(),t.executeFunctionByName(n.amsSortableAfterInitCallback,a,r,s)})},resizable:function(a){var n=e(".resizable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={autoHide:!1===n.amsResizableAutohide||n.amsResizableAutohide,containment:n.amsResizableContainment,grid:n.amsResizableGrid,handles:n.amsResizableHandles,start:t.getFunctionByName(n.amsResizableStart),stop:t.getFunctionByName(n.amsResizableStop)},s=e.extend({},i,n.amsResizableOptions);s=t.executeFunctionByName(n.amsResizableInitCallback,a,s)||s;var r=a.resizable(s);a.disableSelection(),t.executeFunctionByName(n.amsResizableAfterInitCallback,a,r,s)})},typeahead:function(a){var n=e(".typeahead",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.typeahead,t.baseURL+"ext/jquery-typeahead"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i=e.extend({},{},n.amsTypeaheadOptions);i=t.executeFunctionByName(n.amsTypeaheadInitCallback,a,i)||i;var s=a.typeahead(i);t.executeFunctionByName(n.amsTypeaheadAfterInitCallback,a,s,i)})})},treeview:function(a){var n=e(".treeview",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.treview,t.baseURL+"ext/bootstrap-treeview"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/bootstrap-treeview"+t.devext+".css","bootstrap-treeview",function(){n.each(function(){var a=e(this),n=a.data(),i={data:n.amsTreeviewData,levels:n.amsTreeviewLevels,injectStyle:n.amsTreeviewInjectStyle,expandIcon:n.amsTreeviewExpandIcon||"fa fa-fw fa-plus-square-o",collapseIcon:n.amsTreeviewCollaspeIcon||"fa fa-fw fa-minus-square-o",emptyIcon:n.amsTreeviewEmptyIcon||"fa fa-fw",nodeIcon:n.amsTreeviewNodeIcon,selectedIcon:n.amsTreeviewSelectedIcon,checkedIcon:n.amsTreeviewCheckedIcon||"fa fa-fw fa-check-square-o",uncheckedIcon:n.amsTreeviewUncheckedIcon||"fa fa-fw fa-square-o",color:n.amsTreeviewColor,backColor:n.amsTreeviewBackColor,borderColor:n.amsTreeviewBorderColor,onHoverColor:n.amsTreeviewHoverColor,selectedColor:n.amsTreeviewSelectedColor,selectedBackColor:n.amsTreeviewSelectedBackColor,unselectableColor:n.amsTreeviewUnselectableColor||"rgba(1,1,1,0.25)",unselectableBackColor:n.amsTreeviewUnselectableBackColor||"rgba(1,1,1,0.25)",enableLinks:n.amsTreeviewEnableLinks,highlightSelected:n.amsTreeviewHighlightSelected,highlightSearchResults:n.amsTreeviewhighlightSearchResults,showBorder:n.amsTreeviewShowBorder,showIcon:n.amsTreeviewShowIcon,showCheckbox:n.amsTreeviewShowCheckbox,showTags:n.amsTreeviewShowTags,toggleUnselectable:n.amsTreeviewToggleUnselectable,multiSelect:n.amsTreeviewMultiSelect,onNodeChecked:t.getFunctionByName(n.amsTreeviewNodeChecked),onNodeCollapsed:t.getFunctionByName(n.amsTreeviewNodeCollapsed),onNodeDisabled:t.getFunctionByName(n.amsTreeviewNodeDisabled),onNodeEnabled:t.getFunctionByName(n.amsTreeviewNodeEnabled),onNodeExpanded:t.getFunctionByName(n.amsTreeviewNodeExpanded),onNodeSelected:t.getFunctionByName(n.amsTreeviewNodeSelected),onNodeUnchecked:t.getFunctionByName(n.amsTreeviewNodeUnchecked),onNodeUnselected:t.getFunctionByName(n.amsTreeviewNodeUnselected),onSearchComplete:t.getFunctionByName(n.amsTreeviewSearchComplete),onSearchCleared:t.getFunctionByName(n.amsTreeviewSearchCleared)},s=e.extend({},i,n.amsTreeviewOptions);s=t.executeFunctionByName(n.amsTreeviewInitcallback,a,s)||s;var r=a.treeview(s);t.executeFunctionByName(n.amsTreeviewAfterInitCallback,a,r,s)})})})},select2:function(a){var n=e(".select2",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.select2,t.baseURL+"ext/jquery-select2-3.5.4"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data();if(!n.select2){var i={placeholder:n.amsSelect2Placeholder,multiple:n.amsSelect2Multiple,minimumInputLength:n.amsSelect2MinimumInputLength||0,maximumSelectionSize:n.amsSelect2MaximumSelectionSize,openOnEnter:void 0===n.amsSelect2EnterOpen||n.amsSelect2EnterOpen,allowClear:void 0===n.amsSelect2AllowClear||n.amsSelect2AllowClear,width:n.amsSelect2Width||"100%",initSelection:t.getFunctionByName(n.amsSelect2InitSelection),formatSelection:void 0===n.amsSelect2FormatSelection?t.helpers&&t.helpers.select2FormatSelection:t.getFunctionByName(n.amsSelect2FormatSelection),formatResult:t.getFunctionByName(n.amsSelect2FormatResult),formatMatches:void 0===n.amsSelect2FormatMatches?function(e){return 1===e?t.i18n.SELECT2_MATCH:e+t.i18n.SELECT2_MATCHES}:t.getFunctionByName(n.amsSelect2FormatMatches),formatNoMatches:void 0===n.amsSelect2FormatResult?function(e){return t.i18n.SELECT2_NOMATCHES}:t.getFunctionByName(n.amsSelect2FormatResult),formatInputTooShort:void 0===n.amsSelect2FormatInputTooShort?function(e,a){var n=a-e.length;return t.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,n).replace(/\{1\}/,1===n?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatInputTooShort),formatInputTooLong:void 0===n.amsSelect2FormatInputTooLong?function(e,a){var n=e.length-a;return t.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,n).replace(/\{1\}/,1===n?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatInputTooLong),formatSelectionTooBig:void 0===n.amsSelect2FormatSelectionTooBig?function(e){return t.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,e).replace(/\{1\}/,1===e?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatSelectionTooBig),formatLoadMore:void 0===n.amsSelect2FormatLoadMore?function(e){return t.i18n.SELECT2_LOADMORE}:t.getFunctionByName(n.amsSelect2FormatLoadMore),formatSearching:void 0===n.amsSelect2FormatSearching?function(){return t.i18n.SELECT2_SEARCHING}:t.getFunctionByName(n.amsSelect2FormatSearching),separator:n.amsSelect2Separator||",",tokenSeparators:n.amsSelect2TokensSeparators||[","],tokenizer:t.getFunctionByName(n.amsSelect2Tokenizer)};switch(a.context.type){case"text":case"hidden":if(!i.initSelection){var s=a.data("ams-select2-values");s&&(i.initSelection=function(a,t){var n=[];e(a.val().split(i.separator)).each(function(){n.push({id:this,text:s[this]||this})}),t(n)})}}a.attr("readonly")?"hidden"===a.attr("type")&&(i.query=function(){return[]}):n.amsSelect2Query?(i.query=t.getFunctionByName(n.amsSelect2Query),i.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2QueryUrl?(i.ajax={url:n.amsSelect2QueryUrl,quietMillis:n.amsSelect2QuietMillis||200,type:n.amsSelect2QueryType||"POST",dataType:n.amsSelect2QueryDatatype||"json",data:function(a,t,i){var s={};return s[n.amsSelect2QueryParamName||"query"]=a,s[n.amsSelect2PageParamName||"page"]=t,s[n.amsSelect2ContextParamName||"context"]=i,e.extend({},s,n.amsSelect2QueryOptions)},results:t.helpers&&t.helpers.select2QueryUrlResultsCallback},i.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2QueryMethod?(i.query=function(i){var s={id:(new Date).getTime(),params:n.amsSelect2QueryParams||{},success:function(e){return t.helpers&&t.helpers.select2QueryMethodSuccessCallback.call(a,e,"success",i)},error:t.error&&t.error.show};s.params[n.amsSelect2QueryParamName||"query"]=i.term,s.params[n.amsSelect2PageParamName||"page"]=i.page,s.params[n.amsSelect2ContextParamName||"context"]=i.context,s=e.extend({},s,n.amsSelect2QueryOptions),s=t.executeFunctionByName(n.amsSelect2QueryInitCallback,a,s)||s,t.ajax&&t.ajax.check(e.jsonRPC,t.baseURL+"ext/jquery-jsonrpc"+t.devext+".js",function(){e.jsonRPC.withOptions({endPoint:n.amsSelect2MethodTarget||t.jsonrpc&&t.jsonrpc.getAddr(),namespace:n.amsSelect2MethodNamespace,cache:!1},function(){e.jsonRPC.request(n.amsSelect2QueryMethod,s)})})},i.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2Tags?i.tags=n.amsSelect2Tags:n.amsSelect2Data&&(i.data=n.amsSelect2Data),n.amsSelect2EnableFreeTags&&(i.createSearchChoice=function(e){return{id:e,text:(n.amsSelect2FreeTagsPrefix||t.i18n.SELECT2_FREETAG_PREFIX)+e}});var r=e.extend({},i,n.amsSelect2Options);r=t.executeFunctionByName(n.amsSelect2InitCallback,a,r)||r;var o=a.select2(r);t.executeFunctionByName(n.amsSelect2AfterInitCallback,a,o,r),a.hasClass("ordered")&&t.ajax&&t.ajax.check(e.fn.select2Sortable,t.baseURL+"ext/jquery-select2-sortable"+t.devext+".js",function(){a.select2Sortable({bindOrder:"sortableStop"})}),a.on("change",function(){void 0!==e(a.get(0).form).data("validator")&&e(a).valid()})}})})},maskedit:function(a){var n=e("[data-mask]",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.mask,t.baseURL+"ext/jquery-maskedinput-1.4.1"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i={placeholder:void 0===n.amsMaskeditPlaceholder?"X":n.amsMaskeditPlaceholder,complete:t.getFunctionByName(n.amsMaskeditComplete)},s=e.extend({},i,n.amsMaskeditOptions);s=t.executeFunctionByName(n.amsMaskeditInitCallback,a,s)||s;var r=a.mask(a.attr("data-mask"),s);t.executeFunctionByName(n.amsMaskeditAfterInitCallback,a,r,s)})})},inputmask:function(a){var n=e("input[data-input-mask]",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.inputmask,t.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+t.devext+".js",function(){n.each(function(){var a,n=e(this),i=n.data();a="object"==typeof i.inputMask?i.inputMask:{mask:i.inputMask.toString()};var s=e.extend({},a,i.amsInputmaskOptions);s=t.executeFunctionByName(i.amsInputmaskInitCallback,n,s)||s;var r=n.inputmask(s);t.executeFunctionByName(i.amsInputmaskAfterInitCallback,n,r,s)})})},datepicker:function(a){var n=e(".datepicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog&&t.dialog.registerHideCallback(t.helpers&&t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),i={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"d/m/y",datepicker:!0,dayOfWeekStart:1,timepicker:!1,closeOnDateSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,weeks:n.amsDatetimepickerWeeks},s=e.extend({},i,n.amsDatetimepickerOptions);s=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,s)||s;var r=a.datetimepicker(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},datetimepicker:function(a){var n=e(".datetimepicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog&&t.dialog.registerHideCallback(t.helpers&&t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),i={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"d/m/y H:i",datepicker:!0,dayOfWeekStart:1,timepicker:!0,closeOnDateSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,closeOnTimeSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,weeks:n.amsDatetimepickerWeeks},s=e.extend({},i,n.amsDatetimepickerOptions);s=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,s)||s;var r=a.datetimepicker(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},timepicker:function(a){var n=e(".timepicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog&&t.dialog.registerHideCallback(t.helpers&&t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),i={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"H:i",datepicker:!1,timepicker:!0,closeOnTimeSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect},s=e.extend({},i,n.amsDatetimepickerOptions);s=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,s)||s;var r=a.datetimepicker(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},colorpicker:function(a){var n=e(".colorpicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.minicolors,t.baseURL+"ext/jquery-minicolors"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-minicolors"+t.devext+".css","jquery-minicolors",function(){n.each(function(){var a=e(this),n=a.data(),i={position:n.amsColorpickerPosition||a.closest(".input").data("ams-colorpicker-position")||"bottom left"},s=e.extend({},i,n.amsColorpickerOptions);s=t.executeFunctionByName(n.amsColorpickerInitCallback,a,s)||s;var r=a.minicolors(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},dndupload:function(a){var n=e(".dndupload",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.dndupload,t.baseURL+"ext/jquery-dndupload"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-dndupload"+t.devext+".css","jquery-dndupload",function(){n.each(function(){var a=e(this),n=a.data(),i={action:n.amsDnduploadAction||a.attr("action")||"upload-files",fieldname:n.amsDnduploadFieldname||"files",autosubmit:n.amsDnduploadAutosubmit},s=e.extend({},i,n.amsDnduploadOptions);s=t.executeFunctionByName(n.amsDnduploadInitCallback,a,s)||s;var r=a.dndupload(s);t.executeFunctionByName(n.amsDnduploadAfterInitcallback,a,r,s)})})})},validate:function(a){var n=e("FORM:not([novalidate])",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.validate,t.baseURL+"ext/jquery-validate-1.17.0"+t.devext+".js",function(a){if(a&&(e.validator.setDefaults({highlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(e,a){var t=a.parents("label, .input").first();t.length?e.insertAfter(t):e.insertAfter(a)}}),t.plugins&&t.plugins.i18n)){for(var i in t.plugins.i18n.validate)if(t.plugins.i18n.validate.hasOwnProperty(i)){var s=t.plugins.i18n.validate[i];"string"==typeof s&&s.indexOf("{0}")>-1&&(t.plugins.i18n.validate[i]=e.validator.format(s))}e.extend(e.validator.messages,t.plugins.i18n.validate)}n.each(function(){var a=e(this),n=a.data(),i={ignore:null,submitHandler:void 0!==a.attr("data-async")?void 0===n.amsFormSubmitHandler?function(){return e(".state-error",a).removeClass("state-error"),t.ajax&&t.ajax.check(e.fn.ajaxSubmit,t.baseURL+"ext/jquery-form-3.49"+t.devext+".js"),t.form&&t.form.submit(a)}:t.getFunctionByName(n.amsFormSubmitHandler):void 0,invalidHandler:void 0===n.amsFormInvalidHandler?function(t,n){e(".state-error",a).removeClass("state-error");for(var i=0;i0){var o=e(".nav-tabs",e(s.element).parents(".tabforms"));e("li:nth-child("+r+")",o).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",o).click()}}}:t.getFunctionByName(n.amsFormInvalidHandler)};e("[data-ams-validate-rules]",a).each(function(a){0===a&&(i.rules={}),i.rules[e(this).attr("name")]=e(this).data("ams-validate-rules")});var s=e.extend({},i,n.amsValidateOptions);s=t.executeFunctionByName(n.amsValidateInitCallback,a,s)||s;var r=a.validate(s);t.executeFunctionByName(n.amsValidateAfterInitCallback,a,r,s)})})},datatable:function(a){var n=e(".datatable",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.dataTable,t.baseURL+"ext/jquery-dataTables-1.9.4"+t.devext+".js",function(){t.ajax.check(e.fn.dataTableExt.oPagination.bootstrap_full,t.baseURL+"myams-dataTables"+t.devext+".js",function(){e(n).each(function(){var a,n=e(this),i=n.data(),s=(i.amsDatatableExtensions||"").split(/\s+/),r=i.amsDatatableSdom||"W"+(s.indexOf("colreorder")>=0||s.indexOf("colreorderwithresize")>=0?"R":"")+"<'dt-top-row'"+(s.indexOf("colvis")>=0?"C":"")+(!1===i.amsDatatablePagination||!1===i.amsDatatablePaginationSize?"":"L")+(!1===i.amsDatatableGlobalFilter?"":"F")+">r<'dt-wrapper't"+(s.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(!1===i.amsDatatableInformation?"":"i")+"><'col-sm-6 text-right'p>>",o=i.amsDatatableSorting;if("string"==typeof o){var c=o.split(";");for(o=[],a=0;a=0,bPaginate:!1!==i.amsDatatablePagination,bInfo:!1!==i.amsDatatableInfo,bSort:!1!==i.amsDatatableSort,aaSorting:o,aoColumns:d.length>0?d:void 0,bDeferRender:!0,bAutoWidth:!1,iDisplayLength:i.amsDatatableDisplayLength||25,sPaginationType:i.amsDatatablePaginationType||"bootstrap_full",sDom:r,oLanguage:t.plugins&&t.plugins.i18n.datatables,fnInitComplete:function(a,n){e(".ColVis_Button").addClass("btn btn-default btn-sm").html((t.plugins&&t.plugins.i18n.datatables.sColumns||"Columns")+' ')}},g=e.extend({},f,i.amsDatatableOptions),x=[],v=[],y=[];if(s.length>0)for(a=0;a0)for(a=0;a0)for(a=0;a0&&t.ajax&&t.ajax.check(e.fn.tableDnD,t.baseURL+"ext/jquery-tablednd"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data();n.amsTabledndDragHandle?e("tr",a).addClass("no-drag-handle"):e(a).on("mouseover","tr",function(){e(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){e(this.cells[0]).removeClass("drag-handle")});var i={onDragClass:n.amsTabledndDragClass||"dragging-row",onDragStart:t.getFunctionByName(n.amsTabledndDragStart),dragHandle:n.amsTabledndDragHandle,scrollAmount:n.amsTabledndScrollAmount,onAllowDrop:n.amsTabledndAllowDrop,onDrop:t.getFunctionByName(n.amsTabledndDrop)||function(i,s){var r=n.amsTabledndDropTarget;if(r){e(s).data("ams-disabled-handlers","click");try{var o=[];e(i.rows).each(function(){var a=e(this).data("ams-element-name");a&&o.push(a)});var c=t.getFunctionByName(r);if("function"==typeof c)c.call(a,i,o);else{if(!r.startsWith(window.location.protocol)){var l=n.amsLocation;l&&(r=l+"/"+r)}t.ajax&&t.ajax.post(r,{names:JSON.stringify(o)},function(e,a){"success"!==e.status&&t.ajax.handleJSON(e)})}}finally{setTimeout(function(){e(s).removeData("ams-disabled-handlers")},50)}}return!1}},s=e.extend({},i,n.amsTabledndOptions);s=t.executeFunctionByName(n.amsTabledndInitCallback,a,s)||s;var r=a.tableDnD(s);t.executeFunctionByName(n.amsTabledndAfterInitCallback,a,r,s)})})},wizard:function(a){var n=e(".wizard",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.bootstrapWizard,t.baseURL+"ext/bootstrap-wizard-1.4.2"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i={withVisible:void 0===n.amsWizardWithVisible||n.amsWizardWithVisible,tabClass:n.amsWizardTabClass,firstSelector:n.amsWizardFirstSelector,previousSelector:n.amsWizardPreviousSelector,nextSelector:n.amsWizardNextSelector,lastSelector:n.amsWizardLastSelector,finishSelector:n.amsWizardFinishSelector,backSelector:n.amsWizardBackSelector,onInit:t.getFunctionByName(n.amsWizardInit),onShow:t.getFunctionByName(n.amsWizardShow),onNext:t.getFunctionByName(n.amsWizardNext),onPrevious:t.getFunctionByName(n.amsWizardPrevious),onFirst:t.getFunctionByName(n.amsWizardFirst),onLast:t.getFunctionByName(n.amsWizardLast),onBack:t.getFunctionByName(n.amsWizardBack),onFinish:t.getFunctionByName(n.amsWizardFinish),onTabChange:t.getFunctionByName(n.amsWizardTabChange),onTabClick:t.getFunctionByName(n.amsWizardTabClick),onTabShow:t.getFunctionByName(n.amsWizardTabShow)},s=e.extend({},i,n.amsWizardOptions);s=t.executeFunctionByName(n.amsWizardInitCallback,a,s)||s;var r=a.bootstrapWizard(s);t.executeFunctionByName(n.amsWizardAfterInitCallback,a,r,s)})})},tinymce:function(a){function n(){e(".tinymce",e(this)).each(function(){var a=tinymce.get(e(this).attr("id"));a&&a.remove()})}var i=e(".tinymce",a);if(i.length>0){var s=t.baseURL+"ext/tinymce"+(t.devmode?"/dev":"");t.ajax&&t.ajax.check(window.tinymce,s+"/tinymce"+t.devext+".js",function(a){function r(){i.each(function(){var a=e(this),n=a.data(),i={theme:n.amsTinymceTheme||"modern",language:t.lang,menubar:!1!==n.amsTinymceMenubar,statusbar:!1!==n.amsTinymceStatusbar,plugins:n.amsTinymcePlugins||["advlist autosave autolink lists link charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code fullscreen","insertdatetime nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern autoresize"],toolbar:n.amsTinymceToolbar,toolbar1:!1!==n.amsTinymceToolbar1&&(n.amsTinymceToolbar1||"undo redo | pastetext | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),toolbar2:!1!==n.amsTinymceToolbar2&&(n.amsTinymceToolbar2||"forecolor backcolor emoticons | charmap link image media | fullscreen preview print | code"),content_css:n.amsTinymceContentCss,formats:n.amsTinymceFormats,style_formats:n.amsTinymceStyleFormats,block_formats:n.amsTinymceBlockFormats,valid_classes:n.amsTinymceValidClasses,image_advtab:!0,image_list:t.getFunctionByName(n.amsTinymceImageList)||n.amsTinymceImageList,image_class_list:n.amsTinymceImageClassList,link_list:t.getFunctionByName(n.amsTinymceLinkList)||n.amsTinymceLinkList,link_class_list:n.amsTinymceLinkClassList,paste_as_text:void 0===n.amsTinymcePasteAsText||n.amsTinymcePasteAsText,paste_auto_cleanup_on_paste:void 0===n.amsTinymcePasteAutoCleanup||n.amsTinymcePasteAutoCleanup,paste_strip_class_attributes:n.amsTinymcePasteStripClassAttributes||"all",paste_remove_spans:void 0===n.amsTinymcePaseRemoveSpans||n.amsTinymcePasteRemoveSpans,paste_remove_styles:void 0===n.amsTinymcePasteRemoveStyles||n.amsTinymcePasteRemoveStyles,height:n.amsTinymceHeight||50,min_height:50,resize:!0,autoresize_min_height:50,autoresize_max_height:500};if(n.amsTinymceExternalPlugins){var s=n.amsTinymceExternalPlugins.split(/\s+/);for(var r in s)if(s.hasOwnProperty(r)){var o=a.data("ams-tinymce-plugin-"+s[r]);tinymce.PluginManager.load(s[r],t.getSource(o))}}var c=e.extend({},i,n.amsTinymceOptions);c=t.executeFunctionByName(n.amsTinymceInitCallback,a,c)||c;var l=a.tinymce(c);t.executeFunctionByName(n.amsTinymceAfterInitCallback,a,l,c)})}a?t.getScript(s+"/jquery.tinymce"+t.devext+".js",function(){tinymce.baseURL=s,tinymce.suffix=t.devext,t.skin&&t.skin.registerCleanCallback(n),r()}):r()})}},editor:function(n){var i=e(".text-editor textarea",n);i.length>0&&t.ajax&&t.ajax.check(a.ace,t.baseURL+"ext/ace/ace.js",function(n){var s=function(){a.ace_loaded=!0,i.each(function(){var a=e(this),n=a.parents(".text-editor"),i=n.data(),s=ace.require("ace/ext/modelist"),r=i.amsEditorMode||s.getModeForPath(i.amsEditorFilename||"editor.txt").mode,o=e("
",{position:"absolute",width:a.width(),height:a.height(),class:a.attr("class")}).insertBefore(a);a.css("display","none");var c=ace.edit(o[0]),l={mode:r,tabSize:4,useSoftTabs:!1,showGutter:!0,showLineNumbers:!0,printMargin:132,showInvisibles:!0},m=e.extend({},l,i.amsEditorOptions);m=t.executeFunctionByName(i.amsEditorInitCallback,a,m)||m,c.setOptions(m),c.session.setValue(a.val()),c.session.on("change",function(){a.val(c.session.getValue())}),n.data("editor",c),t.executeFunctionByName(i.amsEditorAfterInitCallback,a,c,m)})};n?(ace.config.set("basePath",t.baseURL+"ext/ace"),t.ajax.check(a.ace_loaded,[t.baseURL+"ext/ace/ext-modelist.js"],s)):s()})},imgareaselect:function(a){var n=e(".imgareaselect",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.imgAreaSelect,t.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-imgareaselect"+t.devext+".css","jquery-imgareaselect",function(){n.each(function(){var a=e(this),n=a.data(),i=n.amsImgareaselectParent?a.parents(n.amsImgareaselectParent):"body",s={instance:!0,handles:!0,parent:i,x1:n.amsImgareaselectX1||0,y1:n.amsImgareaselectY1||0,x2:n.amsImgareaselectX2||n.amsImgareaselectImageWidth,y2:n.amsImgareaselectY2||n.amsImgareaselectImageHeight,imageWidth:n.amsImgareaselectImageWidth,imageHeight:n.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:n.amsImgareaselectRatio,onSelectEnd:t.getFunctionByName(n.amsImgareaselectSelectEnd)||function(a,t){var s=n.amsImgareaselectTargetField||"image_";e('input[name="'+s+'x1"]',i).val(t.x1),e('input[name="'+s+'y1"]',i).val(t.y1),e('input[name="'+s+'x2"]',i).val(t.x2),e('input[name="'+s+'y2"]',i).val(t.y2)}},r=e.extend({},s,n.amsImgareaselectOptions);r=t.executeFunctionByName(n.amsImgareaselectInitCallback,a,r)||r;var o=a.imgAreaSelect(r);t.executeFunctionByName(n.amsImgareaselectAfterInitCallback,a,o,r),setTimeout(function(){o.update()},250)})})})},fancybox:function(a){var n=e(".fancybox",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.fancybox,t.baseURL+"ext/jquery-fancybox-2.1.5"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-fancybox-2.1.5"+t.devext+".css","jquery-fancybox",function(){n.each(function(){var a,n=e(this),i=n.data(),s=n;i.amsFancyboxElements&&(s=e(i.amsFancyboxElements,n));var r=(i.amsFancyboxHelpers||"").split(/\s+/);if(r.length>0)for(a=0;a0)for(a=0;a0&&t.ajax&&t.ajax.check(e.fn.plot,t.baseURL+"flot/jquery.flot"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i=(n.amsChartPlugins||"").split(/\s+/);if(i.length>0)for(var s in i)if(i.hasOwnProperty(s)){var r=i[s];(function(a){for(var t in e.plot.plugins)if(e.plot.plugins.hasOwnProperty(t)){var n=e.plot.plugins[t];if(n.name===a)return n}return null})(r)||t.getScript(t.baseURL+"flot/jquery.flot."+r+t.devext+".js")}var o=e.extend({},{},n.amsChartOptions);o=t.executeFunctionByName(n.amsChartInitCallback,a,o)||o;var c=n.amsChartData;c=t.executeFunctionByName(n.amsChartInitData,a,c)||c;var l=a.plot(c,o);t.executeFunctionByName(n.amsChartAfterInitCallback,a,l,o)})})},graphs:function(a){var n=e(".sparkline",a);n.length>0&&t.ajax&&t.ajax.check(t.graphs,t.baseURL+"myams-graphs"+t.devext+".js",function(){t.graphs.init(n)})},scrollbars:function(a){var n=e(".scrollbar",a);n.length>0&&t.ajax&&t.ajax.check(e.event.special.mousewheel,t.baseURL+"ext/jquery-mousewheel.min.js",function(){t.ajax.check(e.fn.mCustomScrollbar,t.baseURL+"ext/jquery-mCustomScrollbar"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar",function(){n.each(function(){var a=e(this),n=a.data(),i={theme:n.amsScrollbarTheme||"light"},s=e.extend({},i,n.amsScrollbarOptions);s=t.executeFunctionByName(n.amsScrollbarInitCallback,a,s)||s;var r=a.mCustomScrollbar(s);t.executeFunctionByName(n.amsScrollbarAfterInitCallback,a,r,s)})})})})}})}(jQuery,this); diff -r 8f1bc8caffce -r 5f7cda8f9da3 src/pyams_skin/resources/js/myams.js --- a/src/pyams_skin/resources/js/myams.js Fri Jul 26 19:17:51 2019 +0200 +++ b/src/pyams_skin/resources/js/myams.js Tue Sep 03 16:30:09 2019 +0200 @@ -2486,7 +2486,8 @@ } if (widget.exists()) { // Update widget state - widget.parents('label:first') + widget.parents('label, .input') + .first() .removeClassPrefix('state-') .addClass('state-error') .after('' + widgetData.message + ''); @@ -4284,7 +4285,7 @@ errorElement: 'span', errorClass: 'state-error', errorPlacement: function(error, element) { - var label = element.parents('label:first'); + var label = element.parents('label, .input').first(); if (label.length) { error.insertAfter(label); } else { diff -r 8f1bc8caffce -r 5f7cda8f9da3 src/pyams_skin/resources/js/myams.min.js --- a/src/pyams_skin/resources/js/myams.min.js Fri Jul 26 19:17:51 2019 +0200 +++ b/src/pyams_skin/resources/js/myams.min.js Tue Sep 03 16:30:09 2019 +0200 @@ -1,1 +1,1 @@ -"use strict";!function(e,a){var t=a.console;String.prototype.startsWith=function(e){var a=this.length,t=e.length;return!(a0},void 0===e.scrollbarWidth&&(e.scrollbarWidth=function(){var a=e('
').appendTo("body"),t=a.children(),n=t.innerWidth()-t.height(99).innerWidth();return a.remove(),n}),e.fn.extend({exists:function(){return e(this).length>0},objectOrParentWithClass:function(e){return this.hasClass(e)?this:this.parents("."+e)},listattr:function(a){var t=[];return this.each(function(){t.push(e(this).attr(a))}),t},style:function(e,a,t){if(void 0!==this.get(0)){var n=this.get(0).style;return void 0!==e?void 0!==a?(t=void 0!==t?t:"",n.setProperty(e,a,t),this):n.getPropertyValue(e):n}},removeClassPrefix:function(a){return this.each(function(t,n){var s=n.className.split(" ").map(function(e){return e.startsWith(a)?"":e});n.className=e.trim(s.join(" "))}),this}}),void 0===a.MyAMS&&(a.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var n=a.MyAMS,s=n;n.baseURL=function(){var a=e('script[src*="/myams.js"], script[src*="/myams.min.js"], script[src*="/myams-core.js"], script[src*="/myams-core.min.js"], script[src*="/myams-require.js"], script[src*="/myams-require.min.js"]').attr("src");return s.devmode=a.indexOf(".min.js")<0,s.devext=s.devmode?"":".min",a.substring(0,a.lastIndexOf("/")+1)}(),n.log=function(){t&&t.debug&&t.debug(this,arguments)},n.getQueryVar=function(e,a){if(e.indexOf("?")<0)return!1;e.endsWith("&")||(e+="&");var t=new RegExp(".*?[&\\?]"+a+"=(.*?)&.*"),n=e.replace(t,"$1");return n!==e&&n},n.rgb2hex=function(a){return"#"+e.map(a.match(/\b(\d+)\b/g),function(e){return("0"+parseInt(e).toString(16)).slice(-2)}).join("")},n.generateId=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()+e()},n.generateUUID=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var t=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===a?t:3&t|8).toString(16)})},n.getObject=function(e,a){if(e){if("string"!=typeof e)return e;var t=e.split(".");a=void 0===a||null===a?window:a;for(var n=0;n").attr("data-ams-id",t).text('@import "'+s.getSource(a)+'";'),n)var c=setInterval(function(){try{o[0].sheet.cssRules;n.call(window,!0,i),clearInterval(c)}catch(e){}},10);o.appendTo(r)}else n&&n.call(window,!1,i)},n.initHandlers=function(a){e(a).on("click","[data-ams-click-handler]",function(a){var t=e(this),n=t.data("ams-disabled-handlers");if(!0!==n&&"click"!==n&&"all"!==n){var i=t.data();if(i.amsClickHandler){!0!==i.amsStopPropagation&&!0!==i.amsClickStopPropagation||a.stopPropagation(),!0!==i.amsClickKeepDefault&&a.preventDefault();for(var r=i.amsClickHandler.split(/\s+/),o=0;o127&&n<2048?(a+=String.fromCharCode(n>>6|192),a+=String.fromCharCode(63&n|128)):(a+=String.fromCharCode(n>>12|224),a+=String.fromCharCode(n>>6&63|128),a+=String.fromCharCode(63&n|128))}return a},decode:function(e){for(var a="",t=0,n=0,s=0,i=0;t191&&n<224?(s=e.charCodeAt(t+1),a+=String.fromCharCode((31&n)<<6|63&s),t+=2):(s=e.charCodeAt(t+1),i=e.charCodeAt(t+2),a+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),t+=3);return a}},function(e,a){var t=a.MyAMS;e.fn.extend({contextMenu:function(a){function n(t,n,s){var i=e(window)[n](),r=e(a.menuSelector)[n](),o=t;return t+r>i&&r',openedSign:''},a),n=e(this);n.find("LI").each(function(){var a=e(this);if(a.find("UL").size()>0){a.find("A:first").append(""+t.closedSign+"");var n=a.find("A:first");"#"===n.attr("href")&&n.click(function(){return!1})}}),n.find("LI.active").each(function(){var a=e(this).parents("UL"),n=a.parent("LI");a.slideDown(t.speed),n.find("b:first").html(t.openedSign),n.addClass("open")}),n.find("LI A").on("click",function(){var a=e(this);if(!a.hasClass("active")){var s=a.attr("href").replace(/^#/,""),i=a.parent().find("UL");if(t.accordion){var r=a.parent().parents("UL"),o=n.find("UL:visible");o.each(function(a){var n=!0;if(r.each(function(e){if(r[e]===o[a])return n=!1,!1}),n&&i!==o[a]){var c=e(o[a]);!s&&c.hasClass("active")||c.slideUp(t.speed,function(){e(this).parent("LI").removeClass("open").find("B:first").delay(t.speed).html(t.closedSign)})}})}var c=a.parent().find("UL:first");s||!c.is(":visible")||c.hasClass("active")?c.slideDown(t.speed,function(){a.parent("LI").addClass("open").find("B:first").delay(t.speed).html(t.openedSign)}):c.slideUp(t.speed,function(){a.parent("LI").removeClass("open").find("B:first").delay(t.speed).html(t.closedSign)})}})}})}(jQuery,this),function(e,a){a.MyAMS.event={stop:function(e){e||(e=window.event),e&&"string"!=typeof e&&(e.stopPropagation?(e.stopPropagation(),e.preventDefault()):(e.cancelBubble=!0,e.returnValue=!1))}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.browser={getInternetExplorerVersion:function(){var e=-1;if("Microsoft Internet Explorer"===navigator.appName){var a=navigator.userAgent;null!==new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(a)&&(e=parseFloat(RegExp.$1))}return e},checkVersion:function(){var e="You're not using Windows Internet Explorer.",t=this.getInternetExplorerVersion();t>-1&&(e=t>=8?"You're using a recent copy of Windows Internet Explorer.":"You should upgrade your copy of Windows Internet Explorer."),a.alert&&a.alert(e)},isIE8orlower:function(){var e="0",a=this.getInternetExplorerVersion();return a>-1&&(e=a>=9?0:1),e},copyToClipboard:function(n){function s(n){var s=!1;if(window.clipboardData&&window.clipboardData.setData)s=clipboardData.setData("Text",n);else if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var i=e("