# HG changeset patch # User Thierry Florac # Date 1480684824 -3600 # Node ID 087f22a85c26253aecd212c5db351dd837c222a4 # Parent cbf2ef06ee8573b9fc1fbd9d0bf68f94775bd630 Updated management of dynamic plug-ins diff -r cbf2ef06ee85 -r 087f22a85c26 src/pyams_skin/resources/js/myams.js --- a/src/pyams_skin/resources/js/myams.js Fri Dec 02 14:20:03 2016 +0100 +++ b/src/pyams_skin/resources/js/myams.js Fri Dec 02 14:20:24 2016 +0100 @@ -2,7 +2,7 @@ * MyAMS * « My Application Management Skin » * - * $Tag$ (rev. 15) + * $Tag$ (rev. 16) * A bootstrap based application/administration skin * * Custom administration and application skin tools @@ -540,6 +540,16 @@ } }; + /** + * Check to know if given element is still present in DOM + */ + MyAMS.isInDOM = function(element) { + element = $(element); + if (!element.exists()) { + return false; + } + return globals.document.contains(element[0]); + }; /** * Get script or CSS file using browser cache @@ -2505,7 +2515,7 @@ // Inner plug-in loader function var plugin; - function _loadPlugin() { + function _loadPlugin(reload) { var index; var callbacks = plugin.callbacks, callback; @@ -2527,9 +2537,9 @@ ams.plugins.enabled[name] = null; } } - // If running in async mode, registered plug-ins are run + // If running in async mode, newly registered plug-ins are run // before callback is called so we call plug-in manually - if (callbacks && callbacks.length && (plugin.async !== false)) { + if ((reload !== true) && callbacks && callbacks.length && (plugin.async !== false)) { for (index=0; index < callbacks.length; index++) { callback = callbacks[index]; ams.executeFunctionByName(callback.callback, element, callback.context); @@ -2537,12 +2547,27 @@ } } + function _checkPluginContext() { + // Update context for an already loaded plug-in + var enabled = ams.plugins.enabled[name]; + // Clean all plug-in contexts + for (index=0; index < enabled.length; index++) { + var callback = enabled[index]; + if (callback && callback.context && !ams.isInDOM(callback.context)) { + enabled[index] = null; + } + } + } + for (name in plugins) { + plugin = plugins[name]; if (ams.plugins.enabled[name] === undefined) { - plugin = plugins[name]; ams.getScript(plugin.src, _loadPlugin, { async: plugin.async === undefined ? true : plugin.async }); + } else { + _checkPluginContext(); + _loadPlugin(true); } } @@ -2568,7 +2593,9 @@ callback(element); break; default: - callback.callback(callback.context); + if (callback && callback.callback) { + callback.callback(callback.context); + } } } } diff -r cbf2ef06ee85 -r 087f22a85c26 src/pyams_skin/resources/js/myams.min.js --- a/src/pyams_skin/resources/js/myams.min.js Fri Dec 02 14:20:03 2016 +0100 +++ b/src/pyams_skin/resources/js/myams.min.js Fri Dec 02 14:20:24 2016 +0100 @@ -1,1 +1,1 @@ -(function(c,b){String.prototype.startsWith=function(g){var e=this.length,f=g.length;if(e0};if(c.scrollbarWidth===undefined){c.scrollbarWidth=function(){var f=c('
').appendTo("body");var g=f.children();var e=g.innerWidth()-g.height(99).innerWidth();f.remove();return e}}c.fn.extend({exists:function(){return c(this).length>0},objectOrParentWithClass:function(e){if(this.hasClass(e)){return this}else{return this.parents("."+e)}},listattr:function(f){var e=[];this.each(function(){e.push(c(this).attr(f))});return e},style:function(f,i,e){var h=this.get(0);if(typeof(h)==="undefined"){return}var g=this.get(0).style;if(typeof(f)!=="undefined"){if(typeof(i)!=="undefined"){e=typeof(e)!=="undefined"?e:"";g.setProperty(f,i,e);return this}else{return g.getPropertyValue(f)}}else{return g}},removeClassPrefix:function(e){this.each(function(g,h){var f=h.className.split(" ").map(function(i){return i.startsWith(e)?"":i});h.className=c.trim(f.join(" "))});return this},contextMenu:function(f){function e(i,k,h){var j=c(window)[k](),l=c(f.menuSelector)[k](),g=i;if(i+l>j&&l',openedSign:''};var f=c.extend({},g,e);var h=c(this);h.find("LI").each(function(){var i=c(this);if(i.find("UL").size()>0){i.find("A:first").append(""+f.closedSign+"");var j=i.find("A:first");if(j.attr("href")==="#"){j.click(function(){return false})}}});h.find("LI.active").each(function(){var i=c(this).parents("UL");var j=i.parent("LI");i.slideDown(f.speed);j.find("b:first").html(f.openedSign);j.addClass("open")});h.find("LI A").on("click",function(){var l=c(this);if(l.hasClass("active")){return}var i=l.attr("href").replace(/^#/,"");var k=l.parent().find("UL");if(f.accordion){var j=l.parent().parents("UL");var m=h.find("UL:visible");m.each(function(o){var q=true;j.each(function(r){if(j[r]===m[o]){q=false;return false}});if(q){if(k!==m[o]){var p=c(m[o]);if(i||!p.hasClass("active")){p.slideUp(f.speed,function(){c(this).parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}}}})}var n=l.parent().find("UL:first");if(!i&&n.is(":visible")&&!n.hasClass("active")){n.slideUp(f.speed,function(){l.parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}else{n.slideDown(f.speed,function(){l.parent("LI").addClass("open").find("B:first").delay(f.speed).html(f.openedSign)})}})}});c.UTF8={encode:function(f){f=f.replace(/\r\n/g,"\n");var e="";for(var h=0;h127)&&(g<2048)){e+=String.fromCharCode((g>>6)|192);e+=String.fromCharCode((g&63)|128)}else{e+=String.fromCharCode((g>>12)|224);e+=String.fromCharCode(((g>>6)&63)|128);e+=String.fromCharCode((g&63)|128)}}}return e},decode:function(e){var g="";var j=0,k=0,h=0,f=0;while(j191)&&(k<224)){h=e.charCodeAt(j+1);g+=String.fromCharCode(((k&31)<<6)|(h&63));j+=2}else{h=e.charCodeAt(j+1);f=e.charCodeAt(j+2);g+=String.fromCharCode(((k&15)<<12)|((h&63)<<6)|(f&63));j+=3}}}return g}};if(b.MyAMS===undefined){b.MyAMS={devmode:true,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:true,enableWidgets:true,enableMobile:false,enableFastclick:false,warnOnFormChange:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var d=b.MyAMS;var a=d;d.baseURL=(function(){var e=c('script[src*="/myams.js"], script[src*="/myams.min.js"]');var f=e.attr("src");a.devmode=f.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return f.substring(0,f.lastIndexOf("/")+1)})();d.log=function(){if(b.console){b.console.log(this,arguments)}};d.getQueryVar=function(g,h){if(g.indexOf("?")<0){return false}if(!g.endsWith("&")){g+="&"}var e=new RegExp(".*?[&\\?]"+h+"=(.*?)&.*");var f=g.replace(e,"$1");return f===g?false:f};d.rgb2hex=function(e){return"#"+c.map(e.match(/\b(\d+)\b/g),function(f){return("0"+parseInt(f).toString(16)).slice(-2)}).join("")};d.generateId=function(){function e(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return e()+e()+e()+e()};d.generateUUID=function(){var f=new Date().getTime();var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(h){var g=(f+Math.random()*16)%16|0;f=Math.floor(f/16);return(h==="x"?g:(g&3|8)).toString(16)});return e};d.getFunctionByName=function(k,g){if(k===undefined){return undefined}else{if(typeof(k)==="function"){return k}}var j=k.split(".");var h=j.pop();g=(g===undefined||g===null)?window:g;for(var f=0;f").attr({rel:"stylesheet",type:"text/css",href:h,"data-ams-id":i}).appendTo(g)}};d.event={stop:function(e){if(!e){e=window.event}if(e){if(e.stopPropagation){e.stopPropagation();e.preventDefault()}else{e.cancelBubble=true;e.returnValue=false}}}};d.browser={getInternetExplorerVersion:function(){var g=-1;if(navigator.appName==="Microsoft Internet Explorer"){var e=navigator.userAgent;var f=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(f.exec(e)!==null){g=parseFloat(RegExp.$1)}}return g},checkVersion:function(){var f="You're not using Windows Internet Explorer.";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=8){f="You're using a recent copy of Windows Internet Explorer."}else{f="You should upgrade your copy of Windows Internet Explorer."}}if(b.alert){b.alert(f)}},isIE8orlower:function(){var f="0";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=9){f=0}else{f=1}}return f},copyToClipboard:function(){return function(){var e=c(this);e.parents(".btn-group").removeClass("open");if(b.prompt){b.prompt(d.i18n.CLIPBOARD_COPY,e.text())}}}};d.error={ajax:function(i,e,h,f){if(e.statusText==="OK"){return}var e=a.ajax.getResponse(e);if(e.contentType==="json"){a.ajax.handleJSON(e.data)}else{var j=i.statusText||i.type;var g=e.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

"+j+"

"+g+"

",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(i);b.console.debug(e)}},show:function(h,e,g){if(!g){return}var f=a.ajax.getResponse(h);if(f.contentType==="json"){a.ajax.handleJSON(f.data)}else{a.skin.messageBox("error",{title:a.i18n.ERRORS_OCCURED,content:"

"+e+"

"+g+"

",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(g);b.console.debug(h)}}};d.ajax={check:function(f,h,j,e){if(typeof(j)==="object"){e=j;j=undefined}var i={async:typeof(j)==="function"};var g=c.extend({},i,e);if(f===undefined){a.getScript(h,function(){if(typeof(j)==="function"){j(true,e)}},g)}else{if(typeof(j)==="function"){j(false,e)}}},getAddr:function(f){var e=f||c("HTML HEAD BASE").attr("href")||window.location.href;return e.substr(0,e.lastIndexOf("/")+1)},start:function(){c("#ajax-gear").show()},stop:function(){c("#ajax-gear").hide()},progress:function(e){if(!e.lengthComputable){return}if(e.loaded>=e.total){return}if(b.console){b.console.log(parseInt((e.loaded/e.total*100),10)+"%")}},post:function(g,i,f,l){var k;if(g.startsWith(window.location.protocol)){k=g}else{k=this.getAddr()+g}if(typeof(f)==="function"){l=f;f={}}else{if(!f){f={}}}if(typeof(l)==="undefined"){l=f.callback}if(typeof(l)==="string"){l=a.getFunctionByName(l)}delete f.callback;var e;var j={url:k,type:"post",cache:false,async:typeof(l)==="function",data:c.param(i),dataType:"json",success:l||function(m){e=m.result}};var h=c.extend({},j,f);c.ajax(h);return e},getResponse:function(h){var j=h.getResponseHeader("content-type"),g,f;if(j){if(j.startsWith("application/javascript")){g="script";f=h.responseText}else{if(j.startsWith("text/html")){g="html";f=h.responseText}else{if(j.startsWith("text/xml")){g="xml";f=h.responseText}else{f=h.responseJSON;if(f){g="json"}else{try{f=JSON.parse(h.responseText);g="json"}catch(i){f=h.responseText;g="text"}}}}}}else{g="json";f={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{contentType:g,data:f}},handleJSON:function(p,g,k){var i=p.status;var e;switch(i){case"alert":if(b.alert){b.alert(p.alert.title+"\n\n"+p.alert.content)}break;case"error":a.form.showErrors(g,p);break;case"info":case"success":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}break;case"modal":a.dialog.open(p.location);break;case"reload":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}e=p.location||window.location.hash;if(e.startsWith("#")){e=e.substr(1)}a.skin.loadURL(e,p.target||k||"#content");break;case"redirect":a.form.resetChanged(g);if(p.close_form===true){a.dialog.close(g)}e=p.location||window.location.href;if(p.window){window.open(e,p.window,p.options)}else{if(window.location.href===e){window.location.reload(true)}else{window.location.href=e}}break;default:if(b.console){b.console.log("Unhandled status: "+i)}}var j;var l;var f;if(p.content){l=p.content;f=c(l.target||k||g||"#content");if(l.raw===true){f.text(l.text)}else{f.html(l.html);a.initContent(f)}if(!l.keep_hidden){f.removeClass("hidden")}}if(p.contents){var h=p.contents;for(j=0;j  '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){h.call(g)}})}}else{h.call(g)}},setChanged:function(e){e.attr("data-ams-form-changed",true)},resetChanged:function(e){if(e!==undefined){c(e).removeAttr("data-ams-form-changed")}},submit:function(h,g,f){h=c(h);if(!h.exists()){return false}if(typeof(g)==="object"){f=g;g=undefined}if(h.data("submitted")){if(!h.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:h.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(h)){return false}c(".alert-danger, SPAN.state-error",h).not(".persistent").remove();c(".state-error",h).removeClassPrefix("state-");var e=c(h.data("ams-submit-button"));if(e&&!e.data("ams-form-hide-loading")){e.button("loading")}a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function k(o,s){var m,z,D;var K=o.data();var n=K.amsFormOptions;var C;var q;var u;var t;var l;var H;function p(O,P){var N;function M(){m.button("reset");clearInterval(N);a.executeFunctionByName(H,o,m)}function L(){a.ajax.post(O,{progress_id:P},{error:M},a.getFunctionByName(l)||function(Q,R){if(R==="success"){if(Q.status==="running"){if(Q.message){m.text(Q.message)}else{m.text(m.data("ams-progress-text")+" "+Q.current+" / "+Q.length)}}else{if(Q.status==="finished"){M()}}}else{M()}})}m.button("loading");N=setInterval(L,t)}if(f){q=f.formDataInitCallback}if(q){delete f.formDataInitCallback}else{q=K.amsFormDataInitCallback}if(q){var A={};if(typeof(q)==="function"){C=q.call(o,A)}else{C=a.executeFunctionByName(q,o,A)}if(A.veto){m=o.data("ams-submit-button");if(m){m.button("reset")}a.form.finalizeSubmitFooter.call(o);return false}}else{C=K.amsFormData||{}}m=c(o.data("ams-submit-button"));if(m&&m.exists()){z=m.data();D=z.amsFormSubmitTarget}else{z={}}var v;var I=g||z.amsFormHandler||K.amsFormHandler||"";if(I.startsWith(window.location.protocol)){v=I}else{var B=z.amsFormAction||o.attr("action").replace(/#/,"");if(B.startsWith(window.location.protocol)){v=B}else{v=a.ajax.getAddr()+B}v+=I}u=z.amsProgressHandler||K.amsProgressHandler||"";t=z.amsProgressInterval||K.amsProgressInterval||1000;l=z.amsProgressCallback||K.amsProgressCallback;H=z.amsProgressEndCallback||K.amsProgressEndCallback;var J=null;if(f&&f.initSubmitTarget){a.executeFunctionByName(f.initSubmitTarget,o)}else{if(K.amsFormInitSubmitTarget){J=c(D||K.amsFormSubmitTarget||"#content");a.executeFunctionByName(K.amsFormInitSubmit||"MyAMS.form.initSubmit",o,J)}else{if(!K.amsFormHideSubmitFooter){a.executeFunctionByName(K.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",o)}}}if(f){C=c.extend({},C,f.form_data)}var w;if(u){C.progress_id=a.generateUUID()}else{w=typeof(s.uuid)!=="undefined";if(w){if(v.indexOf("X-Progress-ID")<0){v+="?X-Progress-ID="+s.uuid}delete s.uuid}}var y={url:v,type:"post",cache:false,data:C,dataType:K.amsFormDatatype,beforeSerialize:function(){if(typeof(b.tinyMCE)!=="undefined"){b.tinyMCE.triggerSave()}},beforeSubmit:function(M,L){L.data("submitted",true)},error:function(O,L,M,N){if(J){a.executeFunctionByName(K.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",N,J)}a.form.resetAfterSubmit(N)},iframe:w};var F=(f&&f.downloadTarget)||K.amsFormDownloadTarget;if(F){var x=c('iframe[name="'+F+'"]');if(!x.exists()){x=c("").hide().attr("name",F).appendTo(c("body"))}y=c.extend({},y,{iframe:true,iframeTarget:x,success:function(L,M,Q,P){var O=c(P).parents(".modal-dialog");if(O.exists()){a.dialog.close(P)}else{var R;var N=P.data("ams-submit-button");if(N){R=N.data("ams-form-submit-callback")}if(!R){R=a.getFunctionByName(K.amsFormSubmitCallback)||a.form._submitCallback}try{R.call(P,L,M,Q,P)}finally{a.form.resetAfterSubmit(P);a.form.resetChanged(P)}}}})}else{y=c.extend({},y,{error:function(O,L,M,N){if(J){a.executeFunctionByName(K.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",N,J)}a.form.resetAfterSubmit(N)},success:function(L,M,P,O){var Q;var N=O.data("ams-submit-button");if(N){Q=N.data("ams-form-submit-callback")}if(!Q){Q=a.getFunctionByName(K.amsFormSubmitCallback)||a.form._submitCallback}try{Q.call(O,L,M,P,O)}finally{a.form.resetAfterSubmit(O);a.form.resetChanged(O)}},iframe:w})}var G=c.extend({},y,s,n,f);if(u){p(u,C.progress_id)}c(o).ajaxSubmit(G);if(F){var E=c(o).parents(".modal-dialog");var r=E.exists()&&m.exists()&&m.data("ams-keep-modal");if(E.exists()&&(r!==true)){a.dialog.close(o)}else{setTimeout(function(){a.form.resetAfterSubmit(o,m);a.form.resetChanged(o)},m.data("ams-form-reset-timeout")||2000)}}}var j=(h.data("ams-form-ignore-uploads")!==true)&&(c('INPUT[type="file"]',h).length>0);if(j){a.ajax.check(c.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var i=c.extend({},{uuid:c.progressBar.submit(h)});k(h,i)}else{k(h,{})}});return false},initSubmit:function(g,f){var e=c(this);var h='';if(!f){f=e.data("ams-form-submit-message")}if(f){h+=""+f+""}c(g).html('
'+h+"
");c(g).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(f){if(f.is(":visible")){var e=f.data("ams-submit-button");if(e){e.button("reset")}a.form.finalizeSubmitFooter.call(f)}f.data("submitted",false);f.removeData("ams-submit-button")},finalizeSubmitOnError:function(e){c("i",e).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(f){var e=c(this);var h='';if(!f){f=c(this).data("ams-form-submit-message")}if(f){h+=''+f+""}var g=c("footer",e);c("button",g).hide();g.append('
'+h+"
")},finalizeSubmitFooter:function(){var e=c(this);var f=c("footer",e);if(f){c(".row",f).remove();c("button",f).show()}},_submitCallback:function(o,h,g,e){var j;if(e.is(":visible")){a.form.finalizeSubmitFooter.call(e);j=e.data("ams-submit-button");if(j){j.button("reset")}}var i=e.data();var l;if(i.amsFormDatatype){l=i.amsFormDatatype}else{var f=a.ajax.getResponse(g);l=f.contentType;o=f.data}var k;if(j){k=c(j.data("ams-form-submit-target")||i.amsFormSubmitTarget||"#content")}else{k=c(i.amsFormSubmitTarget||"#content")}switch(l){case"json":a.ajax.handleJSON(o,e,k);break;case"script":break;case"xml":break;case"html":case"text":default:a.form.resetChanged(e);if(j&&(j.data("ams-keep-modal")!==true)){a.dialog.close(e)}if(!k.exists()){k=c("body")}k.parents(".hidden").removeClass("hidden");c(".alert",k.parents(".alerts-container")).remove();k.css({opacity:"0.0"}).html(o).delay(50).animate({opacity:"1.0"},300);a.initContent(k);a.form.setFocus(k)}var m=g.getResponseHeader("X-AMS-Callback");if(m){var n=g.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(m,e,n===undefined?{}:JSON.parse(n),g)}},_getSubmitValidators:function(f){var e=[];var g=f.data("ams-form-validator");if(g){e.push([f,g])}c("[data-ams-form-validator]",f).each(function(){var h=c(this);e.push([h,h.data("ams-form-validator")])});return e},_checkSubmitValidators:function(g){var i=a.form._getSubmitValidators(g);if(!i.length){return true}var h=[];var n=true;for(var k=0;k0)){h=h.concat(n)}}}}if(h.length>0){var j=h.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(g,"danger",j,h);return false}else{return n}},showErrors:function(e,l){var i;if(typeof(l)==="string"){a.skin.alert(e,"error",a.i18n.ERROR_OCCURED,l)}else{if(l instanceof Array){i=l.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"error",i,l)}else{c(".state-error",e).removeClass("state-error");i=l.error_header||(l.widgets&&(l.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var n=[];var k;if(l.messages){for(k=0;k"+h.header+"
"+h.message)}else{n.push(h.message||h)}}}if(l.widgets){for(k=0;k'+m.message+"");if(m.label){n.push(m.label+" : "+m.message)}var g=j.parents(".tab-pane").index()+1;if(g>0){var f=c(".nav-tabs",c(j).parents(".tabforms"));c("li:nth-child("+g+")",f).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",e).click()}}}a.skin.alert(c("fieldset:first",e),l.error_level||"error",i,n,l.error_message)}}}};d.dialog={_shown_callbacks:[],registerShownCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("shown-callbacks");if(g===undefined){g=[];e.data("shown-callbacks",g)}}else{g=a.dialog._shown_callbacks}if(g.indexOf(h)<0){g.push(h)}},_hide_callbacks:[],registerHideCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("hide-callbacks");if(g===undefined){g=[];e.data("hide-callbacks",g)}}else{g=a.dialog._hide_callbacks}if(g.indexOf(h)<0){g.push(h)}},open:function(f,e){a.ajax.check(c.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(c.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(j){if(j){c(document).off("click.modal");c.fn.modal.defaults.spinner=c.fn.modalmanager.defaults.spinner='
'}var i;var h;if(typeof(f)==="string"){i={};h=f}else{i=f.data();h=f.attr("href")||i.amsUrl;var g=a.getFunctionByName(h);if(typeof(g)==="function"){h=g.call(f)}}if(!h){return}c("body").modalmanager("loading");if(h.indexOf("#")===0){c(h).modal("show")}else{c.ajax({url:h,type:"get",cache:i.amsAllowCache===undefined?false:i.amsAllowCache,data:e,success:function(o,n,m){c("body").modalmanager("removeLoading");var l=a.ajax.getResponse(m);var s=l.contentType;var u=l.data;switch(s){case"json":a.ajax.handleJSON(u,c(c(f).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var q=c(u);var r=c(".modal-dialog",q.wrap("
").parent());var p=r.data();var t={backdrop:"static",overflow:p.amsModalOverflow||".modal-viewport",maxHeight:p.amsModalMaxHeight===undefined?function(){return c(window).height()-c(".modal-header",q).outerHeight(true)-c("footer",q).outerHeight(true)-85}:a.getFunctionByName(p.amsModalMaxHeight)};var k=c.extend({},t,p.amsModalOptions);k=a.executeFunctionByName(p.amsModalInitCallback,r,k)||k;c("
").addClass("modal fade").append(q).modal(k).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(q);if(i.amsLogEvent!==false){a.stats.logPageview(h)}}}})}})})},shown:function(m){function l(o){var p=c(".scrollmarker.top",f);var n=f.scrollTop();if(n>0){p.show()}else{p.hide()}var e=c(".scrollmarker.bottom",f);if(j+n>=f.get(0).scrollHeight){e.hide()}else{e.show()}}var k=m.target;var f=c(".modal-viewport",k);if(f.exists()){var j=parseInt(f.css("max-height"));var h=c.scrollbarWidth();if((f.css("overflow")!=="hidden")&&(f.height()===j)){c("
").addClass("scrollmarker").addClass("top").css("top",0).css("width",f.width()-h).hide().appendTo(f);c("
").addClass("scrollmarker").addClass("bottom").css("top",j-20).css("width",f.width()-h).appendTo(f);f.scroll(l);f.off("resize").on("resize",l)}else{c(".scrollmarker",f).remove()}}c("[data-ams-shown-callback]",k).each(function(){var e=a.getFunctionByName(c(this).data("ams-shown-callback"));if(e){e.call(k,this)}});var g;var i=c(".modal-dialog",k).data("shown-callbacks");if(i){for(g=0;g=0)){g.hide()}}},hidden:function(i){var h=i.target;a.skin.cleanContainer(h);c("[data-ams-hidden-callback]",h).each(function(){var e=a.getFunctionByName(c(this).data("ams-hidden-callback"));if(e){e.call(h,this)}});var f;var g=c(".modal-dialog",h).data("hide-callbacks");if(g){for(f=0;f"+g.error_message+"",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(g.location);break;default:return{results:g.results||g,more:g.has_more||false,context:g.context}}},select2QueryMethodSuccessCallback:function(i,g,h){var f=i.result;if(typeof(f)==="string"){try{f=JSON.parse(f)}catch(j){}}switch(f.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

"+f.error_message+"

",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(f.location);break;default:h.callback({results:f.results||f,more:f.has_more||false,context:f.context})}},contextMenuHandler:function(h,i){var g=i.data();if(g.toggle==="modal"){a.dialog.open(i)}else{var f=i.attr("href")||g.amsUrl;if(!f||f.startsWith("javascript")||i.attr("target")){return}a.event.stop();var e=a.getFunctionByName(f);if(typeof(e)==="function"){f=e.call(i,h)}if(typeof(f)==="function"){f.call(i,h)}else{f=f.replace(/\%23/,"#");h=i.data("ams-target");if(h){a.form.confirmChangedForm(h,function(){a.skin.loadURL(f,h,i.data("ams-link-options"),i.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(f.startsWith("#")){if(f!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=f},150)}else{window.location.hash=f}}}else{window.location=f}})}}}},datetimepickerDialogHiddenCallback:function(){c(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};d.plugins={init:function(k){a.plugins.initData(k);var j=[];c("[data-ams-plugins-disabled]",k).each(function(){var p=c(this).data("ams-plugins-disabled").split(/\s+/);for(var q=0;q=0){continue}var n=a.plugins.enabled[m];if(n){switch(typeof(n)){case"function":n(k);break;default:for(var g=0;g=0){if(b.console){b.console.warn("Plugin "+e+" is already registered!")}return}if(typeof(f)==="object"){var g=f.src;if(g){a.ajax.check(f.callback,g,function(i){if(i){a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}})}else{a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}}else{if(typeof(f)==="function"){a.plugins.enabled[e]=f;if(h){a.executeFunctionByName(h)}}}},enabled:{hint:function(e){var f=c(".hint:not(:parents(.nohints))",e);if(f.length>0){a.ajax.check(c.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");f.each(function(){var j=c(this);var i=j.data();var k={html:i.amsHintHtml,title:a.getFunctionByName(i.amsHintTitleGetter)||function(){var l=c(this);return l.attr("original-title")||l.attr(i.amsHintTitleAttr||"title")||(i.amsHintHtml?l.html():l.text())},opacity:i.amsHintOpacity||0.95,gravity:i.amsHintGravity||"sw",offset:i.amsHintOffset||0};var g=c.extend({},k,i.amsHintOptions);g=a.executeFunctionByName(i.amsHintInitCallback,j,g)||g;var h=j.tipsy(g);a.executeFunctionByName(i.amsHintAfterInitCallback,j,h,g)})})}},contextMenu:function(e){var f=c(".context-menu",e);if(f.length>0){f.each(function(){var j=c(this);var i=j.data();var k={menuSelector:i.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var g=c.extend({},k,i.amsContextmenuOptions);g=a.executeFunctionByName(i.amsContextmenuInitCallback,j,g)||g;var h=j.contextMenu(g);a.executeFunctionByName(i.amsContextmenuAfterInitCallback,j,h,g)})}},switcher:function(e){c("LEGEND.switcher",e).each(function(){var g=c(this);var f=g.parent("fieldset");var h=g.data();if(!h.amsSwitcher){c('').prependTo(c(this)).addClass(h.amsSwitcherState==="open"?(h.amsSwitcherMinusClass||"fa-minus"):(h.amsSwitcherPlusClass||"fa-plus"));g.on("click",function(j){j.preventDefault();var i={};g.trigger("ams.switcher.before-switch",[g,i]);if(i.veto){return}if(f.hasClass("switched")){f.removeClass("switched");c(".fa",g).removeClass(h.amsSwitcherPlusClass||"fa-plus").addClass(h.amsSwitcherMinusClass||"fa-minus");g.trigger("ams.switcher.opened",[g]);var k=g.attr("id");if(k){c('legend.switcher[data-ams-switcher-sync="'+k+'"]',f).each(function(){var l=c(this);if(l.parents("fieldset").hasClass("switched")){l.click()}})}}else{f.addClass("switched");c(".fa",g).removeClass(h.amsSwitcherMinusClass||"fa-minus").addClass(h.amsSwitcherPlusClass||"fa-plus");g.trigger("ams.switcher.closed",[g])}});if(h.amsSwitcherState!=="open"){f.addClass("switched")}g.data("ams-switcher","on")}})},checker:function(e){c("LEGEND.checker",e).each(function(){var p=c(this);var r=p.parent("fieldset");var h=p.data();if(!h.amsChecker){var f=c('');var k=h.amsCheckerFieldname||("checker_"+a.generateId());var q=k.replace(/\./,"_");var i=h.amsCheckerHiddenPrefix;var j=null;var n=h.amsCheckerHiddenValueOn||"true";var l=h.amsCheckerHiddenValueOff||"false";var g=h.amsCheckerMarker||false;if(i){j=c('').attr("name",i+k).val(h.amsCheckerState==="on"?n:l).prependTo(p)}else{if(g){c('').attr("name",g).attr("value",1).prependTo(p)}}var o=c('').attr("name",k).attr("id",q).data("ams-checker-hidden-input",j).data("ams-checker-init",true).val(h.amsCheckerValue||true).attr("checked",h.amsCheckerState==="on"?"checked":null);if(h.amsCheckerReadonly){o.attr("disabled","disabled")}else{o.on("change",function(u){u.preventDefault();var s={};var v=c(this).is(":checked");p.trigger("ams.checker.before-switch",[p,s]);if(s.veto){c(this).prop("checked",!v);return}a.executeFunctionByName(h.amsCheckerChangeHandler,p,v);if(!h.amsCheckerCancelDefault){var t=o.data("ams-checker-hidden-input");if(v){if(h.amsCheckerMode==="disable"){r.removeAttr("disabled")}else{r.removeClass("switched")}if(t){t.val(n)}c("[data-required]",r).attr("required","required");p.trigger("ams.checker.opened",[p])}else{if(h.amsCheckerMode==="disable"){r.prop("disabled","disabled")}else{r.addClass("switched")}if(t){t.val(l)}c("[data-required]",r).removeAttr("required");p.trigger("ams.checker.closed",[p])}}})}o.appendTo(f);c(">label",p).attr("for",o.attr("id"));f.append("").prependTo(p);var m=c("[required]",r);m.attr("data-required",true);if(h.amsCheckerState==="on"){o.attr("checked",true)}else{if(h.amsCheckerMode==="disable"){r.attr("disabled","disabled")}else{r.addClass("switched")}m.removeAttr("required")}p.data("ams-checker","on")}})},slider:function(e){var f=c(".slider",e);if(f.length>0){a.ajax.check(c.fn.slider,a.baseURL+"ext/bootstrap-slider-2.0.0"+a.devext+".js",function(){f.each(function(){var i=c(this);var j=i.data();var k={};var g=c.extend({},k,i.data.amsSliderOptions);g=a.executeFunctionByName(j.amsSliderInitCallback,i,g)||g;var h=i.slider(g);a.executeFunctionByName(j.amsSliderAfterInitCallback,i,h,g)})})}},draggable:function(f){var e=c(".draggable",f);if(e.length>0){e.each(function(){var g=c(this);var j=g.data();var k={containment:j.amsDraggableContainment,helper:a.getFunctionByName(j.amsDraggableHelper)||j.amsDraggableHelper,start:a.getFunctionByName(j.amsDraggableStart),stop:a.getFunctionByName(j.amsDraggableStop)};var h=c.extend({},k,j.amsDraggableOptions);h=a.executeFunctionByName(j.amsDraggableInitCallback,g,h)||h;var i=g.draggable(h);g.disableSelection();a.executeFunctionByName(j.amsDraggableAfterInitCallback,g,i,h)})}},sortable:function(e){var f=c(".sortable",e);if(f.length>0){f.each(function(){var k=c(this);var i=k.data();var j={items:i.amsSortableItems,handle:i.amsSortableHandle,connectWith:i.amsSortableConnectwith,start:a.getFunctionByName(i.amsSortableStart),over:a.getFunctionByName(i.amsSortableOver),containment:i.amsSortableContainment,placeholder:i.amsSortablePlaceholder,stop:a.getFunctionByName(i.amsSortableStop)};var g=c.extend({},j,i.amsSortableOptions);g=a.executeFunctionByName(i.amsSortableInitCallback,k,g)||g;var h=k.sortable(g);k.disableSelection();a.executeFunctionByName(i.amsSortableAfterInitCallback,k,h,g)})}},resizable:function(f){var e=c(".resizable",f);if(e.length>0){e.each(function(){var g=c(this);var j=g.data();var k={autoHide:j.amsResizableAutohide===false?true:j.amsResizableAutohide,containment:j.amsResizableContainment,grid:j.amsResizableGrid,handles:j.amsResizableHandles,start:a.getFunctionByName(j.amsResizableStart),stop:a.getFunctionByName(j.amsResizableStop)};var h=c.extend({},k,j.amsResizableOptions);h=a.executeFunctionByName(j.amsResizableInitCallback,g,h)||h;var i=g.resizable(h);g.disableSelection();a.executeFunctionByName(j.amsResizableAfterInitCallback,g,i,h)})}},typeahead:function(f){var e=c(".typeahead",f);if(e.length>0){a.ajax.check(c.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){e.each(function(){var g=c(this);var j=g.data();var k={};var h=c.extend({},k,j.amsTypeaheadOptions);h=a.executeFunctionByName(j.amsTypeaheadInitCallback,g,h)||h;var i=g.typeahead(h);a.executeFunctionByName(j.amsTypeaheadAfterInitCallback,g,i,h)})})}},select2:function(f){var e=c(".select2",f);if(e.length>0){a.ajax.check(c.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var l={placeholder:k.amsSelect2Placeholder,multiple:k.amsSelect2Multiple,minimumInputLength:k.amsSelect2MinimumInputLength||0,maximumSelectionSize:k.amsSelect2MaximumSelectionSize,openOnEnter:k.amsSelect2EnterOpen===undefined?true:k.amsSelect2EnterOpen,allowClear:k.amsSelect2AllowClear===undefined?true:k.amsSelect2AllowClear,width:k.amsSelect2Width||"100%",initSelection:a.getFunctionByName(k.amsSelect2InitSelection),formatSelection:k.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(k.amsSelect2FormatSelection),formatResult:a.getFunctionByName(k.amsSelect2FormatResult),formatMatches:k.amsSelect2FormatMatches===undefined?function(m){if(m===1){return a.i18n.SELECT2_MATCH}else{return m+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(k.amsSelect2FormatMatches),formatNoMatches:k.amsSelect2FormatResult===undefined?function(m){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(k.amsSelect2FormatResult),formatInputTooShort:k.amsSelect2FormatInputTooShort===undefined?function(m,o){var p=o-m.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(k.amsSelect2FormatInputTooShort),formatInputTooLong:k.amsSelect2FormatInputTooLong===undefined?function(o,m){var p=o.length-m;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(k.amsSelect2FormatInputTooLong),formatSelectionTooBig:k.amsSelect2FormatSelectionTooBig===undefined?function(m){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,m).replace(/\{1\}/,m===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(k.amsSelect2FormatSelectionTooBig),formatLoadMore:k.amsSelect2FormatLoadMore===undefined?function(m){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(k.amsSelect2FormatLoadMore),formatSearching:k.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(k.amsSelect2FormatSearching),separator:k.amsSelect2Separator||",",tokenSeparators:k.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(k.amsSelect2Tokenizer)};switch(g.context.type){case"text":case"hidden":if(!l.initSelection){var h=g.data("ams-select2-values");if(h){l.initSelection=function(m,o){var n=[];c(m.val().split(l.separator)).each(function(){n.push({id:this,text:h[this]||this})});o(n)}}}break;default:break}if(g.attr("readonly")){if(g.attr("type")==="hidden"){l.query=function(){return[]}}}else{if(k.amsSelect2Query){l.query=a.getFunctionByName(k.amsSelect2Query);l.minimumInputLength=k.amsSelect2MinimumInputLength||1}else{if(k.amsSelect2QueryUrl){l.ajax={url:k.amsSelect2QueryUrl,quietMillis:k.amsSelect2QuietMillis||200,type:k.amsSelect2QueryType||"POST",dataType:k.amsSelect2QueryDatatype||"json",data:function(o,p,n){var m={};m[k.amsSelect2QueryParamName||"query"]=o;m[k.amsSelect2PageParamName||"page"]=p;m[k.amsSelect2ContextParamName||"context"]=n;return c.extend({},m,k.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};l.minimumInputLength=k.amsSelect2MinimumInputLength||1}else{if(k.amsSelect2QueryMethod){l.query=function(m){var n={id:new Date().getTime(),params:k.amsSelect2QueryParams||{},success:function(o){return a.helpers.select2QueryMethodSuccessCallback.call(g,o,"success",m)},error:a.error.show};n.params[k.amsSelect2QueryParamName||"query"]=m.term;n.params[k.amsSelect2PageParamName||"page"]=m.page;n.params[k.amsSelect2ContextParamName||"context"]=m.context;n=c.extend({},n,k.amsSelect2QueryOptions);n=a.executeFunctionByName(k.amsSelect2QueryInitCallback,g,n)||n;a.ajax.check(c.jsonRPC,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){c.jsonRPC.withOptions({endPoint:k.amsSelect2MethodTarget||a.jsonrpc.getAddr(),namespace:k.amsSelect2MethodNamespace,cache:false},function(){c.jsonRPC.request(k.amsSelect2QueryMethod,n)})})};l.minimumInputLength=k.amsSelect2MinimumInputLength||1}else{if(k.amsSelect2Tags){l.tags=k.amsSelect2Tags}else{if(k.amsSelect2Data){l.data=k.amsSelect2Data}}}}}}if(k.amsSelect2EnableFreeTags){l.createSearchChoice=function(m){return{id:m,text:(k.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+m}}}var i=c.extend({},l,k.amsSelect2Options);i=a.executeFunctionByName(k.amsSelect2InitCallback,g,i)||i;var j=g.select2(i);a.executeFunctionByName(k.amsSelect2AfterInitCallback,g,j,i);if(g.hasClass("ordered")){a.ajax.check(c.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){g.select2Sortable({bindOrder:"sortableStop"})})}g.on("change",function(){var m=c(g.get(0).form).data("validator");if(m!==undefined){c(g).valid()}})})})}},maskedit:function(f){var e=c("[data-mask]",f);if(e.length>0){a.ajax.check(c.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.4.1"+a.devext+".js",function(){e.each(function(){var g=c(this);var j=g.data();var k={placeholder:j.amsMaskeditPlaceholder===undefined?"X":j.amsMaskeditPlaceholder,complete:a.getFunctionByName(j.amsMaskeditComplete)};var h=c.extend({},k,j.amsMaskeditOptions);h=a.executeFunctionByName(j.amsMaskeditInitCallback,g,h)||h;var i=g.mask(g.attr("data-mask"),h);a.executeFunctionByName(j.amsMaskeditAfterInitCallback,g,i,h)})})}},inputmask:function(f){var e=c("[data-input-mask]",f);if(e.length>0){a.ajax.check(c.fn.inputmask,a.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+a.devext+".js",function(){e.each(function(){var g=c(this);var j=g.data();var k;if(typeof(j.inputMask)==="object"){k=j.inputMask}else{k={mask:j.inputMask.toString()}}var h=c.extend({},k,j.amsInputmaskOptions);h=a.executeFunctionByName(j.amsInputmaskInitCallback,g,h)||h;var i=g.inputmask(h);a.executeFunctionByName(j.amsInputmaskAfterInitCallback,g,i,h)})})}},datepicker:function(e){var f=c(".datepicker",e);if(f.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}f.each(function(){var h=c(this);var k=h.data();var l={lang:k.amsDatetimepickerLang||a.lang,format:k.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var i=c.extend({},l,k.amsDatetimepickerOptions);i=a.executeFunctionByName(k.amsDatetimepickerInitCallback,h,i)||i;var j=h.datetimepicker(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},datetimepicker:function(f){var e=c(".datetimepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var k=h.data();var l={lang:k.amsDatetimepickerLang||a.lang,format:k.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var i=c.extend({},l,k.amsDatetimepickerOptions);i=a.executeFunctionByName(k.amsDatetimepickerInitCallback,h,i)||i;var j=h.datetimepicker(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},timepicker:function(f){var e=c(".timepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var k=h.data();var l={lang:k.amsDatetimepickerLang||a.lang,format:k.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var i=c.extend({},l,k.amsDatetimepickerOptions);i=a.executeFunctionByName(k.amsDatetimepickerInitCallback,h,i)||i;var j=h.datetimepicker(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},colorpicker:function(e){var f=c(".colorpicker",e);if(f.length>0){a.ajax.check(c.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}f.each(function(){var h=c(this);var k=h.data();var l={position:k.amsColorpickerPosition||h.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var i=c.extend({},l,k.amsColorpickerOptions);i=a.executeFunctionByName(k.amsColorpickerInitCallback,h,i)||i;var j=h.minicolors(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},validate:function(f){var e=c("FORM:not([novalidate])",f);if(e.length>0){a.ajax.check(c.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(i){if(i){c.validator.setDefaults({highlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(k,l){var j=l.parents("label:first");if(j.length){k.insertAfter(j)}else{k.insertAfter(l)}}});if(a.plugins.i18n){for(var g in a.plugins.i18n.validate){if(!a.plugins.i18n.validate.hasOwnProperty(g)){continue}var h=a.plugins.i18n.validate[g];if((typeof(h)==="string")&&(h.indexOf("{0}")>-1)){a.plugins.i18n.validate[g]=c.validator.format(h)}}c.extend(c.validator.messages,a.plugins.i18n.validate)}}e.each(function(){var l=c(this);var m=l.data();var n={ignore:null,submitHandler:l.attr("data-async")!==undefined?m.amsFormSubmitHandler===undefined?function(){c(".state-error",l).removeClass("state-error");a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(l)}:a.getFunctionByName(m.amsFormSubmitHandler):undefined,invalidHandler:l.attr("data-async")!==undefined?m.amsFormInvalidHandler===undefined?function(t,s){c(".state-error",l).removeClass("state-error");for(var r=0;r0){var o=c(".nav-tabs",c(q.element).parents(".tabforms"));c("li:nth-child("+p+")",o).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",o).click()}}}:a.getFunctionByName(m.amsFormInvalidHandler):undefined};c("[data-ams-validate-rules]",l).each(function(o){if(o===0){n.rules={}}n.rules[c(this).attr("name")]=c(this).data("ams-validate-rules")});var j=c.extend({},n,m.amsValidateOptions);j=a.executeFunctionByName(m.amsValidateInitCallback,l,j)||j;var k=l.validate(j);a.executeFunctionByName(m.amsValidateAfterInitCallback,l,k,j)})})}},datatable:function(f){var e=c(".datatable",f);if(e.length>0){a.ajax.check(c.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(g){c(e).each(function(){a.ajax.check(c.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var D=c(this);var K=D.data();var G=(K.amsDatatableExtensions||"").split(/\s+/);var q=K.amsDatatableSdom||"W"+((G.indexOf("colreorder")>=0||G.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(G.indexOf("colvis")>=0?"C":"")+((K.amsDatatablePagination===false||K.amsDatatablePaginationSize===false)?"":"L")+(K.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(G.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(K.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var u;var m=K.amsDatatableSorting;if(typeof(m)==="string"){var J=m.split(";");m=[];for(u=0;u=0,bPaginate:K.amsDatatablePagination!==false,bInfo:K.amsDatatableInfo!==false,bSort:K.amsDatatableSort!==false,aaSorting:m,aoColumns:j.length>0?j:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:K.amsDatatableDisplayLength||25,sPaginationType:K.amsDatatablePaginationType||"bootstrap_full",sDom:q,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(M,L){c(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' ')}};var E=c.extend({},x,K.amsDatatableOptions);if(G.length>0){for(u=0;u0){for(u=0;u0){for(u=0;u0){a.ajax.check(c.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(g){e.each(function(){var j=c(this);var k=j.data();if(k.amsTabledndDragHandle){c("tr",j).addClass("no-drag-handle")}else{c(j).on("mouseover","tr",function(){c(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){c(this.cells[0]).removeClass("drag-handle")})}var l={onDragClass:k.amsTabledndDragClass||"dragging-row",onDragStart:a.getFunctionByName(k.amsTabledndDragStart),dragHandle:k.amsTabledndDragHandle,scrollAmount:k.amsTabledndScrollAmount,onAllowDrop:k.amsTabledndAllowDrop,onDrop:a.getFunctionByName(k.amsTabledndDrop)||function(p,q){var o=k.amsTabledndDropTarget;if(o){c(q).data("ams-disabled-handlers","click");var m=[];c(p.rows).each(function(){var r=c(this).data("ams-element-name");if(r){m.push(r)}});var n=a.getFunctionByName(o);if(typeof(n)==="function"){n.call(j,p,m)}else{a.ajax.post(o,{names:JSON.stringify(m)})}setTimeout(function(){c(q).removeData("ams-disabled-handlers")},50)}return false}};var h=c.extend({},l,k.amsTabledndOptions);h=a.executeFunctionByName(k.amsTabledndInitCallback,j,h)||h;var i=j.tableDnD(h);a.executeFunctionByName(k.amsTabledndAfterInitCallback,j,i,h)})})}},tinymce:function(e){function h(){c(".tinymce",c(this)).each(function(){var i=tinymce.get(c(this).attr("id"));if(i){i.remove()}})}var f=c(".tinymce",e);if(f.length>0){var g=a.baseURL+"ext/tinymce"+(a.devmode?"/dev":"");a.ajax.check(window.tinymce,g+"/tinymce"+a.devext+".js",function(i){if(i){a.getScript(g+"/jquery.tinymce"+a.devext+".js");tinymce.baseURL=g;tinymce.suffix=a.devext;a.skin.registerCleanCallback(h)}f.each(function(){var m=c(this);var o=m.data();var q={theme:"modern",language:a.lang,plugins:["advlist autosave autolink lists link image charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code","insertdatetime media nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern"],toolbar1:"newdocument undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",toolbar2:"print preview media | forecolor backcolor emoticons | code",content_css:o.amsTinymceContentCss,formats:o.amsTinymceFormats,style_formats:o.amsTinymceStyleFormats,block_formats:o.amsTinymceBlockFormats,valid_classes:o.amsTinymceValidClasses,image_advtab:true,image_list:a.getFunctionByName(o.amsTinymceImageList)||o.amsTinymceImageList,image_class_list:o.amsTinymceImageClassList,link_list:a.getFunctionByName(o.amsTinymceLinkList)||o.amsTinymceLinkList,link_class_list:o.amsTinymceLinkClassList,resize:true};if(o.amsTinymceExternalPlugins){var p=o.amsTinymceExternalPlugins.split(/\s+/);for(var k in p){var j=m.data("ams-tinymce-plugin-"+p[k]);tinymce.PluginManager.load(p[k],a.getSource(j))}}var l=c.extend({},q,o.amsTinymceOptions);l=a.executeFunctionByName(o.amsTinymceInitCallback,m,l)||l;var n=m.tinymce(l);a.executeFunctionByName(o.amsTinymceAfterInitCallback,m,n,l)})})}},imgareaselect:function(f){var e=c(".imgareaselect",f);if(e.length>0){a.ajax.check(c.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".css")}e.each(function(){var l=c(this);var k=l.data();var i=k.amsImgareaselectParent?l.parents(k.amsImgareaselectParent):"body";var m={instance:true,handles:true,parent:i,x1:k.amsImgareaselectX1||0,y1:k.amsImgareaselectY1||0,x2:k.amsImgareaselectX2||k.amsImgareaselectImageWidth,y2:k.amsImgareaselectY2||k.amsImgareaselectImageHeight,imageWidth:k.amsImgareaselectImageWidth,imageHeight:k.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:k.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(k.amsImgareaselectSelectEnd)||function(n,o){var p=k.amsImgareaselectTargetField||"image_";c('input[name="'+p+'x1"]',i).val(o.x1);c('input[name="'+p+'y1"]',i).val(o.y1);c('input[name="'+p+'x2"]',i).val(o.x2);c('input[name="'+p+'y2"]',i).val(o.y2)}};var h=c.extend({},m,k.amsImgareaselectOptions);h=a.executeFunctionByName(k.amsImgareaselectInitCallback,l,h)||h;var j=l.imgAreaSelect(h);a.executeFunctionByName(k.amsImgareaselectAfterInitCallback,l,j,h);setTimeout(function(){j.update()},250)})})}},fancybox:function(e){var f=c(".fancybox",e);if(f.length>0){a.ajax.check(c.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}f.each(function(){var h=c(this);var n=h.data();var m=(n.amsFancyboxHelpers||"").split(/\s+/);if(m.length>0){for(var i=0;i0){a.ajax.check(c.fn.plot,a.baseURL+"flot/jquery.flot"+a.devext+".js",function(){f.each(function(){function l(s){for(var r in c.plot.plugins){var q=c.plot.plugins[r];if(q.name==s){return q}}return null}var o=c(this);var j=o.data();var p={};var h=(j.amsChartPlugins||"").split(/\s+/);if(h.length>0){for(var m in h){var n=h[m];if(!l(n)){a.getScript(a.baseURL+"flot/jquery.flot."+n+a.devext+".js")}}}var g=c.extend({},p,j.amsChartOptions);g=a.executeFunctionByName(j.amsChartInitCallback,o,g)||g;var i=j.amsChartData;i=a.executeFunctionByName(j.amsChartInitData,o,i)||i;var k=o.plot(i,g);a.executeFunctionByName(j.amsChartAfterInitCallback,o,k,g)})})}},graphs:function(f){var e=c(".sparkline",f);if(e.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(e)})}},scrollbars:function(e){var f=c(".scrollbar",e);if(f.length>0){a.ajax.check(c.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(c.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}f.each(function(){var l=c(this);var j=l.data();var k={theme:j.amsScrollbarTheme||"light"};var h=c.extend({},k,j.amsScrollbarOptions);h=a.executeFunctionByName(j.amsScrollbarInitCallback,l,h)||h;var i=l.mCustomScrollbar(h);a.executeFunctionByName(j.amsScrollbarAfterInitCallback,l,i,h)})})})}}}};d.callbacks={init:function(e){c("[data-ams-callback]",e).each(function(){var f=this;var g=c(f).data();var h=a.getFunctionByName(g.amsCallback);if(h===undefined){if(g.amsCallbackSource){a.getScript(g.amsCallbackSource,function(){a.executeFunctionByName(g.amsCallback,f,g.amsCallbackOptions)})}else{if(b.console){b.console.warn("Undefined callback: "+g.amsCallback)}}}else{h.call(f,g.amsCallbackOptions)}})},alert:function(m){var h=c(this).data();var e=c.extend({},m,h.amsAlertOptions);var k=c(h.amsAlertParent||e.parent||this);var g=h.amsAlertStatus||e.status||"info";var i=h.amsAlertHeader||e.header;var l=h.amsAlertMessage||e.message;var j=h.amsAlertSubtitle||e.subtitle;var f=h.amsAlertMargin===undefined?(e.margin===undefined?false:e.margin):h.amsAlertMargin;a.skin.alert(k,g,i,l,j,f)},messageBox:function(f){var h=c(this).data();var j=c.extend({},f,h.amsMessageboxOptions);var g=c.extend({},j,{title:h.amsMessageboxTitle||j.title||"",content:h.amsMessageboxContent||j.content||"",icon:h.amsMessageboxIcon||j.icon,number:h.amsMessageboxNumber||j.number,timeout:h.amsMessageboxTimeout||j.timeout});var e=h.amsMessageboxStatus||j.status||"info";var i=a.getFunctionByName(h.amsMessageboxCallback||j.callback);a.skin.messageBox(e,g,i)},smallBox:function(f){var h=c(this).data();var j=c.extend({},f,h.amsSmallboxOptions);var g=c.extend({},j,{title:h.amsSmallboxTitle||j.title||"",content:h.amsSmallboxContent||j.content||"",icon:h.amsSmallboxIcon||j.icon,iconSmall:h.amsSmallboxIconSmall||j.iconSmall,timeout:h.amsSmallboxTimeout||j.timeout});var e=h.amsSmallboxStatus||j.status||"info";var i=a.getFunctionByName(h.amsSmallboxCallback||j.callback);a.skin.smallBox(e,g,i)}};d.events={init:function(e){c("[data-ams-events-handlers]",e).each(function(){var g=c(this);var f=g.data("ams-events-handlers");if(f){for(var h in f){if(f.hasOwnProperty(h)){g.on(h,a.getFunctionByName(f[h]))}}}})}};d.container={changeOrder:function(f,g){var e=c('input[name="'+c(this).data("ams-input-name")+'"]',c(this));e.val(g.join(";"))},deleteElement:function(e){return function(){var f=c(this);d.skin.bigBox({title:a.i18n.WARNING,content:'  '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){var j=f.parents("table");var g=j.data("ams-location")||"";var k=f.parents("tr");var h=k.data("ams-delete-target")||j.data("ams-delete-target")||"delete-element.json";var l=k.data("ams-element-name");d.ajax.post(g+"/"+h,{object_name:l},function(m,n){if(m.status==="success"){if(j.hasClass("datatable")){j.dataTable().fnDeleteRow(k[0])}else{k.remove()}}})}})}}};d.skin={_setPageHeight:function(){var e=c("#main").height();var g=a.leftPanel.height();var f=c(window).height()-a.navbarHeight;if(e>f){a.root.css("min-height",e+a.navbarHeight)}else{a.root.css("min-height",f)}a.leftPanel.css("min-height",f);a.leftPanel.css("max-height",f)},_checkMobileWidth:function(){if(c(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){var e=c(".badge","#user-activity >span");if(parseInt(e.text())>0){e.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{e.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},refreshNotificationsPanel:function(g){var f=c(this);f.addClass("disabled");c("i",f).addClass("fa-spin");c('input[name="activity"]:checked',"#user-activity").change();c("i",f).removeClass("fa-spin");f.removeClass("disabled")},_initDesktopWidgets:function(e){if(a.enableWidgets){var f=c(".ams-widget",e);if(f.length>0){a.ajax.check(c.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){f.each(function(){var i=c(this);var h=i.data();var j={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var g=c.extend({},j,h.amsWidgetOptions);g=a.executeFunctionByName(h.amsWidgetInitcallback,i,g)||g;i.MyAMSWidget(g)});b.MyAMSWidget.initWidgetsGrid(c(".ams-widget-grid",e))})}}},_initMobileWidgets:function(e){if(a.enableMobile&&a.enableWidgets){a.skin._initDesktopWidgets(e)}},alert:function(l,f,g,m,k,e){if(f==="error"){f="danger"}c(".alert-"+f,l).remove();var i='

'+g+"

"+(k?("

"+k+"

"):"");if(typeof(m)==="string"){i+="
  • "+m+"
"}else{if(m){i+="
    ";for(var h in m){if(!c.isNumeric(h)){continue}i+="
  • "+m[h]+"
  • "}i+="
"}}i+="
";var j=c(i).prependTo(l);if(l.exists){a.ajax.check(c.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){c.scrollTo(l,{offset:{top:-50}})})}},bigBox:function(e,f){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(e,f)})},messageBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.bigBox(f,g)})},smallBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.smallBox(f,g)})},_drawBreadCrumb:function(){var e=c("OL.breadcrumb","#ribbon");c("li",e).not(".parent").remove();if(!c("li",e).exists()){e.append(c("
  • ").append(c("").text(a.i18n.HOME).addClass("padding-right-5").attr("href",c('nav a[href!="#"]:first').attr("href"))))}c("LI.active >A","nav").each(function(){var h=c(this);var f=c.trim(h.clone().children(".badge").remove().end().text());var g=c("
  • ").append(h.attr("href").replace(/^#/,"")?c("").html(f).attr("href",h.attr("href")):f);e.append(g)})},checkURL:function(){function e(m){c(".active",k).removeClass("active");m.addClass("open").addClass("active");m.parents("li").addClass("open active").children("ul").addClass("active").show();m.parents("li:first").removeClass("open");m.parents("ul").addClass(m.attr("href").replace(/^#/,"")?"active":"").show()}var l;var k=c("nav");var i=location.hash;var g=i.replace(/^#/,"");if(g){var f=c("#content");if(!f.exists()){f=c("body")}l=c('A[href="'+i+'"]',k);if(l.exists()){e(l)}a.skin.loadURL(g,f);var h=c("html head title").data("ams-title-prefix");document.title=(h?h+" > ":"")+(c("[data-ams-page-title]:first",f).data("ams-page-title")||l.attr("title")||document.title)}else{var j=c("[data-ams-active-menu]").data("ams-active-menu");if(j){l=c('A[href="'+j+'"]',k)}else{l=c('>UL >LI >A[href!="#"]',k).first()}if(l.exists()){e(l);if(j){a.skin._drawBreadCrumb()}else{window.location.hash=l.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(f){var e=a.skin._clean_callbacks;if(e.indexOf(f)<0){e.push(f)}},unregisterCleanCallback:function(g){var f=a.skin._clean_callbacks;var e=f.indexOf(g);if(e>=0){f.splice(e,1)}},cleanContainer:function(e){var g=a.skin._clean_callbacks;for(var f=0;f Loading... ');if(e[0]===c("#content")[0]){a.skin._drawBreadCrumb();var k=c("html head title").data("ams-title-prefix");document.title=(k?k+" > ":"")+c(".breadcrumb LI:last-child").text();c("html, body").animate({scrollTop:0},"fast")}else{e.animate({scrollTop:0},"fast")}},success:function(p,l,o){if(j){a.executeFunctionByName(j,this,p,l,o,f)}else{var n=a.ajax.getResponse(o);var m=n.contentType;var k=n.data;c(".loading",e).remove();switch(m){case"json":a.ajax.handleJSON(k,e);break;case"script":break;case"xml":break;case"html":case"text":default:e.parents(".hidden").removeClass("hidden");c(".alert",e.parents(".alerts-container")).remove();e.css({opacity:"0.0"}).html(p).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(e);a.form.setFocus(e)}if(f&&f.afterLoadCallback){a.executeFunctionByName(f.afterLoadCallback,this)}a.stats.logPageview()}},error:function(m,l,k){e.html('

    '+a.i18n.ERROR+k+"

    "+m.responseText)},async:false};var h=c.extend({},i,f);c.ajax(h)},setLanguage:function(f){var h=f.lang;var g=f.handler_type||"json";switch(g){case"json":var i=f.method||"setUserLanguage";a.jsonrpc.post(i,{lang:h},function(){window.location.reload(true)});break;case"ajax":var e=f.href||"setUserLanguage";a.ajax.post(e,{lang:h},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};d.stats={logPageview:function(f){if(typeof(b._gaq)==="undefined"){return}var e=b.window.location;b._gaq.push(["_trackPageview",f||e.pathname+e.hash])},logEvent:function(f,g,e){if(typeof(b._gaq)==="undefined"){return}if(typeof(f)==="object"){g=f.action;e=f.label;f=f.category}b._gaq.push(["_trackEvent",f,g,e])}};d.initPage=function(){var e=c("body");a.root=e;a.leftPanel=c("#left-panel");a.shortcuts=c("#shortcuts");a.plugins.initData(e);var g=c.ajaxSettings.xhr;c.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var i=g();if(i&&(typeof(i.addEventListener)==="function")){var h=this;i.addEventListener("progress",function(j){h.progress(j)},false)}return i}});c(document).ajaxStart(a.ajax.start);c(document).ajaxStop(a.ajax.stop);c(document).ajaxError(a.error.ajax);if(!a.isMobile){a.root.addClass("desktop-detected");a.device="desktop"}else{a.root.addClass("mobile-detected");a.device="mobile";if(a.enableFastclick){a.ajax.check(c.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){c("NAV UL A").noClickDelay();c("A","#hide-menu").noClickDelay()})}}c("#hide-menu >:first-child > A").click(function(h){e.toggleClass("hidden-menu");h.preventDefault()});c("#show-shortcuts").click(function(h){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}h.preventDefault()});a.shortcuts.click(function(h){a.skin._hideShortcutButtons()});c(document).mouseup(function(h){if(!a.shortcuts.is(h.target)&&a.shortcuts.has(h.target).length===0){a.skin._hideShortcutButtons()}});c("#search-mobile").click(function(){a.root.addClass("search-mobile")});c("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});c(".activity-button","#user-activity").click(function(i){var h=c("#user-activity");var j=c(".ajax-dropdown",h);if(!j.is(":visible")){j.css("left",-j.innerWidth()+h.innerWidth()).fadeIn(150);h.addClass("active")}else{j.fadeOut(150);h.removeClass("active")}i.preventDefault()});a.skin.checkNotification();c(document).mouseup(function(h){var i=c(".ajax-dropdown");if(!i.is(h.target)&&i.has(h.target).length===0){i.fadeOut(150).prev().removeClass("active")}});c('input[name="activity"]').change(function(k){var j=c(this).data("ams-url");if(j){k.preventDefault();k.stopPropagation();var i=a.getFunctionByName(j);if(typeof(i)==="function"){j=i.call(this)}if(typeof(j)==="function"){j.call(this)}else{var h=c(".ajax-notifications");a.skin.loadURL(j,h)}}});c("a","#user-menu LI.logout").click(function(h){h.preventDefault();h.stopPropagation();a.loginURL=c(this).attr("href");a.skin.bigBox({title:" "+a.i18n.LOGOUT+" "+c("#show-shortcut").text()+" ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(i){if(i===a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});var f=c("nav");c("UL",f).myams_menu({accordion:f.data("ams-menu-accordion")!==false,speed:a.menuSpeed});c(".minifyme").click(function(h){c("BODY").toggleClass("minified");c(this).effect("highlight",{},500);h.preventDefault()});c("#refresh").click(function(h){a.skin.bigBox({title:" "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(i){if(i===a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});h.preventDefault()});e.on("click",function(i){var h=c(this);if(!h.is(i.target)&&h.has(i.target).length===0&&c(".popover").has(i.target).length===0){h.popover("hide")}});a.ajax.check(c.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){c("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});f.resize(function(){a.skin._setPageHeight()})});if(a.ajaxNav){c(document).on("click",'a[href="#"]',function(h){h.preventDefault()});c(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(m){var k=c(m.currentTarget);var j=k.data("ams-disabled-handlers");if((j===true)||(j==="click")||(j==="all")){return}var i=k.attr("href")||k.data("ams-url");if(!i||i.startsWith("javascript")||k.attr("target")||(k.data("ams-context-menu")===true)){return}m.preventDefault();m.stopPropagation();var h=a.getFunctionByName(i);if(typeof(h)==="function"){i=h.call(k)}if(typeof(i)==="function"){i.call(k)}else{i=i.replace(/\%23/,"#");var l=k.data("ams-target");if(l){a.form.confirmChangedForm(l,function(){a.skin.loadURL(i,l,k.data("ams-link-options"),k.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(i.startsWith("#")){if(i!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=i},50)}else{window.location.hash=i}}}else{window.location=i}})}}});c(document).on("click",'a[target="_blank"]',function(i){i.preventDefault();var h=c(i.currentTarget);window.open(h.attr("href"));a.stats.logEvent(h.data("ams-stats-category")||"Navigation",h.data("ams-stats-action")||"External",h.data("ams-stats-label")||h.attr("href"))});c(document).on("click",'a[target="_top"]',function(h){h.preventDefault();a.form.confirmChangedForm(function(){window.location=c(h.currentTarget).attr("href")})});c(window).on("hashchange",a.skin.checkURL)}c(document).off("click.modal").on("click",'[data-toggle="modal"]',function(j){var i=c(this);var h=i.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}if(i.data("ams-context-menu")===true){return}if(i.data("ams-stop-propagation")===true){j.stopPropagation()}j.preventDefault();a.dialog.open(i);if(i.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});c(document).on("click",'button[type="submit"], button.submit',function(){var h=c(this);c(h.get(0).form).data("ams-submit-button",h)});c(document).on("click",'input[type="checkbox"][readonly]',function(){return false});c(document).on("click","[data-ams-click-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}var i=j.data();if(i.amsClickHandler){if((i.amsStopPropagation===true)||(i.amsClickStopPropagation===true)){k.stopPropagation()}if(i.amsClickKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsClickHandler);if(l!==undefined){l.call(j,i.amsClickHandlerOptions)}}});c(document).on("change","[data-ams-change-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="change")||(h==="all")){return}var i=j.data();if(i.amsChangeHandler){if(i.amsChangeKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsChangeHandler);if(l!==undefined){l.call(j,i.amsChangeHandlerOptions)}}});c(document).on("reset","form",function(i){var h=c(this);setTimeout(function(){h.find(".select2").trigger("change")},10);a.form.setFocus(h)});c(document).on("reset","[data-ams-reset-handler]",function(j){var h=c(this);var i=h.data();if(i.amsResetHandler){if(i.amsResetKeepDefault!==true){j.preventDefault()}var k=a.getFunctionByName(i.amsResetHandler);if(k!==undefined){k.call(h,i.amsResetHandlerOptions)}}});c(document).on("change",'input[type="file"]',function(j){j.preventDefault();var h=c(this);var i=h.parent(".button");if(i.exists()&&i.parent().hasClass("input-file")){i.next('input[type="text"]').val(h.val())}});c(document).on("focusin",function(h){if(c(h.target).closest(".mce-window").length){h.stopImmediatePropagation()}});c("a[data-toggle=tab]",".nav-tabs").on("click",function(h){if(c(this).parent("li").hasClass("disabled")){h.preventDefault();return false}});c(document).on("show.bs.tab",function(j){var h=c(j.target);var i=h.data();if(i.amsUrl){if(i.amsTabLoaded){return}try{h.append('');a.skin.loadURL(i.amsUrl,h.attr("href"));if(i.amsTabLoadOnce){h.data("ams-tab-loaded",true)}}finally{c("i",h).remove()}}});c(document).on("hide.bs.modal",function(i){var h=c(i.target);a.form.confirmChangedForm(h,function(){h.data("modal").isShown=true;return true},function(){i.preventDefault();return false})});a.initContent(document);if(a.ajaxNav&&f.exists()){a.skin.checkURL()}a.form.setFocus(document);c(window).on("beforeunload",a.form.checkBeforeUnload)};d.initContent=function(e){c(".tipsy").remove();c("[rel=tooltip]",e).tooltip();c("[rel=popover]",e).popover();c("[rel=popover-hover]",e).popover({trigger:"hover"});a.plugins.init(e);a.callbacks.init(e);a.events.init(e);a.form.init(e);if(a.device==="desktop"){a.skin._initDesktopWidgets(e)}else{a.skin._initMobileWidgets(e)}a.skin._setPageHeight()};d.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",CLIPBOARD_COPY:"Copy to clipboard with Ctrl+C, and Enter",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"};c(document).ready(function(){c=jQuery.noConflict();var e=c("HTML");var f=e.attr("lang")||e.attr("xml:lang");if(f&&!f.startsWith("en")){d.lang=f;d.getScript(d.baseURL+"i18n/myams_"+f.substr(0,2)+".js",function(){d.initPage()})}else{d.initPage()}})})(jQuery,this); \ No newline at end of file +(function(c,b){String.prototype.startsWith=function(g){var e=this.length,f=g.length;if(e0};if(c.scrollbarWidth===undefined){c.scrollbarWidth=function(){var f=c('
    ').appendTo("body");var g=f.children();var e=g.innerWidth()-g.height(99).innerWidth();f.remove();return e}}c.fn.extend({exists:function(){return c(this).length>0},objectOrParentWithClass:function(e){if(this.hasClass(e)){return this}else{return this.parents("."+e)}},listattr:function(f){var e=[];this.each(function(){e.push(c(this).attr(f))});return e},style:function(f,i,e){var h=this.get(0);if(typeof(h)==="undefined"){return}var g=this.get(0).style;if(typeof(f)!=="undefined"){if(typeof(i)!=="undefined"){e=typeof(e)!=="undefined"?e:"";g.setProperty(f,i,e);return this}else{return g.getPropertyValue(f)}}else{return g}},removeClassPrefix:function(e){this.each(function(g,h){var f=h.className.split(" ").map(function(i){return i.startsWith(e)?"":i});h.className=c.trim(f.join(" "))});return this},contextMenu:function(f){function e(i,k,h){var j=c(window)[k](),l=c(f.menuSelector)[k](),g=i;if(i+l>j&&l',openedSign:''};var f=c.extend({},g,e);var h=c(this);h.find("LI").each(function(){var i=c(this);if(i.find("UL").size()>0){i.find("A:first").append(""+f.closedSign+"");var j=i.find("A:first");if(j.attr("href")==="#"){j.click(function(){return false})}}});h.find("LI.active").each(function(){var i=c(this).parents("UL");var j=i.parent("LI");i.slideDown(f.speed);j.find("b:first").html(f.openedSign);j.addClass("open")});h.find("LI A").on("click",function(){var l=c(this);if(l.hasClass("active")){return}var i=l.attr("href").replace(/^#/,"");var k=l.parent().find("UL");if(f.accordion){var j=l.parent().parents("UL");var m=h.find("UL:visible");m.each(function(o){var q=true;j.each(function(r){if(j[r]===m[o]){q=false;return false}});if(q){if(k!==m[o]){var p=c(m[o]);if(i||!p.hasClass("active")){p.slideUp(f.speed,function(){c(this).parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}}}})}var n=l.parent().find("UL:first");if(!i&&n.is(":visible")&&!n.hasClass("active")){n.slideUp(f.speed,function(){l.parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}else{n.slideDown(f.speed,function(){l.parent("LI").addClass("open").find("B:first").delay(f.speed).html(f.openedSign)})}})}});c.UTF8={encode:function(f){f=f.replace(/\r\n/g,"\n");var e="";for(var h=0;h127)&&(g<2048)){e+=String.fromCharCode((g>>6)|192);e+=String.fromCharCode((g&63)|128)}else{e+=String.fromCharCode((g>>12)|224);e+=String.fromCharCode(((g>>6)&63)|128);e+=String.fromCharCode((g&63)|128)}}}return e},decode:function(e){var g="";var j=0,k=0,h=0,f=0;while(j191)&&(k<224)){h=e.charCodeAt(j+1);g+=String.fromCharCode(((k&31)<<6)|(h&63));j+=2}else{h=e.charCodeAt(j+1);f=e.charCodeAt(j+2);g+=String.fromCharCode(((k&15)<<12)|((h&63)<<6)|(f&63));j+=3}}}return g}};if(b.MyAMS===undefined){b.MyAMS={devmode:true,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:true,enableWidgets:true,enableMobile:false,enableFastclick:false,warnOnFormChange:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var d=b.MyAMS;var a=d;d.baseURL=(function(){var e=c('script[src*="/myams.js"], script[src*="/myams.min.js"]');var f=e.attr("src");a.devmode=f.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return f.substring(0,f.lastIndexOf("/")+1)})();d.log=function(){if(b.console){b.console.log(this,arguments)}};d.getQueryVar=function(g,h){if(g.indexOf("?")<0){return false}if(!g.endsWith("&")){g+="&"}var e=new RegExp(".*?[&\\?]"+h+"=(.*?)&.*");var f=g.replace(e,"$1");return f===g?false:f};d.rgb2hex=function(e){return"#"+c.map(e.match(/\b(\d+)\b/g),function(f){return("0"+parseInt(f).toString(16)).slice(-2)}).join("")};d.generateId=function(){function e(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return e()+e()+e()+e()};d.generateUUID=function(){var f=new Date().getTime();var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(h){var g=(f+Math.random()*16)%16|0;f=Math.floor(f/16);return(h==="x"?g:(g&3|8)).toString(16)});return e};d.getFunctionByName=function(k,g){if(k===undefined){return undefined}else{if(typeof(k)==="function"){return k}}var j=k.split(".");var h=j.pop();g=(g===undefined||g===null)?window:g;for(var f=0;f").attr({rel:"stylesheet",type:"text/css",href:h,"data-ams-id":i}).appendTo(g)}};d.event={stop:function(e){if(!e){e=window.event}if(e){if(e.stopPropagation){e.stopPropagation();e.preventDefault()}else{e.cancelBubble=true;e.returnValue=false}}}};d.browser={getInternetExplorerVersion:function(){var g=-1;if(navigator.appName==="Microsoft Internet Explorer"){var e=navigator.userAgent;var f=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(f.exec(e)!==null){g=parseFloat(RegExp.$1)}}return g},checkVersion:function(){var f="You're not using Windows Internet Explorer.";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=8){f="You're using a recent copy of Windows Internet Explorer."}else{f="You should upgrade your copy of Windows Internet Explorer."}}if(b.alert){b.alert(f)}},isIE8orlower:function(){var f="0";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=9){f=0}else{f=1}}return f},copyToClipboard:function(){return function(){var e=c(this);e.parents(".btn-group").removeClass("open");if(b.prompt){b.prompt(d.i18n.CLIPBOARD_COPY,e.text())}}}};d.error={ajax:function(i,e,h,f){if(e.statusText==="OK"){return}var e=a.ajax.getResponse(e);if(e.contentType==="json"){a.ajax.handleJSON(e.data)}else{var j=i.statusText||i.type;var g=e.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+j+"

    "+g+"

    ",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(i);b.console.debug(e)}},show:function(h,e,g){if(!g){return}var f=a.ajax.getResponse(h);if(f.contentType==="json"){a.ajax.handleJSON(f.data)}else{a.skin.messageBox("error",{title:a.i18n.ERRORS_OCCURED,content:"

    "+e+"

    "+g+"

    ",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(g);b.console.debug(h)}}};d.ajax={check:function(f,h,j,e){if(typeof(j)==="object"){e=j;j=undefined}var i={async:typeof(j)==="function"};var g=c.extend({},i,e);if(f===undefined){a.getScript(h,function(){if(typeof(j)==="function"){j(true,e)}},g)}else{if(typeof(j)==="function"){j(false,e)}}},getAddr:function(f){var e=f||c("HTML HEAD BASE").attr("href")||window.location.href;return e.substr(0,e.lastIndexOf("/")+1)},start:function(){c("#ajax-gear").show()},stop:function(){c("#ajax-gear").hide()},progress:function(e){if(!e.lengthComputable){return}if(e.loaded>=e.total){return}if(b.console){b.console.log(parseInt((e.loaded/e.total*100),10)+"%")}},post:function(g,i,f,l){var k;if(g.startsWith(window.location.protocol)){k=g}else{k=this.getAddr()+g}if(typeof(f)==="function"){l=f;f={}}else{if(!f){f={}}}if(typeof(l)==="undefined"){l=f.callback}if(typeof(l)==="string"){l=a.getFunctionByName(l)}delete f.callback;var e;var j={url:k,type:"post",cache:false,async:typeof(l)==="function",data:c.param(i),dataType:"json",success:l||function(m){e=m.result}};var h=c.extend({},j,f);c.ajax(h);return e},getResponse:function(h){var j=h.getResponseHeader("content-type"),g,f;if(j){if(j.startsWith("application/javascript")){g="script";f=h.responseText}else{if(j.startsWith("text/html")){g="html";f=h.responseText}else{if(j.startsWith("text/xml")){g="xml";f=h.responseText}else{f=h.responseJSON;if(f){g="json"}else{try{f=JSON.parse(h.responseText);g="json"}catch(i){f=h.responseText;g="text"}}}}}}else{g="json";f={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{contentType:g,data:f}},handleJSON:function(p,g,k){var i=p.status;var e;switch(i){case"alert":if(b.alert){b.alert(p.alert.title+"\n\n"+p.alert.content)}break;case"error":a.form.showErrors(g,p);break;case"info":case"success":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}break;case"modal":a.dialog.open(p.location);break;case"reload":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}e=p.location||window.location.hash;if(e.startsWith("#")){e=e.substr(1)}a.skin.loadURL(e,p.target||k||"#content");break;case"redirect":a.form.resetChanged(g);if(p.close_form===true){a.dialog.close(g)}e=p.location||window.location.href;if(p.window){window.open(e,p.window,p.options)}else{if(window.location.href===e){window.location.reload(true)}else{window.location.href=e}}break;default:if(b.console){b.console.log("Unhandled status: "+i)}}var j;var l;var f;if(p.content){l=p.content;f=c(l.target||k||g||"#content");if(l.raw===true){f.text(l.text)}else{f.html(l.html);a.initContent(f)}if(!l.keep_hidden){f.removeClass("hidden")}}if(p.contents){var h=p.contents;for(j=0;j  '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){h.call(g)}})}}else{h.call(g)}},setChanged:function(e){e.attr("data-ams-form-changed",true)},resetChanged:function(e){if(e!==undefined){c(e).removeAttr("data-ams-form-changed")}},submit:function(h,g,f){h=c(h);if(!h.exists()){return false}if(typeof(g)==="object"){f=g;g=undefined}if(h.data("submitted")){if(!h.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:h.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(h)){return false}c(".alert-danger, SPAN.state-error",h).not(".persistent").remove();c(".state-error",h).removeClassPrefix("state-");var e=c(h.data("ams-submit-button"));if(e&&!e.data("ams-form-hide-loading")){e.button("loading")}a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function k(o,s){var m,z,D;var K=o.data();var n=K.amsFormOptions;var C;var q;var u;var t;var l;var H;function p(O,P){var N;function M(){m.button("reset");clearInterval(N);a.executeFunctionByName(H,o,m)}function L(){a.ajax.post(O,{progress_id:P},{error:M},a.getFunctionByName(l)||function(Q,R){if(R==="success"){if(Q.status==="running"){if(Q.message){m.text(Q.message)}else{m.text(m.data("ams-progress-text")+" "+Q.current+" / "+Q.length)}}else{if(Q.status==="finished"){M()}}}else{M()}})}m.button("loading");N=setInterval(L,t)}if(f){q=f.formDataInitCallback}if(q){delete f.formDataInitCallback}else{q=K.amsFormDataInitCallback}if(q){var A={};if(typeof(q)==="function"){C=q.call(o,A)}else{C=a.executeFunctionByName(q,o,A)}if(A.veto){m=o.data("ams-submit-button");if(m){m.button("reset")}a.form.finalizeSubmitFooter.call(o);return false}}else{C=K.amsFormData||{}}m=c(o.data("ams-submit-button"));if(m&&m.exists()){z=m.data();D=z.amsFormSubmitTarget}else{z={}}var v;var I=g||z.amsFormHandler||K.amsFormHandler||"";if(I.startsWith(window.location.protocol)){v=I}else{var B=z.amsFormAction||o.attr("action").replace(/#/,"");if(B.startsWith(window.location.protocol)){v=B}else{v=a.ajax.getAddr()+B}v+=I}u=z.amsProgressHandler||K.amsProgressHandler||"";t=z.amsProgressInterval||K.amsProgressInterval||1000;l=z.amsProgressCallback||K.amsProgressCallback;H=z.amsProgressEndCallback||K.amsProgressEndCallback;var J=null;if(f&&f.initSubmitTarget){a.executeFunctionByName(f.initSubmitTarget,o)}else{if(K.amsFormInitSubmitTarget){J=c(D||K.amsFormSubmitTarget||"#content");a.executeFunctionByName(K.amsFormInitSubmit||"MyAMS.form.initSubmit",o,J)}else{if(!K.amsFormHideSubmitFooter){a.executeFunctionByName(K.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",o)}}}if(f){C=c.extend({},C,f.form_data)}var w;if(u){C.progress_id=a.generateUUID()}else{w=typeof(s.uuid)!=="undefined";if(w){if(v.indexOf("X-Progress-ID")<0){v+="?X-Progress-ID="+s.uuid}delete s.uuid}}var y={url:v,type:"post",cache:false,data:C,dataType:K.amsFormDatatype,beforeSerialize:function(){if(typeof(b.tinyMCE)!=="undefined"){b.tinyMCE.triggerSave()}},beforeSubmit:function(M,L){L.data("submitted",true)},error:function(O,L,M,N){if(J){a.executeFunctionByName(K.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",N,J)}a.form.resetAfterSubmit(N)},iframe:w};var F=(f&&f.downloadTarget)||K.amsFormDownloadTarget;if(F){var x=c('iframe[name="'+F+'"]');if(!x.exists()){x=c("").hide().attr("name",F).appendTo(c("body"))}y=c.extend({},y,{iframe:true,iframeTarget:x,success:function(L,M,Q,P){var O=c(P).parents(".modal-dialog");if(O.exists()){a.dialog.close(P)}else{var R;var N=P.data("ams-submit-button");if(N){R=N.data("ams-form-submit-callback")}if(!R){R=a.getFunctionByName(K.amsFormSubmitCallback)||a.form._submitCallback}try{R.call(P,L,M,Q,P)}finally{a.form.resetAfterSubmit(P);a.form.resetChanged(P)}}}})}else{y=c.extend({},y,{error:function(O,L,M,N){if(J){a.executeFunctionByName(K.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",N,J)}a.form.resetAfterSubmit(N)},success:function(L,M,P,O){var Q;var N=O.data("ams-submit-button");if(N){Q=N.data("ams-form-submit-callback")}if(!Q){Q=a.getFunctionByName(K.amsFormSubmitCallback)||a.form._submitCallback}try{Q.call(O,L,M,P,O)}finally{a.form.resetAfterSubmit(O);a.form.resetChanged(O)}},iframe:w})}var G=c.extend({},y,s,n,f);if(u){p(u,C.progress_id)}c(o).ajaxSubmit(G);if(F){var E=c(o).parents(".modal-dialog");var r=E.exists()&&m.exists()&&m.data("ams-keep-modal");if(E.exists()&&(r!==true)){a.dialog.close(o)}else{setTimeout(function(){a.form.resetAfterSubmit(o,m);a.form.resetChanged(o)},m.data("ams-form-reset-timeout")||2000)}}}var j=(h.data("ams-form-ignore-uploads")!==true)&&(c('INPUT[type="file"]',h).length>0);if(j){a.ajax.check(c.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var i=c.extend({},{uuid:c.progressBar.submit(h)});k(h,i)}else{k(h,{})}});return false},initSubmit:function(g,f){var e=c(this);var h='';if(!f){f=e.data("ams-form-submit-message")}if(f){h+=""+f+""}c(g).html('
    '+h+"
    ");c(g).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(f){if(f.is(":visible")){var e=f.data("ams-submit-button");if(e){e.button("reset")}a.form.finalizeSubmitFooter.call(f)}f.data("submitted",false);f.removeData("ams-submit-button")},finalizeSubmitOnError:function(e){c("i",e).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(f){var e=c(this);var h='';if(!f){f=c(this).data("ams-form-submit-message")}if(f){h+=''+f+""}var g=c("footer",e);c("button",g).hide();g.append('
    '+h+"
    ")},finalizeSubmitFooter:function(){var e=c(this);var f=c("footer",e);if(f){c(".row",f).remove();c("button",f).show()}},_submitCallback:function(o,h,g,e){var j;if(e.is(":visible")){a.form.finalizeSubmitFooter.call(e);j=e.data("ams-submit-button");if(j){j.button("reset")}}var i=e.data();var l;if(i.amsFormDatatype){l=i.amsFormDatatype}else{var f=a.ajax.getResponse(g);l=f.contentType;o=f.data}var k;if(j){k=c(j.data("ams-form-submit-target")||i.amsFormSubmitTarget||"#content")}else{k=c(i.amsFormSubmitTarget||"#content")}switch(l){case"json":a.ajax.handleJSON(o,e,k);break;case"script":break;case"xml":break;case"html":case"text":default:a.form.resetChanged(e);if(j&&(j.data("ams-keep-modal")!==true)){a.dialog.close(e)}if(!k.exists()){k=c("body")}k.parents(".hidden").removeClass("hidden");c(".alert",k.parents(".alerts-container")).remove();k.css({opacity:"0.0"}).html(o).delay(50).animate({opacity:"1.0"},300);a.initContent(k);a.form.setFocus(k)}var m=g.getResponseHeader("X-AMS-Callback");if(m){var n=g.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(m,e,n===undefined?{}:JSON.parse(n),g)}},_getSubmitValidators:function(f){var e=[];var g=f.data("ams-form-validator");if(g){e.push([f,g])}c("[data-ams-form-validator]",f).each(function(){var h=c(this);e.push([h,h.data("ams-form-validator")])});return e},_checkSubmitValidators:function(g){var i=a.form._getSubmitValidators(g);if(!i.length){return true}var h=[];var n=true;for(var k=0;k0)){h=h.concat(n)}}}}if(h.length>0){var j=h.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(g,"danger",j,h);return false}else{return n}},showErrors:function(e,l){var i;if(typeof(l)==="string"){a.skin.alert(e,"error",a.i18n.ERROR_OCCURED,l)}else{if(l instanceof Array){i=l.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"error",i,l)}else{c(".state-error",e).removeClass("state-error");i=l.error_header||(l.widgets&&(l.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var n=[];var k;if(l.messages){for(k=0;k"+h.header+"
    "+h.message)}else{n.push(h.message||h)}}}if(l.widgets){for(k=0;k'+m.message+"");if(m.label){n.push(m.label+" : "+m.message)}var g=j.parents(".tab-pane").index()+1;if(g>0){var f=c(".nav-tabs",c(j).parents(".tabforms"));c("li:nth-child("+g+")",f).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",e).click()}}}a.skin.alert(c("fieldset:first",e),l.error_level||"error",i,n,l.error_message)}}}};d.dialog={_shown_callbacks:[],registerShownCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("shown-callbacks");if(g===undefined){g=[];e.data("shown-callbacks",g)}}else{g=a.dialog._shown_callbacks}if(g.indexOf(h)<0){g.push(h)}},_hide_callbacks:[],registerHideCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("hide-callbacks");if(g===undefined){g=[];e.data("hide-callbacks",g)}}else{g=a.dialog._hide_callbacks}if(g.indexOf(h)<0){g.push(h)}},open:function(f,e){a.ajax.check(c.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(c.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(j){if(j){c(document).off("click.modal");c.fn.modal.defaults.spinner=c.fn.modalmanager.defaults.spinner='
    '}var i;var h;if(typeof(f)==="string"){i={};h=f}else{i=f.data();h=f.attr("href")||i.amsUrl;var g=a.getFunctionByName(h);if(typeof(g)==="function"){h=g.call(f)}}if(!h){return}c("body").modalmanager("loading");if(h.indexOf("#")===0){c(h).modal("show")}else{c.ajax({url:h,type:"get",cache:i.amsAllowCache===undefined?false:i.amsAllowCache,data:e,success:function(o,n,m){c("body").modalmanager("removeLoading");var l=a.ajax.getResponse(m);var s=l.contentType;var u=l.data;switch(s){case"json":a.ajax.handleJSON(u,c(c(f).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var q=c(u);var r=c(".modal-dialog",q.wrap("
    ").parent());var p=r.data();var t={backdrop:"static",overflow:p.amsModalOverflow||".modal-viewport",maxHeight:p.amsModalMaxHeight===undefined?function(){return c(window).height()-c(".modal-header",q).outerHeight(true)-c("footer",q).outerHeight(true)-85}:a.getFunctionByName(p.amsModalMaxHeight)};var k=c.extend({},t,p.amsModalOptions);k=a.executeFunctionByName(p.amsModalInitCallback,r,k)||k;c("
    ").addClass("modal fade").append(q).modal(k).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(q);if(i.amsLogEvent!==false){a.stats.logPageview(h)}}}})}})})},shown:function(m){function l(o){var p=c(".scrollmarker.top",f);var n=f.scrollTop();if(n>0){p.show()}else{p.hide()}var e=c(".scrollmarker.bottom",f);if(j+n>=f.get(0).scrollHeight){e.hide()}else{e.show()}}var k=m.target;var f=c(".modal-viewport",k);if(f.exists()){var j=parseInt(f.css("max-height"));var h=c.scrollbarWidth();if((f.css("overflow")!=="hidden")&&(f.height()===j)){c("
    ").addClass("scrollmarker").addClass("top").css("top",0).css("width",f.width()-h).hide().appendTo(f);c("
    ").addClass("scrollmarker").addClass("bottom").css("top",j-20).css("width",f.width()-h).appendTo(f);f.scroll(l);f.off("resize").on("resize",l)}else{c(".scrollmarker",f).remove()}}c("[data-ams-shown-callback]",k).each(function(){var e=a.getFunctionByName(c(this).data("ams-shown-callback"));if(e){e.call(k,this)}});var g;var i=c(".modal-dialog",k).data("shown-callbacks");if(i){for(g=0;g=0)){g.hide()}}},hidden:function(i){var h=i.target;a.skin.cleanContainer(h);c("[data-ams-hidden-callback]",h).each(function(){var e=a.getFunctionByName(c(this).data("ams-hidden-callback"));if(e){e.call(h,this)}});var f;var g=c(".modal-dialog",h).data("hide-callbacks");if(g){for(f=0;f"+g.error_message+"",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(g.location);break;default:return{results:g.results||g,more:g.has_more||false,context:g.context}}},select2QueryMethodSuccessCallback:function(i,g,h){var f=i.result;if(typeof(f)==="string"){try{f=JSON.parse(f)}catch(j){}}switch(f.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+f.error_message+"

    ",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(f.location);break;default:h.callback({results:f.results||f,more:f.has_more||false,context:f.context})}},contextMenuHandler:function(h,i){var g=i.data();if(g.toggle==="modal"){a.dialog.open(i)}else{var f=i.attr("href")||g.amsUrl;if(!f||f.startsWith("javascript")||i.attr("target")){return}a.event.stop();var e=a.getFunctionByName(f);if(typeof(e)==="function"){f=e.call(i,h)}if(typeof(f)==="function"){f.call(i,h)}else{f=f.replace(/\%23/,"#");h=i.data("ams-target");if(h){a.form.confirmChangedForm(h,function(){a.skin.loadURL(f,h,i.data("ams-link-options"),i.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(f.startsWith("#")){if(f!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=f},150)}else{window.location.hash=f}}}else{window.location=f}})}}}},datetimepickerDialogHiddenCallback:function(){c(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};d.plugins={init:function(l){a.plugins.initData(l);var k=[];c("[data-ams-plugins-disabled]",l).each(function(){var q=c(this).data("ams-plugins-disabled").split(/\s+/);for(var r=0;r=0){continue}var o=a.plugins.enabled[n];if(o){switch(typeof(o)){case"function":o(l);break;default:for(var g=0;g=0){if(b.console){b.console.warn("Plugin "+e+" is already registered!")}return}if(typeof(f)==="object"){var g=f.src;if(g){a.ajax.check(f.callback,g,function(i){if(i){a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}})}else{a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}}else{if(typeof(f)==="function"){a.plugins.enabled[e]=f;if(h){a.executeFunctionByName(h)}}}},enabled:{hint:function(e){var f=c(".hint:not(:parents(.nohints))",e);if(f.length>0){a.ajax.check(c.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");f.each(function(){var j=c(this);var i=j.data();var k={html:i.amsHintHtml,title:a.getFunctionByName(i.amsHintTitleGetter)||function(){var l=c(this);return l.attr("original-title")||l.attr(i.amsHintTitleAttr||"title")||(i.amsHintHtml?l.html():l.text())},opacity:i.amsHintOpacity||0.95,gravity:i.amsHintGravity||"sw",offset:i.amsHintOffset||0};var g=c.extend({},k,i.amsHintOptions);g=a.executeFunctionByName(i.amsHintInitCallback,j,g)||g;var h=j.tipsy(g);a.executeFunctionByName(i.amsHintAfterInitCallback,j,h,g)})})}},contextMenu:function(e){var f=c(".context-menu",e);if(f.length>0){f.each(function(){var j=c(this);var i=j.data();var k={menuSelector:i.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var g=c.extend({},k,i.amsContextmenuOptions);g=a.executeFunctionByName(i.amsContextmenuInitCallback,j,g)||g;var h=j.contextMenu(g);a.executeFunctionByName(i.amsContextmenuAfterInitCallback,j,h,g)})}},switcher:function(e){c("LEGEND.switcher",e).each(function(){var g=c(this);var f=g.parent("fieldset");var h=g.data();if(!h.amsSwitcher){c('').prependTo(c(this)).addClass(h.amsSwitcherState==="open"?(h.amsSwitcherMinusClass||"fa-minus"):(h.amsSwitcherPlusClass||"fa-plus"));g.on("click",function(j){j.preventDefault();var i={};g.trigger("ams.switcher.before-switch",[g,i]);if(i.veto){return}if(f.hasClass("switched")){f.removeClass("switched");c(".fa",g).removeClass(h.amsSwitcherPlusClass||"fa-plus").addClass(h.amsSwitcherMinusClass||"fa-minus");g.trigger("ams.switcher.opened",[g]);var k=g.attr("id");if(k){c('legend.switcher[data-ams-switcher-sync="'+k+'"]',f).each(function(){var l=c(this);if(l.parents("fieldset").hasClass("switched")){l.click()}})}}else{f.addClass("switched");c(".fa",g).removeClass(h.amsSwitcherMinusClass||"fa-minus").addClass(h.amsSwitcherPlusClass||"fa-plus");g.trigger("ams.switcher.closed",[g])}});if(h.amsSwitcherState!=="open"){f.addClass("switched")}g.data("ams-switcher","on")}})},checker:function(e){c("LEGEND.checker",e).each(function(){var p=c(this);var r=p.parent("fieldset");var h=p.data();if(!h.amsChecker){var f=c('');var k=h.amsCheckerFieldname||("checker_"+a.generateId());var q=k.replace(/\./,"_");var i=h.amsCheckerHiddenPrefix;var j=null;var n=h.amsCheckerHiddenValueOn||"true";var l=h.amsCheckerHiddenValueOff||"false";var g=h.amsCheckerMarker||false;if(i){j=c('').attr("name",i+k).val(h.amsCheckerState==="on"?n:l).prependTo(p)}else{if(g){c('').attr("name",g).attr("value",1).prependTo(p)}}var o=c('').attr("name",k).attr("id",q).data("ams-checker-hidden-input",j).data("ams-checker-init",true).val(h.amsCheckerValue||true).attr("checked",h.amsCheckerState==="on"?"checked":null);if(h.amsCheckerReadonly){o.attr("disabled","disabled")}else{o.on("change",function(u){u.preventDefault();var s={};var v=c(this).is(":checked");p.trigger("ams.checker.before-switch",[p,s]);if(s.veto){c(this).prop("checked",!v);return}a.executeFunctionByName(h.amsCheckerChangeHandler,p,v);if(!h.amsCheckerCancelDefault){var t=o.data("ams-checker-hidden-input");if(v){if(h.amsCheckerMode==="disable"){r.removeAttr("disabled")}else{r.removeClass("switched")}if(t){t.val(n)}c("[data-required]",r).attr("required","required");p.trigger("ams.checker.opened",[p])}else{if(h.amsCheckerMode==="disable"){r.prop("disabled","disabled")}else{r.addClass("switched")}if(t){t.val(l)}c("[data-required]",r).removeAttr("required");p.trigger("ams.checker.closed",[p])}}})}o.appendTo(f);c(">label",p).attr("for",o.attr("id"));f.append("").prependTo(p);var m=c("[required]",r);m.attr("data-required",true);if(h.amsCheckerState==="on"){o.attr("checked",true)}else{if(h.amsCheckerMode==="disable"){r.attr("disabled","disabled")}else{r.addClass("switched")}m.removeAttr("required")}p.data("ams-checker","on")}})},slider:function(e){var f=c(".slider",e);if(f.length>0){a.ajax.check(c.fn.slider,a.baseURL+"ext/bootstrap-slider-2.0.0"+a.devext+".js",function(){f.each(function(){var i=c(this);var j=i.data();var k={};var g=c.extend({},k,i.data.amsSliderOptions);g=a.executeFunctionByName(j.amsSliderInitCallback,i,g)||g;var h=i.slider(g);a.executeFunctionByName(j.amsSliderAfterInitCallback,i,h,g)})})}},draggable:function(f){var e=c(".draggable",f);if(e.length>0){e.each(function(){var g=c(this);var j=g.data();var k={containment:j.amsDraggableContainment,helper:a.getFunctionByName(j.amsDraggableHelper)||j.amsDraggableHelper,start:a.getFunctionByName(j.amsDraggableStart),stop:a.getFunctionByName(j.amsDraggableStop)};var h=c.extend({},k,j.amsDraggableOptions);h=a.executeFunctionByName(j.amsDraggableInitCallback,g,h)||h;var i=g.draggable(h);g.disableSelection();a.executeFunctionByName(j.amsDraggableAfterInitCallback,g,i,h)})}},sortable:function(e){var f=c(".sortable",e);if(f.length>0){f.each(function(){var k=c(this);var i=k.data();var j={items:i.amsSortableItems,handle:i.amsSortableHandle,connectWith:i.amsSortableConnectwith,start:a.getFunctionByName(i.amsSortableStart),over:a.getFunctionByName(i.amsSortableOver),containment:i.amsSortableContainment,placeholder:i.amsSortablePlaceholder,stop:a.getFunctionByName(i.amsSortableStop)};var g=c.extend({},j,i.amsSortableOptions);g=a.executeFunctionByName(i.amsSortableInitCallback,k,g)||g;var h=k.sortable(g);k.disableSelection();a.executeFunctionByName(i.amsSortableAfterInitCallback,k,h,g)})}},resizable:function(f){var e=c(".resizable",f);if(e.length>0){e.each(function(){var g=c(this);var j=g.data();var k={autoHide:j.amsResizableAutohide===false?true:j.amsResizableAutohide,containment:j.amsResizableContainment,grid:j.amsResizableGrid,handles:j.amsResizableHandles,start:a.getFunctionByName(j.amsResizableStart),stop:a.getFunctionByName(j.amsResizableStop)};var h=c.extend({},k,j.amsResizableOptions);h=a.executeFunctionByName(j.amsResizableInitCallback,g,h)||h;var i=g.resizable(h);g.disableSelection();a.executeFunctionByName(j.amsResizableAfterInitCallback,g,i,h)})}},typeahead:function(f){var e=c(".typeahead",f);if(e.length>0){a.ajax.check(c.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){e.each(function(){var g=c(this);var j=g.data();var k={};var h=c.extend({},k,j.amsTypeaheadOptions);h=a.executeFunctionByName(j.amsTypeaheadInitCallback,g,h)||h;var i=g.typeahead(h);a.executeFunctionByName(j.amsTypeaheadAfterInitCallback,g,i,h)})})}},select2:function(f){var e=c(".select2",f);if(e.length>0){a.ajax.check(c.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var l={placeholder:k.amsSelect2Placeholder,multiple:k.amsSelect2Multiple,minimumInputLength:k.amsSelect2MinimumInputLength||0,maximumSelectionSize:k.amsSelect2MaximumSelectionSize,openOnEnter:k.amsSelect2EnterOpen===undefined?true:k.amsSelect2EnterOpen,allowClear:k.amsSelect2AllowClear===undefined?true:k.amsSelect2AllowClear,width:k.amsSelect2Width||"100%",initSelection:a.getFunctionByName(k.amsSelect2InitSelection),formatSelection:k.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(k.amsSelect2FormatSelection),formatResult:a.getFunctionByName(k.amsSelect2FormatResult),formatMatches:k.amsSelect2FormatMatches===undefined?function(m){if(m===1){return a.i18n.SELECT2_MATCH}else{return m+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(k.amsSelect2FormatMatches),formatNoMatches:k.amsSelect2FormatResult===undefined?function(m){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(k.amsSelect2FormatResult),formatInputTooShort:k.amsSelect2FormatInputTooShort===undefined?function(m,o){var p=o-m.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(k.amsSelect2FormatInputTooShort),formatInputTooLong:k.amsSelect2FormatInputTooLong===undefined?function(o,m){var p=o.length-m;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(k.amsSelect2FormatInputTooLong),formatSelectionTooBig:k.amsSelect2FormatSelectionTooBig===undefined?function(m){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,m).replace(/\{1\}/,m===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(k.amsSelect2FormatSelectionTooBig),formatLoadMore:k.amsSelect2FormatLoadMore===undefined?function(m){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(k.amsSelect2FormatLoadMore),formatSearching:k.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(k.amsSelect2FormatSearching),separator:k.amsSelect2Separator||",",tokenSeparators:k.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(k.amsSelect2Tokenizer)};switch(g.context.type){case"text":case"hidden":if(!l.initSelection){var h=g.data("ams-select2-values");if(h){l.initSelection=function(m,o){var n=[];c(m.val().split(l.separator)).each(function(){n.push({id:this,text:h[this]||this})});o(n)}}}break;default:break}if(g.attr("readonly")){if(g.attr("type")==="hidden"){l.query=function(){return[]}}}else{if(k.amsSelect2Query){l.query=a.getFunctionByName(k.amsSelect2Query);l.minimumInputLength=k.amsSelect2MinimumInputLength||1}else{if(k.amsSelect2QueryUrl){l.ajax={url:k.amsSelect2QueryUrl,quietMillis:k.amsSelect2QuietMillis||200,type:k.amsSelect2QueryType||"POST",dataType:k.amsSelect2QueryDatatype||"json",data:function(o,p,n){var m={};m[k.amsSelect2QueryParamName||"query"]=o;m[k.amsSelect2PageParamName||"page"]=p;m[k.amsSelect2ContextParamName||"context"]=n;return c.extend({},m,k.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};l.minimumInputLength=k.amsSelect2MinimumInputLength||1}else{if(k.amsSelect2QueryMethod){l.query=function(m){var n={id:new Date().getTime(),params:k.amsSelect2QueryParams||{},success:function(o){return a.helpers.select2QueryMethodSuccessCallback.call(g,o,"success",m)},error:a.error.show};n.params[k.amsSelect2QueryParamName||"query"]=m.term;n.params[k.amsSelect2PageParamName||"page"]=m.page;n.params[k.amsSelect2ContextParamName||"context"]=m.context;n=c.extend({},n,k.amsSelect2QueryOptions);n=a.executeFunctionByName(k.amsSelect2QueryInitCallback,g,n)||n;a.ajax.check(c.jsonRPC,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){c.jsonRPC.withOptions({endPoint:k.amsSelect2MethodTarget||a.jsonrpc.getAddr(),namespace:k.amsSelect2MethodNamespace,cache:false},function(){c.jsonRPC.request(k.amsSelect2QueryMethod,n)})})};l.minimumInputLength=k.amsSelect2MinimumInputLength||1}else{if(k.amsSelect2Tags){l.tags=k.amsSelect2Tags}else{if(k.amsSelect2Data){l.data=k.amsSelect2Data}}}}}}if(k.amsSelect2EnableFreeTags){l.createSearchChoice=function(m){return{id:m,text:(k.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+m}}}var i=c.extend({},l,k.amsSelect2Options);i=a.executeFunctionByName(k.amsSelect2InitCallback,g,i)||i;var j=g.select2(i);a.executeFunctionByName(k.amsSelect2AfterInitCallback,g,j,i);if(g.hasClass("ordered")){a.ajax.check(c.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){g.select2Sortable({bindOrder:"sortableStop"})})}g.on("change",function(){var m=c(g.get(0).form).data("validator");if(m!==undefined){c(g).valid()}})})})}},maskedit:function(f){var e=c("[data-mask]",f);if(e.length>0){a.ajax.check(c.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.4.1"+a.devext+".js",function(){e.each(function(){var g=c(this);var j=g.data();var k={placeholder:j.amsMaskeditPlaceholder===undefined?"X":j.amsMaskeditPlaceholder,complete:a.getFunctionByName(j.amsMaskeditComplete)};var h=c.extend({},k,j.amsMaskeditOptions);h=a.executeFunctionByName(j.amsMaskeditInitCallback,g,h)||h;var i=g.mask(g.attr("data-mask"),h);a.executeFunctionByName(j.amsMaskeditAfterInitCallback,g,i,h)})})}},inputmask:function(f){var e=c("[data-input-mask]",f);if(e.length>0){a.ajax.check(c.fn.inputmask,a.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+a.devext+".js",function(){e.each(function(){var g=c(this);var j=g.data();var k;if(typeof(j.inputMask)==="object"){k=j.inputMask}else{k={mask:j.inputMask.toString()}}var h=c.extend({},k,j.amsInputmaskOptions);h=a.executeFunctionByName(j.amsInputmaskInitCallback,g,h)||h;var i=g.inputmask(h);a.executeFunctionByName(j.amsInputmaskAfterInitCallback,g,i,h)})})}},datepicker:function(e){var f=c(".datepicker",e);if(f.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}f.each(function(){var h=c(this);var k=h.data();var l={lang:k.amsDatetimepickerLang||a.lang,format:k.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var i=c.extend({},l,k.amsDatetimepickerOptions);i=a.executeFunctionByName(k.amsDatetimepickerInitCallback,h,i)||i;var j=h.datetimepicker(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},datetimepicker:function(f){var e=c(".datetimepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var k=h.data();var l={lang:k.amsDatetimepickerLang||a.lang,format:k.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var i=c.extend({},l,k.amsDatetimepickerOptions);i=a.executeFunctionByName(k.amsDatetimepickerInitCallback,h,i)||i;var j=h.datetimepicker(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},timepicker:function(f){var e=c(".timepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var k=h.data();var l={lang:k.amsDatetimepickerLang||a.lang,format:k.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var i=c.extend({},l,k.amsDatetimepickerOptions);i=a.executeFunctionByName(k.amsDatetimepickerInitCallback,h,i)||i;var j=h.datetimepicker(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},colorpicker:function(e){var f=c(".colorpicker",e);if(f.length>0){a.ajax.check(c.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}f.each(function(){var h=c(this);var k=h.data();var l={position:k.amsColorpickerPosition||h.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var i=c.extend({},l,k.amsColorpickerOptions);i=a.executeFunctionByName(k.amsColorpickerInitCallback,h,i)||i;var j=h.minicolors(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},validate:function(f){var e=c("FORM:not([novalidate])",f);if(e.length>0){a.ajax.check(c.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(i){if(i){c.validator.setDefaults({highlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(k,l){var j=l.parents("label:first");if(j.length){k.insertAfter(j)}else{k.insertAfter(l)}}});if(a.plugins.i18n){for(var g in a.plugins.i18n.validate){if(!a.plugins.i18n.validate.hasOwnProperty(g)){continue}var h=a.plugins.i18n.validate[g];if((typeof(h)==="string")&&(h.indexOf("{0}")>-1)){a.plugins.i18n.validate[g]=c.validator.format(h)}}c.extend(c.validator.messages,a.plugins.i18n.validate)}}e.each(function(){var l=c(this);var m=l.data();var n={ignore:null,submitHandler:l.attr("data-async")!==undefined?m.amsFormSubmitHandler===undefined?function(){c(".state-error",l).removeClass("state-error");a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(l)}:a.getFunctionByName(m.amsFormSubmitHandler):undefined,invalidHandler:l.attr("data-async")!==undefined?m.amsFormInvalidHandler===undefined?function(t,s){c(".state-error",l).removeClass("state-error");for(var r=0;r0){var o=c(".nav-tabs",c(q.element).parents(".tabforms"));c("li:nth-child("+p+")",o).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",o).click()}}}:a.getFunctionByName(m.amsFormInvalidHandler):undefined};c("[data-ams-validate-rules]",l).each(function(o){if(o===0){n.rules={}}n.rules[c(this).attr("name")]=c(this).data("ams-validate-rules")});var j=c.extend({},n,m.amsValidateOptions);j=a.executeFunctionByName(m.amsValidateInitCallback,l,j)||j;var k=l.validate(j);a.executeFunctionByName(m.amsValidateAfterInitCallback,l,k,j)})})}},datatable:function(f){var e=c(".datatable",f);if(e.length>0){a.ajax.check(c.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(g){c(e).each(function(){a.ajax.check(c.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var D=c(this);var K=D.data();var G=(K.amsDatatableExtensions||"").split(/\s+/);var q=K.amsDatatableSdom||"W"+((G.indexOf("colreorder")>=0||G.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(G.indexOf("colvis")>=0?"C":"")+((K.amsDatatablePagination===false||K.amsDatatablePaginationSize===false)?"":"L")+(K.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(G.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(K.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var u;var m=K.amsDatatableSorting;if(typeof(m)==="string"){var J=m.split(";");m=[];for(u=0;u=0,bPaginate:K.amsDatatablePagination!==false,bInfo:K.amsDatatableInfo!==false,bSort:K.amsDatatableSort!==false,aaSorting:m,aoColumns:j.length>0?j:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:K.amsDatatableDisplayLength||25,sPaginationType:K.amsDatatablePaginationType||"bootstrap_full",sDom:q,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(M,L){c(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' ')}};var E=c.extend({},x,K.amsDatatableOptions);if(G.length>0){for(u=0;u0){for(u=0;u0){for(u=0;u0){a.ajax.check(c.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(g){e.each(function(){var j=c(this);var k=j.data();if(k.amsTabledndDragHandle){c("tr",j).addClass("no-drag-handle")}else{c(j).on("mouseover","tr",function(){c(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){c(this.cells[0]).removeClass("drag-handle")})}var l={onDragClass:k.amsTabledndDragClass||"dragging-row",onDragStart:a.getFunctionByName(k.amsTabledndDragStart),dragHandle:k.amsTabledndDragHandle,scrollAmount:k.amsTabledndScrollAmount,onAllowDrop:k.amsTabledndAllowDrop,onDrop:a.getFunctionByName(k.amsTabledndDrop)||function(p,q){var o=k.amsTabledndDropTarget;if(o){c(q).data("ams-disabled-handlers","click");var m=[];c(p.rows).each(function(){var r=c(this).data("ams-element-name");if(r){m.push(r)}});var n=a.getFunctionByName(o);if(typeof(n)==="function"){n.call(j,p,m)}else{a.ajax.post(o,{names:JSON.stringify(m)})}setTimeout(function(){c(q).removeData("ams-disabled-handlers")},50)}return false}};var h=c.extend({},l,k.amsTabledndOptions);h=a.executeFunctionByName(k.amsTabledndInitCallback,j,h)||h;var i=j.tableDnD(h);a.executeFunctionByName(k.amsTabledndAfterInitCallback,j,i,h)})})}},tinymce:function(e){function h(){c(".tinymce",c(this)).each(function(){var i=tinymce.get(c(this).attr("id"));if(i){i.remove()}})}var f=c(".tinymce",e);if(f.length>0){var g=a.baseURL+"ext/tinymce"+(a.devmode?"/dev":"");a.ajax.check(window.tinymce,g+"/tinymce"+a.devext+".js",function(i){if(i){a.getScript(g+"/jquery.tinymce"+a.devext+".js");tinymce.baseURL=g;tinymce.suffix=a.devext;a.skin.registerCleanCallback(h)}f.each(function(){var m=c(this);var o=m.data();var q={theme:"modern",language:a.lang,plugins:["advlist autosave autolink lists link image charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code","insertdatetime media nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern"],toolbar1:"newdocument undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",toolbar2:"print preview media | forecolor backcolor emoticons | code",content_css:o.amsTinymceContentCss,formats:o.amsTinymceFormats,style_formats:o.amsTinymceStyleFormats,block_formats:o.amsTinymceBlockFormats,valid_classes:o.amsTinymceValidClasses,image_advtab:true,image_list:a.getFunctionByName(o.amsTinymceImageList)||o.amsTinymceImageList,image_class_list:o.amsTinymceImageClassList,link_list:a.getFunctionByName(o.amsTinymceLinkList)||o.amsTinymceLinkList,link_class_list:o.amsTinymceLinkClassList,resize:true};if(o.amsTinymceExternalPlugins){var p=o.amsTinymceExternalPlugins.split(/\s+/);for(var k in p){var j=m.data("ams-tinymce-plugin-"+p[k]);tinymce.PluginManager.load(p[k],a.getSource(j))}}var l=c.extend({},q,o.amsTinymceOptions);l=a.executeFunctionByName(o.amsTinymceInitCallback,m,l)||l;var n=m.tinymce(l);a.executeFunctionByName(o.amsTinymceAfterInitCallback,m,n,l)})})}},imgareaselect:function(f){var e=c(".imgareaselect",f);if(e.length>0){a.ajax.check(c.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".css")}e.each(function(){var l=c(this);var k=l.data();var i=k.amsImgareaselectParent?l.parents(k.amsImgareaselectParent):"body";var m={instance:true,handles:true,parent:i,x1:k.amsImgareaselectX1||0,y1:k.amsImgareaselectY1||0,x2:k.amsImgareaselectX2||k.amsImgareaselectImageWidth,y2:k.amsImgareaselectY2||k.amsImgareaselectImageHeight,imageWidth:k.amsImgareaselectImageWidth,imageHeight:k.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:k.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(k.amsImgareaselectSelectEnd)||function(n,o){var p=k.amsImgareaselectTargetField||"image_";c('input[name="'+p+'x1"]',i).val(o.x1);c('input[name="'+p+'y1"]',i).val(o.y1);c('input[name="'+p+'x2"]',i).val(o.x2);c('input[name="'+p+'y2"]',i).val(o.y2)}};var h=c.extend({},m,k.amsImgareaselectOptions);h=a.executeFunctionByName(k.amsImgareaselectInitCallback,l,h)||h;var j=l.imgAreaSelect(h);a.executeFunctionByName(k.amsImgareaselectAfterInitCallback,l,j,h);setTimeout(function(){j.update()},250)})})}},fancybox:function(e){var f=c(".fancybox",e);if(f.length>0){a.ajax.check(c.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}f.each(function(){var h=c(this);var n=h.data();var m=(n.amsFancyboxHelpers||"").split(/\s+/);if(m.length>0){for(var i=0;i0){a.ajax.check(c.fn.plot,a.baseURL+"flot/jquery.flot"+a.devext+".js",function(){f.each(function(){function l(s){for(var r in c.plot.plugins){var q=c.plot.plugins[r];if(q.name==s){return q}}return null}var o=c(this);var j=o.data();var p={};var h=(j.amsChartPlugins||"").split(/\s+/);if(h.length>0){for(var m in h){var n=h[m];if(!l(n)){a.getScript(a.baseURL+"flot/jquery.flot."+n+a.devext+".js")}}}var g=c.extend({},p,j.amsChartOptions);g=a.executeFunctionByName(j.amsChartInitCallback,o,g)||g;var i=j.amsChartData;i=a.executeFunctionByName(j.amsChartInitData,o,i)||i;var k=o.plot(i,g);a.executeFunctionByName(j.amsChartAfterInitCallback,o,k,g)})})}},graphs:function(f){var e=c(".sparkline",f);if(e.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(e)})}},scrollbars:function(e){var f=c(".scrollbar",e);if(f.length>0){a.ajax.check(c.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(c.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}f.each(function(){var l=c(this);var j=l.data();var k={theme:j.amsScrollbarTheme||"light"};var h=c.extend({},k,j.amsScrollbarOptions);h=a.executeFunctionByName(j.amsScrollbarInitCallback,l,h)||h;var i=l.mCustomScrollbar(h);a.executeFunctionByName(j.amsScrollbarAfterInitCallback,l,i,h)})})})}}}};d.callbacks={init:function(e){c("[data-ams-callback]",e).each(function(){var f=this;var g=c(f).data();var h=a.getFunctionByName(g.amsCallback);if(h===undefined){if(g.amsCallbackSource){a.getScript(g.amsCallbackSource,function(){a.executeFunctionByName(g.amsCallback,f,g.amsCallbackOptions)})}else{if(b.console){b.console.warn("Undefined callback: "+g.amsCallback)}}}else{h.call(f,g.amsCallbackOptions)}})},alert:function(m){var h=c(this).data();var e=c.extend({},m,h.amsAlertOptions);var k=c(h.amsAlertParent||e.parent||this);var g=h.amsAlertStatus||e.status||"info";var i=h.amsAlertHeader||e.header;var l=h.amsAlertMessage||e.message;var j=h.amsAlertSubtitle||e.subtitle;var f=h.amsAlertMargin===undefined?(e.margin===undefined?false:e.margin):h.amsAlertMargin;a.skin.alert(k,g,i,l,j,f)},messageBox:function(f){var h=c(this).data();var j=c.extend({},f,h.amsMessageboxOptions);var g=c.extend({},j,{title:h.amsMessageboxTitle||j.title||"",content:h.amsMessageboxContent||j.content||"",icon:h.amsMessageboxIcon||j.icon,number:h.amsMessageboxNumber||j.number,timeout:h.amsMessageboxTimeout||j.timeout});var e=h.amsMessageboxStatus||j.status||"info";var i=a.getFunctionByName(h.amsMessageboxCallback||j.callback);a.skin.messageBox(e,g,i)},smallBox:function(f){var h=c(this).data();var j=c.extend({},f,h.amsSmallboxOptions);var g=c.extend({},j,{title:h.amsSmallboxTitle||j.title||"",content:h.amsSmallboxContent||j.content||"",icon:h.amsSmallboxIcon||j.icon,iconSmall:h.amsSmallboxIconSmall||j.iconSmall,timeout:h.amsSmallboxTimeout||j.timeout});var e=h.amsSmallboxStatus||j.status||"info";var i=a.getFunctionByName(h.amsSmallboxCallback||j.callback);a.skin.smallBox(e,g,i)}};d.events={init:function(e){c("[data-ams-events-handlers]",e).each(function(){var g=c(this);var f=g.data("ams-events-handlers");if(f){for(var h in f){if(f.hasOwnProperty(h)){g.on(h,a.getFunctionByName(f[h]))}}}})}};d.container={changeOrder:function(f,g){var e=c('input[name="'+c(this).data("ams-input-name")+'"]',c(this));e.val(g.join(";"))},deleteElement:function(e){return function(){var f=c(this);d.skin.bigBox({title:a.i18n.WARNING,content:'  '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){var j=f.parents("table");var g=j.data("ams-location")||"";var k=f.parents("tr");var h=k.data("ams-delete-target")||j.data("ams-delete-target")||"delete-element.json";var l=k.data("ams-element-name");d.ajax.post(g+"/"+h,{object_name:l},function(m,n){if(m.status==="success"){if(j.hasClass("datatable")){j.dataTable().fnDeleteRow(k[0])}else{k.remove()}}})}})}}};d.skin={_setPageHeight:function(){var e=c("#main").height();var g=a.leftPanel.height();var f=c(window).height()-a.navbarHeight;if(e>f){a.root.css("min-height",e+a.navbarHeight)}else{a.root.css("min-height",f)}a.leftPanel.css("min-height",f);a.leftPanel.css("max-height",f)},_checkMobileWidth:function(){if(c(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){var e=c(".badge","#user-activity >span");if(parseInt(e.text())>0){e.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{e.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},refreshNotificationsPanel:function(g){var f=c(this);f.addClass("disabled");c("i",f).addClass("fa-spin");c('input[name="activity"]:checked',"#user-activity").change();c("i",f).removeClass("fa-spin");f.removeClass("disabled")},_initDesktopWidgets:function(e){if(a.enableWidgets){var f=c(".ams-widget",e);if(f.length>0){a.ajax.check(c.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){f.each(function(){var i=c(this);var h=i.data();var j={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var g=c.extend({},j,h.amsWidgetOptions);g=a.executeFunctionByName(h.amsWidgetInitcallback,i,g)||g;i.MyAMSWidget(g)});b.MyAMSWidget.initWidgetsGrid(c(".ams-widget-grid",e))})}}},_initMobileWidgets:function(e){if(a.enableMobile&&a.enableWidgets){a.skin._initDesktopWidgets(e)}},alert:function(l,f,g,m,k,e){if(f==="error"){f="danger"}c(".alert-"+f,l).remove();var i='

    '+g+"

    "+(k?("

    "+k+"

    "):"");if(typeof(m)==="string"){i+="
    • "+m+"
    "}else{if(m){i+="
      ";for(var h in m){if(!c.isNumeric(h)){continue}i+="
    • "+m[h]+"
    • "}i+="
    "}}i+="
    ";var j=c(i).prependTo(l);if(l.exists){a.ajax.check(c.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){c.scrollTo(l,{offset:{top:-50}})})}},bigBox:function(e,f){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(e,f)})},messageBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.bigBox(f,g)})},smallBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.smallBox(f,g)})},_drawBreadCrumb:function(){var e=c("OL.breadcrumb","#ribbon");c("li",e).not(".parent").remove();if(!c("li",e).exists()){e.append(c("
  • ").append(c("").text(a.i18n.HOME).addClass("padding-right-5").attr("href",c('nav a[href!="#"]:first').attr("href"))))}c("LI.active >A","nav").each(function(){var h=c(this);var f=c.trim(h.clone().children(".badge").remove().end().text());var g=c("
  • ").append(h.attr("href").replace(/^#/,"")?c("").html(f).attr("href",h.attr("href")):f);e.append(g)})},checkURL:function(){function e(m){c(".active",k).removeClass("active");m.addClass("open").addClass("active");m.parents("li").addClass("open active").children("ul").addClass("active").show();m.parents("li:first").removeClass("open");m.parents("ul").addClass(m.attr("href").replace(/^#/,"")?"active":"").show()}var l;var k=c("nav");var i=location.hash;var g=i.replace(/^#/,"");if(g){var f=c("#content");if(!f.exists()){f=c("body")}l=c('A[href="'+i+'"]',k);if(l.exists()){e(l)}a.skin.loadURL(g,f);var h=c("html head title").data("ams-title-prefix");document.title=(h?h+" > ":"")+(c("[data-ams-page-title]:first",f).data("ams-page-title")||l.attr("title")||document.title)}else{var j=c("[data-ams-active-menu]").data("ams-active-menu");if(j){l=c('A[href="'+j+'"]',k)}else{l=c('>UL >LI >A[href!="#"]',k).first()}if(l.exists()){e(l);if(j){a.skin._drawBreadCrumb()}else{window.location.hash=l.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(f){var e=a.skin._clean_callbacks;if(e.indexOf(f)<0){e.push(f)}},unregisterCleanCallback:function(g){var f=a.skin._clean_callbacks;var e=f.indexOf(g);if(e>=0){f.splice(e,1)}},cleanContainer:function(e){var g=a.skin._clean_callbacks;for(var f=0;f Loading... ');if(e[0]===c("#content")[0]){a.skin._drawBreadCrumb();var k=c("html head title").data("ams-title-prefix");document.title=(k?k+" > ":"")+c(".breadcrumb LI:last-child").text();c("html, body").animate({scrollTop:0},"fast")}else{e.animate({scrollTop:0},"fast")}},success:function(p,l,o){if(j){a.executeFunctionByName(j,this,p,l,o,f)}else{var n=a.ajax.getResponse(o);var m=n.contentType;var k=n.data;c(".loading",e).remove();switch(m){case"json":a.ajax.handleJSON(k,e);break;case"script":break;case"xml":break;case"html":case"text":default:e.parents(".hidden").removeClass("hidden");c(".alert",e.parents(".alerts-container")).remove();e.css({opacity:"0.0"}).html(p).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(e);a.form.setFocus(e)}if(f&&f.afterLoadCallback){a.executeFunctionByName(f.afterLoadCallback,this)}a.stats.logPageview()}},error:function(m,l,k){e.html('

    '+a.i18n.ERROR+k+"

    "+m.responseText)},async:false};var h=c.extend({},i,f);c.ajax(h)},setLanguage:function(f){var h=f.lang;var g=f.handler_type||"json";switch(g){case"json":var i=f.method||"setUserLanguage";a.jsonrpc.post(i,{lang:h},function(){window.location.reload(true)});break;case"ajax":var e=f.href||"setUserLanguage";a.ajax.post(e,{lang:h},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};d.stats={logPageview:function(f){if(typeof(b._gaq)==="undefined"){return}var e=b.window.location;b._gaq.push(["_trackPageview",f||e.pathname+e.hash])},logEvent:function(f,g,e){if(typeof(b._gaq)==="undefined"){return}if(typeof(f)==="object"){g=f.action;e=f.label;f=f.category}b._gaq.push(["_trackEvent",f,g,e])}};d.initPage=function(){var e=c("body");a.root=e;a.leftPanel=c("#left-panel");a.shortcuts=c("#shortcuts");a.plugins.initData(e);var g=c.ajaxSettings.xhr;c.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var i=g();if(i&&(typeof(i.addEventListener)==="function")){var h=this;i.addEventListener("progress",function(j){h.progress(j)},false)}return i}});c(document).ajaxStart(a.ajax.start);c(document).ajaxStop(a.ajax.stop);c(document).ajaxError(a.error.ajax);if(!a.isMobile){a.root.addClass("desktop-detected");a.device="desktop"}else{a.root.addClass("mobile-detected");a.device="mobile";if(a.enableFastclick){a.ajax.check(c.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){c("NAV UL A").noClickDelay();c("A","#hide-menu").noClickDelay()})}}c("#hide-menu >:first-child > A").click(function(h){e.toggleClass("hidden-menu");h.preventDefault()});c("#show-shortcuts").click(function(h){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}h.preventDefault()});a.shortcuts.click(function(h){a.skin._hideShortcutButtons()});c(document).mouseup(function(h){if(!a.shortcuts.is(h.target)&&a.shortcuts.has(h.target).length===0){a.skin._hideShortcutButtons()}});c("#search-mobile").click(function(){a.root.addClass("search-mobile")});c("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});c(".activity-button","#user-activity").click(function(i){var h=c("#user-activity");var j=c(".ajax-dropdown",h);if(!j.is(":visible")){j.css("left",-j.innerWidth()+h.innerWidth()).fadeIn(150);h.addClass("active")}else{j.fadeOut(150);h.removeClass("active")}i.preventDefault()});a.skin.checkNotification();c(document).mouseup(function(h){var i=c(".ajax-dropdown");if(!i.is(h.target)&&i.has(h.target).length===0){i.fadeOut(150).prev().removeClass("active")}});c('input[name="activity"]').change(function(k){var j=c(this).data("ams-url");if(j){k.preventDefault();k.stopPropagation();var i=a.getFunctionByName(j);if(typeof(i)==="function"){j=i.call(this)}if(typeof(j)==="function"){j.call(this)}else{var h=c(".ajax-notifications");a.skin.loadURL(j,h)}}});c("a","#user-menu LI.logout").click(function(h){h.preventDefault();h.stopPropagation();a.loginURL=c(this).attr("href");a.skin.bigBox({title:" "+a.i18n.LOGOUT+" "+c("#show-shortcut").text()+" ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(i){if(i===a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});var f=c("nav");c("UL",f).myams_menu({accordion:f.data("ams-menu-accordion")!==false,speed:a.menuSpeed});c(".minifyme").click(function(h){c("BODY").toggleClass("minified");c(this).effect("highlight",{},500);h.preventDefault()});c("#refresh").click(function(h){a.skin.bigBox({title:" "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(i){if(i===a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});h.preventDefault()});e.on("click",function(i){var h=c(this);if(!h.is(i.target)&&h.has(i.target).length===0&&c(".popover").has(i.target).length===0){h.popover("hide")}});a.ajax.check(c.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){c("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});f.resize(function(){a.skin._setPageHeight()})});if(a.ajaxNav){c(document).on("click",'a[href="#"]',function(h){h.preventDefault()});c(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(m){var k=c(m.currentTarget);var j=k.data("ams-disabled-handlers");if((j===true)||(j==="click")||(j==="all")){return}var i=k.attr("href")||k.data("ams-url");if(!i||i.startsWith("javascript")||k.attr("target")||(k.data("ams-context-menu")===true)){return}m.preventDefault();m.stopPropagation();var h=a.getFunctionByName(i);if(typeof(h)==="function"){i=h.call(k)}if(typeof(i)==="function"){i.call(k)}else{i=i.replace(/\%23/,"#");var l=k.data("ams-target");if(l){a.form.confirmChangedForm(l,function(){a.skin.loadURL(i,l,k.data("ams-link-options"),k.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(i.startsWith("#")){if(i!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=i},50)}else{window.location.hash=i}}}else{window.location=i}})}}});c(document).on("click",'a[target="_blank"]',function(i){i.preventDefault();var h=c(i.currentTarget);window.open(h.attr("href"));a.stats.logEvent(h.data("ams-stats-category")||"Navigation",h.data("ams-stats-action")||"External",h.data("ams-stats-label")||h.attr("href"))});c(document).on("click",'a[target="_top"]',function(h){h.preventDefault();a.form.confirmChangedForm(function(){window.location=c(h.currentTarget).attr("href")})});c(window).on("hashchange",a.skin.checkURL)}c(document).off("click.modal").on("click",'[data-toggle="modal"]',function(j){var i=c(this);var h=i.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}if(i.data("ams-context-menu")===true){return}if(i.data("ams-stop-propagation")===true){j.stopPropagation()}j.preventDefault();a.dialog.open(i);if(i.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});c(document).on("click",'button[type="submit"], button.submit',function(){var h=c(this);c(h.get(0).form).data("ams-submit-button",h)});c(document).on("click",'input[type="checkbox"][readonly]',function(){return false});c(document).on("click","[data-ams-click-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}var i=j.data();if(i.amsClickHandler){if((i.amsStopPropagation===true)||(i.amsClickStopPropagation===true)){k.stopPropagation()}if(i.amsClickKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsClickHandler);if(l!==undefined){l.call(j,i.amsClickHandlerOptions)}}});c(document).on("change","[data-ams-change-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="change")||(h==="all")){return}var i=j.data();if(i.amsChangeHandler){if(i.amsChangeKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsChangeHandler);if(l!==undefined){l.call(j,i.amsChangeHandlerOptions)}}});c(document).on("reset","form",function(i){var h=c(this);setTimeout(function(){h.find(".select2").trigger("change")},10);a.form.setFocus(h)});c(document).on("reset","[data-ams-reset-handler]",function(j){var h=c(this);var i=h.data();if(i.amsResetHandler){if(i.amsResetKeepDefault!==true){j.preventDefault()}var k=a.getFunctionByName(i.amsResetHandler);if(k!==undefined){k.call(h,i.amsResetHandlerOptions)}}});c(document).on("change",'input[type="file"]',function(j){j.preventDefault();var h=c(this);var i=h.parent(".button");if(i.exists()&&i.parent().hasClass("input-file")){i.next('input[type="text"]').val(h.val())}});c(document).on("focusin",function(h){if(c(h.target).closest(".mce-window").length){h.stopImmediatePropagation()}});c("a[data-toggle=tab]",".nav-tabs").on("click",function(h){if(c(this).parent("li").hasClass("disabled")){h.preventDefault();return false}});c(document).on("show.bs.tab",function(j){var h=c(j.target);var i=h.data();if(i.amsUrl){if(i.amsTabLoaded){return}try{h.append('');a.skin.loadURL(i.amsUrl,h.attr("href"));if(i.amsTabLoadOnce){h.data("ams-tab-loaded",true)}}finally{c("i",h).remove()}}});c(document).on("hide.bs.modal",function(i){var h=c(i.target);a.form.confirmChangedForm(h,function(){h.data("modal").isShown=true;return true},function(){i.preventDefault();return false})});a.initContent(document);if(a.ajaxNav&&f.exists()){a.skin.checkURL()}a.form.setFocus(document);c(window).on("beforeunload",a.form.checkBeforeUnload)};d.initContent=function(e){c(".tipsy").remove();c("[rel=tooltip]",e).tooltip();c("[rel=popover]",e).popover();c("[rel=popover-hover]",e).popover({trigger:"hover"});a.plugins.init(e);a.callbacks.init(e);a.events.init(e);a.form.init(e);if(a.device==="desktop"){a.skin._initDesktopWidgets(e)}else{a.skin._initMobileWidgets(e)}a.skin._setPageHeight()};d.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",CLIPBOARD_COPY:"Copy to clipboard with Ctrl+C, and Enter",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"};c(document).ready(function(){c=jQuery.noConflict();var e=c("HTML");var f=e.attr("lang")||e.attr("xml:lang");if(f&&!f.startsWith("en")){d.lang=f;d.getScript(d.baseURL+"i18n/myams_"+f.substr(0,2)+".js",function(){d.initPage()})}else{d.initPage()}})})(jQuery,this); \ No newline at end of file