--- a/src/pyams_skin/resources/js/myams-ajax.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-ajax.js Thu Dec 13 14:28:29 2018 +0100
@@ -247,14 +247,14 @@
}
break;
case 'error':
- ams.form.showErrors(form, result);
+ ams.form && ams.form.showErrors(form, result);
break;
case 'info':
case 'success':
if (form !== undefined) {
- ams.form.resetChanged(form);
+ ams.form && ams.form.resetChanged(form);
if (result.close_form !== false) {
- ams.dialog.close(form);
+ ams.dialog && ams.dialog.close(form);
}
}
break;
@@ -265,20 +265,20 @@
case 'callback':
case 'callbacks':
if (form !== undefined) {
- ams.form.resetChanged(form);
+ ams.form && ams.form.resetChanged(form);
if (result.close_form !== false) {
- ams.dialog.close(form);
+ ams.dialog && ams.dialog.close(form);
}
}
break;
case 'modal':
- ams.dialog.open(result.location);
+ ams.dialog && ams.dialog.open(result.location);
break;
case 'reload':
if (form !== undefined) {
- ams.form.resetChanged(form);
+ ams.form && ams.form.resetChanged(form);
if (result.close_form !== false) {
- ams.dialog.close(form);
+ ams.dialog && ams.dialog.close(form);
}
}
url = result.location || window.location.hash;
@@ -286,7 +286,7 @@
url = url.substr(1);
}
var loadTarget = $(result.target || target || '#content');
- ams.skin.loadURL(url, loadTarget, {
+ ams.skin && ams.skin.loadURL(url, loadTarget, {
preLoadCallback: ams.getFunctionByName(result.pre_reload) || function() {
$('[data-ams-pre-reload]', loadTarget).each(function() {
ams.executeFunctionByName($(this).data('ams-pre-reload'));
@@ -303,9 +303,9 @@
break;
case 'redirect':
if (form !== undefined) {
- ams.form.resetChanged(form);
+ ams.form && ams.form.resetChanged(form);
if (result.close_form === true) {
- ams.dialog.close(form);
+ ams.dialog && ams.dialog.close(form);
}
}
url = result.location || window.location.href;
@@ -338,7 +338,7 @@
container.text(content.text);
} else {
container.html(content.html);
- ams.initContent(container);
+ ams.initContent && ams.initContent(container);
}
if (!content.keep_hidden) {
container.removeClass('hidden');
@@ -353,7 +353,7 @@
container.text(content.text);
} else {
container.html(content.html);
- ams.initContent(container);
+ ams.initContent && ams.initContent(container);
}
if (!content.keep_hidden) {
container.removeClass('hidden');
@@ -366,32 +366,32 @@
message = result.message;
if (typeof(message) === 'string') {
if ((status === 'info') || (status === 'success')) {
- ams.skin.smallBox(status, {
- title: message,
- icon: 'fa fa-fw fa-info-circle font-xs align-top margin-top-10',
- timeout: 3000
- });
+ ams.skin && ams.skin.smallBox(status, {
+ title: message,
+ icon: 'fa fa-fw fa-info-circle font-xs align-top margin-top-10',
+ timeout: 3000
+ });
} else {
- ams.skin.alert($(form || '#content'), status, message);
+ ams.skin && ams.skin.alert($(form || '#content'), status, message);
}
} else {
- ams.skin.alert($(message.target || target || form || '#content'),
- message.status || 'success',
- message.header,
- message.body,
- message.subtitle);
+ ams.skin && ams.skin.alert($(message.target || target || form || '#content'),
+ message.status || 'success',
+ message.header,
+ message.body,
+ message.subtitle);
}
}
if (result.smallbox) {
message = result.smallbox;
if (typeof(message) === 'string') {
- ams.skin.smallBox(result.smallbox_status || status, {
+ ams.skin && ams.skin.smallBox(result.smallbox_status || status, {
title: result.smallbox,
icon: result.smallbox_icon || 'fa fa-fw fa-info-circle font-xs align-top margin-top-10',
timeout: result.smallbox_timeout || 3000
});
} else {
- ams.skin.smallBox(message.status || status, {
+ ams.skin && ams.skin.smallBox(message.status || status, {
title: message.message,
icon: message.icon || 'fa fa-fw fa-info-circle font-xs align-top margin-top-10',
timeout: message.timeout || 3000
@@ -401,23 +401,23 @@
if (result.messagebox) {
message = result.messagebox;
if (typeof(message) === 'string') {
- ams.skin.messageBox('info', {
- title: ams.i18n.ERROR_OCCURED,
- content: message,
- timeout: 10000
- });
+ ams.skin && ams.skin.messageBox('info', {
+ title: ams.i18n.ERROR_OCCURED,
+ content: message,
+ timeout: 10000
+ });
} else {
var messageStatus = message.status || 'info';
if (messageStatus === 'error' && form && target) {
ams.executeFunctionByName(form.data('ams-form-submit-error') || 'MyAMS.form.finalizeSubmitOnError', form, target);
}
- ams.skin.messageBox(messageStatus, {
- title: message.title || ams.i18n.ERROR_OCCURED,
- content: message.content,
- icon: message.icon,
- number: message.number,
- timeout: message.timeout === null ? undefined : (message.timeout || 10000)
- });
+ ams.skin && ams.skin.messageBox(messageStatus, {
+ title: message.title || ams.i18n.ERROR_OCCURED,
+ content: message.content,
+ icon: message.icon,
+ number: message.number,
+ timeout: message.timeout === null ? undefined : (message.timeout || 10000)
+ });
}
}
if (result.event) {
--- a/src/pyams_skin/resources/js/myams-ajax.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-ajax.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(e,t){var o=t.MyAMS;o.ajax={check:function(t,n,a,s){function i(e,t){if(void 0!==a){a instanceof Array||(a=[a]);for(var n=0;n<a.length;n++){var s=o.getFunctionByName(a[n]);"function"==typeof s&&s(e,t)}}}a instanceof Array||"object"==typeof a&&(s=a,a=void 0);var r={async:"function"==typeof a},c=e.extend({},r,s);if(t instanceof Array){for(var l=[],f=0;f<t.length;f++)void 0===t[f]&&l.push(o.getScript(n[f],{async:!0}));l.length>0?e.when.apply(e,l).then(function(){i(!0,s)}):i(!1,s)}else void 0===t?"string"==typeof n&&o.getScript(n,function(){i(!0,s)},c):i(!1,s)},getAddr:function(t){var o=t||e("HTML HEAD BASE").attr("href")||window.location.href;return o.substr(0,o.lastIndexOf("/")+1)},start:function(){e("#ajax-gear").show()},stop:function(){e("#ajax-gear").hide()},progress:function(e){e.lengthComputable&&(e.loaded>=e.total||console&&console.log&&console.log(parseInt(e.loaded/e.total*100,10)+"%"))},getJSON:function(){return function(e){var t=e.url;delete e.url,o.ajax.post(t,e,function(e,t,n){o.ajax.handleJSON(e)})}},post:function(n,a,s,i){var r;r=n.startsWith(window.location.protocol)?n:this.getAddr()+n,"function"==typeof s?(i=s,s={}):s||(s={}),void 0===i&&(i=s.callback),"string"==typeof i&&(i=o.getFunctionByName(i)),delete s.callback;var c,l={url:r,type:"post",cache:!1,async:"function"==typeof i,data:e.param(a),dataType:"json",beforeSend:function(e,n){if(void 0!==t.Cookies){var a=Cookies.get(o.csrfCookieName);a&&e.setRequestHeader(o.csrfHeaderName,a)}},success:i||function(e){c=e.result}},f=e.extend({},l,s);return e.ajax(f),c},getResponse:function(e){var t,n,a=e.getResponseHeader("content-type");if(a)if(a.startsWith("application/javascript"))t="script",n=e.responseText;else if(a.startsWith("text/html"))t="html",n=e.responseText;else if(a.startsWith("text/xml"))t="xml",n=e.responseText;else if(n=e.responseJSON)t="json";else try{n=JSON.parse(e.responseText),t="json"}catch(o){n=e.responseText,t="text"}else t="json",n={status:"alert",alert:{title:o.i18n.ERROR_OCCURED,content:o.i18n.NO_SERVER_RESPONSE}};return{contentType:t,data:n}},handleJSON:function(n,a,s){var i,r=n.status;switch(r){case"alert":t.alert&&t.alert(n.alert.title+"\n\n"+n.alert.content);break;case"error":o.form.showErrors(a,n);break;case"info":case"success":void 0!==a&&(o.form.resetChanged(a),!1!==n.close_form&&o.dialog.close(a));break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":void 0!==a&&(o.form.resetChanged(a),!1!==n.close_form&&o.dialog.close(a));break;case"modal":o.dialog.open(n.location);break;case"reload":void 0!==a&&(o.form.resetChanged(a),!1!==n.close_form&&o.dialog.close(a)),(i=n.location||window.location.hash).startsWith("#")&&(i=i.substr(1));var c=e(n.target||s||"#content");o.skin.loadURL(i,c,{preLoadCallback:o.getFunctionByName(n.pre_reload)||function(){e("[data-ams-pre-reload]",c).each(function(){o.executeFunctionByName(e(this).data("ams-pre-reload"))})},preLoadCallbackOptions:n.pre_reload_options,afterLoadCallback:o.getFunctionByName(n.post_reload)||function(){e("[data-ams-post-reload]",c).each(function(){o.executeFunctionByName(e(this).data("ams-post-reload"))})},afterLoadCallbackOptions:n.post_reload_options});break;case"redirect":void 0!==a&&(o.form.resetChanged(a),!0===n.close_form&&o.dialog.close(a)),(i=n.location||window.location.href).endsWith("##")&&(i=i.replace(/##/,window.location.hash)),n.window?window.open(i,n.window,n.options):window.location.href===i?window.location.reload(!0):window.location.href=i;break;default:console&&console.log&&console.log("Unhandled status: "+r)}var l,f,d;if(n.content&&(f=n.content,d=e(f.target||s||a||"#content"),!0===f.raw?d.text(f.text):(d.html(f.html),o.initContent(d)),f.keep_hidden||d.removeClass("hidden")),n.contents){var u=n.contents;for(l=0;l<u.length;l++)f=u[l],d=e(f.target),!0===f.raw?d.text(f.text):(d.html(f.html),o.initContent(d)),f.keep_hidden||d.removeClass("hidden")}var m;if(n.message&&("string"==typeof(m=n.message)?"info"===r||"success"===r?o.skin.smallBox(r,{title:m,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):o.skin.alert(e(a||"#content"),r,m):o.skin.alert(e(m.target||s||a||"#content"),m.status||"success",m.header,m.body,m.subtitle)),n.smallbox&&("string"==typeof(m=n.smallbox)?o.skin.smallBox(n.smallbox_status||r,{title:n.smallbox,icon:n.smallbox_icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:n.smallbox_timeout||3e3}):o.skin.smallBox(m.status||r,{title:m.message,icon:m.icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:m.timeout||3e3})),n.messagebox)if("string"==typeof(m=n.messagebox))o.skin.messageBox("info",{title:o.i18n.ERROR_OCCURED,content:m,timeout:1e4});else{var p=m.status||"info";"error"===p&&a&&s&&o.executeFunctionByName(a.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",a,s),o.skin.messageBox(p,{title:m.title||o.i18n.ERROR_OCCURED,content:m.content,icon:m.icon,number:m.number,timeout:null===m.timeout?void 0:m.timeout||1e4})}if(n.event&&a.trigger(n.event,n.event_options),n.events){var g;for(void 0===a&&(a=e(document)),l=0;l<n.events.length;l++)null!==(g=n.events[l])&&("string"==typeof g?a.trigger(g,n.events_options):a.trigger(g.event,g.options))}if(n.callback&&o.executeFunctionByName(n.callback,a,n.options),n.callbacks){var h;for(l=0;l<n.callbacks.length;l++)"function"==typeof(h=n.callbacks[l])?o.executeFunctionByName(h,a,h.options):o.executeFunctionByName(h.callback,a,h.options)}}}}(jQuery,this);
+!function(e,t){var o=t.MyAMS;o.ajax={check:function(t,n,a,s){function i(e,t){if(void 0!==a){a instanceof Array||(a=[a]);for(var n=0;n<a.length;n++){var s=o.getFunctionByName(a[n]);"function"==typeof s&&s(e,t)}}}a instanceof Array||"object"==typeof a&&(s=a,a=void 0);var r={async:"function"==typeof a},l=e.extend({},r,s);if(t instanceof Array){for(var c=[],f=0;f<t.length;f++)void 0===t[f]&&c.push(o.getScript(n[f],{async:!0}));c.length>0?e.when.apply(e,c).then(function(){i(!0,s)}):i(!1,s)}else void 0===t?"string"==typeof n&&o.getScript(n,function(){i(!0,s)},l):i(!1,s)},getAddr:function(t){var o=t||e("HTML HEAD BASE").attr("href")||window.location.href;return o.substr(0,o.lastIndexOf("/")+1)},start:function(){e("#ajax-gear").show()},stop:function(){e("#ajax-gear").hide()},progress:function(e){e.lengthComputable&&(e.loaded>=e.total||console&&console.log&&console.log(parseInt(e.loaded/e.total*100,10)+"%"))},getJSON:function(){return function(e){var t=e.url;delete e.url,o.ajax.post(t,e,function(e,t,n){o.ajax.handleJSON(e)})}},post:function(n,a,s,i){var r;r=n.startsWith(window.location.protocol)?n:this.getAddr()+n,"function"==typeof s?(i=s,s={}):s||(s={}),void 0===i&&(i=s.callback),"string"==typeof i&&(i=o.getFunctionByName(i)),delete s.callback;var l,c={url:r,type:"post",cache:!1,async:"function"==typeof i,data:e.param(a),dataType:"json",beforeSend:function(e,n){if(void 0!==t.Cookies){var a=Cookies.get(o.csrfCookieName);a&&e.setRequestHeader(o.csrfHeaderName,a)}},success:i||function(e){l=e.result}},f=e.extend({},c,s);return e.ajax(f),l},getResponse:function(e){var t,n,a=e.getResponseHeader("content-type");if(a)if(a.startsWith("application/javascript"))t="script",n=e.responseText;else if(a.startsWith("text/html"))t="html",n=e.responseText;else if(a.startsWith("text/xml"))t="xml",n=e.responseText;else if(n=e.responseJSON)t="json";else try{n=JSON.parse(e.responseText),t="json"}catch(o){n=e.responseText,t="text"}else t="json",n={status:"alert",alert:{title:o.i18n.ERROR_OCCURED,content:o.i18n.NO_SERVER_RESPONSE}};return{contentType:t,data:n}},handleJSON:function(n,a,s){var i,r=n.status;switch(r){case"alert":t.alert&&t.alert(n.alert.title+"\n\n"+n.alert.content);break;case"error":o.form&&o.form.showErrors(a,n);break;case"info":case"success":void 0!==a&&(o.form&&o.form.resetChanged(a),!1!==n.close_form&&o.dialog&&o.dialog.close(a));break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":void 0!==a&&(o.form&&o.form.resetChanged(a),!1!==n.close_form&&o.dialog&&o.dialog.close(a));break;case"modal":o.dialog&&o.dialog.open(n.location);break;case"reload":void 0!==a&&(o.form&&o.form.resetChanged(a),!1!==n.close_form&&o.dialog&&o.dialog.close(a)),(i=n.location||window.location.hash).startsWith("#")&&(i=i.substr(1));var l=e(n.target||s||"#content");o.skin&&o.skin.loadURL(i,l,{preLoadCallback:o.getFunctionByName(n.pre_reload)||function(){e("[data-ams-pre-reload]",l).each(function(){o.executeFunctionByName(e(this).data("ams-pre-reload"))})},preLoadCallbackOptions:n.pre_reload_options,afterLoadCallback:o.getFunctionByName(n.post_reload)||function(){e("[data-ams-post-reload]",l).each(function(){o.executeFunctionByName(e(this).data("ams-post-reload"))})},afterLoadCallbackOptions:n.post_reload_options});break;case"redirect":void 0!==a&&(o.form&&o.form.resetChanged(a),!0===n.close_form&&o.dialog&&o.dialog.close(a)),(i=n.location||window.location.href).endsWith("##")&&(i=i.replace(/##/,window.location.hash)),n.window?window.open(i,n.window,n.options):window.location.href===i?window.location.reload(!0):window.location.href=i;break;default:console&&console.log&&console.log("Unhandled status: "+r)}var c,f,d;if(n.content&&(f=n.content,d=e(f.target||s||a||"#content"),!0===f.raw?d.text(f.text):(d.html(f.html),o.initContent&&o.initContent(d)),f.keep_hidden||d.removeClass("hidden")),n.contents){var u=n.contents;for(c=0;c<u.length;c++)f=u[c],d=e(f.target),!0===f.raw?d.text(f.text):(d.html(f.html),o.initContent&&o.initContent(d)),f.keep_hidden||d.removeClass("hidden")}var m;if(n.message&&("string"==typeof(m=n.message)?"info"===r||"success"===r?o.skin&&o.skin.smallBox(r,{title:m,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):o.skin&&o.skin.alert(e(a||"#content"),r,m):o.skin&&o.skin.alert(e(m.target||s||a||"#content"),m.status||"success",m.header,m.body,m.subtitle)),n.smallbox&&("string"==typeof(m=n.smallbox)?o.skin&&o.skin.smallBox(n.smallbox_status||r,{title:n.smallbox,icon:n.smallbox_icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:n.smallbox_timeout||3e3}):o.skin&&o.skin.smallBox(m.status||r,{title:m.message,icon:m.icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:m.timeout||3e3})),n.messagebox)if("string"==typeof(m=n.messagebox))o.skin&&o.skin.messageBox("info",{title:o.i18n.ERROR_OCCURED,content:m,timeout:1e4});else{var p=m.status||"info";"error"===p&&a&&s&&o.executeFunctionByName(a.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",a,s),o.skin&&o.skin.messageBox(p,{title:m.title||o.i18n.ERROR_OCCURED,content:m.content,icon:m.icon,number:m.number,timeout:null===m.timeout?void 0:m.timeout||1e4})}if(n.event&&a.trigger(n.event,n.event_options),n.events){var g;for(void 0===a&&(a=e(document)),c=0;c<n.events.length;c++)null!==(g=n.events[c])&&("string"==typeof g?a.trigger(g,n.events_options):a.trigger(g.event,g.options))}if(n.callback&&o.executeFunctionByName(n.callback,a,n.options),n.callbacks){var h;for(c=0;c<n.callbacks.length;c++)"function"==typeof(h=n.callbacks[c])?o.executeFunctionByName(h,a,h.options):o.executeFunctionByName(h.callback,a,h.options)}}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-browser.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-browser.js Thu Dec 13 14:28:29 2018 +0100
@@ -90,14 +90,13 @@
}
}
if (copied) {
- ams.skin.smallBox('success',
- {
- title: text.length > 1
- ? ams.i18n.CLIPBOARD_TEXT_COPY_OK
- : ams.i18n.CLIPBOARD_CHARACTER_COPY_OK,
- icon: 'fa fa-fw fa-info-circle font-xs align-top margin-top-10',
- timeout: 3000
- });
+ ams.skin && ams.skin.smallBox('success', {
+ title: text.length > 1
+ ? ams.i18n.CLIPBOARD_TEXT_COPY_OK
+ : ams.i18n.CLIPBOARD_CHARACTER_COPY_OK,
+ icon: 'fa fa-fw fa-info-circle font-xs align-top margin-top-10',
+ timeout: 3000
+ });
} else if (globals.prompt) {
globals.prompt(ams.i18n.CLIPBOARD_COPY, text);
}
--- a/src/pyams_skin/resources/js/myams-browser.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-browser.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(e,o){var r=o.MyAMS;r.browser={getInternetExplorerVersion:function(){var e=-1;if("Microsoft Internet Explorer"===navigator.appName){var o=navigator.userAgent;null!==new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(o)&&(e=parseFloat(RegExp.$1))}return e},checkVersion:function(){var e="You're not using Windows Internet Explorer.",r=this.getInternetExplorerVersion();r>-1&&(e=r>=8?"You're using a recent copy of Windows Internet Explorer.":"You should upgrade your copy of Windows Internet Explorer."),o.alert&&o.alert(e)},isIE8orlower:function(){var e="0",o=this.getInternetExplorerVersion();return o>-1&&(e=o>=9?0:1),e},copyToClipboard:function(n){function t(n){var t=!1;if(window.clipboardData&&window.clipboardData.setData)t=clipboardData.setData("Text",n);else if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var a=e("<textarea>");a.val(n),a.css("position","fixed"),a.appendTo(e("body")),a.get(0).select();try{document.execCommand("copy"),t=!0}catch(e){console&&console.warn&&console.warn("Copy to clipboard failed.",e)}finally{a.remove()}}t?r.skin.smallBox("success",{title:n.length>1?r.i18n.CLIPBOARD_TEXT_COPY_OK:r.i18n.CLIPBOARD_CHARACTER_COPY_OK,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):o.prompt&&o.prompt(r.i18n.CLIPBOARD_COPY,n)}if(void 0===n)return function(){var o=e(this),r=o.text();o.parents(".btn-group").removeClass("open"),t(r)};t(n)}}}(jQuery,this);
+!function(e,o){var n=o.MyAMS;n.browser={getInternetExplorerVersion:function(){var e=-1;if("Microsoft Internet Explorer"===navigator.appName){var o=navigator.userAgent;null!==new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(o)&&(e=parseFloat(RegExp.$1))}return e},checkVersion:function(){var e="You're not using Windows Internet Explorer.",n=this.getInternetExplorerVersion();n>-1&&(e=n>=8?"You're using a recent copy of Windows Internet Explorer.":"You should upgrade your copy of Windows Internet Explorer."),o.alert&&o.alert(e)},isIE8orlower:function(){var e="0",o=this.getInternetExplorerVersion();return o>-1&&(e=o>=9?0:1),e},copyToClipboard:function(r){function t(r){var t=!1;if(window.clipboardData&&window.clipboardData.setData)t=clipboardData.setData("Text",r);else if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var a=e("<textarea>");a.val(r),a.css("position","fixed"),a.appendTo(e("body")),a.get(0).select();try{document.execCommand("copy"),t=!0}catch(e){console&&console.warn&&console.warn("Copy to clipboard failed.",e)}finally{a.remove()}}t?n.skin&&n.skin.smallBox("success",{title:r.length>1?n.i18n.CLIPBOARD_TEXT_COPY_OK:n.i18n.CLIPBOARD_CHARACTER_COPY_OK,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):o.prompt&&o.prompt(n.i18n.CLIPBOARD_COPY,r)}if(void 0===r)return function(){var o=e(this),n=o.text();o.parents(".btn-group").removeClass("open"),t(n)};t(r)}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-callbacks.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-callbacks.js Thu Dec 13 14:28:29 2018 +0100
@@ -99,7 +99,7 @@
var message = data.amsAlertMessage || settings.message;
var subtitle = data.amsAlertSubtitle || settings.subtitle;
var margin = data.amsAlertMargin === undefined ? (settings.margin === undefined ? false : settings.margin) : data.amsAlertMargin;
- ams.skin.alert(parent, status, header, message, subtitle, margin);
+ ams.skin && ams.skin.alert(parent, status, header, message, subtitle, margin);
},
/**
@@ -128,7 +128,7 @@
});
var status = data.amsMessageboxStatus || dataOptions.status || 'info';
var callback = ams.getFunctionByName(data.amsMessageboxCallback || dataOptions.callback);
- ams.skin.messageBox(status, settings, callback);
+ ams.skin && ams.skin.messageBox(status, settings, callback);
},
/**
@@ -157,7 +157,7 @@
});
var status = data.amsSmallboxStatus || dataOptions.status || 'info';
var callback = ams.getFunctionByName(data.amsSmallboxCallback || dataOptions.callback);
- ams.skin.smallBox(status, settings, callback);
+ ams.skin && ams.skin.smallBox(status, settings, callback);
}
};
--- a/src/pyams_skin/resources/js/myams-callbacks.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-callbacks.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(a,e){var t=e.MyAMS;t.callbacks={init:function(e){a("[data-ams-callback]",e).each(function(){var e=this,s=a(e).data();try{var n=JSON.parse(s.amsCallback);Array.isArray(n)||(n=[n])}catch(a){n=s.amsCallback.split(/\s+/)}for(var l=0;l<n.length;l++){var o=n[l];if("string"==typeof o){var c=t.getFunctionByName(o),i=s.amsCallbackOptions;"string"==typeof i&&(i=i.unserialize()),void 0===c?s.amsCallbackSource?t.getScript(s.amsCallbackSource,function(a){t.executeFunctionByName(a,e,i)}(o),{async:void 0===s.amsCallbackAsync||s.amsCallbackAsync}):console&&console.warn&&console.warn("Undefined callback: "+s.amsCallback):c.call(e,i)}else c=t.getFunctionByName(o.callback),"string"==typeof(i=o.options)&&(i=i.unserialize()),void 0===c?o.source?t.getScript(o.source,function(a){t.executeFunctionByName(a.callback,e,a.options)}(o),{async:void 0===o.async||o.async}):console&&console.warn&&console.warn("Undefined callback: "+o.callback):c.call(e,o.options)}})},alert:function(e){var s=a(this).data(),n=a.extend({},e,s.amsAlertOptions),l=a(s.amsAlertParent||n.parent||this),o=s.amsAlertStatus||n.status||"info",c=s.amsAlertHeader||n.header,i=s.amsAlertMessage||n.message,m=s.amsAlertSubtitle||n.subtitle,r=void 0===s.amsAlertMargin?void 0!==n.margin&&n.margin:s.amsAlertMargin;t.skin.alert(l,o,c,i,m,r)},messageBox:function(e){var s=a(this).data(),n=a.extend({},e,s.amsMessageboxOptions),l=a.extend({},n,{title:s.amsMessageboxTitle||n.title||"",content:s.amsMessageboxContent||n.content||"",icon:s.amsMessageboxIcon||n.icon,number:s.amsMessageboxNumber||n.number,timeout:s.amsMessageboxTimeout||n.timeout}),o=s.amsMessageboxStatus||n.status||"info",c=t.getFunctionByName(s.amsMessageboxCallback||n.callback);t.skin.messageBox(o,l,c)},smallBox:function(e){var s=a(this).data(),n=a.extend({},e,s.amsSmallboxOptions),l=a.extend({},n,{title:s.amsSmallboxTitle||n.title||"",content:s.amsSmallboxContent||n.content||"",icon:s.amsSmallboxIcon||n.icon,iconSmall:s.amsSmallboxIconSmall||n.iconSmall,timeout:s.amsSmallboxTimeout||n.timeout}),o=s.amsSmallboxStatus||n.status||"info",c=t.getFunctionByName(s.amsSmallboxCallback||n.callback);t.skin.smallBox(o,l,c)}}}(jQuery,this);
+!function(a,e){var t=e.MyAMS;t.callbacks={init:function(e){a("[data-ams-callback]",e).each(function(){var e=this,s=a(e).data();try{var n=JSON.parse(s.amsCallback);Array.isArray(n)||(n=[n])}catch(a){n=s.amsCallback.split(/\s+/)}for(var l=0;l<n.length;l++){var o=n[l];if("string"==typeof o){var i=t.getFunctionByName(o),c=s.amsCallbackOptions;"string"==typeof c&&(c=c.unserialize()),void 0===i?s.amsCallbackSource?t.getScript(s.amsCallbackSource,function(a){t.executeFunctionByName(a,e,c)}(o),{async:void 0===s.amsCallbackAsync||s.amsCallbackAsync}):console&&console.warn&&console.warn("Undefined callback: "+s.amsCallback):i.call(e,c)}else i=t.getFunctionByName(o.callback),"string"==typeof(c=o.options)&&(c=c.unserialize()),void 0===i?o.source?t.getScript(o.source,function(a){t.executeFunctionByName(a.callback,e,a.options)}(o),{async:void 0===o.async||o.async}):console&&console.warn&&console.warn("Undefined callback: "+o.callback):i.call(e,o.options)}})},alert:function(e){var s=a(this).data(),n=a.extend({},e,s.amsAlertOptions),l=a(s.amsAlertParent||n.parent||this),o=s.amsAlertStatus||n.status||"info",i=s.amsAlertHeader||n.header,c=s.amsAlertMessage||n.message,m=s.amsAlertSubtitle||n.subtitle,r=void 0===s.amsAlertMargin?void 0!==n.margin&&n.margin:s.amsAlertMargin;t.skin&&t.skin.alert(l,o,i,c,m,r)},messageBox:function(e){var s=a(this).data(),n=a.extend({},e,s.amsMessageboxOptions),l=a.extend({},n,{title:s.amsMessageboxTitle||n.title||"",content:s.amsMessageboxContent||n.content||"",icon:s.amsMessageboxIcon||n.icon,number:s.amsMessageboxNumber||n.number,timeout:s.amsMessageboxTimeout||n.timeout}),o=s.amsMessageboxStatus||n.status||"info",i=t.getFunctionByName(s.amsMessageboxCallback||n.callback);t.skin&&t.skin.messageBox(o,l,i)},smallBox:function(e){var s=a(this).data(),n=a.extend({},e,s.amsSmallboxOptions),l=a.extend({},n,{title:s.amsSmallboxTitle||n.title||"",content:s.amsSmallboxContent||n.content||"",icon:s.amsSmallboxIcon||n.icon,iconSmall:s.amsSmallboxIconSmall||n.iconSmall,timeout:s.amsSmallboxTimeout||n.timeout}),o=s.amsSmallboxStatus||n.status||"info",i=t.getFunctionByName(s.amsSmallboxCallback||n.callback);t.skin&&t.skin.smallBox(o,l,i)}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-container.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-container.js Thu Dec 13 14:28:29 2018 +0100
@@ -28,7 +28,7 @@
deleteElement: function() {
return function() {
var link = $(this);
- ams.skin.bigBox({
+ ams.skin && ams.skin.bigBox({
title: ams.i18n.WARNING,
content: '<i class="text-danger fa fa-fw fa-bell"></i> ' + ams.i18n.DELETE_WARNING,
status: 'info',
@@ -43,7 +43,7 @@
}
var deleteTarget = tr.data('ams-delete-target') || table.data('ams-delete-target') || 'delete-element.json';
var objectName = tr.data('ams-element-name');
- ams.ajax.post(location + deleteTarget, {'object_name': objectName}, function(result, status) {
+ ams.ajax && ams.ajax.post(location + deleteTarget, {'object_name': objectName}, function(result, status) {
if (result.status === 'success') {
if (table.hasClass('datatable')) {
table.dataTable().fnDeleteRow(tr[0]);
@@ -51,10 +51,10 @@
tr.remove();
}
if (result.handle_json) {
- ams.ajax.handleJSON(result);
+ ams.ajax && ams.ajax.handleJSON(result);
}
} else {
- ams.ajax.handleJSON(result);
+ ams.ajax && ams.ajax.handleJSON(result);
}
});
}
@@ -72,8 +72,8 @@
var row = source.parents('tr').first();
var table = row.parents('table');
$('i', source).attr('class', 'fa fa-fw fa-spinner fa-pulse');
- ams.ajax.post(table.data('ams-location') + '/' +
- (cell.data('ams-attribute-switcher') || table.data('ams-attribute-switcher')),
+ ams.ajax && ams.ajax.post(table.data('ams-location') + '/' +
+ (cell.data('ams-attribute-switcher') || table.data('ams-attribute-switcher')),
{object_name: row.data('ams-element-name')},
function(result, status) {
if (result.visible) {
@@ -96,8 +96,8 @@
var row = source.parents('tr').first();
var table = row.parents('table');
$('i', source).attr('class', 'fa fa-fw fa-spinner fa-pulse');
- ams.ajax.post(table.data('ams-location') + '/' +
- (cell.data('ams-attribute-switcher') || table.data('ams-attribute-switcher')),
+ ams.ajax && ams.ajax.post(table.data('ams-location') + '/' +
+ (cell.data('ams-attribute-switcher') || table.data('ams-attribute-switcher')),
{object_name: row.data('ams-element-name')},
function(result, status) {
if (result[attribute] || result['on']) {
--- a/src/pyams_skin/resources/js/myams-container.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-container.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(a,t){var e=t.MyAMS;e.container={changeOrder:function(t,e){a('input[name="'+a(this).data("ams-input-name")+'"]',a(this)).val(e.join(";"))},deleteElement:function(){return function(){var t=a(this);e.skin.bigBox({title:e.i18n.WARNING,content:'<i class="text-danger fa fa-fw fa-bell"></i> '+e.i18n.DELETE_WARNING,status:"info",buttons:e.i18n.BTN_OK_CANCEL},function(a){if(a===e.i18n.BTN_OK){var n=t.parents("tr").first(),s=n.parents("table").first(),i=n.data("ams-location")||s.data("ams-location")||"";i&&(i+="/");var r=n.data("ams-delete-target")||s.data("ams-delete-target")||"delete-element.json",f=n.data("ams-element-name");e.ajax.post(i+r,{object_name:f},function(a,t){"success"===a.status?(s.hasClass("datatable")?s.dataTable().fnDeleteRow(n[0]):n.remove(),a.handle_json&&e.ajax.handleJSON(a)):e.ajax.handleJSON(a)})}})}},switchElementVisibility:function(){return function(){var t=a(this),n=t.parents("td").first(),s=t.parents("tr").first(),i=s.parents("table");a("i",t).attr("class","fa fa-fw fa-spinner fa-pulse"),e.ajax.post(i.data("ams-location")+"/"+(n.data("ams-attribute-switcher")||i.data("ams-attribute-switcher")),{object_name:s.data("ams-element-name")},function(e,n){e.visible?a("i",t).attr("class","fa fa-fw fa-eye"):a("i",t).attr("class","fa fa-fw fa-eye-slash text-danger")})}},switchElementAttribute:function(){return function(){var t=a(this),n=t.parents("td").first(),s=n.data("ams-switcher-attribute-name"),i=t.parents("tr").first(),r=i.parents("table");a("i",t).attr("class","fa fa-fw fa-spinner fa-pulse"),e.ajax.post(r.data("ams-location")+"/"+(n.data("ams-attribute-switcher")||r.data("ams-attribute-switcher")),{object_name:i.data("ams-element-name")},function(e,n){e[s]||e.on?a("i",t).attr("class",r.data("ams-"+s+"-icon-on")||"fa fa-fw fa-check-square-o"):a("i",t).attr("class",r.data("ams-"+s+"-icon-off")||"fa fa-fw fa-check-square txt-color-silver opacity-75")})}}}}(jQuery,this);
+!function(a,t){var e=t.MyAMS;e.container={changeOrder:function(t,e){a('input[name="'+a(this).data("ams-input-name")+'"]',a(this)).val(e.join(";"))},deleteElement:function(){return function(){var t=a(this);e.skin&&e.skin.bigBox({title:e.i18n.WARNING,content:'<i class="text-danger fa fa-fw fa-bell"></i> '+e.i18n.DELETE_WARNING,status:"info",buttons:e.i18n.BTN_OK_CANCEL},function(a){if(a===e.i18n.BTN_OK){var n=t.parents("tr").first(),s=n.parents("table").first(),i=n.data("ams-location")||s.data("ams-location")||"";i&&(i+="/");var r=n.data("ams-delete-target")||s.data("ams-delete-target")||"delete-element.json",f=n.data("ams-element-name");e.ajax&&e.ajax.post(i+r,{object_name:f},function(a,t){"success"===a.status?(s.hasClass("datatable")?s.dataTable().fnDeleteRow(n[0]):n.remove(),a.handle_json&&e.ajax&&e.ajax.handleJSON(a)):e.ajax&&e.ajax.handleJSON(a)})}})}},switchElementVisibility:function(){return function(){var t=a(this),n=t.parents("td").first(),s=t.parents("tr").first(),i=s.parents("table");a("i",t).attr("class","fa fa-fw fa-spinner fa-pulse"),e.ajax&&e.ajax.post(i.data("ams-location")+"/"+(n.data("ams-attribute-switcher")||i.data("ams-attribute-switcher")),{object_name:s.data("ams-element-name")},function(e,n){e.visible?a("i",t).attr("class","fa fa-fw fa-eye"):a("i",t).attr("class","fa fa-fw fa-eye-slash text-danger")})}},switchElementAttribute:function(){return function(){var t=a(this),n=t.parents("td").first(),s=n.data("ams-switcher-attribute-name"),i=t.parents("tr").first(),r=i.parents("table");a("i",t).attr("class","fa fa-fw fa-spinner fa-pulse"),e.ajax&&e.ajax.post(r.data("ams-location")+"/"+(n.data("ams-attribute-switcher")||r.data("ams-attribute-switcher")),{object_name:i.data("ams-element-name")},function(e,n){e[s]||e.on?a("i",t).attr("class",r.data("ams-"+s+"-icon-on")||"fa fa-fw fa-check-square-o"):a("i",t).attr("class",r.data("ams-"+s+"-icon-off")||"fa fa-fw fa-check-square txt-color-silver opacity-75")})}}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-core.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-core.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-"use strict";!function(s,e){var t=e.console;String.prototype.startsWith=function(t){var e=this.length,r=t.length;return!(e<r)&&this.substr(0,r)===t},String.prototype.endsWith=function(t){var e=this.length,r=t.length;return!(e<r)&&this.substr(e-r)===t},String.prototype.unserialize=function(t){for(var e=decodeURIComponent(this).split("&"),r={},n=0;n<e.length;n++){var i=e[n].split("=",2);r[i[0]]=i[1]}return r},Array.prototype.indexOf||(Array.prototype.indexOf=function(t,e){var r=this.length;for((e=(e=Number(e)||0)<0?Math.ceil(e):Math.floor(e))<0&&(e+=r);e<r;e++)if(e in this&&this[e]===t)return e;return-1}),s.expr[":"].hasvalue=function(t,e,r){return""!==s(t).val()},s.expr[":"].econtains=function(t,e,r){return(t.textContent||t.innerText||s(t).text()||"").toLowerCase()===r[3].toLowerCase()},s.expr[":"].withtext=function(t,e,r){return(t.textContent||t.innerText||s(t).text()||"")===r[3]},s.expr[":"].parents=function(t,e,r){return 0<s(t).parents(r[3]).length},void 0===s.scrollbarWidth&&(s.scrollbarWidth=function(){var t=s('<div style="width: 50px; height: 50px; overflow: auto"><div/></div>').appendTo("body"),e=t.children(),r=e.innerWidth()-e.height(99).innerWidth();return t.remove(),r}),s.fn.extend({exists:function(){return 0<s(this).length},objectOrParentWithClass:function(t){return this.hasClass(t)?this:this.parents("."+t)},listattr:function(t){var e=[];return this.each(function(){e.push(s(this).attr(t))}),e},style:function(t,e,r){if(void 0!==this.get(0)){var n=this.get(0).style;return void 0!==t?void 0!==e?(r=void 0!==r?r:"",n.setProperty(t,e,r),this):n.getPropertyValue(t):n}},removeClassPrefix:function(n){return this.each(function(t,e){var r=e.className.split(" ").map(function(t){return t.startsWith(n)?"":t});e.className=s.trim(r.join(" "))}),this}}),void 0===e.MyAMS&&(e.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var r,n=e.MyAMS,c=n;n.baseURL=(r=s('script[src*="/myams.js"], script[src*="/myams.min.js"], script[src*="/myams-core.js"], script[src*="/myams-core.min.js"], script[src*="/myams-require.js"], script[src*="/myams-require.min.js"]').attr("src"),c.devmode=r.indexOf(".min.js")<0,c.devext=c.devmode?"":".min",r.substring(0,r.lastIndexOf("/")+1)),n.log=function(){t&&t.debug&&t.debug(this,arguments)},n.getQueryVar=function(t,e){if(t.indexOf("?")<0)return!1;t.endsWith("&")||(t+="&");var r=new RegExp(".*?[&\\?]"+e+"=(.*?)&.*"),n=t.replace(r,"$1");return n!==t&&n},n.rgb2hex=function(t){return"#"+s.map(t.match(/\b(\d+)\b/g),function(t){return("0"+parseInt(t).toString(16)).slice(-2)}).join("")},n.generateId=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+t()+t()},n.generateUUID=function(){var r=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(r+16*Math.random())%16|0;return r=Math.floor(r/16),("x"===t?e:3&e|8).toString(16)})},n.getObject=function(t,e){if(t){if("string"!=typeof t)return t;var r=t.split(".");e=null==e?window:e;for(var n=0;n<r.length;n++)try{e=e[r[n]]}catch(t){return}return e}},n.getFunctionByName=function(t,e){if(void 0!==t){if("function"==typeof t)return t;var r=t.split("."),n=r.pop();e=null==e?window:e;for(var i=0;i<r.length;i++)try{e=e[r[i]]}catch(t){return}try{return e[n]}catch(t){return}}},n.executeFunctionByName=function(t,e){var r=c.getFunctionByName(t,window);if("function"==typeof r){var n=Array.prototype.slice.call(arguments,2);return r.apply(e,n)}},n.isInDOM=function(t){return!!(t=s(t)).exists()&&e.document.body.contains(t[0])},n.getSource=function(t){return t.replace(/{[^{}]*}/g,function(t){return c.getFunctionByName(t.substr(1,t.length-2))})},n.getScript=function(t,e,r,n){"object"==typeof e&&(n=r,r=e,e=null),void 0===r&&(r={});var i={dataType:"script",url:c.getSource(t),success:e,error:n||c.error.show,cache:!c.devmode,async:void 0===r.async?"function"==typeof e:r.async},o=s.extend({},i,r);return s.ajax(o)},n.getCSS=function(t,e,r,n){r&&(r=c.getFunctionByName(r));var i=s("HEAD"),o=s('style[data-ams-id="'+e+'"]',i);if(0===o.length){if(o=s("<style>").attr("data-ams-id",e).text('@import "'+c.getSource(t)+'";'),r)var a=setInterval(function(){try{o[0].sheet.cssRules;r.call(window,!0,n),clearInterval(a)}catch(t){}},10);o.appendTo(i)}else r&&r.call(window,!1,n)}}(jQuery,this);
+"use strict";!function(t,e){var r=e.console;String.prototype.startsWith=function(t){var e=this.length,r=t.length;return!(e<r)&&this.substr(0,r)===t},String.prototype.endsWith=function(t){var e=this.length,r=t.length;return!(e<r)&&this.substr(e-r)===t},String.prototype.unserialize=function(t){for(var e=decodeURIComponent(this).split("&"),r={},n=0;n<e.length;n++){var i=e[n].split("=",2);r[i[0]]=i[1]}return r},Array.prototype.indexOf||(Array.prototype.indexOf=function(t,e){var r=this.length;for((e=(e=Number(e)||0)<0?Math.ceil(e):Math.floor(e))<0&&(e+=r);e<r;e++)if(e in this&&this[e]===t)return e;return-1}),t.expr[":"].hasvalue=function(e,r,n){return""!==t(e).val()},t.expr[":"].econtains=function(e,r,n){return(e.textContent||e.innerText||t(e).text()||"").toLowerCase()===n[3].toLowerCase()},t.expr[":"].withtext=function(e,r,n){return(e.textContent||e.innerText||t(e).text()||"")===n[3]},t.expr[":"].parents=function(e,r,n){return t(e).parents(n[3]).length>0},void 0===t.scrollbarWidth&&(t.scrollbarWidth=function(){var e=t('<div style="width: 50px; height: 50px; overflow: auto"><div/></div>').appendTo("body"),r=e.children(),n=r.innerWidth()-r.height(99).innerWidth();return e.remove(),n}),t.fn.extend({exists:function(){return t(this).length>0},objectOrParentWithClass:function(t){return this.hasClass(t)?this:this.parents("."+t)},listattr:function(e){var r=[];return this.each(function(){r.push(t(this).attr(e))}),r},style:function(t,e,r){if(void 0!==this.get(0)){var n=this.get(0).style;return void 0!==t?void 0!==e?(r=void 0!==r?r:"",n.setProperty(t,e,r),this):n.getPropertyValue(t):n}},removeClassPrefix:function(e){return this.each(function(r,n){var i=n.className.split(" ").map(function(t){return t.startsWith(e)?"":t});n.className=t.trim(i.join(" "))}),this}}),void 0===e.MyAMS&&(e.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var n=e.MyAMS,i=n;n.baseURL=function(){var e=t('script[src*="/myams.js"], script[src*="/myams.min.js"], script[src*="/myams-core.js"], script[src*="/myams-core.min.js"], script[src*="/myams-require.js"], script[src*="/myams-require.min.js"]').attr("src");return i.devmode=e.indexOf(".min.js")<0,i.devext=i.devmode?"":".min",e.substring(0,e.lastIndexOf("/")+1)}(),n.log=function(){r&&r.debug&&r.debug(this,arguments)},n.getQueryVar=function(t,e){if(t.indexOf("?")<0)return!1;t.endsWith("&")||(t+="&");var r=new RegExp(".*?[&\\?]"+e+"=(.*?)&.*"),n=t.replace(r,"$1");return n!==t&&n},n.rgb2hex=function(e){return"#"+t.map(e.match(/\b(\d+)\b/g),function(t){return("0"+parseInt(t).toString(16)).slice(-2)}).join("")},n.generateId=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+t()+t()},n.generateUUID=function(){var t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?r:3&r|8).toString(16)})},n.getObject=function(t,e){if(t){if("string"!=typeof t)return t;var r=t.split(".");e=void 0===e||null===e?window:e;for(var n=0;n<r.length;n++)try{e=e[r[n]]}catch(t){return}return e}},n.getFunctionByName=function(t,e){if(void 0!==t){if("function"==typeof t)return t;var r=t.split("."),n=r.pop();e=void 0===e||null===e?window:e;for(var i=0;i<r.length;i++)try{e=e[r[i]]}catch(t){return}try{return e[n]}catch(t){return}}},n.executeFunctionByName=function(t,e){var r=i.getFunctionByName(t,window);if("function"==typeof r){var n=Array.prototype.slice.call(arguments,2);return r.apply(e,n)}},n.isInDOM=function(r){return!!(r=t(r)).exists()&&e.document.body.contains(r[0])},n.getSource=function(t){return t.replace(/{[^{}]*}/g,function(t){return i.getFunctionByName(t.substr(1,t.length-2))})},n.getScript=function(e,r,n,o){"object"==typeof r&&(o=n,n=r,r=null),void 0===n&&(n={});var a={dataType:"script",url:i.getSource(e),success:r,error:o||i.error.show,cache:!i.devmode,async:void 0===n.async?"function"==typeof r:n.async},s=t.extend({},a,n);return t.ajax(s)},n.getCSS=function(e,r,n,o){n&&(n=i.getFunctionByName(n));var a=t("HEAD"),s=t('style[data-ams-id="'+r+'"]',a);if(0===s.length){if(s=t("<style>").attr("data-ams-id",r).text('@import "'+i.getSource(e)+'";'),n)var c=setInterval(function(){try{s[0].sheet.cssRules;n.call(window,!0,o),clearInterval(c)}catch(t){}},10);s.appendTo(a)}else n&&n.call(window,!1,o)}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-dialog.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-dialog.js Thu Dec 13 14:28:29 2018 +0100
@@ -69,106 +69,106 @@
* Modal dialog opener
*/
open: function(source, options, callbacks) {
- ams.ajax.check($.fn.modalmanager,
- ams.baseURL + 'ext/bootstrap-modalmanager' + ams.devext + '.js',
- function() {
- ams.ajax.check($.fn.modal.defaults,
- ams.baseURL + 'ext/bootstrap-modal' + ams.devext + '.js',
- function(first_load) {
- if (first_load) {
- $(document).off('click.modal');
- $.fn.modal.defaults.spinner = $.fn.modalmanager.defaults.spinner =
- '<div class="loading-spinner" style="width: 200px; margin-left: -100px;">' +
- '<div class="progress progress-striped active">' +
- '<div class="progress-bar" style="width: 100%;"></div>' +
- '</div>' +
- '</div>';
- }
+ ams.ajax && ams.ajax.check($.fn.modalmanager,
+ ams.baseURL + 'ext/bootstrap-modalmanager' + ams.devext + '.js',
+ function() {
+ ams.ajax.check($.fn.modal.defaults,
+ ams.baseURL + 'ext/bootstrap-modal' + ams.devext + '.js',
+ function(first_load) {
+ if (first_load) {
+ $(document).off('click.modal');
+ $.fn.modal.defaults.spinner = $.fn.modalmanager.defaults.spinner =
+ '<div class="loading-spinner" style="width: 200px; margin-left: -100px;">' +
+ '<div class="progress progress-striped active">' +
+ '<div class="progress-bar" style="width: 100%;"></div>' +
+ '</div>' +
+ '</div>';
+ }
- var sourceData;
- var url;
- if (typeof(source) === 'string') {
- sourceData = {};
- url = source;
- } else {
- sourceData = source.data();
- url = source.attr('href') || sourceData.amsUrl;
- var url_getter = ams.getFunctionByName(url);
- if (typeof(url_getter) === 'function') {
- url = url_getter.call(source);
- }
- }
- if (!url) {
- return;
- }
- $('body').modalmanager('loading');
- if (url.indexOf('#') === 0) {
- // Inner hidden modal dialog
- $(url).modal('show');
- } else {
- // Remote URL modal dialog
- $.ajax({
- url: url,
- type: 'get',
- cache: sourceData.amsAllowCache === undefined ? false : sourceData.amsAllowCache,
- data: options,
- success: function(data, status, request) {
- $('body').modalmanager('removeLoading');
- var response = ams.ajax.getResponse(request);
- var dataType = response.contentType;
- var result = response.data;
- switch (dataType) {
- case 'json':
- ams.ajax.handleJSON(result, $($(source).data('ams-json-target') || '#content'));
- break;
- case 'script':
- break;
- case 'xml':
- break;
- case 'html':
- /* falls through */
- case 'text':
- /* falls through */
- default:
- var content = $(result);
- var dialog = $('.modal-dialog', content.wrap('<div></div>').parent());
- var dialogData = dialog.data() || {};
- var dataOptions = {
- backdrop: 'static',
- overflow: dialogData.amsModalOverflow || '.modal-viewport',
- maxHeight: dialogData.amsModalMaxHeight === undefined ?
- function() {
- return $(window).height() -
- $('.modal-header', content).outerHeight(true) -
- $('footer', content).outerHeight(true) - 85;
- }
- : ams.getFunctionByName(dialogData.amsModalMaxHeight)
- };
- var settings = $.extend({}, dataOptions, dialogData.amsModalOptions);
- settings = ams.executeFunctionByName(dialogData.amsModalInitCallback, dialog, settings) || settings;
- if (callbacks) {
- if (callbacks.shown) {
- ams.dialog.registerShownCallback(callbacks.shown, content);
- }
- if (callbacks.hide) {
- ams.dialog.registerHideCallback(callbacks.hide, content);
- }
- }
- $('<div>').addClass('modal fade')
- .append(content)
- .modal(settings)
- .on('shown', ams.dialog.shown)
- .on('hidden', ams.dialog.hidden);
- ams.initContent(content);
- if (sourceData.amsLogEvent !== false) {
- ams.stats.logPageview(url);
- }
- }
- }
- });
- }
- });
- });
+ var sourceData;
+ var url;
+ if (typeof (source) === 'string') {
+ sourceData = {};
+ url = source;
+ } else {
+ sourceData = source.data();
+ url = source.attr('href') || sourceData.amsUrl;
+ var url_getter = ams.getFunctionByName(url);
+ if (typeof (url_getter) === 'function') {
+ url = url_getter.call(source);
+ }
+ }
+ if (!url) {
+ return;
+ }
+ $('body').modalmanager('loading');
+ if (url.indexOf('#') === 0) {
+ // Inner hidden modal dialog
+ $(url).modal('show');
+ } else {
+ // Remote URL modal dialog
+ $.ajax({
+ url: url,
+ type: 'get',
+ cache: sourceData.amsAllowCache === undefined ? false : sourceData.amsAllowCache,
+ data: options,
+ success: function(data, status, request) {
+ $('body').modalmanager('removeLoading');
+ var response = ams.ajax.getResponse(request);
+ var dataType = response.contentType;
+ var result = response.data;
+ switch (dataType) {
+ case 'json':
+ ams.ajax.handleJSON(result, $($(source).data('ams-json-target') || '#content'));
+ break;
+ case 'script':
+ break;
+ case 'xml':
+ break;
+ case 'html':
+ /* falls through */
+ case 'text':
+ /* falls through */
+ default:
+ var content = $(result);
+ var dialog = $('.modal-dialog', content.wrap('<div></div>').parent());
+ var dialogData = dialog.data() || {};
+ var dataOptions = {
+ backdrop: 'static',
+ overflow: dialogData.amsModalOverflow || '.modal-viewport',
+ maxHeight: dialogData.amsModalMaxHeight === undefined ?
+ function() {
+ return $(window).height() -
+ $('.modal-header', content).outerHeight(true) -
+ $('footer', content).outerHeight(true) - 85;
+ }
+ : ams.getFunctionByName(dialogData.amsModalMaxHeight)
+ };
+ var settings = $.extend({}, dataOptions, dialogData.amsModalOptions);
+ settings = ams.executeFunctionByName(dialogData.amsModalInitCallback, dialog, settings) || settings;
+ if (callbacks) {
+ if (callbacks.shown) {
+ ams.dialog.registerShownCallback(callbacks.shown, content);
+ }
+ if (callbacks.hide) {
+ ams.dialog.registerHideCallback(callbacks.hide, content);
+ }
+ }
+ $('<div>').addClass('modal fade')
+ .append(content)
+ .modal(settings)
+ .on('shown', ams.dialog.shown)
+ .on('hidden', ams.dialog.hidden);
+ ams.initContent && ams.initContent(content);
+ if (sourceData.amsLogEvent !== false) {
+ ams.stats && ams.stats.logPageview(url);
+ }
+ }
+ }
+ });
+ }
+ });
+ });
},
/**
@@ -242,7 +242,7 @@
}
}
- ams.form.setFocus(modal);
+ ams.form && ams.form.setFocus(modal);
},
/**
@@ -268,7 +268,7 @@
hidden: function(e) {
var modal = e.target;
// Call registered cleaning callbacks
- ams.skin.cleanContainer(modal);
+ ams.skin && ams.skin.cleanContainer(modal);
// Check for hidden callbacks defined via data API
$('[data-ams-hidden-callback]', modal).each(function() {
var callback = ams.getFunctionByName($(this).data('ams-hidden-callback'));
--- a/src/pyams_skin/resources/js/myams-dialog.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-dialog.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(a,e){var o=e.MyAMS;o.dialog={_shown_callbacks:[],registerShownCallback:function(a,e){var l;e&&(l=e.objectOrParentWithClass("modal-dialog"));var t;l&&l.exists()?void 0===(t=l.data("shown-callbacks"))&&(t=[],l.data("shown-callbacks",t)):t=o.dialog._shown_callbacks,t.indexOf(a)<0&&t.push(a)},_hide_callbacks:[],registerHideCallback:function(a,e){var l;e&&(l=e.objectOrParentWithClass("modal-dialog"));var t;l&&l.exists()?void 0===(t=l.data("hide-callbacks"))&&(t=[],l.data("hide-callbacks",t)):t=o.dialog._hide_callbacks,t.indexOf(a)<0&&t.push(a)},open:function(e,l,t){o.ajax.check(a.fn.modalmanager,o.baseURL+"ext/bootstrap-modalmanager"+o.devext+".js",function(){o.ajax.check(a.fn.modal.defaults,o.baseURL+"ext/bootstrap-modal"+o.devext+".js",function(s){s&&(a(document).off("click.modal"),a.fn.modal.defaults.spinner=a.fn.modalmanager.defaults.spinner='<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="progress-bar" style="width: 100%;"></div></div></div>');var d,i;if("string"==typeof e)d={},i=e;else{d=e.data(),i=e.attr("href")||d.amsUrl;var n=o.getFunctionByName(i);"function"==typeof n&&(i=n.call(e))}i&&(a("body").modalmanager("loading"),0===i.indexOf("#")?a(i).modal("show"):a.ajax({url:i,type:"get",cache:void 0!==d.amsAllowCache&&d.amsAllowCache,data:l,success:function(l,s,n){a("body").modalmanager("removeLoading");var c=o.ajax.getResponse(n),r=c.contentType,h=c.data;switch(r){case"json":o.ajax.handleJSON(h,a(a(e).data("ams-json-target")||"#content"));break;case"script":case"xml":break;case"html":case"text":default:var m=a(h),g=a(".modal-dialog",m.wrap("<div></div>").parent()),f=g.data()||{},v={backdrop:"static",overflow:f.amsModalOverflow||".modal-viewport",maxHeight:void 0===f.amsModalMaxHeight?function(){return a(window).height()-a(".modal-header",m).outerHeight(!0)-a("footer",m).outerHeight(!0)-85}:o.getFunctionByName(f.amsModalMaxHeight)},p=a.extend({},v,f.amsModalOptions);p=o.executeFunctionByName(f.amsModalInitCallback,g,p)||p,t&&(t.shown&&o.dialog.registerShownCallback(t.shown,m),t.hide&&o.dialog.registerHideCallback(t.hide,m)),a("<div>").addClass("modal fade").append(m).modal(p).on("shown",o.dialog.shown).on("hidden",o.dialog.hidden),o.initContent(m),!1!==d.amsLogEvent&&o.stats.logPageview(i)}}}))})})},shown:function(e){function l(e){var o=a(".scrollmarker.top",s),l=s.scrollTop();l>0?o.show():o.hide();var t=a(".scrollmarker.bottom",s);d+l>=s.get(0).scrollHeight?t.hide():t.show()}var t=e.target,s=a(".modal-viewport",t);if(s.exists()){var d=parseInt(s.css("max-height")),i=a.scrollbarWidth();"hidden"!==s.css("overflow")&&s.height()===d?(a("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",s.width()-i).hide().appendTo(s),a("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",d-20).css("width",s.width()-i).appendTo(s),s.scroll(l),s.off("resize").on("resize",l)):a(".scrollmarker",s).remove()}a("[data-ams-shown-callback]",t).each(function(){var e=o.getFunctionByName(a(this).data("ams-shown-callback"));e&&e.call(t,this)});var n,c=a(".modal-dialog",t).data("shown-callbacks");if(c)for(n=0;n<c.length;n++)c[n].call(t);if(c=o.dialog._shown_callbacks)for(n=0;n<c.length;n++)c[n].call(t);o.form.setFocus(t)},close:function(e){"string"==typeof e&&(e=a(e));var o=e.parents(".modal").data("modal");if(o){var l=a("body").data("modalmanager");l&&l.getOpenModals().indexOf(o)>=0&&o.hide()}},hidden:function(e){var l=e.target;o.skin.cleanContainer(l),a("[data-ams-hidden-callback]",l).each(function(){var e=o.getFunctionByName(a(this).data("ams-hidden-callback"));e&&e.call(l,this)});var t,s=a(".modal-dialog",l).data("hide-callbacks");if(s)for(t=0;t<s.length;t++)s[t].call(l);if(s=o.dialog._hide_callbacks)for(t=0;t<s.length;t++)s[t].call(l)}}}(jQuery,this);
+!function(a,e){var o=e.MyAMS;o.dialog={_shown_callbacks:[],registerShownCallback:function(a,e){var t;e&&(t=e.objectOrParentWithClass("modal-dialog"));var l;t&&t.exists()?void 0===(l=t.data("shown-callbacks"))&&(l=[],t.data("shown-callbacks",l)):l=o.dialog._shown_callbacks,l.indexOf(a)<0&&l.push(a)},_hide_callbacks:[],registerHideCallback:function(a,e){var t;e&&(t=e.objectOrParentWithClass("modal-dialog"));var l;t&&t.exists()?void 0===(l=t.data("hide-callbacks"))&&(l=[],t.data("hide-callbacks",l)):l=o.dialog._hide_callbacks,l.indexOf(a)<0&&l.push(a)},open:function(e,t,l){o.ajax&&o.ajax.check(a.fn.modalmanager,o.baseURL+"ext/bootstrap-modalmanager"+o.devext+".js",function(){o.ajax.check(a.fn.modal.defaults,o.baseURL+"ext/bootstrap-modal"+o.devext+".js",function(s){s&&(a(document).off("click.modal"),a.fn.modal.defaults.spinner=a.fn.modalmanager.defaults.spinner='<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="progress-bar" style="width: 100%;"></div></div></div>');var d,i;if("string"==typeof e)d={},i=e;else{d=e.data(),i=e.attr("href")||d.amsUrl;var n=o.getFunctionByName(i);"function"==typeof n&&(i=n.call(e))}i&&(a("body").modalmanager("loading"),0===i.indexOf("#")?a(i).modal("show"):a.ajax({url:i,type:"get",cache:void 0!==d.amsAllowCache&&d.amsAllowCache,data:t,success:function(t,s,n){a("body").modalmanager("removeLoading");var c=o.ajax.getResponse(n),r=c.contentType,h=c.data;switch(r){case"json":o.ajax.handleJSON(h,a(a(e).data("ams-json-target")||"#content"));break;case"script":case"xml":break;case"html":case"text":default:var m=a(h),g=a(".modal-dialog",m.wrap("<div></div>").parent()),f=g.data()||{},v={backdrop:"static",overflow:f.amsModalOverflow||".modal-viewport",maxHeight:void 0===f.amsModalMaxHeight?function(){return a(window).height()-a(".modal-header",m).outerHeight(!0)-a("footer",m).outerHeight(!0)-85}:o.getFunctionByName(f.amsModalMaxHeight)},p=a.extend({},v,f.amsModalOptions);p=o.executeFunctionByName(f.amsModalInitCallback,g,p)||p,l&&(l.shown&&o.dialog.registerShownCallback(l.shown,m),l.hide&&o.dialog.registerHideCallback(l.hide,m)),a("<div>").addClass("modal fade").append(m).modal(p).on("shown",o.dialog.shown).on("hidden",o.dialog.hidden),o.initContent&&o.initContent(m),!1!==d.amsLogEvent&&o.stats&&o.stats.logPageview(i)}}}))})})},shown:function(e){function t(e){var o=a(".scrollmarker.top",s),t=s.scrollTop();t>0?o.show():o.hide();var l=a(".scrollmarker.bottom",s);d+t>=s.get(0).scrollHeight?l.hide():l.show()}var l=e.target,s=a(".modal-viewport",l);if(s.exists()){var d=parseInt(s.css("max-height")),i=a.scrollbarWidth();"hidden"!==s.css("overflow")&&s.height()===d?(a("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",s.width()-i).hide().appendTo(s),a("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",d-20).css("width",s.width()-i).appendTo(s),s.scroll(t),s.off("resize").on("resize",t)):a(".scrollmarker",s).remove()}a("[data-ams-shown-callback]",l).each(function(){var e=o.getFunctionByName(a(this).data("ams-shown-callback"));e&&e.call(l,this)});var n,c=a(".modal-dialog",l).data("shown-callbacks");if(c)for(n=0;n<c.length;n++)c[n].call(l);if(c=o.dialog._shown_callbacks)for(n=0;n<c.length;n++)c[n].call(l);o.form&&o.form.setFocus(l)},close:function(e){"string"==typeof e&&(e=a(e));var o=e.parents(".modal").data("modal");if(o){var t=a("body").data("modalmanager");t&&t.getOpenModals().indexOf(o)>=0&&o.hide()}},hidden:function(e){var t=e.target;o.skin&&o.skin.cleanContainer(t),a("[data-ams-hidden-callback]",t).each(function(){var e=o.getFunctionByName(a(this).data("ams-hidden-callback"));e&&e.call(t,this)});var l,s=a(".modal-dialog",t).data("hide-callbacks");if(s)for(l=0;l<s.length;l++)s[l].call(t);if(s=o.dialog._hide_callbacks)for(l=0;l<s.length;l++)s[l].call(t)}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-error.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-error.js Thu Dec 13 14:28:29 2018 +0100
@@ -18,22 +18,26 @@
if (response && response.statusText && response.statusText.toUpperCase() === 'OK') {
return;
}
- response = ams.ajax.getResponse(response);
- if (response.contentType === 'json') {
- ams.ajax.handleJSON(response.data);
+ response = ams.ajax && ams.ajax.getResponse(response);
+ if (response) {
+ if (response.contentType === 'json') {
+ ams.ajax.handleJSON(response.data);
+ } else {
+ var title = error || event.statusText || event.type;
+ var message = response.responseText;
+ ams.skin && ams.skin.messageBox('error', {
+ title: ams.i18n.ERROR_OCCURED,
+ content: '<h4>' + title + '</h4><p>' + (message || '') + '</p>',
+ icon: 'fa fa-warning animated shake',
+ timeout: 10000
+ });
+ }
+ if (console) {
+ console.error && console.error(event);
+ console.debug && console.debug(response);
+ }
} else {
- var title = error || event.statusText || event.type;
- var message = response.responseText;
- ams.skin.messageBox('error', {
- title: ams.i18n.ERROR_OCCURED,
- content: '<h4>' + title + '</h4><p>' + (message || '') + '</p>',
- icon: 'fa fa-warning animated shake',
- timeout: 10000
- });
- }
- if (console) {
- console.error && console.error(event);
- console.debug && console.debug(response);
+ console.error && console.error("Missing MyAMS AJAX module!")
}
},
@@ -44,20 +48,24 @@
if (!error) {
return;
}
- var response = ams.ajax.getResponse(request);
- if (response.contentType === 'json') {
- ams.ajax.handleJSON(response.data);
+ var response = ams.ajax && ams.ajax.getResponse(request);
+ if (response) {
+ if (response.contentType === 'json') {
+ ams.ajax.handleJSON(response.data);
+ } else {
+ ams.skin.messageBox('error', {
+ title: ams.i18n.ERRORS_OCCURED,
+ content: '<h4>' + status + '</h4><p>' + error + '</p>',
+ icon: "fa fa-warning animated shake",
+ timeout: 10000
+ });
+ }
+ if (console) {
+ console.error && console.error(error);
+ console.debug && console.debug(request);
+ }
} else {
- ams.skin.messageBox('error', {
- title: ams.i18n.ERRORS_OCCURED,
- content: '<h4>' + status + '</h4><p>' + error + '</p>',
- icon: "fa fa-warning animated shake",
- timeout: 10000
- });
- }
- if (console) {
- console.error && console.error(error);
- console.debug && console.debug(request);
+ console.error && console.error("Missing MyAMS AJAX module!")
}
}
};
--- a/src/pyams_skin/resources/js/myams-error.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-error.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(e,o){var n=o.MyAMS;n.error={ajax:function(e,o,t,a){if(!("abort"===a||o&&o.statusText&&"OK"===o.statusText.toUpperCase())){if("json"===(o=n.ajax.getResponse(o)).contentType)n.ajax.handleJSON(o.data);else{var s=a||e.statusText||e.type,r=o.responseText;n.skin.messageBox("error",{title:n.i18n.ERROR_OCCURED,content:"<h4>"+s+"</h4><p>"+(r||"")+"</p>",icon:"fa fa-warning animated shake",timeout:1e4})}console&&(console.error&&console.error(e),console.debug&&console.debug(o))}},show:function(e,o,t){if(t){var a=n.ajax.getResponse(e);"json"===a.contentType?n.ajax.handleJSON(a.data):n.skin.messageBox("error",{title:n.i18n.ERRORS_OCCURED,content:"<h4>"+o+"</h4><p>"+t+"</p>",icon:"fa fa-warning animated shake",timeout:1e4}),console&&(console.error&&console.error(t),console.debug&&console.debug(e))}}}}(jQuery,this);
+!function(e,o){var n=o.MyAMS;n.error={ajax:function(e,o,s,a){if(!("abort"===a||o&&o.statusText&&"OK"===o.statusText.toUpperCase()))if(o=n.ajax&&n.ajax.getResponse(o)){if("json"===o.contentType)n.ajax.handleJSON(o.data);else{var r=a||e.statusText||e.type,t=o.responseText;n.skin&&n.skin.messageBox("error",{title:n.i18n.ERROR_OCCURED,content:"<h4>"+r+"</h4><p>"+(t||"")+"</p>",icon:"fa fa-warning animated shake",timeout:1e4})}console&&(console.error&&console.error(e),console.debug&&console.debug(o))}else console.error&&console.error("Missing MyAMS AJAX module!")},show:function(e,o,s){if(s){var a=n.ajax&&n.ajax.getResponse(e);a?("json"===a.contentType?n.ajax.handleJSON(a.data):n.skin.messageBox("error",{title:n.i18n.ERRORS_OCCURED,content:"<h4>"+o+"</h4><p>"+s+"</p>",icon:"fa fa-warning animated shake",timeout:1e4}),console&&(console.error&&console.error(s),console.debug&&console.debug(e))):console.error&&console.error("Missing MyAMS AJAX module!")}}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-form.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-form.js Thu Dec 13 14:28:29 2018 +0100
@@ -104,7 +104,7 @@
cancelCallback.call(element);
}
} else {
- ams.skin.bigBox({
+ ams.skin && ams.skin.bigBox({
title: ams.i18n.WARNING,
content: '<i class="text-danger fa fa-2x fa-bell shake animated"></i> ' + ams.i18n.FORM_CHANGED_WARNING,
buttons: ams.i18n.BTN_OK_CANCEL
@@ -151,7 +151,7 @@
// Prevent multiple submits of the same form
if (form.data('submitted')) {
if (!form.data('ams-form-hide-submitted')) {
- ams.skin.messageBox('warning', {
+ ams.skin && ams.skin.messageBox('warning', {
title: ams.i18n.WAIT,
content: ams.i18n.FORM_SUBMITTED,
icon: 'fa fa-save shake animated',
@@ -161,7 +161,7 @@
return false;
}
// Check submit validators
- if (!ams.form._checkSubmitValidators(form)) {
+ if (ams.form && !ams.form._checkSubmitValidators(form)) {
return false;
}
// Remove remaining status messages
@@ -173,283 +173,283 @@
button.data('ams-progress-content', button.html());
button.button('loading');
}
- ams.ajax.check($.fn.ajaxSubmit,
- ams.baseURL + 'ext/jquery-form-3.49' + ams.devext + '.js',
- function() {
+ ams.ajax && ams.ajax.check($.fn.ajaxSubmit,
+ ams.baseURL + 'ext/jquery-form-3.49' + ams.devext + '.js',
+ function() {
- function _submitAjaxForm(form, options) {
+ function _submitAjaxForm(form, options) {
- var button,
- buttonData,
- buttonTarget;
- var data = form.data();
- var formOptions = data.amsFormOptions;
- var formData;
- var formDataCallback;
+ var button,
+ buttonData,
+ buttonTarget;
+ var data = form.data();
+ var formOptions = data.amsFormOptions;
+ var formData;
+ var formDataCallback;
- var progressHandler;
- var progressInterval;
- var progressCallback;
- var progressEndCallback;
+ var progressHandler;
+ var progressInterval;
+ var progressCallback;
+ var progressEndCallback;
- // Inner progress status handler
- function _getProgress(handler, progress_id) {
+ // Inner progress status handler
+ function _getProgress(handler, progress_id) {
- var interval;
+ var interval;
- function _clearProgressStatus() {
- clearInterval(interval);
- ams.form.resetAfterSubmit(form, button);
- button.html(button.data('ams-progress-content'));
- ams.executeFunctionByName(progressEndCallback, form, button);
- ams.form.resetChanged(form);
- }
+ function _clearProgressStatus() {
+ clearInterval(interval);
+ ams.form.resetAfterSubmit(form, button);
+ button.html(button.data('ams-progress-content'));
+ ams.executeFunctionByName(progressEndCallback, form, button);
+ ams.form.resetChanged(form);
+ }
- function _getProgressStatus() {
- ams.ajax.post(handler,
- {progress_id: progress_id},
- {error: _clearProgressStatus},
- ams.getFunctionByName(progressCallback) || function(result, status) {
- if (status === 'success') {
- if (result.status === 'running') {
- if (result.message) {
- button.text(result.message);
- } else {
- var text = button.data('ams-progress-text') || ams.i18n.PROGRESS;
- if (result.current) {
- text += ': ' + result.current + '/ ' + (result.length || 100);
- } else {
- text += '...';
- }
- button.text(text);
- }
- } else if (result.status === 'finished') {
- _clearProgressStatus();
- }
- } else {
- _clearProgressStatus();
- }
- });
- }
+ function _getProgressStatus() {
+ ams.ajax && ams.ajax.post(handler,
+ {progress_id: progress_id},
+ {error: _clearProgressStatus},
+ ams.getFunctionByName(progressCallback) || function(result, status) {
+ if (status === 'success') {
+ if (result.status === 'running') {
+ if (result.message) {
+ button.text(result.message);
+ } else {
+ var text = button.data('ams-progress-text') || ams.i18n.PROGRESS;
+ if (result.current) {
+ text += ': ' + result.current + '/ ' + (result.length || 100);
+ } else {
+ text += '...';
+ }
+ button.text(text);
+ }
+ } else if (result.status === 'finished') {
+ _clearProgressStatus();
+ }
+ } else {
+ _clearProgressStatus();
+ }
+ });
+ }
- button.button('loading');
- interval = setInterval(_getProgressStatus, progressInterval);
- }
+ button.button('loading');
+ interval = setInterval(_getProgressStatus, progressInterval);
+ }
- // Initialize form data
- if (submitOptions) {
- formDataCallback = submitOptions.formDataInitCallback;
- }
- if (formDataCallback) {
- delete submitOptions.formDataInitCallback;
- } else {
- formDataCallback = data.amsFormDataInitCallback;
- }
- if (formDataCallback) {
- var veto = {};
- formData = ams.executeFunctionByName(formDataCallback, form, veto);
- if (veto.veto) {
- button = form.data('ams-submit-button');
- if (button) {
- button.button('reset');
- }
- ams.form.finalizeSubmitFooter.call(form);
- return false;
- }
- } else {
- formData = data.amsFormData || {};
- }
+ // Initialize form data
+ if (submitOptions) {
+ formDataCallback = submitOptions.formDataInitCallback;
+ }
+ if (formDataCallback) {
+ delete submitOptions.formDataInitCallback;
+ } else {
+ formDataCallback = data.amsFormDataInitCallback;
+ }
+ if (formDataCallback) {
+ var veto = {};
+ formData = ams.executeFunctionByName(formDataCallback, form, veto);
+ if (veto.veto) {
+ button = form.data('ams-submit-button');
+ if (button) {
+ button.button('reset');
+ }
+ ams.form.finalizeSubmitFooter.call(form);
+ return false;
+ }
+ } else {
+ formData = data.amsFormData || {};
+ }
- // Check submit button for custom action handler and target
- button = $(form.data('ams-submit-button'));
- if (button && button.exists()) {
- buttonData = button.data();
- buttonTarget = buttonData.amsFormSubmitTarget;
- } else {
- buttonData = {};
- }
+ // Check submit button for custom action handler and target
+ button = $(form.data('ams-submit-button'));
+ if (button && button.exists()) {
+ buttonData = button.data();
+ buttonTarget = buttonData.amsFormSubmitTarget;
+ } else {
+ buttonData = {};
+ }
- // Check action URL
- var url;
- var formHandler = handler || buttonData.amsFormHandler || data.amsFormHandler || '';
- if (formHandler.startsWith(window.location.protocol)) {
- url = formHandler;
- } else {
- var action = buttonData.amsFormAction || form.attr('action').replace(/#/, '');
- if (action.startsWith(window.location.protocol)) {
- url = action;
- } else {
- url = ams.ajax.getAddr() + action;
- }
- url += formHandler;
- }
- progressHandler = buttonData.amsProgressHandler || data.amsProgressHandler || '';
- progressInterval = buttonData.amsProgressInterval || data.amsProgressInterval || 1000;
- progressCallback = buttonData.amsProgressCallback || data.amsProgressCallback;
- progressEndCallback = buttonData.amsProgressEndCallback || data.amsProgressEndCallback;
+ // Check action URL
+ var url;
+ var formHandler = handler || buttonData.amsFormHandler || data.amsFormHandler || '';
+ if (formHandler.startsWith(window.location.protocol)) {
+ url = formHandler;
+ } else {
+ var action = buttonData.amsFormAction || form.attr('action').replace(/#/, '');
+ if (action.startsWith(window.location.protocol)) {
+ url = action;
+ } else {
+ url = ams.ajax && (ams.ajax.getAddr() + action);
+ }
+ url += formHandler;
+ }
+ progressHandler = buttonData.amsProgressHandler || data.amsProgressHandler || '';
+ progressInterval = buttonData.amsProgressInterval || data.amsProgressInterval || 1000;
+ progressCallback = buttonData.amsProgressCallback || data.amsProgressCallback;
+ progressEndCallback = buttonData.amsProgressEndCallback || data.amsProgressEndCallback;
- // Initialize submit target with AJAX indicator
- var target = null;
- if (submitOptions && submitOptions.initSubmitTarget) {
- ams.executeFunctionByName(submitOptions.initSubmitTarget, form);
- } else {
- if (data.amsFormInitSubmitTarget) {
- target = $(buttonTarget || data.amsFormSubmitTarget || '#content');
- ams.executeFunctionByName(data.amsFormInitSubmit || 'MyAMS.form.initSubmit', form, target);
- } else if (!data.amsFormHideSubmitFooter) {
- ams.executeFunctionByName(data.amsFormInitSubmit || 'MyAMS.form.initSubmitFooter', form);
- }
- }
+ // Initialize submit target with AJAX indicator
+ var target = null;
+ if (submitOptions && submitOptions.initSubmitTarget) {
+ ams.executeFunctionByName(submitOptions.initSubmitTarget, form);
+ } else {
+ if (data.amsFormInitSubmitTarget) {
+ target = $(buttonTarget || data.amsFormSubmitTarget || '#content');
+ ams.executeFunctionByName(data.amsFormInitSubmit || 'MyAMS.form.initSubmit', form, target);
+ } else if (!data.amsFormHideSubmitFooter) {
+ ams.executeFunctionByName(data.amsFormInitSubmit || 'MyAMS.form.initSubmitFooter', form);
+ }
+ }
- // Complete form data
- if (submitOptions) {
- formData = $.extend({}, formData, submitOptions.form_data);
- }
+ // Complete form data
+ if (submitOptions) {
+ formData = $.extend({}, formData, submitOptions.form_data);
+ }
- // Check progress handler
- var hasUpload;
- if (progressHandler) {
- formData.progress_id = ams.generateUUID();
- } else {
- // Check progress meter via Apache progress module
- hasUpload = typeof(options.uuid) !== 'undefined';
- if (hasUpload) {
- if (url.indexOf('X-Progress-ID') < 0) {
- url += "?X-Progress-ID=" + options.uuid;
- }
- delete options.uuid;
- }
- }
+ // Check progress handler
+ var hasUpload;
+ if (progressHandler) {
+ formData.progress_id = ams.generateUUID();
+ } else {
+ // Check progress meter via Apache progress module
+ hasUpload = typeof (options.uuid) !== 'undefined';
+ if (hasUpload) {
+ if (url.indexOf('X-Progress-ID') < 0) {
+ url += "?X-Progress-ID=" + options.uuid;
+ }
+ delete options.uuid;
+ }
+ }
- // Initialize default AJAX settings
- var defaults = {
- url: url,
- type: 'post',
- cache: false,
- data: formData,
- dataType: data.amsFormDatatype,
- beforeSerialize: function(/*form, options*/) {
- if (typeof(globals.tinyMCE) !== 'undefined') {
- globals.tinyMCE.triggerSave();
- }
- },
- beforeSubmit: function(data, form /*, options*/) {
- form.data('submitted', true);
- },
- error: function(request, status, error, form) {
- if (target) {
- ams.executeFunctionByName(data.amsFormSubmitError || 'MyAMS.form.finalizeSubmitOnError', form, target);
- }
- ams.form.resetAfterSubmit(form);
- },
- iframe: hasUpload
- };
+ // Initialize default AJAX settings
+ var defaults = {
+ url: url,
+ type: 'post',
+ cache: false,
+ data: formData,
+ dataType: data.amsFormDatatype,
+ beforeSerialize: function(/*form, options*/) {
+ if (typeof (globals.tinyMCE) !== 'undefined') {
+ globals.tinyMCE.triggerSave();
+ }
+ },
+ beforeSubmit: function(data, form /*, options*/) {
+ form.data('submitted', true);
+ },
+ error: function(request, status, error, form) {
+ if (target) {
+ ams.executeFunctionByName(data.amsFormSubmitError || 'MyAMS.form.finalizeSubmitOnError', form, target);
+ }
+ ams.form.resetAfterSubmit(form);
+ },
+ iframe: hasUpload
+ };
- // Initialize IFrame for custom download target
- var downloadTarget = (submitOptions && submitOptions.downloadTarget) || data.amsFormDownloadTarget;
- if (downloadTarget) {
- var iframe = $('iframe[name="' + downloadTarget + '"]');
- if (!iframe.exists()) {
- iframe = $('<iframe></iframe>').hide()
- .attr('name', downloadTarget)
- .appendTo($('body'));
- }
- defaults = $.extend({}, defaults, {
- iframe: true,
- iframeTarget: iframe,
- success: function(result, status, request, form) {
- var modal = $(form).parents('.modal-dialog');
- if (modal.exists()) {
- ams.dialog.close(form);
- } else {
- var callback;
- var button = form.data('ams-submit-button');
- if (button) {
- callback = button.data('ams-form-submit-callback');
- }
- if (!callback) {
- callback = ams.getFunctionByName(data.amsFormSubmitCallback) || ams.form._submitCallback;
- }
- try {
- callback.call(form, result, status, request, form);
- } finally {
- ams.form.resetAfterSubmit(form);
- ams.form.resetChanged(form);
- }
- }
- }
- });
- } else {
- defaults = $.extend({}, defaults, {
- error: function(request, status, error, form) {
- if (target) {
- ams.executeFunctionByName(data.amsFormSubmitError || 'MyAMS.form.finalizeSubmitOnError', form, target);
- }
- ams.form.resetAfterSubmit(form);
- },
- success: function(result, status, request, form) {
- var callback;
- var button = form.data('ams-submit-button');
- if (button) {
- callback = button.data('ams-form-submit-callback');
- }
- if (!callback) {
- callback = ams.getFunctionByName(data.amsFormSubmitCallback) || ams.form._submitCallback;
- }
- try {
- callback.call(form, result, status, request, form);
- } finally {
- ams.form.resetAfterSubmit(form);
- ams.form.resetChanged(form);
- }
- },
- iframe: hasUpload
- });
- }
- var settings = $.extend({}, defaults, options, formOptions, submitOptions);
+ // Initialize IFrame for custom download target
+ var downloadTarget = (submitOptions && submitOptions.downloadTarget) || data.amsFormDownloadTarget;
+ if (downloadTarget) {
+ var iframe = $('iframe[name="' + downloadTarget + '"]');
+ if (!iframe.exists()) {
+ iframe = $('<iframe></iframe>').hide()
+ .attr('name', downloadTarget)
+ .appendTo($('body'));
+ }
+ defaults = $.extend({}, defaults, {
+ iframe: true,
+ iframeTarget: iframe,
+ success: function(result, status, request, form) {
+ var modal = $(form).parents('.modal-dialog');
+ if (modal.exists()) {
+ ams.dialog && ams.dialog.close(form);
+ } else {
+ var callback;
+ var button = form.data('ams-submit-button');
+ if (button) {
+ callback = button.data('ams-form-submit-callback');
+ }
+ if (!callback) {
+ callback = ams.getFunctionByName(data.amsFormSubmitCallback) || ams.form._submitCallback;
+ }
+ try {
+ callback.call(form, result, status, request, form);
+ } finally {
+ ams.form.resetAfterSubmit(form);
+ ams.form.resetChanged(form);
+ }
+ }
+ }
+ });
+ } else {
+ defaults = $.extend({}, defaults, {
+ error: function(request, status, error, form) {
+ if (target) {
+ ams.executeFunctionByName(data.amsFormSubmitError || 'MyAMS.form.finalizeSubmitOnError', form, target);
+ }
+ ams.form.resetAfterSubmit(form);
+ },
+ success: function(result, status, request, form) {
+ var callback;
+ var button = form.data('ams-submit-button');
+ if (button) {
+ callback = button.data('ams-form-submit-callback');
+ }
+ if (!callback) {
+ callback = ams.getFunctionByName(data.amsFormSubmitCallback) || ams.form._submitCallback;
+ }
+ try {
+ callback.call(form, result, status, request, form);
+ } finally {
+ ams.form.resetAfterSubmit(form);
+ ams.form.resetChanged(form);
+ }
+ },
+ iframe: hasUpload
+ });
+ }
+ var settings = $.extend({}, defaults, options, formOptions, submitOptions);
- // Initialize progress handler
- if (progressHandler) {
- _getProgress(progressHandler, formData.progress_id);
- }
+ // Initialize progress handler
+ if (progressHandler) {
+ _getProgress(progressHandler, formData.progress_id);
+ }
- // Submit form
- $(form).ajaxSubmit(settings);
+ // Submit form
+ $(form).ajaxSubmit(settings);
- // If external download target is specified, reset form submit button and footer
- if (downloadTarget) {
- var modal = $(form).parents('.modal-dialog');
- var keepModal = modal.exists() && button.exists() && button.data('ams-keep-modal');
- if (modal.exists() && (keepModal !== true)) {
- ams.dialog.close(form);
- } else {
- if (!progressHandler) {
- setTimeout(function () {
- ams.form.resetAfterSubmit(form, button);
- ams.form.resetChanged(form);
- }, button.data('ams-form-reset-timeout') || 2000);
- }
- }
- }
- }
+ // If external download target is specified, reset form submit button and footer
+ if (downloadTarget) {
+ var modal = $(form).parents('.modal-dialog');
+ var keepModal = modal.exists() && button.exists() && button.data('ams-keep-modal');
+ if (modal.exists() && (keepModal !== true)) {
+ ams.dialog && ams.dialog.close(form);
+ } else {
+ if (!progressHandler) {
+ setTimeout(function() {
+ ams.form.resetAfterSubmit(form, button);
+ ams.form.resetChanged(form);
+ }, button.data('ams-form-reset-timeout') || 2000);
+ }
+ }
+ }
+ }
- var hasUpload = (form.data('ams-form-ignore-uploads') !== true) &&
- ($('INPUT[type="file"]', form).length > 0);
- if (hasUpload) {
- // JQuery-progressbar plug-in must be loaded synchronously!!
- // Otherwise, hidden input fields created by jquery-validate plug-in
- // and matching named buttons will be deleted (on first form submit)
- // before JQuery-form plug-in can get them when submitting the form...
- ams.ajax.check($.progressBar,
- ams.baseURL + 'ext/jquery-progressbar' + ams.devext + '.js');
- var settings = $.extend({}, {
- uuid: $.progressBar.submit(form)
- });
- _submitAjaxForm(form, settings);
- } else {
- _submitAjaxForm(form, {});
- }
- });
+ var hasUpload = (form.data('ams-form-ignore-uploads') !== true) &&
+ ($('INPUT[type="file"]', form).length > 0);
+ if (hasUpload) {
+ // JQuery-progressbar plug-in must be loaded synchronously!!
+ // Otherwise, hidden input fields created by jquery-validate plug-in
+ // and matching named buttons will be deleted (on first form submit)
+ // before JQuery-form plug-in can get them when submitting the form...
+ ams.ajax && ams.ajax.check($.progressBar,
+ ams.baseURL + 'ext/jquery-progressbar' + ams.devext + '.js');
+ var settings = $.extend({}, {
+ uuid: $.progressBar.submit(form)
+ });
+ _submitAjaxForm(form, settings);
+ } else {
+ _submitAjaxForm(form, {});
+ }
+ });
return false;
},
@@ -569,9 +569,11 @@
if (data.amsFormDatatype) {
dataType = data.amsFormDatatype;
} else {
- var response = ams.ajax.getResponse(request);
- dataType = response.contentType;
- result = response.data;
+ var response = ams.ajax && ams.ajax.getResponse(request);
+ if (response) {
+ dataType = response.contentType;
+ result = response.data;
+ }
}
var target;
@@ -583,7 +585,7 @@
switch (dataType) {
case 'json':
- ams.ajax.handleJSON(result, form, target);
+ ams.ajax && ams.ajax.handleJSON(result, form, target);
break;
case 'script':
break;
@@ -596,7 +598,7 @@
default:
ams.form.resetChanged(form);
if (button && (button.data('ams-keep-modal') !== true)) {
- ams.dialog.close(form);
+ ams.dialog && ams.dialog.close(form);
}
if (!target.exists()) {
target = $('body');
@@ -607,7 +609,7 @@
.html(result)
.delay(50)
.animate({opacity: '1.0'}, 300);
- ams.initContent(target);
+ ams.initContent && ams.initContent(target);
ams.form.setFocus(target);
}
var callback = request.getResponseHeader('X-AMS-Callback');
@@ -664,7 +666,7 @@
}
if (output.length > 0) {
var header = output.length === 1 ? ams.i18n.ERROR_OCCURED : ams.i18n.ERRORS_OCCURED;
- ams.skin.alert(form, 'danger', header, output);
+ ams.skin && ams.skin.alert(form, 'danger', header, output);
return false;
} else {
return result;
@@ -687,10 +689,10 @@
showErrors: function(form, errors) {
var header;
if (typeof(errors) === 'string') {
- ams.skin.alert(form, 'error', ams.i18n.ERROR_OCCURED, errors);
+ ams.skin && ams.skin.alert(form, 'error', ams.i18n.ERROR_OCCURED, errors);
} else if (errors instanceof Array) {
header = errors.length === 1 ? ams.i18n.ERROR_OCCURED : ams.i18n.ERRORS_OCCURED;
- ams.skin.alert(form, 'error', header, errors);
+ ams.skin && ams.skin.alert(form, 'error', header, errors);
} else {
$('.state-error', form).removeClass('state-error');
header = errors.error_header ||
@@ -737,7 +739,7 @@
}
}
}
- ams.skin.alert($('.form-group:first', form), errors.error_level || 'error', header, message, errors.error_message);
+ ams.skin && ams.skin.alert($('.form-group:first', form), errors.error_level || 'error', header, message, errors.error_message);
}
}
};
--- a/src/pyams_skin/resources/js/myams-form.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-form.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(e,a){var t=a.MyAMS;t.form={init:function(a){e("FORM",a).each(function(){var a=e(this);e('INPUT.select2[type="hidden"]',a).each(function(){var a=e(this);a.data("ams-select2-input-value",a.val())})});(t.warnOnFormChange?e('FORM[data-ams-warn-on-change!="false"]',a):e('FORM[data-ams-warn-on-change="true"]',a)).each(function(){var a=e(this);e('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',a).each(function(){var a=e(this);if(!0!==a.data("ams-ignore-change")){var r=a.data("ams-changed-event")||"change";a.on(r,function(){t.form.setChanged(e(this).parents("FORM"))})}}),a.on("reset",function(){t.form.resetChanged(e(this))})})},setFocus:function(a){var t=e("[data-ams-focus-target]",a).first();t.exists()||(t=e("input, select",a).first()),t.exists()&&(t.hasClass("select2-input")&&(t=t.parents(".select2")),t.hasClass("select2")?setTimeout(function(){t.select2("focus"),!0===t.data("ams-focus-open")&&t.select2("open")},100):t.focus())},checkBeforeUnload:function(){if(e('FORM[data-ams-form-changed="true"]').exists())return t.i18n.FORM_CHANGED_WARNING},confirmChangedForm:function(r,s,i){"function"==typeof r&&(s=r,r=void 0),e('FORM[data-ams-form-changed="true"]',r).exists()?i?a.confirm(t.i18n.FORM_CHANGED_WARNING,t.i18n.WARNING)?s.call(r):i.call(r):t.skin.bigBox({title:t.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+t.i18n.FORM_CHANGED_WARNING,buttons:t.i18n.BTN_OK_CANCEL},function(e){e===t.i18n.BTN_OK&&s.call(r)}):s.call(r)},setChanged:function(e){e.attr("data-ams-form-changed",!0)},resetChanged:function(a){void 0!==a&&e(a).removeAttr("data-ams-form-changed")},submit:function(r,s,i){if(!(r=e(r)).exists())return!1;if("object"==typeof s&&(i=s,s=void 0),r.data("submitted"))return r.data("ams-form-hide-submitted")||t.skin.messageBox("warning",{title:t.i18n.WAIT,content:t.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:r.data("ams-form-alert-timeout")||5e3}),!1;if(!t.form._checkSubmitValidators(r))return!1;e(".alert-danger, SPAN.state-error",r).not(".persistent").remove(),e(".state-error",r).removeClassPrefix("state-");var n=e(r.data("ams-submit-button"));return n&&!n.data("ams-form-hide-loading")&&(n.data("ams-progress-content",n.html()),n.button("loading")),t.ajax.check(e.fn.ajaxSubmit,t.baseURL+"ext/jquery-form-3.49"+t.devext+".js",function(){function n(r,n){var o,m,l,u,c,f,d,g,b,h=r.data(),v=h.amsFormOptions;if(i&&(c=i.formDataInitCallback),c?delete i.formDataInitCallback:c=h.amsFormDataInitCallback,c){var p={};if(u=t.executeFunctionByName(c,r,p),p.veto)return(o=r.data("ams-submit-button"))&&o.button("reset"),t.form.finalizeSubmitFooter.call(r),!1}else u=h.amsFormData||{};(o=e(r.data("ams-submit-button")))&&o.exists()?l=(m=o.data()).amsFormSubmitTarget:m={};var C,x=s||m.amsFormHandler||h.amsFormHandler||"";if(x.startsWith(window.location.protocol))C=x;else{var S=m.amsFormAction||r.attr("action").replace(/#/,"");C=S.startsWith(window.location.protocol)?S:t.ajax.getAddr()+S,C+=x}f=m.amsProgressHandler||h.amsProgressHandler||"",d=m.amsProgressInterval||h.amsProgressInterval||1e3,g=m.amsProgressCallback||h.amsProgressCallback,b=m.amsProgressEndCallback||h.amsProgressEndCallback;var F=null;i&&i.initSubmitTarget?t.executeFunctionByName(i.initSubmitTarget,r):h.amsFormInitSubmitTarget?(F=e(l||h.amsFormSubmitTarget||"#content"),t.executeFunctionByName(h.amsFormInitSubmit||"MyAMS.form.initSubmit",r,F)):h.amsFormHideSubmitFooter||t.executeFunctionByName(h.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",r),i&&(u=e.extend({},u,i.form_data));var R;f?u.progress_id=t.generateUUID():(R=void 0!==n.uuid)&&(C.indexOf("X-Progress-ID")<0&&(C+="?X-Progress-ID="+n.uuid),delete n.uuid);var y={url:C,type:"post",cache:!1,data:u,dataType:h.amsFormDatatype,beforeSerialize:function(){void 0!==a.tinyMCE&&a.tinyMCE.triggerSave()},beforeSubmit:function(e,a){a.data("submitted",!0)},error:function(e,a,r,s){F&&t.executeFunctionByName(h.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",s,F),t.form.resetAfterSubmit(s)},iframe:R},N=i&&i.downloadTarget||h.amsFormDownloadTarget;if(N){var O=e('iframe[name="'+N+'"]');O.exists()||(O=e("<iframe></iframe>").hide().attr("name",N).appendTo(e("body"))),y=e.extend({},y,{iframe:!0,iframeTarget:O,success:function(a,r,s,i){if(e(i).parents(".modal-dialog").exists())t.dialog.close(i);else{var n,o=i.data("ams-submit-button");o&&(n=o.data("ams-form-submit-callback")),n||(n=t.getFunctionByName(h.amsFormSubmitCallback)||t.form._submitCallback);try{n.call(i,a,r,s,i)}finally{t.form.resetAfterSubmit(i),t.form.resetChanged(i)}}}})}else y=e.extend({},y,{error:function(e,a,r,s){F&&t.executeFunctionByName(h.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",s,F),t.form.resetAfterSubmit(s)},success:function(e,a,r,s){var i,n=s.data("ams-submit-button");n&&(i=n.data("ams-form-submit-callback")),i||(i=t.getFunctionByName(h.amsFormSubmitCallback)||t.form._submitCallback);try{i.call(s,e,a,r,s)}finally{t.form.resetAfterSubmit(s),t.form.resetChanged(s)}},iframe:R});var k=e.extend({},y,n,v,i);if(f&&function(e,a){function s(){clearInterval(i),t.form.resetAfterSubmit(r,o),o.html(o.data("ams-progress-content")),t.executeFunctionByName(b,r,o),t.form.resetChanged(r)}var i;o.button("loading"),i=setInterval(function(){t.ajax.post(e,{progress_id:a},{error:s},t.getFunctionByName(g)||function(e,a){if("success"===a)if("running"===e.status)if(e.message)o.text(e.message);else{var r=o.data("ams-progress-text")||t.i18n.PROGRESS;e.current?r+=": "+e.current+"/ "+(e.length||100):r+="...",o.text(r)}else"finished"===e.status&&s();else s()})},d)}(f,u.progress_id),e(r).ajaxSubmit(k),N){var E=e(r).parents(".modal-dialog"),A=E.exists()&&o.exists()&&o.data("ams-keep-modal");E.exists()&&!0!==A?t.dialog.close(r):f||setTimeout(function(){t.form.resetAfterSubmit(r,o),t.form.resetChanged(r)},o.data("ams-form-reset-timeout")||2e3)}}if(!0!==r.data("ams-form-ignore-uploads")&&e('INPUT[type="file"]',r).length>0){t.ajax.check(e.progressBar,t.baseURL+"ext/jquery-progressbar"+t.devext+".js");var o=e.extend({},{uuid:e.progressBar.submit(r)});n(r,o)}else n(r,{})}),!1},initSubmit:function(a,t){var r=e(this),s='<i class="fa fa-3x fa-gear fa-spin"></i>';t||(t=r.data("ams-form-submit-message")),t&&(s+="<strong>"+t+"</strong>"),e(a).html('<div class="row margin-20"><div class="text-center">'+s+"</div></div>"),e(a).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(e){if(e.is(":visible")){var a=e.data("ams-submit-button");a&&a.button("reset"),t.form.finalizeSubmitFooter.call(e)}e.data("submitted",!1),e.removeData("ams-submit-button")},finalizeSubmitOnError:function(a){e("i",a).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(a){var t=e(this),r='<i class="fa fa-3x fa-gear fa-spin"></i>';a||(a=e(this).data("ams-form-submit-message")),a&&(r+='<strong class="submit-message align-top padding-left-10 margin-top-10">'+a+"</strong>");var s=e("footer",t);e("button",s).hide(),s.append('<div class="row"><div class="text-center">'+r+"</div></div>")},finalizeSubmitFooter:function(){var a=e(this),t=e("footer",a);t&&(e(".row",t).remove(),e("button",t).show())},_submitCallback:function(a,r,s,i){var n;i.is(":visible")&&(t.form.finalizeSubmitFooter.call(i),(n=i.data("ams-submit-button"))&&n.button("reset"));var o,m=i.data();if(m.amsFormDatatype)o=m.amsFormDatatype;else{var l=t.ajax.getResponse(s);o=l.contentType,a=l.data}var u;switch(u=e(n?n.data("ams-form-submit-target")||m.amsFormSubmitTarget||"#content":m.amsFormSubmitTarget||"#content"),o){case"json":t.ajax.handleJSON(a,i,u);break;case"script":case"xml":break;case"html":case"text":default:t.form.resetChanged(i),n&&!0!==n.data("ams-keep-modal")&&t.dialog.close(i),u.exists()||(u=e("body")),u.parents(".hidden").removeClass("hidden"),e(".alert",u.parents(".alerts-container")).remove(),u.css({opacity:"0.0"}).html(a).delay(50).animate({opacity:"1.0"},300),t.initContent(u),t.form.setFocus(u)}var c=s.getResponseHeader("X-AMS-Callback");if(c){var f=s.getResponseHeader("X-AMS-Callback-Options");t.executeFunctionByName(c,i,void 0===f?{}:JSON.parse(f),s)}},_getSubmitValidators:function(a){var t=[],r=a.data("ams-form-validator");return r&&t.push([a,r]),e("[data-ams-form-validator]",a).each(function(){var a=e(this);t.push([a,a.data("ams-form-validator")])}),t},_checkSubmitValidators:function(e){var a=t.form._getSubmitValidators(e);if(!a.length)return!0;for(var r=[],s=!0,i=0;i<a.length;i++){var n=a[i],o=n[0],m=n[1],l=t.executeFunctionByName(m,e,o);!1===l?s=!1:"string"==typeof l?r.push(l):s.length&&s.length>0&&(r=r.concat(s))}if(r.length>0){var u=1===r.length?t.i18n.ERROR_OCCURED:t.i18n.ERRORS_OCCURED;return t.skin.alert(e,"danger",u,r),!1}return s},showErrors:function(a,r){var s;if("string"==typeof r)t.skin.alert(a,"error",t.i18n.ERROR_OCCURED,r);else if(r instanceof Array)s=1===r.length?t.i18n.ERROR_OCCURED:t.i18n.ERRORS_OCCURED,t.skin.alert(a,"error",s,r);else{e(".state-error",a).removeClass("state-error"),s=r.error_header||(r.widgets&&r.widgets.length>1?t.i18n.ERRORS_OCCURED:t.i18n.ERROR_OCCURED);var i,n=[];if(r.messages)for(i=0;i<r.messages.length;i++){var o=r.messages[i];o.header?n.push("<strong>"+o.header+"</strong><br />"+o.message):n.push(o.message||o)}if(r.widgets)for(i=0;i<r.widgets.length;i++){var m=r.widgets[i],l=e('[name="'+m.name+'"]',a);l.exists()||(l=e('[name="'+m.name+':list"]',a)),l.exists()?l.parents("label:first").removeClassPrefix("state-").addClass("state-error").after('<span for="name" class="state-error">'+m.message+"</span>"):m.label&&n.push(m.label+" : "+m.message);var u=l.parents(".tab-pane").index()+1;if(u>0){var c=e(".nav-tabs",e(l).parents(".tabforms"));e("li:nth-child("+u+")",c).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",a).click()}}t.skin.alert(e(".form-group:first",a),r.error_level||"error",s,n,r.error_message)}}}}(jQuery,this);
+!function(a,e){var t=e.MyAMS;t.form={init:function(e){a("FORM",e).each(function(){var e=a(this);a('INPUT.select2[type="hidden"]',e).each(function(){var e=a(this);e.data("ams-select2-input-value",e.val())})});(t.warnOnFormChange?a('FORM[data-ams-warn-on-change!="false"]',e):a('FORM[data-ams-warn-on-change="true"]',e)).each(function(){var e=a(this);a('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',e).each(function(){var e=a(this);if(!0!==e.data("ams-ignore-change")){var r=e.data("ams-changed-event")||"change";e.on(r,function(){t.form.setChanged(a(this).parents("FORM"))})}}),e.on("reset",function(){t.form.resetChanged(a(this))})})},setFocus:function(e){var t=a("[data-ams-focus-target]",e).first();t.exists()||(t=a("input, select",e).first()),t.exists()&&(t.hasClass("select2-input")&&(t=t.parents(".select2")),t.hasClass("select2")?setTimeout(function(){t.select2("focus"),!0===t.data("ams-focus-open")&&t.select2("open")},100):t.focus())},checkBeforeUnload:function(){if(a('FORM[data-ams-form-changed="true"]').exists())return t.i18n.FORM_CHANGED_WARNING},confirmChangedForm:function(r,s,i){"function"==typeof r&&(s=r,r=void 0),a('FORM[data-ams-form-changed="true"]',r).exists()?i?e.confirm(t.i18n.FORM_CHANGED_WARNING,t.i18n.WARNING)?s.call(r):i.call(r):t.skin&&t.skin.bigBox({title:t.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+t.i18n.FORM_CHANGED_WARNING,buttons:t.i18n.BTN_OK_CANCEL},function(a){a===t.i18n.BTN_OK&&s.call(r)}):s.call(r)},setChanged:function(a){a.attr("data-ams-form-changed",!0)},resetChanged:function(e){void 0!==e&&a(e).removeAttr("data-ams-form-changed")},submit:function(r,s,i){if(!(r=a(r)).exists())return!1;if("object"==typeof s&&(i=s,s=void 0),r.data("submitted"))return r.data("ams-form-hide-submitted")||t.skin&&t.skin.messageBox("warning",{title:t.i18n.WAIT,content:t.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:r.data("ams-form-alert-timeout")||5e3}),!1;if(t.form&&!t.form._checkSubmitValidators(r))return!1;a(".alert-danger, SPAN.state-error",r).not(".persistent").remove(),a(".state-error",r).removeClassPrefix("state-");var n=a(r.data("ams-submit-button"));return n&&!n.data("ams-form-hide-loading")&&(n.data("ams-progress-content",n.html()),n.button("loading")),t.ajax&&t.ajax.check(a.fn.ajaxSubmit,t.baseURL+"ext/jquery-form-3.49"+t.devext+".js",function(){function n(r,n){var o,m,l,u,c,f,d,g,b,h=r.data(),v=h.amsFormOptions;if(i&&(c=i.formDataInitCallback),c?delete i.formDataInitCallback:c=h.amsFormDataInitCallback,c){var p={};if(u=t.executeFunctionByName(c,r,p),p.veto)return(o=r.data("ams-submit-button"))&&o.button("reset"),t.form.finalizeSubmitFooter.call(r),!1}else u=h.amsFormData||{};(o=a(r.data("ams-submit-button")))&&o.exists()?l=(m=o.data()).amsFormSubmitTarget:m={};var x,C=s||m.amsFormHandler||h.amsFormHandler||"";if(C.startsWith(window.location.protocol))x=C;else{var S=m.amsFormAction||r.attr("action").replace(/#/,"");x=S.startsWith(window.location.protocol)?S:t.ajax&&t.ajax.getAddr()+S,x+=C}f=m.amsProgressHandler||h.amsProgressHandler||"",d=m.amsProgressInterval||h.amsProgressInterval||1e3,g=m.amsProgressCallback||h.amsProgressCallback,b=m.amsProgressEndCallback||h.amsProgressEndCallback;var F=null;i&&i.initSubmitTarget?t.executeFunctionByName(i.initSubmitTarget,r):h.amsFormInitSubmitTarget?(F=a(l||h.amsFormSubmitTarget||"#content"),t.executeFunctionByName(h.amsFormInitSubmit||"MyAMS.form.initSubmit",r,F)):h.amsFormHideSubmitFooter||t.executeFunctionByName(h.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",r),i&&(u=a.extend({},u,i.form_data));var R;f?u.progress_id=t.generateUUID():(R=void 0!==n.uuid)&&(x.indexOf("X-Progress-ID")<0&&(x+="?X-Progress-ID="+n.uuid),delete n.uuid);var y={url:x,type:"post",cache:!1,data:u,dataType:h.amsFormDatatype,beforeSerialize:function(){void 0!==e.tinyMCE&&e.tinyMCE.triggerSave()},beforeSubmit:function(a,e){e.data("submitted",!0)},error:function(a,e,r,s){F&&t.executeFunctionByName(h.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",s,F),t.form.resetAfterSubmit(s)},iframe:R},k=i&&i.downloadTarget||h.amsFormDownloadTarget;if(k){var N=a('iframe[name="'+k+'"]');N.exists()||(N=a("<iframe></iframe>").hide().attr("name",k).appendTo(a("body"))),y=a.extend({},y,{iframe:!0,iframeTarget:N,success:function(e,r,s,i){if(a(i).parents(".modal-dialog").exists())t.dialog&&t.dialog.close(i);else{var n,o=i.data("ams-submit-button");o&&(n=o.data("ams-form-submit-callback")),n||(n=t.getFunctionByName(h.amsFormSubmitCallback)||t.form._submitCallback);try{n.call(i,e,r,s,i)}finally{t.form.resetAfterSubmit(i),t.form.resetChanged(i)}}}})}else y=a.extend({},y,{error:function(a,e,r,s){F&&t.executeFunctionByName(h.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",s,F),t.form.resetAfterSubmit(s)},success:function(a,e,r,s){var i,n=s.data("ams-submit-button");n&&(i=n.data("ams-form-submit-callback")),i||(i=t.getFunctionByName(h.amsFormSubmitCallback)||t.form._submitCallback);try{i.call(s,a,e,r,s)}finally{t.form.resetAfterSubmit(s),t.form.resetChanged(s)}},iframe:R});var O=a.extend({},y,n,v,i);if(f&&function(a,e){function s(){clearInterval(i),t.form.resetAfterSubmit(r,o),o.html(o.data("ams-progress-content")),t.executeFunctionByName(b,r,o),t.form.resetChanged(r)}var i;o.button("loading"),i=setInterval(function(){t.ajax&&t.ajax.post(a,{progress_id:e},{error:s},t.getFunctionByName(g)||function(a,e){if("success"===e)if("running"===a.status)if(a.message)o.text(a.message);else{var r=o.data("ams-progress-text")||t.i18n.PROGRESS;a.current?r+=": "+a.current+"/ "+(a.length||100):r+="...",o.text(r)}else"finished"===a.status&&s();else s()})},d)}(f,u.progress_id),a(r).ajaxSubmit(O),k){var E=a(r).parents(".modal-dialog"),A=E.exists()&&o.exists()&&o.data("ams-keep-modal");E.exists()&&!0!==A?t.dialog&&t.dialog.close(r):f||setTimeout(function(){t.form.resetAfterSubmit(r,o),t.form.resetChanged(r)},o.data("ams-form-reset-timeout")||2e3)}}if(!0!==r.data("ams-form-ignore-uploads")&&a('INPUT[type="file"]',r).length>0){t.ajax&&t.ajax.check(a.progressBar,t.baseURL+"ext/jquery-progressbar"+t.devext+".js");var o=a.extend({},{uuid:a.progressBar.submit(r)});n(r,o)}else n(r,{})}),!1},initSubmit:function(e,t){var r=a(this),s='<i class="fa fa-3x fa-gear fa-spin"></i>';t||(t=r.data("ams-form-submit-message")),t&&(s+="<strong>"+t+"</strong>"),a(e).html('<div class="row margin-20"><div class="text-center">'+s+"</div></div>"),a(e).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(a){if(a.is(":visible")){var e=a.data("ams-submit-button");e&&e.button("reset"),t.form.finalizeSubmitFooter.call(a)}a.data("submitted",!1),a.removeData("ams-submit-button")},finalizeSubmitOnError:function(e){a("i",e).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(e){var t=a(this),r='<i class="fa fa-3x fa-gear fa-spin"></i>';e||(e=a(this).data("ams-form-submit-message")),e&&(r+='<strong class="submit-message align-top padding-left-10 margin-top-10">'+e+"</strong>");var s=a("footer",t);a("button",s).hide(),s.append('<div class="row"><div class="text-center">'+r+"</div></div>")},finalizeSubmitFooter:function(){var e=a(this),t=a("footer",e);t&&(a(".row",t).remove(),a("button",t).show())},_submitCallback:function(e,r,s,i){var n;i.is(":visible")&&(t.form.finalizeSubmitFooter.call(i),(n=i.data("ams-submit-button"))&&n.button("reset"));var o,m=i.data();if(m.amsFormDatatype)o=m.amsFormDatatype;else{var l=t.ajax&&t.ajax.getResponse(s);l&&(o=l.contentType,e=l.data)}var u;switch(u=a(n?n.data("ams-form-submit-target")||m.amsFormSubmitTarget||"#content":m.amsFormSubmitTarget||"#content"),o){case"json":t.ajax&&t.ajax.handleJSON(e,i,u);break;case"script":case"xml":break;case"html":case"text":default:t.form.resetChanged(i),n&&!0!==n.data("ams-keep-modal")&&t.dialog&&t.dialog.close(i),u.exists()||(u=a("body")),u.parents(".hidden").removeClass("hidden"),a(".alert",u.parents(".alerts-container")).remove(),u.css({opacity:"0.0"}).html(e).delay(50).animate({opacity:"1.0"},300),t.initContent&&t.initContent(u),t.form.setFocus(u)}var c=s.getResponseHeader("X-AMS-Callback");if(c){var f=s.getResponseHeader("X-AMS-Callback-Options");t.executeFunctionByName(c,i,void 0===f?{}:JSON.parse(f),s)}},_getSubmitValidators:function(e){var t=[],r=e.data("ams-form-validator");return r&&t.push([e,r]),a("[data-ams-form-validator]",e).each(function(){var e=a(this);t.push([e,e.data("ams-form-validator")])}),t},_checkSubmitValidators:function(a){var e=t.form._getSubmitValidators(a);if(!e.length)return!0;for(var r=[],s=!0,i=0;i<e.length;i++){var n=e[i],o=n[0],m=n[1],l=t.executeFunctionByName(m,a,o);!1===l?s=!1:"string"==typeof l?r.push(l):s.length&&s.length>0&&(r=r.concat(s))}if(r.length>0){var u=1===r.length?t.i18n.ERROR_OCCURED:t.i18n.ERRORS_OCCURED;return t.skin&&t.skin.alert(a,"danger",u,r),!1}return s},showErrors:function(e,r){var s;if("string"==typeof r)t.skin&&t.skin.alert(e,"error",t.i18n.ERROR_OCCURED,r);else if(r instanceof Array)s=1===r.length?t.i18n.ERROR_OCCURED:t.i18n.ERRORS_OCCURED,t.skin&&t.skin.alert(e,"error",s,r);else{a(".state-error",e).removeClass("state-error"),s=r.error_header||(r.widgets&&r.widgets.length>1?t.i18n.ERRORS_OCCURED:t.i18n.ERROR_OCCURED);var i,n=[];if(r.messages)for(i=0;i<r.messages.length;i++){var o=r.messages[i];o.header?n.push("<strong>"+o.header+"</strong><br />"+o.message):n.push(o.message||o)}if(r.widgets)for(i=0;i<r.widgets.length;i++){var m=r.widgets[i],l=a('[name="'+m.name+'"]',e);l.exists()||(l=a('[name="'+m.name+':list"]',e)),l.exists()?l.parents("label:first").removeClassPrefix("state-").addClass("state-error").after('<span for="name" class="state-error">'+m.message+"</span>"):m.label&&n.push(m.label+" : "+m.message);var u=l.parents(".tab-pane").index()+1;if(u>0){var c=a(".nav-tabs",a(l).parents(".tabforms"));a("li:nth-child("+u+")",c).removeClassPrefix("state-").addClass("state-error"),a("li.state-error:first a",e).click()}}t.skin&&t.skin.alert(a(".form-group:first",e),r.error_level||"error",s,n,r.error_message)}}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-graphs.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-graphs.js Thu Dec 13 14:28:29 2018 +0100
@@ -12,177 +12,177 @@
ams.graphs = {
init: function(graphs) {
- ams.ajax.check($.fn.sparkline,
- MyAMS.baseURL + 'ext/jquery-sparkline-2.1.1.min.js',
- function() {
- graphs.each(function() {
- var graph = $(this);
- var graph_data = graph.data();
- var sparklineType = graph_data.sparklineType || 'bar';
- switch (sparklineType) {
- case 'bar':
- graph.sparkline('html', {
- type: 'bar',
- barColor: graph_data.sparklineBarColor || graph.css('color') || '#0000f0',
- height: graph_data.sparklineHeight || '26px',
- barWidth: graph_data.sparklineBarwidth || 5,
- barSpacing: graph_data.sparklineBarspacing || 2,
- stackedBarColor: graph.data.sparklineBarstackedColor || ["#A90329", "#0099c6", "#98AA56", "#da532c", "#4490B1", "#6E9461", "#990099", "#B4CAD3"],
- negBarColor: graph.data.sparklineNegbarColor || '#A90329',
- zeroAxis: 'false'
- });
- break;
+ ams.ajax && ams.ajax.check($.fn.sparkline,
+ MyAMS.baseURL + 'ext/jquery-sparkline-2.1.1.min.js',
+ function() {
+ graphs.each(function() {
+ var graph = $(this);
+ var graph_data = graph.data();
+ var sparklineType = graph_data.sparklineType || 'bar';
+ switch (sparklineType) {
+ case 'bar':
+ graph.sparkline('html', {
+ type: 'bar',
+ barColor: graph_data.sparklineBarColor || graph.css('color') || '#0000f0',
+ height: graph_data.sparklineHeight || '26px',
+ barWidth: graph_data.sparklineBarwidth || 5,
+ barSpacing: graph_data.sparklineBarspacing || 2,
+ stackedBarColor: graph.data.sparklineBarstackedColor || ["#A90329", "#0099c6", "#98AA56", "#da532c", "#4490B1", "#6E9461", "#990099", "#B4CAD3"],
+ negBarColor: graph.data.sparklineNegbarColor || '#A90329',
+ zeroAxis: 'false'
+ });
+ break;
- /var/local/src/pyams/pyams_skin/src/pyams_skin/resources/js case 'line':
- graph.sparkline('html', {
- type: 'line',
- width: graph_data.sparklineWidth || '90px',
- height: graph_data.sparklineHeight || '20px',
- lineWidth: graph_data.sparklineLineWidth || 1,
- lineColor: graph_data.sparklineLineColor || graph.css('color') || '#0000f0',
- fillColor: graph_data.fillColor || '#c0d0f0',
- spotColor: graph_data.sparklineSpotColor || '#f08000',
- minSpotColor: graph_data.sparklineMinspotColor || '#ed1c24',
- maxSpotColor: graph_data.sparklineMaxspotColor || '#f08000',
- highlightSpotColor: graph_data.sparklineHighlightspotColor || '#50f050',
- highlightLineColor: graph_data.sparklineHighlightlineColor || 'f02020',
- spotRadius: graph_data.sparklineSpotradius || 1.5,
- chartRangeMin: graph_data.sparklineMinY || 'undefined',
- chartRangeMax: graph_data.sparklineMaxY || 'undefined',
- chartRangeMinX: graph_data.sparklineMinX || 'undefined',
- chartRangeMaxX: graph_data.sparklineMaxX || 'undefined',
- normalRangeMin: graph_data.minVal || 'undefined',
- normalRangeMax: graph_data.maxVal || 'undefined',
- normalRangeColor: graph_data.normColor || '#c0c0c0',
- drawNormalOnTop: graph_data.drawNormal || false
- });
- break;
+ case 'line':
+ graph.sparkline('html', {
+ type: 'line',
+ width: graph_data.sparklineWidth || '90px',
+ height: graph_data.sparklineHeight || '20px',
+ lineWidth: graph_data.sparklineLineWidth || 1,
+ lineColor: graph_data.sparklineLineColor || graph.css('color') || '#0000f0',
+ fillColor: graph_data.fillColor || '#c0d0f0',
+ spotColor: graph_data.sparklineSpotColor || '#f08000',
+ minSpotColor: graph_data.sparklineMinspotColor || '#ed1c24',
+ maxSpotColor: graph_data.sparklineMaxspotColor || '#f08000',
+ highlightSpotColor: graph_data.sparklineHighlightspotColor || '#50f050',
+ highlightLineColor: graph_data.sparklineHighlightlineColor || 'f02020',
+ spotRadius: graph_data.sparklineSpotradius || 1.5,
+ chartRangeMin: graph_data.sparklineMinY || 'undefined',
+ chartRangeMax: graph_data.sparklineMaxY || 'undefined',
+ chartRangeMinX: graph_data.sparklineMinX || 'undefined',
+ chartRangeMaxX: graph_data.sparklineMaxX || 'undefined',
+ normalRangeMin: graph_data.minVal || 'undefined',
+ normalRangeMax: graph_data.maxVal || 'undefined',
+ normalRangeColor: graph_data.normColor || '#c0c0c0',
+ drawNormalOnTop: graph_data.drawNormal || false
+ });
+ break;
- case 'pie':
- graph.sparkline('html', {
- type: 'pie',
- width : graph_data.sparklinePiesize || 90,
- height : graph_data.sparklinePiesize || 90,
- tooltipFormat : '<span style="color: {{color}}">●</span> ({{percent.1}}%)',
- sliceColors : graph_data.sparklinePiecolor || ["#B4CAD3", "#4490B1", "#98AA56", "#da532c", "#6E9461", "#0099c6", "#990099", "#717D8A"],
- borderWidth : 1,
- offset : graph_data.sparklineOffset || 0,
- borderColor : graph_data.borderColor || '#45494C'
- });
- break;
+ case 'pie':
+ graph.sparkline('html', {
+ type: 'pie',
+ width: graph_data.sparklinePiesize || 90,
+ height: graph_data.sparklinePiesize || 90,
+ tooltipFormat: '<span style="color: {{color}}">●</span> ({{percent.1}}%)',
+ sliceColors: graph_data.sparklinePiecolor || ["#B4CAD3", "#4490B1", "#98AA56", "#da532c", "#6E9461", "#0099c6", "#990099", "#717D8A"],
+ borderWidth: 1,
+ offset: graph_data.sparklineOffset || 0,
+ borderColor: graph_data.borderColor || '#45494C'
+ });
+ break;
- case 'box':
- graph.sparkline('html', {
- type : 'box',
- width : graph_data.sparklineWidth || 'auto',
- height : graph_data.sparklineHeight || 'auto',
- raw : graph_data.sparklineBoxraw || false,
- target : graph_data.sparklineTargetval || 'undefined',
- minValue : graph_data.sparklineMin || 'undefined',
- maxValue : graph_data.sparklineMax || 'undefined',
- showOutliers : graph_data.sparklineShowoutlier || true,
- outlierIQR : graph_data.sparklineOutlierIqr || 1.5,
- spotRadius : graph_data.sparklineSpotradius || 1.5,
- boxLineColor : graph.css('color') || '#000000',
- boxFillColor : graph_data.fillColor || '#c0d0f0',
- whiskerColor : graph_data.sparklineWhisColor || '#000000',
- outlierLineColor : graph_data.sparklineOutlineColor || '#303030',
- outlierFillColor : graph_data.sparklineOutlinefillColor || '#f0f0f0',
- medianColor : graph_data.sparklineOutlinemedianColor || '#f00000',
- targetColor : graph_data.sparklineOutlinetargetColor || '#40a020'
- });
- break;
+ case 'box':
+ graph.sparkline('html', {
+ type: 'box',
+ width: graph_data.sparklineWidth || 'auto',
+ height: graph_data.sparklineHeight || 'auto',
+ raw: graph_data.sparklineBoxraw || false,
+ target: graph_data.sparklineTargetval || 'undefined',
+ minValue: graph_data.sparklineMin || 'undefined',
+ maxValue: graph_data.sparklineMax || 'undefined',
+ showOutliers: graph_data.sparklineShowoutlier || true,
+ outlierIQR: graph_data.sparklineOutlierIqr || 1.5,
+ spotRadius: graph_data.sparklineSpotradius || 1.5,
+ boxLineColor: graph.css('color') || '#000000',
+ boxFillColor: graph_data.fillColor || '#c0d0f0',
+ whiskerColor: graph_data.sparklineWhisColor || '#000000',
+ outlierLineColor: graph_data.sparklineOutlineColor || '#303030',
+ outlierFillColor: graph_data.sparklineOutlinefillColor || '#f0f0f0',
+ medianColor: graph_data.sparklineOutlinemedianColor || '#f00000',
+ targetColor: graph_data.sparklineOutlinetargetColor || '#40a020'
+ });
+ break;
- case 'bullet':
- graph.sparkline('html', {
- type : 'bullet',
- height : graph_data.sparklineHeight || 'auto',
- targetWidth : graph_data.sparklineWidth || 2,
- targetColor : graph_data.sparklineBulletColor || '#ed1c24',
- performanceColor : graph_data.sparklinePerformanceColor || '#3030f0',
- rangeColors : graph_data.sparklineBulletrangeColor || ["#d3dafe", "#a8b6ff", "#7f94ff"]
- });
- break;
+ case 'bullet':
+ graph.sparkline('html', {
+ type: 'bullet',
+ height: graph_data.sparklineHeight || 'auto',
+ targetWidth: graph_data.sparklineWidth || 2,
+ targetColor: graph_data.sparklineBulletColor || '#ed1c24',
+ performanceColor: graph_data.sparklinePerformanceColor || '#3030f0',
+ rangeColors: graph_data.sparklineBulletrangeColor || ["#d3dafe", "#a8b6ff", "#7f94ff"]
+ });
+ break;
- case 'discrete':
- graph.sparkline('html', {
- type : 'discrete',
- width : graph_data.sparklineWidth || 50,
- height : graph_data.sparklineHeight || 26,
- lineColor : graph.css('color'),
- lineHeight : graph_data.sparklineLineHeight || 5,
- thresholdValue : graph_data.sparklineThreshold || 'undefined',
- thresholdColor : graph_data.sparklineThresholdColor || '#ed1c24'
- });
- break;
+ case 'discrete':
+ graph.sparkline('html', {
+ type: 'discrete',
+ width: graph_data.sparklineWidth || 50,
+ height: graph_data.sparklineHeight || 26,
+ lineColor: graph.css('color'),
+ lineHeight: graph_data.sparklineLineHeight || 5,
+ thresholdValue: graph_data.sparklineThreshold || 'undefined',
+ thresholdColor: graph_data.sparklineThresholdColor || '#ed1c24'
+ });
+ break;
- case 'tristate':
- graph.sparkline('html', {
- type : 'tristate',
- height : graph_data.sparklineHeight || 26,
- posBarColor : graph_data.sparklinePosbarColor || '#60f060',
- negBarColor : graph_data.sparklineNegbarColor || '#f04040',
- zeroBarColor : graph_data.sparklineZerobarColor || '#909090',
- barWidth : graph_data.sparklineBarwidth || 5,
- barSpacing : graph_data.sparklineBarspacing || 2,
- zeroAxis : graph_data.sparklineZeroaxis || false
- });
- break;
+ case 'tristate':
+ graph.sparkline('html', {
+ type: 'tristate',
+ height: graph_data.sparklineHeight || 26,
+ posBarColor: graph_data.sparklinePosbarColor || '#60f060',
+ negBarColor: graph_data.sparklineNegbarColor || '#f04040',
+ zeroBarColor: graph_data.sparklineZerobarColor || '#909090',
+ barWidth: graph_data.sparklineBarwidth || 5,
+ barSpacing: graph_data.sparklineBarspacing || 2,
+ zeroAxis: graph_data.sparklineZeroaxis || false
+ });
+ break;
- case 'compositebar':
- graph.sparkline(graph_data.sparklineBarVal, {
- type : 'bar',
- width : graph_data.sparklineWidth || '100%',
- height : graph_data.sparklineHeight || '20px',
- barColor : graph_data.sparklineColorBottom || '#333333',
- barWidth : graph_data.sparklineBarwidth || 3
- });
- graph.sparkline(graph_data.sparklineLineVal, {
- width : graph_data.sparklineWidth || '100%',
- height : graph_data.sparklineHeight || '20px',
- lineColor : graph_data.sparklineColorTop || '#ed1c24',
- lineWidth : graph_data.sparklineLineWidth || 1,
- composite : true,
- fillColor : false
- });
- break;
+ case 'compositebar':
+ graph.sparkline(graph_data.sparklineBarVal, {
+ type: 'bar',
+ width: graph_data.sparklineWidth || '100%',
+ height: graph_data.sparklineHeight || '20px',
+ barColor: graph_data.sparklineColorBottom || '#333333',
+ barWidth: graph_data.sparklineBarwidth || 3
+ });
+ graph.sparkline(graph_data.sparklineLineVal, {
+ width: graph_data.sparklineWidth || '100%',
+ height: graph_data.sparklineHeight || '20px',
+ lineColor: graph_data.sparklineColorTop || '#ed1c24',
+ lineWidth: graph_data.sparklineLineWidth || 1,
+ composite: true,
+ fillColor: false
+ });
+ break;
- case 'compositeline':
- graph.sparkline(graph_data.sparklineBarVal, {
- type : 'line',
- spotRadius : graph_data.sparklineSpotradiusTop || 1.5,
- spotColor : graph_data.sparklineSpotColor || '#f08000',
- minSpotColor : graph_data.sparklineMinSpotColorTop || '#ed1c24',
- maxSpotColor : graph_data.sparklineMaxSpotColorTop || '#f08000',
- highlightSpotColor : graph_data.sparklineHighlightSpotColorTop || '#50f050',
- highlightLineColor : graph_data.sparklineHighlightLineColorTop || '#f02020',
- valueSpots : graph_data.sparklineBarValSpotsTop || null,
- lineWidth : graph_data.sparklineLineWidthTop || 1,
- width : graph_data.sparklineWidth || '90px',
- height : graph_data.sparklineHeight || '20px',
- lineColor : graph_data.sparklineColorTop || '#333333',
- fillColor : graph_data.sparklineFillcolorTop || 'transparent'
- });
- graph.sparkline(graph_data.sparklineLineVal, {
- type : 'line',
- spotRadius : graph_data.sparklineSpotradiusBottom || graph_data.sparklineSpotradiusTop || 1.5,
- spotColor : graph_data.sparklineSpotColor || '#f08000',
- minSpotColor : graph_data.sparklineMinspotColorBottom || graph_data.sparklineMinspotColorTop || '#ed1c24',
- maxSpotColor : graph_data.sparklineMaxspotColorBottom || graph_data.sparklineMaxspotColorTop || '#f08000',
- highlightSpotColor : graph_data.sparklineHighlightspotColorBottom || graph_data.sparklineHighlightspotColorTop || '#50f050',
- highlightLineColor : graph_data.sparklineHighlightlineColorBottom || graph_data.sparklineHighlightlineColorTop || '#f02020',
- valueSpots : graph_data.sparklineBarValSpotsBottom || null,
- lineWidth : graph_data.sparklineLineWidthBottom || 1,
- width : graph_data.sparklineWidth || '90px',
- height : graph_data.sparklineHeight || '20px',
- lineColor : graph_data.sparklineColorBottom || '#ed1c24',
- composite : true,
- fillColor : graph_data.sparklineFillcolorBottom || 'transparent'
- });
- break;
- }
- });
- });
+ case 'compositeline':
+ graph.sparkline(graph_data.sparklineBarVal, {
+ type: 'line',
+ spotRadius: graph_data.sparklineSpotradiusTop || 1.5,
+ spotColor: graph_data.sparklineSpotColor || '#f08000',
+ minSpotColor: graph_data.sparklineMinSpotColorTop || '#ed1c24',
+ maxSpotColor: graph_data.sparklineMaxSpotColorTop || '#f08000',
+ highlightSpotColor: graph_data.sparklineHighlightSpotColorTop || '#50f050',
+ highlightLineColor: graph_data.sparklineHighlightLineColorTop || '#f02020',
+ valueSpots: graph_data.sparklineBarValSpotsTop || null,
+ lineWidth: graph_data.sparklineLineWidthTop || 1,
+ width: graph_data.sparklineWidth || '90px',
+ height: graph_data.sparklineHeight || '20px',
+ lineColor: graph_data.sparklineColorTop || '#333333',
+ fillColor: graph_data.sparklineFillcolorTop || 'transparent'
+ });
+ graph.sparkline(graph_data.sparklineLineVal, {
+ type: 'line',
+ spotRadius: graph_data.sparklineSpotradiusBottom || graph_data.sparklineSpotradiusTop || 1.5,
+ spotColor: graph_data.sparklineSpotColor || '#f08000',
+ minSpotColor: graph_data.sparklineMinspotColorBottom || graph_data.sparklineMinspotColorTop || '#ed1c24',
+ maxSpotColor: graph_data.sparklineMaxspotColorBottom || graph_data.sparklineMaxspotColorTop || '#f08000',
+ highlightSpotColor: graph_data.sparklineHighlightspotColorBottom || graph_data.sparklineHighlightspotColorTop || '#50f050',
+ highlightLineColor: graph_data.sparklineHighlightlineColorBottom || graph_data.sparklineHighlightlineColorTop || '#f02020',
+ valueSpots: graph_data.sparklineBarValSpotsBottom || null,
+ lineWidth: graph_data.sparklineLineWidthBottom || 1,
+ width: graph_data.sparklineWidth || '90px',
+ height: graph_data.sparklineHeight || '20px',
+ lineColor: graph_data.sparklineColorBottom || '#ed1c24',
+ composite: true,
+ fillColor: graph_data.sparklineFillcolorBottom || 'transparent'
+ });
+ break;
+ }
+ });
+ });
}
};
--- a/src/pyams_skin/resources/js/myams-graphs.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-graphs.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(l,o){"use strict";var i=o.MyAMS;i.graphs={init:function(o){i.ajax.check(l.fn.sparkline,MyAMS.baseURL+"ext/jquery-sparkline-2.1.1.min.js",function(){o.each(function(){var o=l(this),i=o.data();switch(i.sparklineType||"bar"){case"bar":o.sparkline("html",{type:"bar",barColor:i.sparklineBarColor||o.css("color")||"#0000f0",height:i.sparklineHeight||"26px",barWidth:i.sparklineBarwidth||5,barSpacing:i.sparklineBarspacing||2,stackedBarColor:o.data.sparklineBarstackedColor||["#A90329","#0099c6","#98AA56","#da532c","#4490B1","#6E9461","#990099","#B4CAD3"],negBarColor:o.data.sparklineNegbarColor||"#A90329",zeroAxis:"false"});break;case"line":o.sparkline("html",{type:"line",width:i.sparklineWidth||"90px",height:i.sparklineHeight||"20px",lineWidth:i.sparklineLineWidth||1,lineColor:i.sparklineLineColor||o.css("color")||"#0000f0",fillColor:i.fillColor||"#c0d0f0",spotColor:i.sparklineSpotColor||"#f08000",minSpotColor:i.sparklineMinspotColor||"#ed1c24",maxSpotColor:i.sparklineMaxspotColor||"#f08000",highlightSpotColor:i.sparklineHighlightspotColor||"#50f050",highlightLineColor:i.sparklineHighlightlineColor||"f02020",spotRadius:i.sparklineSpotradius||1.5,chartRangeMin:i.sparklineMinY||"undefined",chartRangeMax:i.sparklineMaxY||"undefined",chartRangeMinX:i.sparklineMinX||"undefined",chartRangeMaxX:i.sparklineMaxX||"undefined",normalRangeMin:i.minVal||"undefined",normalRangeMax:i.maxVal||"undefined",normalRangeColor:i.normColor||"#c0c0c0",drawNormalOnTop:i.drawNormal||!1});break;case"pie":o.sparkline("html",{type:"pie",width:i.sparklinePiesize||90,height:i.sparklinePiesize||90,tooltipFormat:'<span style="color: {{color}}">●</span> ({{percent.1}}%)',sliceColors:i.sparklinePiecolor||["#B4CAD3","#4490B1","#98AA56","#da532c","#6E9461","#0099c6","#990099","#717D8A"],borderWidth:1,offset:i.sparklineOffset||0,borderColor:i.borderColor||"#45494C"});break;case"box":o.sparkline("html",{type:"box",width:i.sparklineWidth||"auto",height:i.sparklineHeight||"auto",raw:i.sparklineBoxraw||!1,target:i.sparklineTargetval||"undefined",minValue:i.sparklineMin||"undefined",maxValue:i.sparklineMax||"undefined",showOutliers:i.sparklineShowoutlier||!0,outlierIQR:i.sparklineOutlierIqr||1.5,spotRadius:i.sparklineSpotradius||1.5,boxLineColor:o.css("color")||"#000000",boxFillColor:i.fillColor||"#c0d0f0",whiskerColor:i.sparklineWhisColor||"#000000",outlierLineColor:i.sparklineOutlineColor||"#303030",outlierFillColor:i.sparklineOutlinefillColor||"#f0f0f0",medianColor:i.sparklineOutlinemedianColor||"#f00000",targetColor:i.sparklineOutlinetargetColor||"#40a020"});break;case"bullet":o.sparkline("html",{type:"bullet",height:i.sparklineHeight||"auto",targetWidth:i.sparklineWidth||2,targetColor:i.sparklineBulletColor||"#ed1c24",performanceColor:i.sparklinePerformanceColor||"#3030f0",rangeColors:i.sparklineBulletrangeColor||["#d3dafe","#a8b6ff","#7f94ff"]});break;case"discrete":o.sparkline("html",{type:"discrete",width:i.sparklineWidth||50,height:i.sparklineHeight||26,lineColor:o.css("color"),lineHeight:i.sparklineLineHeight||5,thresholdValue:i.sparklineThreshold||"undefined",thresholdColor:i.sparklineThresholdColor||"#ed1c24"});break;case"tristate":o.sparkline("html",{type:"tristate",height:i.sparklineHeight||26,posBarColor:i.sparklinePosbarColor||"#60f060",negBarColor:i.sparklineNegbarColor||"#f04040",zeroBarColor:i.sparklineZerobarColor||"#909090",barWidth:i.sparklineBarwidth||5,barSpacing:i.sparklineBarspacing||2,zeroAxis:i.sparklineZeroaxis||!1});break;case"compositebar":o.sparkline(i.sparklineBarVal,{type:"bar",width:i.sparklineWidth||"100%",height:i.sparklineHeight||"20px",barColor:i.sparklineColorBottom||"#333333",barWidth:i.sparklineBarwidth||3}),o.sparkline(i.sparklineLineVal,{width:i.sparklineWidth||"100%",height:i.sparklineHeight||"20px",lineColor:i.sparklineColorTop||"#ed1c24",lineWidth:i.sparklineLineWidth||1,composite:!0,fillColor:!1});break;case"compositeline":o.sparkline(i.sparklineBarVal,{type:"line",spotRadius:i.sparklineSpotradiusTop||1.5,spotColor:i.sparklineSpotColor||"#f08000",minSpotColor:i.sparklineMinSpotColorTop||"#ed1c24",maxSpotColor:i.sparklineMaxSpotColorTop||"#f08000",highlightSpotColor:i.sparklineHighlightSpotColorTop||"#50f050",highlightLineColor:i.sparklineHighlightLineColorTop||"#f02020",valueSpots:i.sparklineBarValSpotsTop||null,lineWidth:i.sparklineLineWidthTop||1,width:i.sparklineWidth||"90px",height:i.sparklineHeight||"20px",lineColor:i.sparklineColorTop||"#333333",fillColor:i.sparklineFillcolorTop||"transparent"}),o.sparkline(i.sparklineLineVal,{type:"line",spotRadius:i.sparklineSpotradiusBottom||i.sparklineSpotradiusTop||1.5,spotColor:i.sparklineSpotColor||"#f08000",minSpotColor:i.sparklineMinspotColorBottom||i.sparklineMinspotColorTop||"#ed1c24",maxSpotColor:i.sparklineMaxspotColorBottom||i.sparklineMaxspotColorTop||"#f08000",highlightSpotColor:i.sparklineHighlightspotColorBottom||i.sparklineHighlightspotColorTop||"#50f050",highlightLineColor:i.sparklineHighlightlineColorBottom||i.sparklineHighlightlineColorTop||"#f02020",valueSpots:i.sparklineBarValSpotsBottom||null,lineWidth:i.sparklineLineWidthBottom||1,width:i.sparklineWidth||"90px",height:i.sparklineHeight||"20px",lineColor:i.sparklineColorBottom||"#ed1c24",composite:!0,fillColor:i.sparklineFillcolorBottom||"transparent"})}})})}}}(jQuery,this);
+!function(o,i){"use strict";var l=i.MyAMS;l.graphs={init:function(i){l.ajax&&l.ajax.check(o.fn.sparkline,MyAMS.baseURL+"ext/jquery-sparkline-2.1.1.min.js",function(){i.each(function(){var i=o(this),l=i.data();switch(l.sparklineType||"bar"){case"bar":i.sparkline("html",{type:"bar",barColor:l.sparklineBarColor||i.css("color")||"#0000f0",height:l.sparklineHeight||"26px",barWidth:l.sparklineBarwidth||5,barSpacing:l.sparklineBarspacing||2,stackedBarColor:i.data.sparklineBarstackedColor||["#A90329","#0099c6","#98AA56","#da532c","#4490B1","#6E9461","#990099","#B4CAD3"],negBarColor:i.data.sparklineNegbarColor||"#A90329",zeroAxis:"false"});break;case"line":i.sparkline("html",{type:"line",width:l.sparklineWidth||"90px",height:l.sparklineHeight||"20px",lineWidth:l.sparklineLineWidth||1,lineColor:l.sparklineLineColor||i.css("color")||"#0000f0",fillColor:l.fillColor||"#c0d0f0",spotColor:l.sparklineSpotColor||"#f08000",minSpotColor:l.sparklineMinspotColor||"#ed1c24",maxSpotColor:l.sparklineMaxspotColor||"#f08000",highlightSpotColor:l.sparklineHighlightspotColor||"#50f050",highlightLineColor:l.sparklineHighlightlineColor||"f02020",spotRadius:l.sparklineSpotradius||1.5,chartRangeMin:l.sparklineMinY||"undefined",chartRangeMax:l.sparklineMaxY||"undefined",chartRangeMinX:l.sparklineMinX||"undefined",chartRangeMaxX:l.sparklineMaxX||"undefined",normalRangeMin:l.minVal||"undefined",normalRangeMax:l.maxVal||"undefined",normalRangeColor:l.normColor||"#c0c0c0",drawNormalOnTop:l.drawNormal||!1});break;case"pie":i.sparkline("html",{type:"pie",width:l.sparklinePiesize||90,height:l.sparklinePiesize||90,tooltipFormat:'<span style="color: {{color}}">●</span> ({{percent.1}}%)',sliceColors:l.sparklinePiecolor||["#B4CAD3","#4490B1","#98AA56","#da532c","#6E9461","#0099c6","#990099","#717D8A"],borderWidth:1,offset:l.sparklineOffset||0,borderColor:l.borderColor||"#45494C"});break;case"box":i.sparkline("html",{type:"box",width:l.sparklineWidth||"auto",height:l.sparklineHeight||"auto",raw:l.sparklineBoxraw||!1,target:l.sparklineTargetval||"undefined",minValue:l.sparklineMin||"undefined",maxValue:l.sparklineMax||"undefined",showOutliers:l.sparklineShowoutlier||!0,outlierIQR:l.sparklineOutlierIqr||1.5,spotRadius:l.sparklineSpotradius||1.5,boxLineColor:i.css("color")||"#000000",boxFillColor:l.fillColor||"#c0d0f0",whiskerColor:l.sparklineWhisColor||"#000000",outlierLineColor:l.sparklineOutlineColor||"#303030",outlierFillColor:l.sparklineOutlinefillColor||"#f0f0f0",medianColor:l.sparklineOutlinemedianColor||"#f00000",targetColor:l.sparklineOutlinetargetColor||"#40a020"});break;case"bullet":i.sparkline("html",{type:"bullet",height:l.sparklineHeight||"auto",targetWidth:l.sparklineWidth||2,targetColor:l.sparklineBulletColor||"#ed1c24",performanceColor:l.sparklinePerformanceColor||"#3030f0",rangeColors:l.sparklineBulletrangeColor||["#d3dafe","#a8b6ff","#7f94ff"]});break;case"discrete":i.sparkline("html",{type:"discrete",width:l.sparklineWidth||50,height:l.sparklineHeight||26,lineColor:i.css("color"),lineHeight:l.sparklineLineHeight||5,thresholdValue:l.sparklineThreshold||"undefined",thresholdColor:l.sparklineThresholdColor||"#ed1c24"});break;case"tristate":i.sparkline("html",{type:"tristate",height:l.sparklineHeight||26,posBarColor:l.sparklinePosbarColor||"#60f060",negBarColor:l.sparklineNegbarColor||"#f04040",zeroBarColor:l.sparklineZerobarColor||"#909090",barWidth:l.sparklineBarwidth||5,barSpacing:l.sparklineBarspacing||2,zeroAxis:l.sparklineZeroaxis||!1});break;case"compositebar":i.sparkline(l.sparklineBarVal,{type:"bar",width:l.sparklineWidth||"100%",height:l.sparklineHeight||"20px",barColor:l.sparklineColorBottom||"#333333",barWidth:l.sparklineBarwidth||3}),i.sparkline(l.sparklineLineVal,{width:l.sparklineWidth||"100%",height:l.sparklineHeight||"20px",lineColor:l.sparklineColorTop||"#ed1c24",lineWidth:l.sparklineLineWidth||1,composite:!0,fillColor:!1});break;case"compositeline":i.sparkline(l.sparklineBarVal,{type:"line",spotRadius:l.sparklineSpotradiusTop||1.5,spotColor:l.sparklineSpotColor||"#f08000",minSpotColor:l.sparklineMinSpotColorTop||"#ed1c24",maxSpotColor:l.sparklineMaxSpotColorTop||"#f08000",highlightSpotColor:l.sparklineHighlightSpotColorTop||"#50f050",highlightLineColor:l.sparklineHighlightLineColorTop||"#f02020",valueSpots:l.sparklineBarValSpotsTop||null,lineWidth:l.sparklineLineWidthTop||1,width:l.sparklineWidth||"90px",height:l.sparklineHeight||"20px",lineColor:l.sparklineColorTop||"#333333",fillColor:l.sparklineFillcolorTop||"transparent"}),i.sparkline(l.sparklineLineVal,{type:"line",spotRadius:l.sparklineSpotradiusBottom||l.sparklineSpotradiusTop||1.5,spotColor:l.sparklineSpotColor||"#f08000",minSpotColor:l.sparklineMinspotColorBottom||l.sparklineMinspotColorTop||"#ed1c24",maxSpotColor:l.sparklineMaxspotColorBottom||l.sparklineMaxspotColorTop||"#f08000",highlightSpotColor:l.sparklineHighlightspotColorBottom||l.sparklineHighlightspotColorTop||"#50f050",highlightLineColor:l.sparklineHighlightlineColorBottom||l.sparklineHighlightlineColorTop||"#f02020",valueSpots:l.sparklineBarValSpotsBottom||null,lineWidth:l.sparklineLineWidthBottom||1,width:l.sparklineWidth||"90px",height:l.sparklineHeight||"20px",lineColor:l.sparklineColorBottom||"#ed1c24",composite:!0,fillColor:l.sparklineFillcolorBottom||"transparent"})}})})}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-helpers.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-helpers.js Thu Dec 13 14:28:29 2018 +0100
@@ -63,7 +63,7 @@
select2QueryUrlResultsCallback: function(data, page, context) {
switch (data.status) {
case 'error':
- ams.skin.messageBox('error', {
+ ams.skin && ams.skin.messageBox('error', {
title: ams.i18n.ERROR_OCCURED,
content: '<h4>' + data.error_message + '</h4>',
icon: "fa fa-warning animated shake",
@@ -72,7 +72,7 @@
break;
case 'modal':
$(this).data('select2').dropdown.hide();
- ams.dialog.open(data.location);
+ ams.dialog && ams.dialog.open(data.location);
break;
default:
return {
@@ -93,7 +93,7 @@
}
switch (result.status) {
case 'error':
- ams.skin.messageBox('error', {
+ ams.skin && ams.skin.messageBox('error', {
title: ams.i18n.ERROR_OCCURED,
content: '<h4>' + result.error_message + '</h4>',
icon: "fa fa-warning animated shake",
@@ -102,7 +102,7 @@
break;
case 'modal':
$(this).data('select2').dropdown.hide();
- ams.dialog.open(result.location);
+ ams.dialog && ams.dialog.open(result.location);
break;
default:
options.callback({
@@ -127,7 +127,7 @@
ams.getFunctionByName(data.amsSelect2HelperCallback) || function(result) {
if (result) {
target.html(result);
- ams.initContent(target);
+ ams.initContent && ams.initContent(target);
} else {
target.empty();
}
@@ -138,17 +138,17 @@
break;
case 'json-rpc':
target.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>');
- ams.jsonrpc.post(data.amsSelect2HelperMethod,
- {value: source.val()},
- {url: data.amsSelect2HelperUrl},
- ams.getFunctionByName(data.amsSelect2HelperCallback) || function(result) {
- if (result.result) {
- target.html(result.result);
- ams.initContent(target);
- } else {
- target.empty();
- }
- });
+ ams.jsonrpc && ams.jsonrpc.post(data.amsSelect2HelperMethod,
+ {value: source.val()},
+ {url: data.amsSelect2HelperUrl},
+ ams.getFunctionByName(data.amsSelect2HelperCallback) || function(result) {
+ if (result.result) {
+ target.html(result.result);
+ ams.initContent && ams.initContent(target);
+ } else {
+ target.empty();
+ }
+ });
break;
default:
var callback = data.amsSelect2HelperCallback;
@@ -165,13 +165,13 @@
}
var menuData = menu.data();
if (menuData.toggle === 'modal') {
- ams.dialog.open(menu);
+ ams.dialog && ams.dialog.open(menu);
} else {
var href = menu.attr('href') || menuData.amsUrl;
if (!href || href.startsWith('javascript') || menu.attr('target')) {
return;
}
- ams.event.stop();
+ ams.event && ams.event.stop();
var hrefGetter = ams.getFunctionByName(href);
if (typeof(hrefGetter) === 'function') {
href = hrefGetter.call(menu, target);
@@ -185,11 +185,11 @@
href = href.replace(/\%23/, '#');
target = menu.data('ams-target');
if (target) {
- ams.form.confirmChangedForm(target, function () {
- ams.skin.loadURL(href, target, menu.data('ams-link-options'), menu.data('ams-link-callback'));
+ ams.form && ams.form.confirmChangedForm(target, function () {
+ ams.skin && ams.skin.loadURL(href, target, menu.data('ams-link-options'), menu.data('ams-link-callback'));
});
} else {
- ams.form.confirmChangedForm(function () {
+ ams.form && ams.form.confirmChangedForm(function () {
if (href.startsWith('#')) {
if (href !== location.hash) {
if (ams.root.hasClass('mobile-view-activated')) {
--- a/src/pyams_skin/resources/js/myams-helpers.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-helpers.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(e,t){var a=t.MyAMS;a.helpers={sort:function(t,a){a||(a="weight"),t.children().sort(function(t,s){return+e(t).data(a)-+e(s).data(a)}).each(function(){t.append(this)})},select2ClearSelection:function(){var t=e(this),a=t.parents("label").first(),s=t.data("ams-select2-target");e('[name="'+s+'"]',a).data("select2").val("")},select2FormatSelection:function(t,a){t instanceof Array||(t=[t]),e(t).each(function(){"object"==typeof this?a.append(this.text):a.append(this)})},select2SelectAllHelper:function(){var t=e(this),a=t.parents("label").first(),s=t.data("ams-select2-target"),r=e('[name="'+s+'"]',a);"SELECT"===r.get(0).tagName?r.select2("val",e("option",r).listattr("value")):r.select2("data",r.data("ams-select2-data"))},select2QueryUrlResultsCallback:function(t,s,r){switch(t.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+t.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":e(this).data("select2").dropdown.hide(),a.dialog.open(t.location);break;default:return{results:t.results||t,more:t.has_more||!1,context:t.context}}},select2QueryMethodSuccessCallback:function(t,s,r){var n=t.result;if("string"==typeof n)try{n=JSON.parse(n)}catch(e){}switch(n.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+n.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":e(this).data("select2").dropdown.hide(),a.dialog.open(n.location);break;default:r.callback({results:n.results||n,more:n.has_more||!1,context:n.context})}},select2ChangeHelper:function(){var t=e(this),s=t.data(),r=e(s.amsSelect2HelperTarget);switch(s.amsSelect2HelperType){case"html":r.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>');var n={};n[s.amsSelect2HelperArgument||"value"]=t.val(),e.get(s.amsSelect2HelperUrl,n,a.getFunctionByName(s.amsSelect2HelperCallback)||function(e){e?(r.html(e),a.initContent(r)):r.empty()}).fail(function(){r.empty()});break;case"json-rpc":r.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>'),a.jsonrpc.post(s.amsSelect2HelperMethod,{value:t.val()},{url:s.amsSelect2HelperUrl},a.getFunctionByName(s.amsSelect2HelperCallback)||function(e){e.result?(r.html(e.result),a.initContent(r)):r.empty()});break;default:var i=s.amsSelect2HelperCallback;i&&a.executeFunctionByName(i,t,s)}},contextMenuHandler:function(e,t){"A"!==t.get(0).tagName&&(t=t.parents("a").first());var s=t.data();if("modal"===s.toggle)a.dialog.open(t);else{var r=t.attr("href")||s.amsUrl;if(!r||r.startsWith("javascript")||t.attr("target"))return;a.event.stop();var n=a.getFunctionByName(r);"function"==typeof n&&(r=n.call(t,e)),"function"==typeof r?r.call(t,e):(r=r.replace(/\%23/,"#"),(e=t.data("ams-target"))?a.form.confirmChangedForm(e,function(){a.skin.loadURL(r,e,t.data("ams-link-options"),t.data("ams-link-callback"))}):a.form.confirmChangedForm(function(){r.startsWith("#")?r!==location.hash&&(a.root.hasClass("mobile-view-activated")?(a.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=r},150)):window.location.hash=r):window.location=r}))}},datetimepickerDialogHiddenCallback:function(){e(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")},clearSearchTarget:function(){var t=e(this);if(!t.val()){var a=e(t).parents("form").first();e(a.data("ams-form-submit-target")).empty()}},setSEOStatus:function(){var t=e(this),a=t.siblings(".progress").children(".progress-bar"),s=Math.min(t.val().length,100),r="success";s<20||s>80?r="danger":(s<40||s>66)&&(r="warning"),a.removeClassPrefix("progress-bar").addClass("progress-bar").addClass("progress-bar-"+r).css("width",s+"%")}}}(jQuery,this);
+!function(e,t){var a=t.MyAMS;a.helpers={sort:function(t,a){a||(a="weight"),t.children().sort(function(t,s){return+e(t).data(a)-+e(s).data(a)}).each(function(){t.append(this)})},select2ClearSelection:function(){var t=e(this),a=t.parents("label").first(),s=t.data("ams-select2-target");e('[name="'+s+'"]',a).data("select2").val("")},select2FormatSelection:function(t,a){t instanceof Array||(t=[t]),e(t).each(function(){"object"==typeof this?a.append(this.text):a.append(this)})},select2SelectAllHelper:function(){var t=e(this),a=t.parents("label").first(),s=t.data("ams-select2-target"),r=e('[name="'+s+'"]',a);"SELECT"===r.get(0).tagName?r.select2("val",e("option",r).listattr("value")):r.select2("data",r.data("ams-select2-data"))},select2QueryUrlResultsCallback:function(t,s,r){switch(t.status){case"error":a.skin&&a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+t.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":e(this).data("select2").dropdown.hide(),a.dialog&&a.dialog.open(t.location);break;default:return{results:t.results||t,more:t.has_more||!1,context:t.context}}},select2QueryMethodSuccessCallback:function(t,s,r){var n=t.result;if("string"==typeof n)try{n=JSON.parse(n)}catch(e){}switch(n.status){case"error":a.skin&&a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+n.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":e(this).data("select2").dropdown.hide(),a.dialog&&a.dialog.open(n.location);break;default:r.callback({results:n.results||n,more:n.has_more||!1,context:n.context})}},select2ChangeHelper:function(){var t=e(this),s=t.data(),r=e(s.amsSelect2HelperTarget);switch(s.amsSelect2HelperType){case"html":r.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>');var n={};n[s.amsSelect2HelperArgument||"value"]=t.val(),e.get(s.amsSelect2HelperUrl,n,a.getFunctionByName(s.amsSelect2HelperCallback)||function(e){e?(r.html(e),a.initContent&&a.initContent(r)):r.empty()}).fail(function(){r.empty()});break;case"json-rpc":r.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>'),a.jsonrpc&&a.jsonrpc.post(s.amsSelect2HelperMethod,{value:t.val()},{url:s.amsSelect2HelperUrl},a.getFunctionByName(s.amsSelect2HelperCallback)||function(e){e.result?(r.html(e.result),a.initContent&&a.initContent(r)):r.empty()});break;default:var i=s.amsSelect2HelperCallback;i&&a.executeFunctionByName(i,t,s)}},contextMenuHandler:function(e,t){"A"!==t.get(0).tagName&&(t=t.parents("a").first());var s=t.data();if("modal"===s.toggle)a.dialog&&a.dialog.open(t);else{var r=t.attr("href")||s.amsUrl;if(!r||r.startsWith("javascript")||t.attr("target"))return;a.event&&a.event.stop();var n=a.getFunctionByName(r);"function"==typeof n&&(r=n.call(t,e)),"function"==typeof r?r.call(t,e):(r=r.replace(/\%23/,"#"),(e=t.data("ams-target"))?a.form&&a.form.confirmChangedForm(e,function(){a.skin&&a.skin.loadURL(r,e,t.data("ams-link-options"),t.data("ams-link-callback"))}):a.form&&a.form.confirmChangedForm(function(){r.startsWith("#")?r!==location.hash&&(a.root.hasClass("mobile-view-activated")?(a.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=r},150)):window.location.hash=r):window.location=r}))}},datetimepickerDialogHiddenCallback:function(){e(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")},clearSearchTarget:function(){var t=e(this);if(!t.val()){var a=e(t).parents("form").first();e(a.data("ams-form-submit-target")).empty()}},setSEOStatus:function(){var t=e(this),a=t.siblings(".progress").children(".progress-bar"),s=Math.min(t.val().length,100),r="success";s<20||s>80?r="danger":(s<40||s>66)&&(r="warning"),a.removeClassPrefix("progress-bar").addClass("progress-bar").addClass("progress-bar-"+r).css("width",s+"%")}}}(jQuery,this);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_skin/resources/js/myams-i18n.js Thu Dec 13 14:28:29 2018 +0100
@@ -0,0 +1,68 @@
+(function($, globals) {
+
+ var ams = globals.MyAMS;
+
+ /**
+ * MyAMS locale strings
+ */
+ ams.i18n = {
+
+ INFO: "Information",
+ WARNING: "!! WARNING !!",
+ ERROR: "ERROR: ",
+
+ LOADING: "Loading...",
+ PROGRESS: "Processing",
+
+ 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",
+ CLIPBOARD_CHARACTER_COPY_OK: "Character copied to clipboard",
+ CLIPBOARD_TEXT_COPY_OK: "Text copied to clipboard",
+
+ 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"
+ };
+
+})(jQuery, this);
--- a/src/pyams_skin/resources/js/myams-init.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-init.js Thu Dec 13 14:28:29 2018 +0100
@@ -30,8 +30,8 @@
}
}
},
- progress: ams.ajax.progress,
- progressUpload: ams.ajax.progress,
+ progress: ams.ajax && ams.ajax.progress,
+ progressUpload: ams.ajax && ams.ajax.progress,
xhr: function() {
var request = xhr();
if (request && (typeof(request.addEventListener) === "function")) {
@@ -45,9 +45,9 @@
return request;
}
});
- $(document).ajaxStart(ams.ajax.start);
- $(document).ajaxStop(ams.ajax.stop);
- $(document).ajaxError(ams.error.ajax);
+ $(document).ajaxStart(ams.ajax && ams.ajax.start);
+ $(document).ajaxStop(ams.ajax && ams.ajax.stop);
+ $(document).ajaxError(ams.error && ams.error.ajax);
// Check for minified state in local storage
var state = globals.localStorage && globals.localStorage.getItem('window-state');
@@ -63,32 +63,32 @@
ams.root.addClass('mobile-detected');
ams.device = 'mobile';
if (ams.enableFastclick) {
- ams.ajax.check($.fn.noClickDelay,
- ams.baseURL + '/ext/jquery-smartclick' + ams.devext + '.js',
- function() {
- $('NAV UL A').noClickDelay();
- $('A', '#hide-menu').noClickDelay();
- });
+ ams.ajax && ams.ajax.check($.fn.noClickDelay,
+ ams.baseURL + '/ext/jquery-smartclick' + ams.devext + '.js',
+ function() {
+ $('NAV UL A').noClickDelay();
+ $('A', '#hide-menu').noClickDelay();
+ });
}
}
// Switch shortcuts
$('#show-shortcuts').click(function(e) {
if (ams.shortcuts.is(":visible")) {
- ams.skin._hideShortcutButtons();
+ ams.skin && ams.skin._hideShortcutButtons();
} else {
- ams.skin._showShortcutButtons();
+ ams.skin && ams.skin._showShortcutButtons();
}
e.preventDefault();
});
ams.shortcuts.click(function(e) {
- ams.skin._hideShortcutButtons();
+ ams.skin && ams.skin._hideShortcutButtons();
});
$(document).mouseup(function(e) {
if (!ams.shortcuts.is(e.target) &&
ams.shortcuts.has(e.target).length === 0) {
- ams.skin._hideShortcutButtons();
+ ams.skin && ams.skin._hideShortcutButtons();
}
});
@@ -115,7 +115,7 @@
}
e.preventDefault();
});
- ams.skin.checkNotification();
+ ams.skin && ams.skin.checkNotification();
$(document).mouseup(function(e) {
var dropdown = $('.ajax-dropdown');
@@ -140,7 +140,7 @@
href.call(this);
} else {
var container = $('.ajax-notifications');
- ams.skin.loadURL(href, container);
+ ams.skin && ams.skin.loadURL(href, container);
}
}
});
@@ -152,7 +152,7 @@
//get the link
ams.loginURL = $(this).attr('href');
// ask verification
- ams.skin.bigBox({
+ ams.skin && ams.skin.bigBox({
title : "<i class='fa fa-sign-out txt-color-orangeDark'></i> " + ams.i18n.LOGOUT +
" <span class='txt-color-orangeDark'><strong>" + $('#show-shortcut').text() + "</strong></span> ?",
content : ams.i18n.LOGOUT_COMMENT,
@@ -201,7 +201,7 @@
// Reset widgets
$('#refresh').click(function(e) {
- ams.skin.bigBox({
+ ams.skin && ams.skin.bigBox({
title: "<i class='fa fa-refresh' style='color: green'></i> " + ams.i18n.CLEAR_STORAGE_TITLE,
content: ams.i18n.CLEAR_STORAGE_CONTENT,
buttons: '['+ams.i18n.BTN_CANCEL+']['+ams.i18n.BTN_OK+']'
@@ -225,17 +225,17 @@
});
// Resize events
- ams.ajax.check($.resize,
- ams.baseURL + 'ext/jquery-resize' + ams.devext + '.js',
- function() {
- $('#main').resize(function() {
- ams.skin._setPageHeight();
- ams.skin._checkMobileWidth();
- });
- nav.resize(function() {
- ams.skin._setPageHeight();
- });
- });
+ ams.ajax && ams.ajax.check($.resize,
+ ams.baseURL + 'ext/jquery-resize' + ams.devext + '.js',
+ function() {
+ $('#main').resize(function() {
+ ams.skin._setPageHeight();
+ ams.skin._checkMobileWidth();
+ });
+ nav.resize(function() {
+ ams.skin._setPageHeight();
+ });
+ });
// Init AJAX navigation
if (ams.ajaxNav) {
@@ -282,16 +282,16 @@
} else {
var target = link.data('ams-target');
if (target) {
- ams.form.confirmChangedForm(target, function () {
- ams.skin.loadURL(href, target, link.data('ams-link-options'), link.data('ams-link-callback'));
+ ams.form && ams.form.confirmChangedForm(target, function () {
+ ams.skin && ams.skin.loadURL(href, target, link.data('ams-link-options'), link.data('ams-link-callback'));
});
} else {
- ams.form.confirmChangedForm(function () {
+ ams.form && ams.form.confirmChangedForm(function() {
if (href.startsWith('#')) {
if (href !== location.hash) {
if (ams.root.hasClass('mobile-view-activated')) {
ams.root.removeClass('hidden-menu');
- window.setTimeout(function () {
+ window.setTimeout(function() {
window.location.hash = href;
}, 50);
} else {
@@ -310,19 +310,19 @@
e.preventDefault();
var target = $(e.currentTarget);
window.open(target.attr('href'));
- ams.stats.logEvent(target.data('ams-stats-category') || 'Navigation',
- target.data('ams-stats-action') || 'External',
- target.data('ams-stats-label') || target.attr('href'));
+ ams.stats && ams.stats.logEvent(target.data('ams-stats-category') || 'Navigation',
+ target.data('ams-stats-action') || 'External',
+ target.data('ams-stats-label') || target.attr('href'));
});
$(document).on('click', 'a[target="_top"]', function(e) {
e.preventDefault();
- ams.form.confirmChangedForm(function() {
+ ams.form && ams.form.confirmChangedForm(function() {
window.location = $(e.currentTarget).attr('href');
});
});
// Check URL when hash changed
- $(window).on('hashchange', ams.skin.checkURL);
+ $(window).on('hashchange', ams.skin && ams.skin.checkURL);
}
// Initialize modal dialogs links
@@ -340,7 +340,7 @@
e.stopPropagation();
}
e.preventDefault();
- ams.dialog.open(source);
+ ams.dialog && ams.dialog.open(source);
if (source.parents('#shortcut').exists()) {
setTimeout(ams.skin._hideShortcutButtons, 300);
}
@@ -443,7 +443,7 @@
}
});
}, 10);
- ams.form.setFocus(form);
+ ams.form && ams.form.setFocus(form);
});
// Initialize custom reset handlers
@@ -525,7 +525,7 @@
return;
}
link.append('<i class="fa fa-spin fa-cog margin-left-5"></i>');
- ams.skin.loadURL(data.amsUrl, link.attr('href'), {
+ ams.skin && ams.skin.loadURL(data.amsUrl, link.attr('href'), {
afterLoadCallback: function() {
if (data.amsTabLoadOnce) {
link.data('ams-tab-loaded', true);
@@ -542,7 +542,7 @@
// Check modal form dialogs on close
$(document).on('hide.bs.modal', function(e) {
var modal = $(e.target);
- ams.form.confirmChangedForm(modal, function() {
+ ams.form && ams.form.confirmChangedForm(modal, function() {
// Confirm closing if OK
var bsModal = modal.data('modal') || modal.data('bs.modal');
if (bsModal) {
@@ -558,18 +558,18 @@
// Enable custom MyAMS refresh events
$(document).on('myams.refresh', function(event, options) {
- ams.executeFunctionByName(options.handler || ams.skin.refreshContent, event.target, options);
+ ams.executeFunctionByName(options.handler || (ams.skin && ams.skin.refreshContent), event.target, options);
});
// Init page content
ams.initContent(document);
if (ams.ajaxNav && nav.exists()) {
- ams.skin.checkURL();
+ ams.skin && ams.skin.checkURL();
}
- ams.form.setFocus(document);
+ ams.form && ams.form.setFocus(document);
// Add unload event listener to check for modified forms
- $(window).on('beforeunload', ams.form.checkBeforeUnload);
+ $(window).on('beforeunload', ams.form && ams.form.checkBeforeUnload);
};
@@ -594,108 +594,19 @@
});
// Init registered plug-ins and callbacks
- ams.plugins.init(element);
- ams.callbacks.init(element);
- ams.events.init(element);
- ams.form.init(element);
+ ams.plugins && ams.plugins.init(element);
+ ams.callbacks && ams.callbacks.init(element);
+ ams.events && ams.events.init(element);
+ ams.form && ams.form.init(element);
// Initialize widgets
if (ams.device === 'desktop') {
- ams.skin._initDesktopWidgets(element);
+ ams.skin && ams.skin._initDesktopWidgets(element);
} else {
- ams.skin._initMobileWidgets(element);
+ ams.skin && ams.skin._initMobileWidgets(element);
}
- ams.skin._setPageHeight();
-
- };
-
-
- /**
- * MyAMS locale strings
- */
- ams.i18n = {
-
- INFO: "Information",
- WARNING: "!! WARNING !!",
- ERROR: "ERROR: ",
-
- LOADING: "Loading...",
- PROGRESS: "Processing",
-
- 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]",
+ ams.skin && ams.skin._setPageHeight();
- CLIPBOARD_COPY: "Copy to clipboard with Ctrl+C, and Enter",
- CLIPBOARD_CHARACTER_COPY_OK: "Character copied to clipboard",
- CLIPBOARD_TEXT_COPY_OK: "Text copied to clipboard",
-
- 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"
- }
-
- ams.plugins.i18n = {
- widgets: {},
- validate: {},
- datatables: {},
- fancybox: {
- ERROR: "Can't load requested content.",
- RETRY: "Please check URL or try again later.",
- CLOSE: "Close",
- NEXT: "Next",
- PREVIOUS: "Previous"
- },
- dndupload: {
- FILES_SELECTED: '{count} files selected',
- CHOOSE_FILE: 'Select file(s)',
- ADD_INFO: 'to add them to current folder,',
- DRAG_FILE: 'or drag and drop them here!',
- UPLOAD: 'Upload',
- UPLOADING: 'Uploading…',
- DONE: 'Done!',
- UPLOAD_MORE: 'Upload more?',
- ERROR: 'Error!',
- TRY_AGAIN: 'Try again?'
- }
};
--- a/src/pyams_skin/resources/js/myams-init.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-init.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(t,e){var a=e.MyAMS;a.initPage=function(){var o=t("body");a.root=o,a.leftPanel=t("#left-panel"),a.shortcuts=t("#shortcuts"),a.plugins.initData(o);var n=t.ajaxSettings.xhr;t.ajaxSetup({beforeSend:function(t,o){if(a.safeMethods.indexOf(o.type)<0&&void 0!==e.Cookies){var n=Cookies.get(a.csrfCookieName);n&&t.setRequestHeader(a.csrfHeaderName,n)}},progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var t=n();if(t&&"function"==typeof t.addEventListener){var e=this;e&&e.progress&&t.addEventListener("progress",function(t){e.progress(t)},!1)}return t}}),t(document).ajaxStart(a.ajax.start),t(document).ajaxStop(a.ajax.stop),t(document).ajaxError(a.error.ajax);var i=e.localStorage&&e.localStorage.getItem("window-state");i&&o.addClass(i),a.isMobile?(a.root.addClass("mobile-detected"),a.device="mobile",a.enableFastclick&&a.ajax.check(t.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){t("NAV UL A").noClickDelay(),t("A","#hide-menu").noClickDelay()})):(a.root.addClass("desktop-detected"),a.device="desktop"),t("#show-shortcuts").click(function(t){a.shortcuts.is(":visible")?a.skin._hideShortcutButtons():a.skin._showShortcutButtons(),t.preventDefault()}),a.shortcuts.click(function(t){a.skin._hideShortcutButtons()}),t(document).mouseup(function(t){a.shortcuts.is(t.target)||0!==a.shortcuts.has(t.target).length||a.skin._hideShortcutButtons()}),t("#search-mobile").click(function(){a.root.addClass("search-mobile")}),t("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")}),t(".activity-button","#user-activity").click(function(e){var a=t("#user-activity"),o=t(".ajax-dropdown",a);o.is(":visible")?(o.fadeOut(150),a.removeClass("active")):(o.css("left",-o.innerWidth()+a.innerWidth()).fadeIn(150),a.addClass("active")),e.preventDefault()}),a.skin.checkNotification(),t(document).mouseup(function(e){var a=t(".ajax-dropdown");a.is(e.target)||0!==a.has(e.target).length||a.fadeOut(150).prev().removeClass("active")}),t('input[name="activity"]').change(function(e){var o=t(this).data("ams-url");if(o){e.preventDefault(),e.stopPropagation();var n=a.getFunctionByName(o);if("function"==typeof n&&(o=n.call(this)),"function"==typeof o)o.call(this);else{var i=t(".ajax-notifications");a.skin.loadURL(o,i)}}}),t("a","#user-menu LI.logout").click(function(e){e.preventDefault(),e.stopPropagation(),a.loginURL=t(this).attr("href"),a.skin.bigBox({title:"<i class='fa fa-sign-out txt-color-orangeDark'></i> "+a.i18n.LOGOUT+" <span class='txt-color-orangeDark'><strong>"+t("#show-shortcut").text()+"</strong></span> ?",content:a.i18n.LOGOUT_COMMENT,buttons:a.i18n.BTN_YES_NO},function(t){t===a.i18n.BTN_YES&&(a.root.addClass("animated fadeOutUp"),setTimeout(a.skin.logout,1e3))})});var s=t("nav");t("UL",s).myams_menu({accordion:!1!==s.data("ams-menu-accordion"),speed:a.menuSpeed}),t("#hide-menu").find(">:first-child >A").click(function(t){o.toggleClass("hidden-menu"),e.localStorage&&(o.hasClass("hidden-menu")?e.localStorage.setItem("window-state","hidden-menu"):e.localStorage.setItem("window-state","")),t.preventDefault()}),t(".minifyme").click(function(a){o.toggleClass("minified"),e.localStorage&&(o.hasClass("minified")?e.localStorage.setItem("window-state","minified"):e.localStorage.setItem("window-state","")),t(this).effect("highlight",{},500),a.preventDefault()}),t("#refresh").click(function(t){a.skin.bigBox({title:"<i class='fa fa-refresh' style='color: green'></i> "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(t){t===a.i18n.BTN_OK&&localStorage&&(localStorage.clear(),location.reload())}),t.preventDefault()}),o.on("click",function(e){var a=t(this);a.is(e.target)||0!==a.has(e.target).length||0!==t(".popover").has(e.target).length||a.popover("hide")}),a.ajax.check(t.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){t("#main").resize(function(){a.skin._setPageHeight(),a.skin._checkMobileWidth()}),s.resize(function(){a.skin._setPageHeight()})}),a.ajaxNav&&(t(document).on("click",'a[href="#"]',function(t){t.preventDefault()}),t(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(e){var o=t(e.currentTarget),n=o.data("ams-disabled-handlers");if(!0!==n&&"click"!==n&&"all"!==n){var i=o.attr("href")||o.data("ams-url");if(i&&!i.startsWith("javascript")&&!o.attr("target")&&!0!==o.data("ams-context-menu")){e.preventDefault(),e.stopPropagation();var s,r,c;i.indexOf("?")>=0?(s=i.split("?"),r=s[0],c=s[1].unserialize()):(r=i,c=void 0);var l=a.getFunctionByName(r);"function"==typeof l&&(i=l.call(o,c)),"function"==typeof i?i.call(o,c):(i=i.replace(/\%23/,"#"),e.ctrlKey?window.open(i):(r=o.data("ams-target"))?a.form.confirmChangedForm(r,function(){a.skin.loadURL(i,r,o.data("ams-link-options"),o.data("ams-link-callback"))}):a.form.confirmChangedForm(function(){i.startsWith("#")?i!==location.hash&&(a.root.hasClass("mobile-view-activated")?(a.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=i},50)):window.location.hash=i):window.location=i}))}}}),t(document).on("click",'a[target="_blank"]',function(e){e.preventDefault();var o=t(e.currentTarget);window.open(o.attr("href")),a.stats.logEvent(o.data("ams-stats-category")||"Navigation",o.data("ams-stats-action")||"External",o.data("ams-stats-label")||o.attr("href"))}),t(document).on("click",'a[target="_top"]',function(e){e.preventDefault(),a.form.confirmChangedForm(function(){window.location=t(e.currentTarget).attr("href")})}),t(window).on("hashchange",a.skin.checkURL)),t(document).off("click.modal").on("click",'[data-toggle="modal"]',function(e){var o=t(this),n=o.data("ams-disabled-handlers");!0!==n&&"click"!==n&&"all"!==n&&!0!==o.data("ams-context-menu")&&(!0===o.data("ams-stop-propagation")&&e.stopPropagation(),e.preventDefault(),a.dialog.open(o),o.parents("#shortcut").exists()&&setTimeout(a.skin._hideShortcutButtons,300))}),t(document).on("click",'button[type="submit"], button.submit',function(){var e=t(this);t(e.get(0).form).data("ams-submit-button",e)}),t(document).on("click",'input[type="checkbox"][readonly]',function(){return!1}),t(document).on("click","[data-ams-click-handler]",function(e){var o=t(this),n=o.data("ams-disabled-handlers");if(!0!==n&&"click"!==n&&"all"!==n){var i=o.data();if(i.amsClickHandler){!0!==i.amsStopPropagation&&!0!==i.amsClickStopPropagation||e.stopPropagation(),!0!==i.amsClickKeepDefault&&e.preventDefault();for(var s=i.amsClickHandler.split(/\s+/),r=0;r<s.length;r++){var c=a.getFunctionByName(s[r]);void 0!==c&&c.call(o,e,i.amsClickHandlerOptions)}}}}),t(document).on("change","[data-ams-change-handler]",function(e){var o=t(this);if(!o.prop("readonly")){var n=o.data("ams-disabled-handlers");if(!0!==n&&"change"!==n&&"all"!==n){var i=o.data();if(i.amsChangeHandler){!0!==i.amsStopPropagation&&!0!==i.amsChangeStopPropagation||e.stopPropagation(),!0!==i.amsChangeKeepDefault&&e.preventDefault();for(var s=i.amsChangeHandler.split(/\s+/),r=0;r<s.length;r++){var c=a.getFunctionByName(s[r]);void 0!==c&&c.call(o,e,i.amsChangeHandlerOptions)}}}}}),t(document).on("keydown","textarea",function(e){10!==e.keyCode&&13!==e.keyCode||!e.ctrlKey&&!e.metaKey||t(this).closest("form").submit()}),t(document).on("reset","form",function(e){var o=t(this);setTimeout(function(){t(".alert-danger, SPAN.state-error",o).not(".persistent").remove(),t("LABEL.state-error",o).removeClass("state-error"),t('INPUT.select2[type="hidden"]',o).each(function(){var e=t(this),a=e.data("select2"),o=e.data("ams-select2-input-value");o&&e.select2("val",o.split(a.opts.separator))}),o.find(".select2").trigger("change"),t("[data-ams-reset-callback]",o).each(function(){var e=t(this),n=e.data(),i=a.getFunctionByName(n.amsResetCallback);void 0!==i&&i.call(o,e,n.amsResetCallbackOptions)})},10),a.form.setFocus(o)}),t(document).on("reset","[data-ams-reset-handler]",function(e){var o=t(this),n=o.data();if(n.amsResetHandler){!0!==n.amsResetKeepDefault&&e.preventDefault();var i=a.getFunctionByName(n.amsResetHandler);void 0!==i&&i.call(o,n.amsResetHandlerOptions)}}),t(document).on("click","[data-ams-click-event]",function(e){var a=t(this);t(e.target).trigger(a.data("ams-click-event"),a.data("ams-click-event-options"))}),t(document).on("change",'input[type="file"]',function(e){e.preventDefault();var a=t(this),o=a.parent(".button");o.exists()&&o.parent().hasClass("input-file")&&o.next('input[type="text"]').val(a.val())}),t(document).on("focus",'input[readonly="readonly"]',function(){t(this).blur()}),t(document).on("focusin",function(e){t(e.target).closest(".mce-window").length&&e.stopImmediatePropagation()}),t(document).on("click",".nav-tabs a[data-toggle=tab]",function(e){if(t(this).parent("li").hasClass("disabled"))return e.preventDefault(),!1}),t(document).on("show.bs.dropdown",".btn-group",function(){var e=t(this),a=e.children(".dropdown-menu"),o=e.get(0).getBoundingClientRect(),n=o.top,i=o.height,s=a.outerHeight();n>s&&t(window).height()-n<i+s&&e.addClass("dropup")}).on("hidden.bs.dropdown",".btn-group",function(){t(this).removeClass("dropup")}),t(document).on("show.bs.tab",function(e){var o=t(e.target);o.exists()&&"A"!==o.get(0).tagName&&(o=t("a[href]",o));var n=o.data();if(n&&n.amsUrl){if(n.amsTabLoaded)return;o.append('<i class="fa fa-spin fa-cog margin-left-5"></i>'),a.skin.loadURL(n.amsUrl,o.attr("href"),{afterLoadCallback:function(){n.amsTabLoadOnce&&o.data("ams-tab-loaded",!0),t("i",o).remove()},afterErrorCallback:function(){t("i",o).remove()}})}}),t(document).on("hide.bs.modal",function(e){var o=t(e.target);a.form.confirmChangedForm(o,function(){var t=o.data("modal")||o.data("bs.modal");return t&&(t.isShown=!0),!0},function(){return e.preventDefault(),!1})}),t(document).on("myams.refresh",function(t,e){a.executeFunctionByName(e.handler||a.skin.refreshContent,t.target,e)}),a.initContent(document),a.ajaxNav&&s.exists()&&a.skin.checkURL(),a.form.setFocus(document),t(window).on("beforeunload",a.form.checkBeforeUnload)},a.initContent=function(e){t(".tipsy").remove(),t("[rel=tooltip]",e).tooltip(),t("[rel=popover]",e).popover(),t("[rel=popover-hover]",e).popover({trigger:"hover"}),a.plugins.init(e),a.callbacks.init(e),a.events.init(e),a.form.init(e),"desktop"===a.device?a.skin._initDesktopWidgets(e):a.skin._initMobileWidgets(e),a.skin._setPageHeight()},a.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",LOADING:"Loading...",PROGRESS:"Processing",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",CLIPBOARD_CHARACTER_COPY_OK:"Character copied to clipboard",CLIPBOARD_TEXT_COPY_OK:"Text copied to clipboard",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"},a.plugins.i18n={widgets:{},validate:{},datatables:{},fancybox:{ERROR:"Can't load requested content.",RETRY:"Please check URL or try again later.",CLOSE:"Close",NEXT:"Next",PREVIOUS:"Previous"},dndupload:{FILES_SELECTED:"{count} files selected",CHOOSE_FILE:"Select file(s)",ADD_INFO:"to add them to current folder,",DRAG_FILE:"or drag and drop them here!",UPLOAD:"Upload",UPLOADING:"Uploading…",DONE:"Done!",UPLOAD_MORE:"Upload more?",ERROR:"Error!",TRY_AGAIN:"Try again?"}},t(document).ready(function(){var e=(t=jQuery.noConflict())("HTML");e.removeClass("no-js").addClass("js");var o=e.attr("lang")||e.attr("xml:lang");o&&!o.startsWith("en")?(a.lang=o,a.getScript(a.baseURL+"i18n/myams_"+o.substr(0,2)+a.devext+".js",function(){a.initPage()})):a.initPage()})}(jQuery,this);
+!function(t,e){var a=e.MyAMS;a.initPage=function(){var n=t("body");a.root=n,a.leftPanel=t("#left-panel"),a.shortcuts=t("#shortcuts"),a.plugins.initData(n);var o=t.ajaxSettings.xhr;t.ajaxSetup({beforeSend:function(t,n){if(a.safeMethods.indexOf(n.type)<0&&void 0!==e.Cookies){var o=Cookies.get(a.csrfCookieName);o&&t.setRequestHeader(a.csrfHeaderName,o)}},progress:a.ajax&&a.ajax.progress,progressUpload:a.ajax&&a.ajax.progress,xhr:function(){var t=o();if(t&&"function"==typeof t.addEventListener){var e=this;e&&e.progress&&t.addEventListener("progress",function(t){e.progress(t)},!1)}return t}}),t(document).ajaxStart(a.ajax&&a.ajax.start),t(document).ajaxStop(a.ajax&&a.ajax.stop),t(document).ajaxError(a.error&&a.error.ajax);var i=e.localStorage&&e.localStorage.getItem("window-state");i&&n.addClass(i),a.isMobile?(a.root.addClass("mobile-detected"),a.device="mobile",a.enableFastclick&&a.ajax&&a.ajax.check(t.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){t("NAV UL A").noClickDelay(),t("A","#hide-menu").noClickDelay()})):(a.root.addClass("desktop-detected"),a.device="desktop"),t("#show-shortcuts").click(function(t){a.shortcuts.is(":visible")?a.skin&&a.skin._hideShortcutButtons():a.skin&&a.skin._showShortcutButtons(),t.preventDefault()}),a.shortcuts.click(function(t){a.skin&&a.skin._hideShortcutButtons()}),t(document).mouseup(function(t){a.shortcuts.is(t.target)||0!==a.shortcuts.has(t.target).length||a.skin&&a.skin._hideShortcutButtons()}),t("#search-mobile").click(function(){a.root.addClass("search-mobile")}),t("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")}),t(".activity-button","#user-activity").click(function(e){var a=t("#user-activity"),n=t(".ajax-dropdown",a);n.is(":visible")?(n.fadeOut(150),a.removeClass("active")):(n.css("left",-n.innerWidth()+a.innerWidth()).fadeIn(150),a.addClass("active")),e.preventDefault()}),a.skin&&a.skin.checkNotification(),t(document).mouseup(function(e){var a=t(".ajax-dropdown");a.is(e.target)||0!==a.has(e.target).length||a.fadeOut(150).prev().removeClass("active")}),t('input[name="activity"]').change(function(e){var n=t(this).data("ams-url");if(n){e.preventDefault(),e.stopPropagation();var o=a.getFunctionByName(n);if("function"==typeof o&&(n=o.call(this)),"function"==typeof n)n.call(this);else{var i=t(".ajax-notifications");a.skin&&a.skin.loadURL(n,i)}}}),t("a","#user-menu LI.logout").click(function(e){e.preventDefault(),e.stopPropagation(),a.loginURL=t(this).attr("href"),a.skin&&a.skin.bigBox({title:"<i class='fa fa-sign-out txt-color-orangeDark'></i> "+a.i18n.LOGOUT+" <span class='txt-color-orangeDark'><strong>"+t("#show-shortcut").text()+"</strong></span> ?",content:a.i18n.LOGOUT_COMMENT,buttons:a.i18n.BTN_YES_NO},function(t){t===a.i18n.BTN_YES&&(a.root.addClass("animated fadeOutUp"),setTimeout(a.skin.logout,1e3))})});var s=t("nav");t("UL",s).myams_menu({accordion:!1!==s.data("ams-menu-accordion"),speed:a.menuSpeed}),t("#hide-menu").find(">:first-child >A").click(function(t){n.toggleClass("hidden-menu"),e.localStorage&&(n.hasClass("hidden-menu")?e.localStorage.setItem("window-state","hidden-menu"):e.localStorage.setItem("window-state","")),t.preventDefault()}),t(".minifyme").click(function(a){n.toggleClass("minified"),e.localStorage&&(n.hasClass("minified")?e.localStorage.setItem("window-state","minified"):e.localStorage.setItem("window-state","")),t(this).effect("highlight",{},500),a.preventDefault()}),t("#refresh").click(function(t){a.skin&&a.skin.bigBox({title:"<i class='fa fa-refresh' style='color: green'></i> "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(t){t===a.i18n.BTN_OK&&localStorage&&(localStorage.clear(),location.reload())}),t.preventDefault()}),n.on("click",function(e){var a=t(this);a.is(e.target)||0!==a.has(e.target).length||0!==t(".popover").has(e.target).length||a.popover("hide")}),a.ajax&&a.ajax.check(t.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){t("#main").resize(function(){a.skin._setPageHeight(),a.skin._checkMobileWidth()}),s.resize(function(){a.skin._setPageHeight()})}),a.ajaxNav&&(t(document).on("click",'a[href="#"]',function(t){t.preventDefault()}),t(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(e){var n=t(e.currentTarget),o=n.data("ams-disabled-handlers");if(!0!==o&&"click"!==o&&"all"!==o){var i=n.attr("href")||n.data("ams-url");if(i&&!i.startsWith("javascript")&&!n.attr("target")&&!0!==n.data("ams-context-menu")){e.preventDefault(),e.stopPropagation();var s,r,c;i.indexOf("?")>=0?(s=i.split("?"),r=s[0],c=s[1].unserialize()):(r=i,c=void 0);var l=a.getFunctionByName(r);"function"==typeof l&&(i=l.call(n,c)),"function"==typeof i?i.call(n,c):(i=i.replace(/\%23/,"#"),e.ctrlKey?window.open(i):(r=n.data("ams-target"))?a.form&&a.form.confirmChangedForm(r,function(){a.skin&&a.skin.loadURL(i,r,n.data("ams-link-options"),n.data("ams-link-callback"))}):a.form&&a.form.confirmChangedForm(function(){i.startsWith("#")?i!==location.hash&&(a.root.hasClass("mobile-view-activated")?(a.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=i},50)):window.location.hash=i):window.location=i}))}}}),t(document).on("click",'a[target="_blank"]',function(e){e.preventDefault();var n=t(e.currentTarget);window.open(n.attr("href")),a.stats&&a.stats.logEvent(n.data("ams-stats-category")||"Navigation",n.data("ams-stats-action")||"External",n.data("ams-stats-label")||n.attr("href"))}),t(document).on("click",'a[target="_top"]',function(e){e.preventDefault(),a.form&&a.form.confirmChangedForm(function(){window.location=t(e.currentTarget).attr("href")})}),t(window).on("hashchange",a.skin&&a.skin.checkURL)),t(document).off("click.modal").on("click",'[data-toggle="modal"]',function(e){var n=t(this),o=n.data("ams-disabled-handlers");!0!==o&&"click"!==o&&"all"!==o&&!0!==n.data("ams-context-menu")&&(!0===n.data("ams-stop-propagation")&&e.stopPropagation(),e.preventDefault(),a.dialog&&a.dialog.open(n),n.parents("#shortcut").exists()&&setTimeout(a.skin._hideShortcutButtons,300))}),t(document).on("click",'button[type="submit"], button.submit',function(){var e=t(this);t(e.get(0).form).data("ams-submit-button",e)}),t(document).on("click",'input[type="checkbox"][readonly]',function(){return!1}),t(document).on("click","[data-ams-click-handler]",function(e){var n=t(this),o=n.data("ams-disabled-handlers");if(!0!==o&&"click"!==o&&"all"!==o){var i=n.data();if(i.amsClickHandler){!0!==i.amsStopPropagation&&!0!==i.amsClickStopPropagation||e.stopPropagation(),!0!==i.amsClickKeepDefault&&e.preventDefault();for(var s=i.amsClickHandler.split(/\s+/),r=0;r<s.length;r++){var c=a.getFunctionByName(s[r]);void 0!==c&&c.call(n,e,i.amsClickHandlerOptions)}}}}),t(document).on("change","[data-ams-change-handler]",function(e){var n=t(this);if(!n.prop("readonly")){var o=n.data("ams-disabled-handlers");if(!0!==o&&"change"!==o&&"all"!==o){var i=n.data();if(i.amsChangeHandler){!0!==i.amsStopPropagation&&!0!==i.amsChangeStopPropagation||e.stopPropagation(),!0!==i.amsChangeKeepDefault&&e.preventDefault();for(var s=i.amsChangeHandler.split(/\s+/),r=0;r<s.length;r++){var c=a.getFunctionByName(s[r]);void 0!==c&&c.call(n,e,i.amsChangeHandlerOptions)}}}}}),t(document).on("keydown","textarea",function(e){10!==e.keyCode&&13!==e.keyCode||!e.ctrlKey&&!e.metaKey||t(this).closest("form").submit()}),t(document).on("reset","form",function(e){var n=t(this);setTimeout(function(){t(".alert-danger, SPAN.state-error",n).not(".persistent").remove(),t("LABEL.state-error",n).removeClass("state-error"),t('INPUT.select2[type="hidden"]',n).each(function(){var e=t(this),a=e.data("select2"),n=e.data("ams-select2-input-value");n&&e.select2("val",n.split(a.opts.separator))}),n.find(".select2").trigger("change"),t("[data-ams-reset-callback]",n).each(function(){var e=t(this),o=e.data(),i=a.getFunctionByName(o.amsResetCallback);void 0!==i&&i.call(n,e,o.amsResetCallbackOptions)})},10),a.form&&a.form.setFocus(n)}),t(document).on("reset","[data-ams-reset-handler]",function(e){var n=t(this),o=n.data();if(o.amsResetHandler){!0!==o.amsResetKeepDefault&&e.preventDefault();var i=a.getFunctionByName(o.amsResetHandler);void 0!==i&&i.call(n,o.amsResetHandlerOptions)}}),t(document).on("click","[data-ams-click-event]",function(e){var a=t(this);t(e.target).trigger(a.data("ams-click-event"),a.data("ams-click-event-options"))}),t(document).on("change",'input[type="file"]',function(e){e.preventDefault();var a=t(this),n=a.parent(".button");n.exists()&&n.parent().hasClass("input-file")&&n.next('input[type="text"]').val(a.val())}),t(document).on("focus",'input[readonly="readonly"]',function(){t(this).blur()}),t(document).on("focusin",function(e){t(e.target).closest(".mce-window").length&&e.stopImmediatePropagation()}),t(document).on("click",".nav-tabs a[data-toggle=tab]",function(e){if(t(this).parent("li").hasClass("disabled"))return e.preventDefault(),!1}),t(document).on("show.bs.dropdown",".btn-group",function(){var e=t(this),a=e.children(".dropdown-menu"),n=e.get(0).getBoundingClientRect(),o=n.top,i=n.height,s=a.outerHeight();o>s&&t(window).height()-o<i+s&&e.addClass("dropup")}).on("hidden.bs.dropdown",".btn-group",function(){t(this).removeClass("dropup")}),t(document).on("show.bs.tab",function(e){var n=t(e.target);n.exists()&&"A"!==n.get(0).tagName&&(n=t("a[href]",n));var o=n.data();if(o&&o.amsUrl){if(o.amsTabLoaded)return;n.append('<i class="fa fa-spin fa-cog margin-left-5"></i>'),a.skin&&a.skin.loadURL(o.amsUrl,n.attr("href"),{afterLoadCallback:function(){o.amsTabLoadOnce&&n.data("ams-tab-loaded",!0),t("i",n).remove()},afterErrorCallback:function(){t("i",n).remove()}})}}),t(document).on("hide.bs.modal",function(e){var n=t(e.target);a.form&&a.form.confirmChangedForm(n,function(){var t=n.data("modal")||n.data("bs.modal");return t&&(t.isShown=!0),!0},function(){return e.preventDefault(),!1})}),t(document).on("myams.refresh",function(t,e){a.executeFunctionByName(e.handler||a.skin&&a.skin.refreshContent,t.target,e)}),a.initContent(document),a.ajaxNav&&s.exists()&&a.skin&&a.skin.checkURL(),a.form&&a.form.setFocus(document),t(window).on("beforeunload",a.form&&a.form.checkBeforeUnload)},a.initContent=function(e){t(".tipsy").remove(),t("[rel=tooltip]",e).tooltip(),t("[rel=popover]",e).popover(),t("[rel=popover-hover]",e).popover({trigger:"hover"}),a.plugins&&a.plugins.init(e),a.callbacks&&a.callbacks.init(e),a.events&&a.events.init(e),a.form&&a.form.init(e),"desktop"===a.device?a.skin&&a.skin._initDesktopWidgets(e):a.skin&&a.skin._initMobileWidgets(e),a.skin&&a.skin._setPageHeight()},t(document).ready(function(){var e=(t=jQuery.noConflict())("HTML");e.removeClass("no-js").addClass("js");var n=e.attr("lang")||e.attr("xml:lang");n&&!n.startsWith("en")?(a.lang=n,a.getScript(a.baseURL+"i18n/myams_"+n.substr(0,2)+a.devext+".js",function(){a.initPage()})):a.initPage()})}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-jsonrpc.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-jsonrpc.js Thu Dec 13 14:28:29 2018 +0100
@@ -27,51 +27,50 @@
* - @callback: name of a callback which will be called on server response
*/
query: function(query, method, options, callback) {
- ams.ajax.check($.jsonRPC,
- ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
- function() {
- if (typeof(options) === 'function') {
- callback = options;
- options = {};
- }
- else if (!options) {
- options = {};
- }
- if (callback === 'undefined') {
- callback = options.callback;
- }
- if (typeof(callback) === 'string') {
- callback = ams.getFunctionByName(callback);
- }
- delete options.callback;
+ ams.ajax && ams.ajax.check($.jsonRPC,
+ ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
+ function() {
+ if (typeof (options) === 'function') {
+ callback = options;
+ options = {};
+ } else if (!options) {
+ options = {};
+ }
+ if (callback === 'undefined') {
+ callback = options.callback;
+ }
+ if (typeof (callback) === 'string') {
+ callback = ams.getFunctionByName(callback);
+ }
+ delete options.callback;
- var params = {};
- if (typeof(query) === 'string') {
- params.query = query;
- } else if (typeof(query) === 'object') {
- $.extend(params, query);
- }
- $.extend(params, options);
+ var params = {};
+ if (typeof (query) === 'string') {
+ params.query = query;
+ } else if (typeof (query) === 'object') {
+ $.extend(params, query);
+ }
+ $.extend(params, options);
- var result;
- var defaults = {
- id: new Date().getTime(),
- params: params,
- success: callback || function(data) {
- result = data;
- },
- error: ams.error.show
- };
- var settings = $.extend({}, defaults, options);
- $.jsonRPC.withOptions({
- endPoint: ams.jsonrpc.getAddr(options.url),
- namespace: options.namespace,
- cache: false
- }, function() {
- $.jsonRPC.request(method, settings);
- });
- return result;
- });
+ var result;
+ var defaults = {
+ id: new Date().getTime(),
+ params: params,
+ success: callback || function(data) {
+ result = data;
+ },
+ error: ams.error && ams.error.show
+ };
+ var settings = $.extend({}, defaults, options);
+ $.jsonRPC.withOptions({
+ endPoint: ams.jsonrpc.getAddr(options.url),
+ namespace: options.namespace,
+ cache: false
+ }, function() {
+ $.jsonRPC.request(method, settings);
+ });
+ return result;
+ });
},
/**
@@ -83,43 +82,42 @@
* - @callback: name of a callback which will be called on server response
*/
post: function(method, data, options, callback) {
- ams.ajax.check($.jsonRPC,
- ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
- function() {
- if (typeof(options) === 'function') {
- callback = options;
- options = {};
- }
- else if (!options) {
- options = {};
- }
- if (typeof(callback) === 'undefined') {
- callback = options.callback;
- }
- if (typeof(callback) === 'string') {
- callback = ams.getFunctionByName(callback);
- }
- delete options.callback;
+ ams.ajax && ams.ajax.check($.jsonRPC,
+ ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
+ function() {
+ if (typeof (options) === 'function') {
+ callback = options;
+ options = {};
+ } else if (!options) {
+ options = {};
+ }
+ if (typeof (callback) === 'undefined') {
+ callback = options.callback;
+ }
+ if (typeof (callback) === 'string') {
+ callback = ams.getFunctionByName(callback);
+ }
+ delete options.callback;
- var result;
- var defaults = {
- id: new Date().getTime(),
- params: data,
- success: callback || function(data) {
- result = data;
- },
- error: ams.error.show
- };
- var settings = $.extend({}, defaults, options);
- $.jsonRPC.withOptions({
- endPoint: ams.jsonrpc.getAddr(options.url),
- namespace: options.namespace,
- cache: false
- }, function() {
- $.jsonRPC.request(method, settings);
- });
- return result;
- });
+ var result;
+ var defaults = {
+ id: new Date().getTime(),
+ params: data,
+ success: callback || function(data) {
+ result = data;
+ },
+ error: ams.error && ams.error.show
+ };
+ var settings = $.extend({}, defaults, options);
+ $.jsonRPC.withOptions({
+ endPoint: ams.jsonrpc.getAddr(options.url),
+ namespace: options.namespace,
+ cache: false
+ }, function() {
+ $.jsonRPC.request(method, settings);
+ });
+ return result;
+ });
}
};
--- a/src/pyams_skin/resources/js/myams-jsonrpc.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-jsonrpc.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(e,n){var t=n.MyAMS;t.jsonrpc={getAddr:function(n){var t=(n||e("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return t.substr(0,t.lastIndexOf("/")+1)},query:function(n,r,o,c){t.ajax.check(e.jsonRPC,t.baseURL+"ext/jquery-jsonrpc"+t.devext+".js",function(){"function"==typeof o?(c=o,o={}):o||(o={}),"undefined"===c&&(c=o.callback),"string"==typeof c&&(c=t.getFunctionByName(c)),delete o.callback;var s={};"string"==typeof n?s.query=n:"object"==typeof n&&e.extend(s,n),e.extend(s,o);var a,i={id:(new Date).getTime(),params:s,success:c||function(e){a=e},error:t.error.show},u=e.extend({},i,o);return e.jsonRPC.withOptions({endPoint:t.jsonrpc.getAddr(o.url),namespace:o.namespace,cache:!1},function(){e.jsonRPC.request(r,u)}),a})},post:function(n,r,o,c){t.ajax.check(e.jsonRPC,t.baseURL+"ext/jquery-jsonrpc"+t.devext+".js",function(){"function"==typeof o?(c=o,o={}):o||(o={}),void 0===c&&(c=o.callback),"string"==typeof c&&(c=t.getFunctionByName(c)),delete o.callback;var s,a={id:(new Date).getTime(),params:r,success:c||function(e){s=e},error:t.error.show},i=e.extend({},a,o);return e.jsonRPC.withOptions({endPoint:t.jsonrpc.getAddr(o.url),namespace:o.namespace,cache:!1},function(){e.jsonRPC.request(n,i)}),s})}}}(jQuery,this);
+!function(e,n){var t=n.MyAMS;t.jsonrpc={getAddr:function(n){var t=(n||e("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return t.substr(0,t.lastIndexOf("/")+1)},query:function(n,r,o,c){t.ajax&&t.ajax.check(e.jsonRPC,t.baseURL+"ext/jquery-jsonrpc"+t.devext+".js",function(){"function"==typeof o?(c=o,o={}):o||(o={}),"undefined"===c&&(c=o.callback),"string"==typeof c&&(c=t.getFunctionByName(c)),delete o.callback;var a={};"string"==typeof n?a.query=n:"object"==typeof n&&e.extend(a,n),e.extend(a,o);var s,i={id:(new Date).getTime(),params:a,success:c||function(e){s=e},error:t.error&&t.error.show},u=e.extend({},i,o);return e.jsonRPC.withOptions({endPoint:t.jsonrpc.getAddr(o.url),namespace:o.namespace,cache:!1},function(){e.jsonRPC.request(r,u)}),s})},post:function(n,r,o,c){t.ajax&&t.ajax.check(e.jsonRPC,t.baseURL+"ext/jquery-jsonrpc"+t.devext+".js",function(){"function"==typeof o?(c=o,o={}):o||(o={}),void 0===c&&(c=o.callback),"string"==typeof c&&(c=t.getFunctionByName(c)),delete o.callback;var a,s={id:(new Date).getTime(),params:r,success:c||function(e){a=e},error:t.error&&t.error.show},i=e.extend({},s,o);return e.jsonRPC.withOptions({endPoint:t.jsonrpc.getAddr(o.url),namespace:o.namespace,cache:!1},function(){e.jsonRPC.request(n,i)}),a})}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-loader.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-loader.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(s,e){var h=e.MyAMS,o=[];h.require=function(e,n){for(var r=[],t=0;t<e.length;t++){var a=e[t];if(o.indexOf(a)<0){var i=h.baseURL+"myams-"+a+h.devext+".js";r.push(h.getScript(i,{async:!0},console.error)),o.push(a)}}0<r.length?s.when.apply(s,r).then(function(){n()}):n()}}(jQuery,this);
+!function(e,n){var r=n.MyAMS,t=[];r.require=function(n,a){for(var i=[],s=0;s<n.length;s++){var h=n[s];if(t.indexOf(h)<0){var o=r.baseURL+"myams-"+h+r.devext+".js";i.push(r.getScript(o,{async:!0},console.error)),t.push(h)}}i.length>0?e.when.apply(e,i).then(function(){a()}):a()}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-menus.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-menus.js Thu Dec 13 14:28:29 2018 +0100
@@ -48,7 +48,7 @@
var invokedOn = $(this).data("invokedOn");
var selectedMenu = $(e.target);
settings.menuSelected.call(this, invokedOn, selectedMenu);
- ams.event.stop(e);
+ ams.event && ams.event.stop(e);
});
return false;
});
--- a/src/pyams_skin/resources/js/myams-menus.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-menus.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(e,n){var i=n.MyAMS;e.fn.extend({contextMenu:function(n){function t(i,t,a){var s=e(window)[t](),c=e(n.menuSelector)[t](),o=i;return i+c>s&&c<i&&(o-=c),o}return this.each(function(){e("a",e(n.menuSelector)).each(function(){e(this).data("ams-context-menu",!0)}),e(this).on("contextmenu",function(a){if(!a.ctrlKey)return e(n.menuSelector).data("invokedOn",e(a.target)).show().css({position:"fixed",left:t(a.clientX,"width")-10,top:t(a.clientY,"height")-10}).off("click").on("click",function(t){e(this).hide();var a=e(this).data("invokedOn"),s=e(t.target);n.menuSelected.call(this,a,s),i.event.stop(t)}),!1}),e(document).click(function(){e(n.menuSelector).hide()})})},myams_menu:function(n){var i=e.extend({},{accordion:!0,speed:200,closedSign:'<em class="fa fa-angle-down"></em>',openedSign:'<em class="fa fa-angle-up"></em>'},n),t=e(this);t.find("LI").each(function(){var n=e(this);if(n.find("UL").size()>0){n.find("A:first").append("<b class='collapse-sign'>"+i.closedSign+"</b>");var t=n.find("A:first");"#"===t.attr("href")&&t.click(function(){return!1})}}),t.find("LI.active").each(function(){var n=e(this).parents("UL"),t=n.parent("LI");n.slideDown(i.speed),t.find("b:first").html(i.openedSign),t.addClass("open")}),t.find("LI A").on("click",function(){var n=e(this);if(!n.hasClass("active")){var a=n.attr("href").replace(/^#/,""),s=n.parent().find("UL");if(i.accordion){var c=n.parent().parents("UL"),o=t.find("UL:visible");o.each(function(n){var t=!0;if(c.each(function(e){if(c[e]===o[n])return t=!1,!1}),t&&s!==o[n]){var d=e(o[n]);!a&&d.hasClass("active")||d.slideUp(i.speed,function(){e(this).parent("LI").removeClass("open").find("B:first").delay(i.speed).html(i.closedSign)})}})}var d=n.parent().find("UL:first");a||!d.is(":visible")||d.hasClass("active")?d.slideDown(i.speed,function(){n.parent("LI").addClass("open").find("B:first").delay(i.speed).html(i.openedSign)}):d.slideUp(i.speed,function(){n.parent("LI").removeClass("open").find("B:first").delay(i.speed).html(i.closedSign)})}})}})}(jQuery,this);
+!function(e,n){var i=n.MyAMS;e.fn.extend({contextMenu:function(n){function t(i,t,a){var s=e(window)[t](),c=e(n.menuSelector)[t](),o=i;return i+c>s&&c<i&&(o-=c),o}return this.each(function(){e("a",e(n.menuSelector)).each(function(){e(this).data("ams-context-menu",!0)}),e(this).on("contextmenu",function(a){if(!a.ctrlKey)return e(n.menuSelector).data("invokedOn",e(a.target)).show().css({position:"fixed",left:t(a.clientX,"width")-10,top:t(a.clientY,"height")-10}).off("click").on("click",function(t){e(this).hide();var a=e(this).data("invokedOn"),s=e(t.target);n.menuSelected.call(this,a,s),i.event&&i.event.stop(t)}),!1}),e(document).click(function(){e(n.menuSelector).hide()})})},myams_menu:function(n){var i=e.extend({},{accordion:!0,speed:200,closedSign:'<em class="fa fa-angle-down"></em>',openedSign:'<em class="fa fa-angle-up"></em>'},n),t=e(this);t.find("LI").each(function(){var n=e(this);if(n.find("UL").size()>0){n.find("A:first").append("<b class='collapse-sign'>"+i.closedSign+"</b>");var t=n.find("A:first");"#"===t.attr("href")&&t.click(function(){return!1})}}),t.find("LI.active").each(function(){var n=e(this).parents("UL"),t=n.parent("LI");n.slideDown(i.speed),t.find("b:first").html(i.openedSign),t.addClass("open")}),t.find("LI A").on("click",function(){var n=e(this);if(!n.hasClass("active")){var a=n.attr("href").replace(/^#/,""),s=n.parent().find("UL");if(i.accordion){var c=n.parent().parents("UL"),o=t.find("UL:visible");o.each(function(n){var t=!0;if(c.each(function(e){if(c[e]===o[n])return t=!1,!1}),t&&s!==o[n]){var d=e(o[n]);!a&&d.hasClass("active")||d.slideUp(i.speed,function(){e(this).parent("LI").removeClass("open").find("B:first").delay(i.speed).html(i.closedSign)})}})}var d=n.parent().find("UL:first");a||!d.is(":visible")||d.hasClass("active")?d.slideDown(i.speed,function(){n.parent("LI").addClass("open").find("B:first").delay(i.speed).html(i.openedSign)}):d.slideUp(i.speed,function(){n.parent("LI").removeClass("open").find("B:first").delay(i.speed).html(i.closedSign)})}})}})}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-notify.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-notify.js Thu Dec 13 14:28:29 2018 +0100
@@ -41,7 +41,7 @@
var SmartMSG,
Content,
- isIE8 = ams.browser.isIE8orlower();
+ isIE8 = ams.browser && ams.browser.isIE8orlower();
var defaults = {
title: "",
content: "",
@@ -75,7 +75,7 @@
ExistMsg = 1;
SmartMSG = "<div class='MessageBox animated fadeIn fast' id='MsgBoxBack'></div>";
$("body").append(SmartMSG);
- if (ams.browser.isIE8orlower() === 1) {
+ if (isIE8) {
$("#MsgBoxBack").addClass("MessageIE");
}
}
@@ -219,7 +219,7 @@
colors: undefined
}, settings);
if (settings.sound === true) {
- if (ams.browser.isIE8orlower() === 0) {
+ if (ams.browser && (ams.browser.isIE8orlower() === 0)) {
var audioElement = document.createElement("audio");
if (navigator.userAgent.match("Firefox/")) {
audioElement.setAttribute("src", ams.baseURL + '../snd/bigbox.ogg');
@@ -348,7 +348,7 @@
colors: undefined
}, settings);
if (settings.sound === true) {
- if (ams.browser.isIE8orlower() === 0) {
+ if (ams.browser && (ams.browser.isIE8orlower() === 0)) {
var audioElement = document.createElement("audio");
if (navigator.userAgent.match("Firefox/")) {
audioElement.setAttribute("src", ams.baseURL + '../snd/smallbox.ogg');
--- a/src/pyams_skin/resources/js/myams-notify.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-notify.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(t,o){"use strict";t(document).ready(function(){t("body").append("<div id='divSmallBoxes'></div>").append("<div id='divMiniIcons'></div>").append("<div id='divBigBoxes'></div>")});var i,e=0,a=0,s=0,n=0,l=0,c=o.MyAMS;c.notify={messageBox:function(i,s){var n,l,d=c.browser.isIE8orlower(),r={title:"",content:"",status:"",NormalButton:void 0,ActiveButton:void 0,buttons:void 0,input:void 0,placeholder:"",options:void 0,sound:void 0},u=t.extend({},r,i);if(u.sound&&0===d){var v=document.createElement("audio");navigator.userAgent.match("Firefox/")?v.setAttribute("src",c.baseURL+"../sound/message.ogg"):v.setAttribute("src",c.baseURL+"../sound/message.mp3"),t.get(),v.addEventListener("load",function(){v.play()},!0),v.pause(),v.play()}a+=1,0===e&&(e=1,n="<div class='MessageBox animated fadeIn fast' id='MsgBoxBack'></div>",t("body").append(n),1===c.browser.isIE8orlower()&&t("#MsgBoxBack").addClass("MessageIE"));var m,h="",p=0,f="",b=0;if(void 0!==u.input)switch(p=1,u.input=u.input.toLowerCase(),u.input){case"text":case"password":h="<input class='form-control' type='"+u.input+"' id='txt"+a+"' placeholder='"+u.placeholder+"'/><br/><br/>";break;case"select":if(void 0===u.options)o.alert&&o.alert("For this type of input, the options parameter is required.");else{for(h="<select class='form-control' id='txt"+a+"'>",m=0;m<=u.options.length-1;m++)"["===u.options[m]?f="":"]"===u.options[m]?(b+=1,h+=f="<option>"+f+"</option>"):f+=u.options[m];h+="</select>"}break;default:o.alert&&o.alert("That type of input is not handled yet")}for(l="<div class='MessageBoxContainer "+u.status+" animated fadeIn fast' id='Msg"+a+"'>",l+="<div class='MessageBoxMiddle'>",l+="<span class='MsgTitle'>"+u.title+"</span class='MsgTitle'>",l+="<p class='pText'>"+u.content+"</p>",l+=h,l+="<div class='MessageBoxButtonSection'>",void 0===u.buttons&&(u.buttons="[Accept]"),u.buttons=t.trim(u.buttons),u.buttons=u.buttons.split(""),void 0===u.NormalButton&&(u.NormalButton="#232323"),void 0===u.ActiveButton&&(u.ActiveButton="#ed145b"),m=0;m<=u.buttons.length-1;m++)"["===u.buttons[m]?f="":"]"===u.buttons[m]?l+=f="<button id='bot"+(b+=1)+"-Msg"+a+"' class='btn "+(1===b?"btn-primary":"btn-default")+" btn-sm botTempo'> "+f+"</button>":f+=u.buttons[m];l+="</div>",l+="</div>",l+="</div>",a>1&&(t(".MessageBoxContainer").hide(),t(".MessageBoxContainer").css("z-index",99999)),t(".MessageBox").append(l),1===p&&t("#txt"+a).focus(),t(".botTempo").hover(function(){t(this).attr("id")},function(){t(this).attr("id")}),t(".botTempo").click(function(){var o=t(this).attr("id"),i=o.substr(o.indexOf("-")+1),n=t.trim(t(this).text());if(1===p){if("function"==typeof s){var l=i.replace("Msg",""),c=t("#txt"+l).val();s&&s(n,c)}}else"function"==typeof s&&s&&s(n);t("#"+i).addClass("animated fadeOut fast"),0===(a-=1)&&t("#MsgBoxBack").removeClass("fadeIn").addClass("fadeOut").delay(300).queue(function(){e=0,t(this).remove()})})},bigBox:function(o,i){var e;if(!0===(o=t.extend({title:"",content:"",icon:void 0,number:void 0,color:void 0,sound:!0,timeout:void 0,colortime:1500,colors:void 0},o)).sound&&0===c.browser.isIE8orlower()){var a=document.createElement("audio");navigator.userAgent.match("Firefox/")?a.setAttribute("src",c.baseURL+"../snd/bigbox.ogg"):a.setAttribute("src",c.baseURL+"../snd/bigbox.mp3"),t.get(),a.addEventListener("load",function(){a.play()},!0),a.pause(),a.play()}e="<div id='bigBox"+(s+=1)+"' class='BigBox animated fadeIn fast'><div id='bigBoxColor"+s+"'><i class='btnClose fa fa-times' id='btnClose"+s+"'></i>",void 0===o.icon&&(o.icon="fa fa-cloud"),e+="<span><i class='"+o.icon+"'></i> "+o.title+"</span>",e+="<p>"+o.content+"</p>",e+="<div class='bigboxnumber'>",void 0!==o.number&&(e+=o.number),e+="</div></div>",e+="</div>",t("#divBigBoxes").append(e),void 0===o.color&&(o.color="#004d60"),t("#bigBox"+s).css("background-color",o.color),t("#divMiniIcons").append("<div id='miniIcon"+s+"' class='cajita animated fadeIn' style='background-color: "+o.color+";'><i class='"+o.icon+"'/></i></div>"),t("#miniIcon"+s).bind("click",function(){var o=t(this).attr("id"),i=o.replace("miniIcon","bigBox"),e=o.replace("miniIcon","bigBoxColor");t(".cajita").each(function(o){var i=t(this).attr("id").replace("miniIcon","bigBox");t("#"+i).css("z-index",9998)}),t("#"+i).css("z-index",9999),t("#"+e).removeClass("animated fadeIn").delay(1).queue(function(){t(this).show(),t(this).addClass("animated fadeIn"),t(this).clearQueue()})});var n,l=t("#btnClose"+s),d=t("#bigBox"+s),r=t("#miniIcon"+s);if(void 0!==o.colors&&o.colors.length>0&&(l.attr("colorcount","0"),n=setInterval(function(){var t=l.attr("colorcount");l.animate({backgroundColor:o.colors[t].color}),d.animate({backgroundColor:o.colors[t].color}),r.animate({backgroundColor:o.colors[t].color}),t<o.colors.length-1?l.attr("colorcount",1*t+1):l.attr("colorcount",0)},o.colortime)),l.bind("click",function(){clearInterval(n),"function"==typeof i&&i&&i();var o=t(this).attr("id"),e=o.replace("btnClose","bigBox"),a=o.replace("btnClose","miniIcon");t("#"+e).removeClass("fadeIn fast"),t("#"+e).addClass("fadeOut fast").delay(300).queue(function(){t(this).clearQueue(),t(this).remove()}),t("#"+a).removeClass("fadeIn fast"),t("#"+a).addClass("fadeOut fast").delay(300).queue(function(){t(this).clearQueue(),t(this).remove()})}),void 0!==o.timeout){var u=s;setTimeout(function(){clearInterval(n);var o=t("#bigBox"+u);o.removeClass("fadeIn fast"),o.addClass("fadeOut fast").delay(300).queue(function(){t(this).clearQueue(),t(this).remove()});var i=t("#miniIcon"+u);i.removeClass("fadeIn fast"),i.addClass("fadeOut fast").delay(300).queue(function(){t(this).clearQueue(),t(this).remove()})},o.timeout)}},smallBox:function(o,e){var a;if(!0===(o=t.extend({title:"",content:"",icon:void 0,iconSmall:void 0,sound:!0,color:void 0,timeout:void 0,colortime:1500,colors:void 0},o)).sound&&0===c.browser.isIE8orlower()){var s=document.createElement("audio");navigator.userAgent.match("Firefox/")?s.setAttribute("src",c.baseURL+"../snd/smallbox.ogg"):s.setAttribute("src",c.baseURL+"../snd/smallbox.mp3"),t.get(),s.addEventListener("load",function(){s.play()},!0),s.pause(),s.play()}a="";var d="",r="smallbox"+(n+=1);d=void 0===o.iconSmall?"<div class='miniIcon'></div>":"<div class='miniIcon'><i class='miniPic "+o.iconSmall+"'></i></div>",a=void 0===o.icon?"<div id='smallbox"+n+"' class='SmallBox animated fadeInRight fast'><div class='textoFull'><span>"+o.title+"</span><p>"+o.content+"</p></div>"+d+"</div>":"<div id='smallbox"+n+"' class='SmallBox animated fadeInRight fast'><div class='foto'><i class='"+o.icon+"'></i></div><div class='textoFoto'><span>"+o.title+"</span><p>"+o.content+"</p></div>"+d+"</div>",1===n?(t("#divSmallBoxes").append(a),l=t("#smallbox"+n).height()+40):0===t(".SmallBox").size()?(t("#divSmallBoxes").append(a),l=t("#smallbox"+n).height()+40):(t("#divSmallBoxes").append(a),t("#smallbox"+n).css("top",l),l=l+t("#smallbox"+n).height()+20,t(".SmallBox").each(function(o){0===o?(t(this).css("top",20),i=t(this).height()+40,l=t(this).height()+40):(t(this).css("top",i),i=i+t(this).height()+20,l=l+t(this).height()+20)}));var u=t("#smallbox"+n);void 0===o.color?u.css("background-color","#004d60"):u.css("background-color",o.color);var v;void 0!==o.colors&&o.colors.length>0&&(u.attr("colorcount","0"),v=setInterval(function(){var t=u.attr("colorcount");u.animate({backgroundColor:o.colors[t].color}),t<o.colors.length-1?u.attr("colorcount",1*t+1):u.attr("colorcount",0)},o.colortime)),void 0!==o.timeout&&setTimeout(function(){clearInterval(v);var o=t(this).height()+20;t("#"+r).css("top");0!==t("#"+r+":hover").length?t("#"+r).on("mouseleave",function(){l-=o,t("#"+r).remove(),"function"==typeof e&&e&&e();var i=0;t(".SmallBox").each(function(o){0===o?(t(this).animate({top:20},300),i=t(this).height()+40,l=t(this).height()+40):(t(this).animate({top:i},350),i=i+t(this).height()+20,l=l+t(this).height()+20)})}):(clearInterval(v),l-=o,"function"==typeof e&&e&&e(),t("#"+r).removeClass().addClass("SmallBox").animate({opacity:0},300,function(){t(this).remove();var o=0;t(".SmallBox").each(function(i){0===i?(t(this).animate({top:20},300),o=t(this).height()+40,l=t(this).height()+40):(t(this).animate({top:o}),o=o+t(this).height()+20,l=l+t(this).height()+20)})}))},o.timeout),t("#smallbox"+n).bind("click",function(){clearInterval(v),"function"==typeof e&&e&&e();var o=t(this).height()+20;t(this).attr("id"),t(this).css("top");l-=o,t(this).removeClass().addClass("SmallBox").animate({opacity:0},300,function(){t(this).remove();var o=0;t(".SmallBox").each(function(i){0===i?(t(this).animate({top:20},300),o=t(this).height()+40,l=t(this).height()+40):(t(this).animate({top:o},350),o=o+t(this).height()+20,l=l+t(this).height()+20)})})})}}}(jQuery,this);
+!function(t,o){"use strict";t(document).ready(function(){t("body").append("<div id='divSmallBoxes'></div>").append("<div id='divMiniIcons'></div>").append("<div id='divBigBoxes'></div>")});var i,e=0,a=0,s=0,n=0,l=0,c=o.MyAMS;c.notify={messageBox:function(i,s){var n,l,d=c.browser&&c.browser.isIE8orlower(),r={title:"",content:"",status:"",NormalButton:void 0,ActiveButton:void 0,buttons:void 0,input:void 0,placeholder:"",options:void 0,sound:void 0},u=t.extend({},r,i);if(u.sound&&0===d){var v=document.createElement("audio");navigator.userAgent.match("Firefox/")?v.setAttribute("src",c.baseURL+"../sound/message.ogg"):v.setAttribute("src",c.baseURL+"../sound/message.mp3"),t.get(),v.addEventListener("load",function(){v.play()},!0),v.pause(),v.play()}a+=1,0===e&&(e=1,n="<div class='MessageBox animated fadeIn fast' id='MsgBoxBack'></div>",t("body").append(n),d&&t("#MsgBoxBack").addClass("MessageIE"));var m,h="",p=0,f="",b=0;if(void 0!==u.input)switch(p=1,u.input=u.input.toLowerCase(),u.input){case"text":case"password":h="<input class='form-control' type='"+u.input+"' id='txt"+a+"' placeholder='"+u.placeholder+"'/><br/><br/>";break;case"select":if(void 0===u.options)o.alert&&o.alert("For this type of input, the options parameter is required.");else{for(h="<select class='form-control' id='txt"+a+"'>",m=0;m<=u.options.length-1;m++)"["===u.options[m]?f="":"]"===u.options[m]?(b+=1,h+=f="<option>"+f+"</option>"):f+=u.options[m];h+="</select>"}break;default:o.alert&&o.alert("That type of input is not handled yet")}for(l="<div class='MessageBoxContainer "+u.status+" animated fadeIn fast' id='Msg"+a+"'>",l+="<div class='MessageBoxMiddle'>",l+="<span class='MsgTitle'>"+u.title+"</span class='MsgTitle'>",l+="<p class='pText'>"+u.content+"</p>",l+=h,l+="<div class='MessageBoxButtonSection'>",void 0===u.buttons&&(u.buttons="[Accept]"),u.buttons=t.trim(u.buttons),u.buttons=u.buttons.split(""),void 0===u.NormalButton&&(u.NormalButton="#232323"),void 0===u.ActiveButton&&(u.ActiveButton="#ed145b"),m=0;m<=u.buttons.length-1;m++)"["===u.buttons[m]?f="":"]"===u.buttons[m]?l+=f="<button id='bot"+(b+=1)+"-Msg"+a+"' class='btn "+(1===b?"btn-primary":"btn-default")+" btn-sm botTempo'> "+f+"</button>":f+=u.buttons[m];l+="</div>",l+="</div>",l+="</div>",a>1&&(t(".MessageBoxContainer").hide(),t(".MessageBoxContainer").css("z-index",99999)),t(".MessageBox").append(l),1===p&&t("#txt"+a).focus(),t(".botTempo").hover(function(){t(this).attr("id")},function(){t(this).attr("id")}),t(".botTempo").click(function(){var o=t(this).attr("id"),i=o.substr(o.indexOf("-")+1),n=t.trim(t(this).text());if(1===p){if("function"==typeof s){var l=i.replace("Msg",""),c=t("#txt"+l).val();s&&s(n,c)}}else"function"==typeof s&&s&&s(n);t("#"+i).addClass("animated fadeOut fast"),0===(a-=1)&&t("#MsgBoxBack").removeClass("fadeIn").addClass("fadeOut").delay(300).queue(function(){e=0,t(this).remove()})})},bigBox:function(o,i){var e;if(!0===(o=t.extend({title:"",content:"",icon:void 0,number:void 0,color:void 0,sound:!0,timeout:void 0,colortime:1500,colors:void 0},o)).sound&&c.browser&&0===c.browser.isIE8orlower()){var a=document.createElement("audio");navigator.userAgent.match("Firefox/")?a.setAttribute("src",c.baseURL+"../snd/bigbox.ogg"):a.setAttribute("src",c.baseURL+"../snd/bigbox.mp3"),t.get(),a.addEventListener("load",function(){a.play()},!0),a.pause(),a.play()}e="<div id='bigBox"+(s+=1)+"' class='BigBox animated fadeIn fast'><div id='bigBoxColor"+s+"'><i class='btnClose fa fa-times' id='btnClose"+s+"'></i>",void 0===o.icon&&(o.icon="fa fa-cloud"),e+="<span><i class='"+o.icon+"'></i> "+o.title+"</span>",e+="<p>"+o.content+"</p>",e+="<div class='bigboxnumber'>",void 0!==o.number&&(e+=o.number),e+="</div></div>",e+="</div>",t("#divBigBoxes").append(e),void 0===o.color&&(o.color="#004d60"),t("#bigBox"+s).css("background-color",o.color),t("#divMiniIcons").append("<div id='miniIcon"+s+"' class='cajita animated fadeIn' style='background-color: "+o.color+";'><i class='"+o.icon+"'/></i></div>"),t("#miniIcon"+s).bind("click",function(){var o=t(this).attr("id"),i=o.replace("miniIcon","bigBox"),e=o.replace("miniIcon","bigBoxColor");t(".cajita").each(function(o){var i=t(this).attr("id").replace("miniIcon","bigBox");t("#"+i).css("z-index",9998)}),t("#"+i).css("z-index",9999),t("#"+e).removeClass("animated fadeIn").delay(1).queue(function(){t(this).show(),t(this).addClass("animated fadeIn"),t(this).clearQueue()})});var n,l=t("#btnClose"+s),d=t("#bigBox"+s),r=t("#miniIcon"+s);if(void 0!==o.colors&&o.colors.length>0&&(l.attr("colorcount","0"),n=setInterval(function(){var t=l.attr("colorcount");l.animate({backgroundColor:o.colors[t].color}),d.animate({backgroundColor:o.colors[t].color}),r.animate({backgroundColor:o.colors[t].color}),t<o.colors.length-1?l.attr("colorcount",1*t+1):l.attr("colorcount",0)},o.colortime)),l.bind("click",function(){clearInterval(n),"function"==typeof i&&i&&i();var o=t(this).attr("id"),e=o.replace("btnClose","bigBox"),a=o.replace("btnClose","miniIcon");t("#"+e).removeClass("fadeIn fast"),t("#"+e).addClass("fadeOut fast").delay(300).queue(function(){t(this).clearQueue(),t(this).remove()}),t("#"+a).removeClass("fadeIn fast"),t("#"+a).addClass("fadeOut fast").delay(300).queue(function(){t(this).clearQueue(),t(this).remove()})}),void 0!==o.timeout){var u=s;setTimeout(function(){clearInterval(n);var o=t("#bigBox"+u);o.removeClass("fadeIn fast"),o.addClass("fadeOut fast").delay(300).queue(function(){t(this).clearQueue(),t(this).remove()});var i=t("#miniIcon"+u);i.removeClass("fadeIn fast"),i.addClass("fadeOut fast").delay(300).queue(function(){t(this).clearQueue(),t(this).remove()})},o.timeout)}},smallBox:function(o,e){var a;if(!0===(o=t.extend({title:"",content:"",icon:void 0,iconSmall:void 0,sound:!0,color:void 0,timeout:void 0,colortime:1500,colors:void 0},o)).sound&&c.browser&&0===c.browser.isIE8orlower()){var s=document.createElement("audio");navigator.userAgent.match("Firefox/")?s.setAttribute("src",c.baseURL+"../snd/smallbox.ogg"):s.setAttribute("src",c.baseURL+"../snd/smallbox.mp3"),t.get(),s.addEventListener("load",function(){s.play()},!0),s.pause(),s.play()}a="";var d="",r="smallbox"+(n+=1);d=void 0===o.iconSmall?"<div class='miniIcon'></div>":"<div class='miniIcon'><i class='miniPic "+o.iconSmall+"'></i></div>",a=void 0===o.icon?"<div id='smallbox"+n+"' class='SmallBox animated fadeInRight fast'><div class='textoFull'><span>"+o.title+"</span><p>"+o.content+"</p></div>"+d+"</div>":"<div id='smallbox"+n+"' class='SmallBox animated fadeInRight fast'><div class='foto'><i class='"+o.icon+"'></i></div><div class='textoFoto'><span>"+o.title+"</span><p>"+o.content+"</p></div>"+d+"</div>",1===n?(t("#divSmallBoxes").append(a),l=t("#smallbox"+n).height()+40):0===t(".SmallBox").size()?(t("#divSmallBoxes").append(a),l=t("#smallbox"+n).height()+40):(t("#divSmallBoxes").append(a),t("#smallbox"+n).css("top",l),l=l+t("#smallbox"+n).height()+20,t(".SmallBox").each(function(o){0===o?(t(this).css("top",20),i=t(this).height()+40,l=t(this).height()+40):(t(this).css("top",i),i=i+t(this).height()+20,l=l+t(this).height()+20)}));var u=t("#smallbox"+n);void 0===o.color?u.css("background-color","#004d60"):u.css("background-color",o.color);var v;void 0!==o.colors&&o.colors.length>0&&(u.attr("colorcount","0"),v=setInterval(function(){var t=u.attr("colorcount");u.animate({backgroundColor:o.colors[t].color}),t<o.colors.length-1?u.attr("colorcount",1*t+1):u.attr("colorcount",0)},o.colortime)),void 0!==o.timeout&&setTimeout(function(){clearInterval(v);var o=t(this).height()+20;t("#"+r).css("top");0!==t("#"+r+":hover").length?t("#"+r).on("mouseleave",function(){l-=o,t("#"+r).remove(),"function"==typeof e&&e&&e();var i=0;t(".SmallBox").each(function(o){0===o?(t(this).animate({top:20},300),i=t(this).height()+40,l=t(this).height()+40):(t(this).animate({top:i},350),i=i+t(this).height()+20,l=l+t(this).height()+20)})}):(clearInterval(v),l-=o,"function"==typeof e&&e&&e(),t("#"+r).removeClass().addClass("SmallBox").animate({opacity:0},300,function(){t(this).remove();var o=0;t(".SmallBox").each(function(i){0===i?(t(this).animate({top:20},300),o=t(this).height()+40,l=t(this).height()+40):(t(this).animate({top:o}),o=o+t(this).height()+20,l=l+t(this).height()+20)})}))},o.timeout),t("#smallbox"+n).bind("click",function(){clearInterval(v),"function"==typeof e&&e&&e();var o=t(this).height()+20;t(this).attr("id"),t(this).css("top");l-=o,t(this).removeClass().addClass("SmallBox").animate({opacity:0},300,function(){t(this).remove();var o=0;t(".SmallBox").each(function(i){0===i?(t(this).animate({top:20},300),o=t(this).height()+40,l=t(this).height()+40):(t(this).animate({top:o},350),o=o+t(this).height()+20,l=l+t(this).height()+20)})})})}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-plugins-loader.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-plugins-loader.js Thu Dec 13 14:28:29 2018 +0100
@@ -13,6 +13,8 @@
*/
(function($, globals) {
+ "use strict";
+
var ams = globals.MyAMS;
ams.plugins = {
@@ -34,7 +36,7 @@
var disabled = [];
$('[data-ams-plugins-disabled]', element).each(function() {
var plugins = $(this).data('ams-plugins-disabled').split(/\s+/);
- for (var index=0; index < plugins.length; index++) {
+ for (var index = 0; index < plugins.length; index++) {
disabled.push(plugins[index]);
}
});
@@ -49,9 +51,9 @@
var plugin = plugins[name];
plugin.css = plugin.css || new_plugin.css;
plugin.callbacks.push({
- callback: new_plugin.callback,
- context: new_plugin.context
- });
+ callback: new_plugin.callback,
+ context: new_plugin.context
+ });
if (new_plugin.register) {
plugin.register = true;
}
@@ -79,7 +81,7 @@
var source = $(this);
var amsPlugins = source.data('ams-plugins');
- if (typeof(amsPlugins) === 'string') {
+ if (typeof (amsPlugins) === 'string') {
var names = source.data('ams-plugins').split(/\s+/);
for (var index = 0; index < names.length; index++) {
name = names[index];
@@ -111,7 +113,7 @@
var callbacks = plugin.callbacks,
callback;
if (callbacks && callbacks.length) {
- for (index=0; index < callbacks.length; index++) {
+ for (index = 0; index < callbacks.length; index++) {
callback = callbacks[index];
callback.callback = ams.getFunctionByName(callback.callback);
if (plugin.register !== false) {
@@ -131,7 +133,7 @@
// If running in async mode, newly registered plug-ins are run
// before callback is called so we call plug-in manually
if ((reload !== true) && callbacks && callbacks.length && (plugin.async !== false)) {
- for (index=0; index < callbacks.length; index++) {
+ for (index = 0; index < callbacks.length; index++) {
callback = callbacks[index];
ams.executeFunctionByName(callback.callback, element, callback.context);
}
@@ -142,7 +144,7 @@
// 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++) {
+ for (index = 0; index < enabled.length; index++) {
var callback = enabled[index];
if (callback && callback.context && !ams.isInDOM(callback.context)) {
enabled[index] = null;
@@ -175,14 +177,14 @@
}
var callbacks = ams.plugins.enabled[index];
if (callbacks) {
- switch (typeof(callbacks)) {
+ switch (typeof (callbacks)) {
case 'function':
callbacks(element);
break;
default:
for (var cbIndex = 0; cbIndex < callbacks.length; cbIndex++) {
var callback = callbacks[cbIndex];
- switch (typeof(callback)) {
+ switch (typeof (callback)) {
case 'function':
callback(element);
break;
@@ -211,7 +213,7 @@
for (var name in data) {
if (data.hasOwnProperty(name)) {
var elementData = data[name];
- if (typeof(elementData) !== 'string') {
+ if (typeof (elementData) !== 'string') {
elementData = JSON.stringify(elementData);
}
dataElement.attr('data-' + name, elementData);
@@ -229,7 +231,7 @@
* @callback: a callback function which can be called after plug-in registry
*/
register: function(plugin, name, callback) {
- if (typeof(name) === 'function') {
+ if (typeof (name) === 'function') {
callback = name;
name = null;
}
@@ -240,10 +242,10 @@
}
return;
}
- if (typeof(plugin) === 'object') {
+ if (typeof (plugin) === 'object') {
var src = plugin.src;
if (src) {
- ams.ajax.check(plugin.callback, src, function(first_load) {
+ ams.ajax && ams.ajax.check(plugin.callback, src, function(first_load) {
if (first_load) {
ams.plugins.enabled[name] = ams.getFunctionByName(plugin.callback);
if (plugin.css) {
@@ -263,7 +265,7 @@
ams.executeFunctionByName(callback);
}
}
- } else if (typeof(plugin) === 'function') {
+ } else if (typeof (plugin) === 'function') {
ams.plugins.enabled[name] = plugin;
if (callback) {
ams.executeFunctionByName(callback);
@@ -272,4 +274,29 @@
}
};
+ ams.plugins.i18n = {
+ widgets: {},
+ validate: {},
+ datatables: {},
+ fancybox: {
+ ERROR: "Can't load requested content.",
+ RETRY: "Please check URL or try again later.",
+ CLOSE: "Close",
+ NEXT: "Next",
+ PREVIOUS: "Previous"
+ },
+ dndupload: {
+ FILES_SELECTED: '{count} files selected',
+ CHOOSE_FILE: 'Select file(s)',
+ ADD_INFO: 'to add them to current folder,',
+ DRAG_FILE: 'or drag and drop them here!',
+ UPLOAD: 'Upload',
+ UPLOADING: 'Uploading…',
+ DONE: 'Done!',
+ UPLOAD_MORE: 'Upload more?',
+ ERROR: 'Error!',
+ TRY_AGAIN: 'Try again?'
+ }
+ };
+
})(jQuery, this);
--- a/src/pyams_skin/resources/js/myams-plugins-loader.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-plugins-loader.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(a,n){var e=n.MyAMS;e.plugins={enabled:{},init:function(n){function s(a,n){if(i.hasOwnProperty(a)){var s=i[a];s.css=s.css||n.css,s.callbacks.push({callback:n.callback,context:n.context}),n.register&&(s.register=!0),!1===n.async&&(s.async=!1)}else i[a]={src:n.src,css:n.css,callbacks:[{callback:n.callback,context:n.context}],register:n.register,async:n.async};n.css&&e.getCSS(n.css,a+"_css")}function t(a){var s,t,c=r.callbacks;if(c&&c.length){for(s=0;s<c.length;s++)if(t=c[s],t.callback=e.getFunctionByName(t.callback),!1!==r.register){var i=e.plugins.enabled;i.hasOwnProperty(l)?i[l].push(t):i[l]=[t]}}else!1!==r.register&&(e.plugins.enabled[l]=null);if(!0!==a&&c&&c.length&&!1!==r.async)for(s=0;s<c.length;s++)t=c[s],e.executeFunctionByName(t.callback,n,t.context)}e.plugins.initData(n);var c=[];a("[data-ams-plugins-disabled]",n).each(function(){for(var n=a(this).data("ams-plugins-disabled").split(/\s+/),e=0;e<n.length;e++)c.push(n[e])});var l,i={};a("[data-ams-plugins]",n).each(function(){var n=a(this),e=n.data("ams-plugins");if("string"==typeof e)for(var t=n.data("ams-plugins").split(/\s+/),c=0;c<t.length;c++){l=t[c];var i={src:n.data("ams-plugin-"+l+"-src"),css:n.data("ams-plugin-"+l+"-css"),callback:n.data("ams-plugin-"+l+"-callback"),context:n,register:n.data("ams-plugin-"+l+"-register"),async:n.data("ams-plugin-"+l+"-async")};s(l,i)}else for(l in e)e.hasOwnProperty(l)&&s(l,e[l])});var r;for(l in i)i.hasOwnProperty(l)&&(r=i[l],void 0===e.plugins.enabled[l]?e.getScript(r.src,t,{async:void 0===r.async||r.async}):(!function(){var a=e.plugins.enabled[l];for(o=0;o<a.length;o++){var n=a[o];n&&n.context&&!e.isInDOM(n.context)&&(a[o]=null)}}(),t(!0)));for(var o in e.plugins.enabled)if(e.plugins.enabled.hasOwnProperty(o)&&!(c.indexOf(o)>=0)){var u=e.plugins.enabled[o];if(u)switch(typeof u){case"function":u(n);break;default:for(var g=0;g<u.length;g++){var f=u[g];switch(typeof f){case"function":f(n);break;default:f&&f.callback&&f.callback(f.context)}}}}},initData:function(n){a("[data-ams-data]",n).each(function(){var n=a(this),e=n.data("ams-data");if(e)for(var s in e)if(e.hasOwnProperty(s)){var t=e[s];"string"!=typeof t&&(t=JSON.stringify(t)),n.attr("data-"+s,t)}})},register:function(a,n,s){if("function"==typeof n&&(s=n,n=null),n=n||a.name,e.plugins.enabled.indexOf(n)>=0)console&&console.warn&&console.warn("Plugin "+n+" is already registered!");else if("object"==typeof a){var t=a.src;t?e.ajax.check(a.callback,t,function(t){t&&(e.plugins.enabled[n]=e.getFunctionByName(a.callback),a.css&&e.getCSS(a.css,n+"_css"),s&&e.executeFunctionByName(s))}):(e.plugins.enabled[n]=e.getFunctionByName(a.callback),a.css&&e.getCSS(a.css,n+"_css"),s&&e.executeFunctionByName(s))}else"function"==typeof a&&(e.plugins.enabled[n]=a,s&&e.executeFunctionByName(s))}}}(jQuery,this);
+!function(a,e){"use strict";var n=e.MyAMS;n.plugins={enabled:{},init:function(e){function t(a,e){if(i.hasOwnProperty(a)){var t=i[a];t.css=t.css||e.css,t.callbacks.push({callback:e.callback,context:e.context}),e.register&&(t.register=!0),!1===e.async&&(t.async=!1)}else i[a]={src:e.src,css:e.css,callbacks:[{callback:e.callback,context:e.context}],register:e.register,async:e.async};e.css&&n.getCSS(e.css,a+"_css")}function s(a){var t,s,c=r.callbacks;if(c&&c.length){for(t=0;t<c.length;t++)if(s=c[t],s.callback=n.getFunctionByName(s.callback),!1!==r.register){var i=n.plugins.enabled;i.hasOwnProperty(l)?i[l].push(s):i[l]=[s]}}else!1!==r.register&&(n.plugins.enabled[l]=null);if(!0!==a&&c&&c.length&&!1!==r.async)for(t=0;t<c.length;t++)s=c[t],n.executeFunctionByName(s.callback,e,s.context)}n.plugins.initData(e);var c=[];a("[data-ams-plugins-disabled]",e).each(function(){for(var e=a(this).data("ams-plugins-disabled").split(/\s+/),n=0;n<e.length;n++)c.push(e[n])});var l,i={};a("[data-ams-plugins]",e).each(function(){var e=a(this),n=e.data("ams-plugins");if("string"==typeof n)for(var s=e.data("ams-plugins").split(/\s+/),c=0;c<s.length;c++){l=s[c];var i={src:e.data("ams-plugin-"+l+"-src"),css:e.data("ams-plugin-"+l+"-css"),callback:e.data("ams-plugin-"+l+"-callback"),context:e,register:e.data("ams-plugin-"+l+"-register"),async:e.data("ams-plugin-"+l+"-async")};t(l,i)}else for(l in n)n.hasOwnProperty(l)&&t(l,n[l])});var r;for(l in i)i.hasOwnProperty(l)&&(r=i[l],void 0===n.plugins.enabled[l]?n.getScript(r.src,s,{async:void 0===r.async||r.async}):(!function(){var a=n.plugins.enabled[l];for(o=0;o<a.length;o++){var e=a[o];e&&e.context&&!n.isInDOM(e.context)&&(a[o]=null)}}(),s(!0)));for(var o in n.plugins.enabled)if(n.plugins.enabled.hasOwnProperty(o)&&!(c.indexOf(o)>=0)){var u=n.plugins.enabled[o];if(u)switch(typeof u){case"function":u(e);break;default:for(var g=0;g<u.length;g++){var d=u[g];switch(typeof d){case"function":d(e);break;default:d&&d.callback&&d.callback(d.context)}}}}},initData:function(e){a("[data-ams-data]",e).each(function(){var e=a(this),n=e.data("ams-data");if(n)for(var t in n)if(n.hasOwnProperty(t)){var s=n[t];"string"!=typeof s&&(s=JSON.stringify(s)),e.attr("data-"+t,s)}})},register:function(a,e,t){if("function"==typeof e&&(t=e,e=null),e=e||a.name,n.plugins.enabled.indexOf(e)>=0)console&&console.warn&&console.warn("Plugin "+e+" is already registered!");else if("object"==typeof a){var s=a.src;s?n.ajax&&n.ajax.check(a.callback,s,function(s){s&&(n.plugins.enabled[e]=n.getFunctionByName(a.callback),a.css&&n.getCSS(a.css,e+"_css"),t&&n.executeFunctionByName(t))}):(n.plugins.enabled[e]=n.getFunctionByName(a.callback),a.css&&n.getCSS(a.css,e+"_css"),t&&n.executeFunctionByName(t))}else"function"==typeof a&&(n.plugins.enabled[e]=a,t&&n.executeFunctionByName(t))}},n.plugins.i18n={widgets:{},validate:{},datatables:{},fancybox:{ERROR:"Can't load requested content.",RETRY:"Please check URL or try again later.",CLOSE:"Close",NEXT:"Next",PREVIOUS:"Previous"},dndupload:{FILES_SELECTED:"{count} files selected",CHOOSE_FILE:"Select file(s)",ADD_INFO:"to add them to current folder,",DRAG_FILE:"or drag and drop them here!",UPLOAD:"Upload",UPLOADING:"Uploading…",DONE:"Done!",UPLOAD_MORE:"Upload more?",ERROR:"Error!",TRY_AGAIN:"Try again?"}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-plugins.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-plugins.js Thu Dec 13 14:28:29 2018 +0100
@@ -44,10 +44,10 @@
if (width && height) {
svg.get(0).setAttribute('viewBox',
'0 0 ' + Math.round(parseFloat(width)) + ' ' +
- Math.round(parseFloat(height)));
+ Math.round(parseFloat(height)));
}
svg.attr('width', '100%')
- .attr('height', 'auto');
+ .attr('height', 'auto');
})
}
},
@@ -58,35 +58,35 @@
hint: function(element) {
var hints = $('.hint:not(:parents(.nohints))', element);
if (hints.length > 0) {
- ams.ajax.check($.fn.tipsy,
- ams.baseURL + 'ext/jquery-tipsy' + ams.devext + '.js',
- function() {
- ams.getCSS(ams.baseURL + '../css/ext/jquery-tipsy' + ams.devext + '.css',
- 'jquery-tipsy', function() {
- hints.each(function () {
- var hint = $(this);
- var data = hint.data();
- var dataOptions = {
- html: data.amsHintHtml === undefined ? (hint.attr('title') || '').startsWith('<') : data.amsHintHtml,
- title: ams.getFunctionByName(data.amsHintTitleGetter) || function () {
- var hint = $(this);
- var result = hint.attr('original-title') ||
- hint.attr(data.amsHintTitleAttr || 'title') ||
- (data.amsHintHtml ? hint.html() : hint.text());
- result = result.replace(/\?_="/, '?_=' + new Date().getTime() + '"');
- return result;
- },
- opacity: data.amsHintOpacity || 0.95,
- gravity: data.amsHintGravity || 'sw',
- offset: data.amsHintOffset || 0
- };
- var settings = $.extend({}, dataOptions, data.amsHintOptions);
- settings = ams.executeFunctionByName(data.amsHintInitCallback, hint, settings) || settings;
- var plugin = hint.tipsy(settings);
- ams.executeFunctionByName(data.amsHintAfterInitCallback, hint, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.tipsy,
+ ams.baseURL + 'ext/jquery-tipsy' + ams.devext + '.js',
+ function() {
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-tipsy' + ams.devext + '.css',
+ 'jquery-tipsy', function() {
+ hints.each(function() {
+ var hint = $(this);
+ var data = hint.data();
+ var dataOptions = {
+ html: data.amsHintHtml === undefined ? (hint.attr('title') || '').startsWith('<') : data.amsHintHtml,
+ title: ams.getFunctionByName(data.amsHintTitleGetter) || function() {
+ var hint = $(this);
+ var result = hint.attr('original-title') ||
+ hint.attr(data.amsHintTitleAttr || 'title') ||
+ (data.amsHintHtml ? hint.html() : hint.text());
+ result = result.replace(/\?_="/, '?_=' + new Date().getTime() + '"');
+ return result;
+ },
+ opacity: data.amsHintOpacity || 0.95,
+ gravity: data.amsHintGravity || 'sw',
+ offset: data.amsHintOffset || 0
+ };
+ var settings = $.extend({}, dataOptions, data.amsHintOptions);
+ settings = ams.executeFunctionByName(data.amsHintInitCallback, hint, settings) || settings;
+ var plugin = hint.tipsy(settings);
+ ams.executeFunctionByName(data.amsHintAfterInitCallback, hint, plugin, settings);
+ });
+ });
+ });
}
},
@@ -101,7 +101,7 @@
var data = menu.data();
var dataOptions = {
menuSelector: data.amsContextmenuSelector,
- menuSelected: ams.helpers.contextMenuHandler
+ menuSelected: ams.helpers && ams.helpers.contextMenuHandler
};
var settings = $.extend({}, dataOptions, data.amsContextmenuOptions);
settings = ams.executeFunctionByName(data.amsContextmenuInitCallback, menu, settings) || settings;
@@ -123,8 +123,8 @@
$('<i class="fa fa-fw"></i>')
.prependTo($(this))
.addClass(data.amsSwitcherState === 'open' ?
- (data.amsSwitcherMinusClass || 'fa-minus') :
- (data.amsSwitcherPlusClass || 'fa-plus'));
+ (data.amsSwitcherMinusClass || 'fa-minus') :
+ (data.amsSwitcherPlusClass || 'fa-plus'));
legend.on('click', function(e) {
e.preventDefault();
var veto = {};
@@ -135,11 +135,11 @@
if (fieldset.hasClass('switched')) {
fieldset.removeClass('switched');
$('.fa', legend).removeClass(data.amsSwitcherPlusClass || 'fa-plus')
- .addClass(data.amsSwitcherMinusClass || 'fa-minus');
+ .addClass(data.amsSwitcherMinusClass || 'fa-minus');
legend.trigger('ams.switcher.opened', [legend]);
var id = legend.attr('id');
if (id) {
- $('legend.switcher[data-ams-switcher-sync="'+id+'"]', fieldset).each(function() {
+ $('legend.switcher[data-ams-switcher-sync="' + id + '"]', fieldset).each(function() {
var switcher = $(this);
if (switcher.parents('fieldset').hasClass('switched')) {
switcher.click();
@@ -149,7 +149,7 @@
} else {
fieldset.addClass('switched');
$('.fa', legend).removeClass(data.amsSwitcherMinusClass || 'fa-minus')
- .addClass(data.amsSwitcherPlusClass || 'fa-plus');
+ .addClass(data.amsSwitcherPlusClass || 'fa-plus');
legend.trigger('ams.switcher.closed', [legend]);
}
});
@@ -171,7 +171,7 @@
var data = legend.data();
if (!data.amsChecker) {
var checker = $('<label class="checkbox"></label>');
- var fieldname = data.amsCheckerFieldname || ('checker_'+ams.generateId());
+ var fieldname = data.amsCheckerFieldname || ('checker_' + ams.generateId());
var checkboxId = fieldname.replace(/\./, '_');
var prefix = data.amsCheckerHiddenPrefix;
var hidden = null;
@@ -180,19 +180,19 @@
var marker = data.amsCheckerMarker || false;
if (prefix) {
hidden = $('<input type="hidden">').attr('name', prefix + fieldname)
- .val(data.amsCheckerState === 'on' ? checkedValue : uncheckedValue)
- .prependTo(legend);
+ .val(data.amsCheckerState === 'on' ? checkedValue : uncheckedValue)
+ .prependTo(legend);
} else if (marker) {
$('<input type="hidden">').attr('name', marker)
- .attr('value', 1)
- .prependTo(legend);
+ .attr('value', 1)
+ .prependTo(legend);
}
var input = $('<input type="checkbox">').attr('name', fieldname)
- .attr('id', checkboxId)
- .data('ams-checker-hidden-input', hidden)
- .data('ams-checker-init', true)
- .val(data.amsCheckerValue || true)
- .attr('checked', data.amsCheckerState === 'on' ? 'checked' : null);
+ .attr('id', checkboxId)
+ .data('ams-checker-hidden-input', hidden)
+ .data('ams-checker-init', true)
+ .val(data.amsCheckerValue || true)
+ .attr('checked', data.amsCheckerState === 'on' ? 'checked' : null);
if (data.amsCheckerReadonly) {
input.attr('disabled', 'disabled');
} else {
@@ -240,7 +240,7 @@
input.appendTo(checker);
$('>label', legend).attr('for', input.attr('id'));
checker.append('<i></i>')
- .prependTo(legend);
+ .prependTo(legend);
var required = $('[required]', fieldset);
required.attr('data-required', true);
if (data.amsCheckerState === 'on') {
@@ -265,19 +265,19 @@
slider: function(element) {
var sliders = $('.slider', element);
if (sliders.length > 0) {
- ams.ajax.check($.fn.slider,
- ams.baseURL + 'ext/bootstrap-slider-2.0.0' + ams.devext + '.js',
- function() {
- sliders.each(function() {
- var slider = $(this);
- var data = slider.data();
- var dataOptions = {};
- var settings = $.extend({}, dataOptions, slider.data.amsSliderOptions);
- settings = ams.executeFunctionByName(data.amsSliderInitCallback, slider, settings) || settings;
- var plugin = slider.slider(settings);
- ams.executeFunctionByName(data.amsSliderAfterInitCallback, slider, plugin, settings);
- });
- });
+ ams.ajax && ams.ajax.check($.fn.slider,
+ ams.baseURL + 'ext/bootstrap-slider-2.0.0' + ams.devext + '.js',
+ function() {
+ sliders.each(function() {
+ var slider = $(this);
+ var data = slider.data();
+ var dataOptions = {};
+ var settings = $.extend({}, dataOptions, slider.data.amsSliderOptions);
+ settings = ams.executeFunctionByName(data.amsSliderInitCallback, slider, settings) || settings;
+ var plugin = slider.slider(settings);
+ ams.executeFunctionByName(data.amsSliderAfterInitCallback, slider, plugin, settings);
+ });
+ });
}
},
@@ -390,19 +390,19 @@
typeahead: function(element) {
var typeaheads = $('.typeahead', element);
if (typeaheads.length > 0) {
- ams.ajax.check($.fn.typeahead,
- ams.baseURL + 'ext/jquery-typeahead' + ams.devext + '.js',
- function() {
- typeaheads.each(function() {
- var input = $(this);
- var data = input.data();
- var dataOptions = {};
- var settings = $.extend({}, dataOptions, data.amsTypeaheadOptions);
- settings = ams.executeFunctionByName(data.amsTypeaheadInitCallback, input, settings) || settings;
- var plugin = input.typeahead(settings);
- ams.executeFunctionByName(data.amsTypeaheadAfterInitCallback, input, plugin, settings);
- });
- });
+ ams.ajax && ams.ajax.check($.fn.typeahead,
+ ams.baseURL + 'ext/jquery-typeahead' + ams.devext + '.js',
+ function() {
+ typeaheads.each(function() {
+ var input = $(this);
+ var data = input.data();
+ var dataOptions = {};
+ var settings = $.extend({}, dataOptions, data.amsTypeaheadOptions);
+ settings = ams.executeFunctionByName(data.amsTypeaheadInitCallback, input, settings) || settings;
+ var plugin = input.typeahead(settings);
+ ams.executeFunctionByName(data.amsTypeaheadAfterInitCallback, input, plugin, settings);
+ });
+ });
}
},
@@ -412,61 +412,61 @@
treeview: function(element) {
var treeviews = $('.treeview', element);
if (treeviews.length > 0) {
- ams.ajax.check($.fn.treview,
- ams.baseURL + 'ext/bootstrap-treeview' + ams.devext + '.js',
- function() {
- ams.getCSS(ams.baseURL + '../css/ext/bootstrap-treeview' + ams.devext + '.css',
- 'bootstrap-treeview',
- function() {
- treeviews.each(function () {
- var treeview = $(this);
- var data = treeview.data();
- var dataOptions = {
- data: data.amsTreeviewData,
- levels: data.amsTreeviewLevels,
- injectStyle: data.amsTreeviewInjectStyle,
- expandIcon: data.amsTreeviewExpandIcon || 'fa fa-fw fa-plus-square-o',
- collapseIcon: data.amsTreeviewCollaspeIcon || 'fa fa-fw fa-minus-square-o',
- emptyIcon: data.amsTreeviewEmptyIcon || 'fa fa-fw',
- nodeIcon: data.amsTreeviewNodeIcon,
- selectedIcon: data.amsTreeviewSelectedIcon,
- checkedIcon: data.amsTreeviewCheckedIcon || 'fa fa-fw fa-check-square-o',
- uncheckedIcon: data.amsTreeviewUncheckedIcon || 'fa fa-fw fa-square-o',
- color: data.amsTreeviewColor,
- backColor: data.amsTreeviewBackColor,
- borderColor: data.amsTreeviewBorderColor,
- onHoverColor: data.amsTreeviewHoverColor,
- selectedColor: data.amsTreeviewSelectedColor,
- selectedBackColor: data.amsTreeviewSelectedBackColor,
- unselectableColor: data.amsTreeviewUnselectableColor || 'rgba(1,1,1,0.25)',
- unselectableBackColor: data.amsTreeviewUnselectableBackColor || 'rgba(1,1,1,0.25)',
- enableLinks: data.amsTreeviewEnableLinks,
- highlightSelected: data.amsTreeviewHighlightSelected,
- highlightSearchResults: data.amsTreeviewhighlightSearchResults,
- showBorder: data.amsTreeviewShowBorder,
- showIcon: data.amsTreeviewShowIcon,
- showCheckbox: data.amsTreeviewShowCheckbox,
- showTags: data.amsTreeviewShowTags,
- toggleUnselectable: data.amsTreeviewToggleUnselectable,
- multiSelect: data.amsTreeviewMultiSelect,
- onNodeChecked: ams.getFunctionByName(data.amsTreeviewNodeChecked),
- onNodeCollapsed: ams.getFunctionByName(data.amsTreeviewNodeCollapsed),
- onNodeDisabled: ams.getFunctionByName(data.amsTreeviewNodeDisabled),
- onNodeEnabled: ams.getFunctionByName(data.amsTreeviewNodeEnabled),
- onNodeExpanded: ams.getFunctionByName(data.amsTreeviewNodeExpanded),
- onNodeSelected: ams.getFunctionByName(data.amsTreeviewNodeSelected),
- onNodeUnchecked: ams.getFunctionByName(data.amsTreeviewNodeUnchecked),
- onNodeUnselected: ams.getFunctionByName(data.amsTreeviewNodeUnselected),
- onSearchComplete: ams.getFunctionByName(data.amsTreeviewSearchComplete),
- onSearchCleared: ams.getFunctionByName(data.amsTreeviewSearchCleared)
- };
- var settings = $.extend({}, dataOptions, data.amsTreeviewOptions);
- settings = ams.executeFunctionByName(data.amsTreeviewInitcallback, treeview, settings) || settings;
- var plugin = treeview.treeview(settings);
- ams.executeFunctionByName(data.amsTreeviewAfterInitCallback, treeview, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.treview,
+ ams.baseURL + 'ext/bootstrap-treeview' + ams.devext + '.js',
+ function() {
+ ams.getCSS(ams.baseURL + '../css/ext/bootstrap-treeview' + ams.devext + '.css',
+ 'bootstrap-treeview',
+ function() {
+ treeviews.each(function() {
+ var treeview = $(this);
+ var data = treeview.data();
+ var dataOptions = {
+ data: data.amsTreeviewData,
+ levels: data.amsTreeviewLevels,
+ injectStyle: data.amsTreeviewInjectStyle,
+ expandIcon: data.amsTreeviewExpandIcon || 'fa fa-fw fa-plus-square-o',
+ collapseIcon: data.amsTreeviewCollaspeIcon || 'fa fa-fw fa-minus-square-o',
+ emptyIcon: data.amsTreeviewEmptyIcon || 'fa fa-fw',
+ nodeIcon: data.amsTreeviewNodeIcon,
+ selectedIcon: data.amsTreeviewSelectedIcon,
+ checkedIcon: data.amsTreeviewCheckedIcon || 'fa fa-fw fa-check-square-o',
+ uncheckedIcon: data.amsTreeviewUncheckedIcon || 'fa fa-fw fa-square-o',
+ color: data.amsTreeviewColor,
+ backColor: data.amsTreeviewBackColor,
+ borderColor: data.amsTreeviewBorderColor,
+ onHoverColor: data.amsTreeviewHoverColor,
+ selectedColor: data.amsTreeviewSelectedColor,
+ selectedBackColor: data.amsTreeviewSelectedBackColor,
+ unselectableColor: data.amsTreeviewUnselectableColor || 'rgba(1,1,1,0.25)',
+ unselectableBackColor: data.amsTreeviewUnselectableBackColor || 'rgba(1,1,1,0.25)',
+ enableLinks: data.amsTreeviewEnableLinks,
+ highlightSelected: data.amsTreeviewHighlightSelected,
+ highlightSearchResults: data.amsTreeviewhighlightSearchResults,
+ showBorder: data.amsTreeviewShowBorder,
+ showIcon: data.amsTreeviewShowIcon,
+ showCheckbox: data.amsTreeviewShowCheckbox,
+ showTags: data.amsTreeviewShowTags,
+ toggleUnselectable: data.amsTreeviewToggleUnselectable,
+ multiSelect: data.amsTreeviewMultiSelect,
+ onNodeChecked: ams.getFunctionByName(data.amsTreeviewNodeChecked),
+ onNodeCollapsed: ams.getFunctionByName(data.amsTreeviewNodeCollapsed),
+ onNodeDisabled: ams.getFunctionByName(data.amsTreeviewNodeDisabled),
+ onNodeEnabled: ams.getFunctionByName(data.amsTreeviewNodeEnabled),
+ onNodeExpanded: ams.getFunctionByName(data.amsTreeviewNodeExpanded),
+ onNodeSelected: ams.getFunctionByName(data.amsTreeviewNodeSelected),
+ onNodeUnchecked: ams.getFunctionByName(data.amsTreeviewNodeUnchecked),
+ onNodeUnselected: ams.getFunctionByName(data.amsTreeviewNodeUnselected),
+ onSearchComplete: ams.getFunctionByName(data.amsTreeviewSearchComplete),
+ onSearchCleared: ams.getFunctionByName(data.amsTreeviewSearchCleared)
+ };
+ var settings = $.extend({}, dataOptions, data.amsTreeviewOptions);
+ settings = ams.executeFunctionByName(data.amsTreeviewInitcallback, treeview, settings) || settings;
+ var plugin = treeview.treeview(settings);
+ ams.executeFunctionByName(data.amsTreeviewAfterInitCallback, treeview, plugin, settings);
+ });
+ });
+ });
}
},
@@ -476,195 +476,199 @@
select2: function(element) {
var selects = $('.select2', element);
if (selects.length > 0) {
- ams.ajax.check($.fn.select2,
- ams.baseURL + 'ext/jquery-select2-3.5.4' + ams.devext + '.js',
- function() {
- selects.each(function() {
- var select = $(this);
- var data = select.data();
- if (data.select2) {
- // Already initialized
- return;
- }
- var dataOptions = {
- placeholder: data.amsSelect2Placeholder,
- multiple: data.amsSelect2Multiple,
- minimumInputLength: data.amsSelect2MinimumInputLength || 0,
- maximumSelectionSize: data.amsSelect2MaximumSelectionSize,
- openOnEnter: data.amsSelect2EnterOpen === undefined ? true : data.amsSelect2EnterOpen,
- allowClear: data.amsSelect2AllowClear === undefined ? true : data.amsSelect2AllowClear,
- width: data.amsSelect2Width || '100%',
- initSelection: ams.getFunctionByName(data.amsSelect2InitSelection),
- formatSelection: data.amsSelect2FormatSelection === undefined ?
- ams.helpers.select2FormatSelection
- : ams.getFunctionByName(data.amsSelect2FormatSelection),
- formatResult: ams.getFunctionByName(data.amsSelect2FormatResult),
- formatMatches: data.amsSelect2FormatMatches === undefined ?
- function(matches) {
- if (matches === 1) {
- return ams.i18n.SELECT2_MATCH;
- } else {
- return matches + ams.i18n.SELECT2_MATCHES;
- }
- }
- : ams.getFunctionByName(data.amsSelect2FormatMatches),
- formatNoMatches: data.amsSelect2FormatResult === undefined ?
- function(term) {
- return ams.i18n.SELECT2_NOMATCHES;
- }
- : ams.getFunctionByName(data.amsSelect2FormatResult),
- formatInputTooShort: data.amsSelect2FormatInputTooShort === undefined ?
- function(input, min) {
- var n = min - input.length;
- return ams.i18n.SELECT2_INPUT_TOOSHORT
- .replace(/\{0\}/, n)
- .replace(/\{1\}/, n === 1 ? "" : ams.i18n.SELECT2_PLURAL);
- }
- : ams.getFunctionByName(data.amsSelect2FormatInputTooShort),
- formatInputTooLong: data.amsSelect2FormatInputTooLong === undefined ?
- function(input, max) {
- var n = input.length - max;
- return ams.i18n.SELECT2_INPUT_TOOLONG
- .replace(/\{0\}/, n)
- .replace(/\{1\}/, n === 1 ? "" : ams.i18n.SELECT2_PLURAL);
- }
- : ams.getFunctionByName(data.amsSelect2FormatInputTooLong),
- formatSelectionTooBig: data.amsSelect2FormatSelectionTooBig === undefined ?
- function(limit) {
- return ams.i18n.SELECT2_SELECTION_TOOBIG
- .replace(/\{0\}/, limit)
- .replace(/\{1\}/, limit === 1 ? "" : ams.i18n.SELECT2_PLURAL);
- }
- : ams.getFunctionByName(data.amsSelect2FormatSelectionTooBig),
- formatLoadMore: data.amsSelect2FormatLoadMore === undefined ?
- function (pageNumber) {
- return ams.i18n.SELECT2_LOADMORE;
- }
- : ams.getFunctionByName(data.amsSelect2FormatLoadMore),
- formatSearching: data.amsSelect2FormatSearching === undefined ?
- function() {
- return ams.i18n.SELECT2_SEARCHING;
- }
- : ams.getFunctionByName(data.amsSelect2FormatSearching),
- separator: data.amsSelect2Separator || ',',
- tokenSeparators: data.amsSelect2TokensSeparators || [','],
- tokenizer: ams.getFunctionByName(data.amsSelect2Tokenizer)
- };
+ ams.ajax && ams.ajax.check($.fn.select2,
+ ams.baseURL + 'ext/jquery-select2-3.5.4' + ams.devext + '.js',
+ function() {
+ selects.each(function() {
+ var select = $(this);
+ var data = select.data();
+ if (data.select2) {
+ // Already initialized
+ return;
+ }
+ var dataOptions = {
+ placeholder: data.amsSelect2Placeholder,
+ multiple: data.amsSelect2Multiple,
+ minimumInputLength: data.amsSelect2MinimumInputLength || 0,
+ maximumSelectionSize: data.amsSelect2MaximumSelectionSize,
+ openOnEnter: data.amsSelect2EnterOpen === undefined ? true : data.amsSelect2EnterOpen,
+ allowClear: data.amsSelect2AllowClear === undefined ? true : data.amsSelect2AllowClear,
+ width: data.amsSelect2Width || '100%',
+ initSelection: ams.getFunctionByName(data.amsSelect2InitSelection),
+ formatSelection: data.amsSelect2FormatSelection === undefined
+ ? ams.helpers && ams.helpers.select2FormatSelection
+ : ams.getFunctionByName(data.amsSelect2FormatSelection),
+ formatResult: ams.getFunctionByName(data.amsSelect2FormatResult),
+ formatMatches: data.amsSelect2FormatMatches === undefined ?
+ function(matches) {
+ if (matches === 1) {
+ return ams.i18n.SELECT2_MATCH;
+ } else {
+ return matches + ams.i18n.SELECT2_MATCHES;
+ }
+ }
+ : ams.getFunctionByName(data.amsSelect2FormatMatches),
+ formatNoMatches: data.amsSelect2FormatResult === undefined ?
+ function(term) {
+ return ams.i18n.SELECT2_NOMATCHES;
+ }
+ : ams.getFunctionByName(data.amsSelect2FormatResult),
+ formatInputTooShort: data.amsSelect2FormatInputTooShort === undefined ?
+ function(input, min) {
+ var n = min - input.length;
+ return ams.i18n.SELECT2_INPUT_TOOSHORT
+ .replace(/\{0\}/, n)
+ .replace(/\{1\}/, n === 1 ? "" : ams.i18n.SELECT2_PLURAL);
+ }
+ : ams.getFunctionByName(data.amsSelect2FormatInputTooShort),
+ formatInputTooLong: data.amsSelect2FormatInputTooLong === undefined ?
+ function(input, max) {
+ var n = input.length - max;
+ return ams.i18n.SELECT2_INPUT_TOOLONG
+ .replace(/\{0\}/, n)
+ .replace(/\{1\}/, n === 1 ? "" : ams.i18n.SELECT2_PLURAL);
+ }
+ : ams.getFunctionByName(data.amsSelect2FormatInputTooLong),
+ formatSelectionTooBig: data.amsSelect2FormatSelectionTooBig === undefined ?
+ function(limit) {
+ return ams.i18n.SELECT2_SELECTION_TOOBIG
+ .replace(/\{0\}/, limit)
+ .replace(/\{1\}/, limit === 1 ? "" : ams.i18n.SELECT2_PLURAL);
+ }
+ : ams.getFunctionByName(data.amsSelect2FormatSelectionTooBig),
+ formatLoadMore: data.amsSelect2FormatLoadMore === undefined ?
+ function(pageNumber) {
+ return ams.i18n.SELECT2_LOADMORE;
+ }
+ : ams.getFunctionByName(data.amsSelect2FormatLoadMore),
+ formatSearching: data.amsSelect2FormatSearching === undefined ?
+ function() {
+ return ams.i18n.SELECT2_SEARCHING;
+ }
+ : ams.getFunctionByName(data.amsSelect2FormatSearching),
+ separator: data.amsSelect2Separator || ',',
+ tokenSeparators: data.amsSelect2TokensSeparators || [','],
+ tokenizer: ams.getFunctionByName(data.amsSelect2Tokenizer)
+ };
- switch (select.context.type) {
- case 'text':
- case 'hidden':
- if (!dataOptions.initSelection) {
- var valuesData = select.data('ams-select2-values');
- if (valuesData) {
- dataOptions.initSelection = function(element, callback) {
- var data = [];
- $(element.val().split(dataOptions.separator)).each(function() {
- data.push({id: this,
- text: valuesData[this] || this});
- });
- callback(data);
- };
- }
- }
- break;
- default:
- break;
- }
+ switch (select.context.type) {
+ case 'text':
+ case 'hidden':
+ if (!dataOptions.initSelection) {
+ var valuesData = select.data('ams-select2-values');
+ if (valuesData) {
+ dataOptions.initSelection = function(element, callback) {
+ var data = [];
+ $(element.val().split(dataOptions.separator)).each(function() {
+ data.push({
+ id: this,
+ text: valuesData[this] || this
+ });
+ });
+ callback(data);
+ };
+ }
+ }
+ break;
+ default:
+ break;
+ }
- if (select.attr('readonly')) {
- if (select.attr('type') === 'hidden') {
- dataOptions.query = function () {
- return [];
- };
- }
- } else if (data.amsSelect2Query) {
- // Custom query method
- dataOptions.query = ams.getFunctionByName(data.amsSelect2Query);
- dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
- } else if (data.amsSelect2QueryUrl) {
- // AJAX query
- dataOptions.ajax = {
- url: data.amsSelect2QueryUrl,
- quietMillis: data.amsSelect2QuietMillis || 200,
- type: data.amsSelect2QueryType || 'POST',
- dataType: data.amsSelect2QueryDatatype || 'json',
- data: function(term, page, context) {
- var options = {};
- options[data.amsSelect2QueryParamName || 'query'] = term;
- options[data.amsSelect2PageParamName || 'page'] = page;
- options[data.amsSelect2ContextParamName || 'context'] = context;
- return $.extend({}, options, data.amsSelect2QueryOptions);
- },
- results: ams.helpers.select2QueryUrlResultsCallback
- };
- dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
- } else if (data.amsSelect2QueryMethod) {
- // JSON-RPC query
- dataOptions.query = function(options) {
- var settings = {
- id: new Date().getTime(),
- params: data.amsSelect2QueryParams || {},
- success: function(result) {
- return ams.helpers.select2QueryMethodSuccessCallback.call(select, result, 'success', options);
- },
- error: ams.error.show
- };
- settings.params[data.amsSelect2QueryParamName || 'query'] = options.term;
- settings.params[data.amsSelect2PageParamName || 'page'] = options.page;
- settings.params[data.amsSelect2ContextParamName || 'context'] = options.context;
- settings = $.extend({}, settings, data.amsSelect2QueryOptions);
- settings = ams.executeFunctionByName(data.amsSelect2QueryInitCallback, select, settings) || settings;
- ams.ajax.check($.jsonRPC,
- ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
- function() {
- $.jsonRPC.withOptions({
- endPoint: data.amsSelect2MethodTarget || ams.jsonrpc.getAddr(),
- namespace: data.amsSelect2MethodNamespace,
- cache: false
- }, function() {
- $.jsonRPC.request(data.amsSelect2QueryMethod, settings);
- });
- });
- };
- dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
- } else if (data.amsSelect2Tags) {
- // Tags mode
- dataOptions.tags = data.amsSelect2Tags;
- } else if (data.amsSelect2Data) {
- // Provided data mode
- dataOptions.data = data.amsSelect2Data;
- }
+ if (select.attr('readonly')) {
+ if (select.attr('type') === 'hidden') {
+ dataOptions.query = function() {
+ return [];
+ };
+ }
+ } else if (data.amsSelect2Query) {
+ // Custom query method
+ dataOptions.query = ams.getFunctionByName(data.amsSelect2Query);
+ dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
+ } else if (data.amsSelect2QueryUrl) {
+ // AJAX query
+ dataOptions.ajax = {
+ url: data.amsSelect2QueryUrl,
+ quietMillis: data.amsSelect2QuietMillis || 200,
+ type: data.amsSelect2QueryType || 'POST',
+ dataType: data.amsSelect2QueryDatatype || 'json',
+ data: function(term, page, context) {
+ var options = {};
+ options[data.amsSelect2QueryParamName || 'query'] = term;
+ options[data.amsSelect2PageParamName || 'page'] = page;
+ options[data.amsSelect2ContextParamName || 'context'] = context;
+ return $.extend({}, options, data.amsSelect2QueryOptions);
+ },
+ results: ams.helpers && ams.helpers.select2QueryUrlResultsCallback
+ };
+ dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
+ } else if (data.amsSelect2QueryMethod) {
+ // JSON-RPC query
+ dataOptions.query = function(options) {
+ var settings = {
+ id: new Date().getTime(),
+ params: data.amsSelect2QueryParams || {},
+ success: function(result) {
+ return ams.helpers && ams.helpers.select2QueryMethodSuccessCallback.call(select, result, 'success', options);
+ },
+ error: ams.error && ams.error.show
+ };
+ settings.params[data.amsSelect2QueryParamName || 'query'] = options.term;
+ settings.params[data.amsSelect2PageParamName || 'page'] = options.page;
+ settings.params[data.amsSelect2ContextParamName || 'context'] = options.context;
+ settings = $.extend({}, settings, data.amsSelect2QueryOptions);
+ settings = ams.executeFunctionByName(data.amsSelect2QueryInitCallback, select, settings) || settings;
+ ams.ajax && ams.ajax.check($.jsonRPC,
+ ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
+ function() {
+ $.jsonRPC.withOptions({
+ endPoint: data.amsSelect2MethodTarget || (ams.jsonrpc && ams.jsonrpc.getAddr()),
+ namespace: data.amsSelect2MethodNamespace,
+ cache: false
+ }, function() {
+ $.jsonRPC.request(data.amsSelect2QueryMethod, settings);
+ });
+ });
+ };
+ dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
+ } else if (data.amsSelect2Tags) {
+ // Tags mode
+ dataOptions.tags = data.amsSelect2Tags;
+ } else if (data.amsSelect2Data) {
+ // Provided data mode
+ dataOptions.data = data.amsSelect2Data;
+ }
- if (data.amsSelect2EnableFreeTags) {
- dataOptions.createSearchChoice = function(term) {
- return {id: term,
- text: (data.amsSelect2FreeTagsPrefix || ams.i18n.SELECT2_FREETAG_PREFIX) + term};
- };
- }
+ if (data.amsSelect2EnableFreeTags) {
+ dataOptions.createSearchChoice = function(term) {
+ return {
+ id: term,
+ text: (data.amsSelect2FreeTagsPrefix || ams.i18n.SELECT2_FREETAG_PREFIX) + term
+ };
+ };
+ }
- var settings = $.extend({}, dataOptions, data.amsSelect2Options);
- settings = ams.executeFunctionByName(data.amsSelect2InitCallback, select, settings) || settings;
- var plugin = select.select2(settings);
- ams.executeFunctionByName(data.amsSelect2AfterInitCallback, select, plugin, settings);
- if (select.hasClass('ordered')) {
- ams.ajax.check($.fn.select2Sortable,
- ams.baseURL + 'ext/jquery-select2-sortable' + ams.devext + '.js',
- function() {
- select.select2Sortable({
- bindOrder: 'sortableStop'
- });
- });
- }
+ var settings = $.extend({}, dataOptions, data.amsSelect2Options);
+ settings = ams.executeFunctionByName(data.amsSelect2InitCallback, select, settings) || settings;
+ var plugin = select.select2(settings);
+ ams.executeFunctionByName(data.amsSelect2AfterInitCallback, select, plugin, settings);
+ if (select.hasClass('ordered')) {
+ ams.ajax && ams.ajax.check($.fn.select2Sortable,
+ ams.baseURL + 'ext/jquery-select2-sortable' + ams.devext + '.js',
+ function() {
+ select.select2Sortable({
+ bindOrder: 'sortableStop'
+ });
+ });
+ }
- select.on('change', function() {
- var validator = $(select.get(0).form).data('validator');
- if (validator !== undefined) {
- $(select).valid();
- }
- });
- });
- });
+ select.on('change', function() {
+ var validator = $(select.get(0).form).data('validator');
+ if (validator !== undefined) {
+ $(select).valid();
+ }
+ });
+ });
+ });
}
},
@@ -674,22 +678,22 @@
maskedit: function(element) {
var masks = $('[data-mask]', element);
if (masks.length > 0) {
- ams.ajax.check($.fn.mask,
- ams.baseURL + 'ext/jquery-maskedinput-1.4.1' + ams.devext + '.js',
- function() {
- masks.each(function() {
- var mask = $(this);
- var data = mask.data();
- var dataOptions = {
- placeholder: data.amsMaskeditPlaceholder === undefined ? 'X' : data.amsMaskeditPlaceholder,
- complete: ams.getFunctionByName(data.amsMaskeditComplete)
- };
- var settings = $.extend({}, dataOptions, data.amsMaskeditOptions);
- settings = ams.executeFunctionByName(data.amsMaskeditInitCallback, mask, settings) || settings;
- var plugin = mask.mask(mask.attr('data-mask'), settings);
- ams.executeFunctionByName(data.amsMaskeditAfterInitCallback, mask, plugin, settings);
- });
- });
+ ams.ajax && ams.ajax.check($.fn.mask,
+ ams.baseURL + 'ext/jquery-maskedinput-1.4.1' + ams.devext + '.js',
+ function() {
+ masks.each(function() {
+ var mask = $(this);
+ var data = mask.data();
+ var dataOptions = {
+ placeholder: data.amsMaskeditPlaceholder === undefined ? 'X' : data.amsMaskeditPlaceholder,
+ complete: ams.getFunctionByName(data.amsMaskeditComplete)
+ };
+ var settings = $.extend({}, dataOptions, data.amsMaskeditOptions);
+ settings = ams.executeFunctionByName(data.amsMaskeditInitCallback, mask, settings) || settings;
+ var plugin = mask.mask(mask.attr('data-mask'), settings);
+ ams.executeFunctionByName(data.amsMaskeditAfterInitCallback, mask, plugin, settings);
+ });
+ });
}
},
@@ -704,26 +708,26 @@
inputmask: function(element) {
var masks = $('input[data-input-mask]', element);
if (masks.length > 0) {
- ams.ajax.check($.fn.inputmask,
- ams.baseURL + 'ext/jquery-inputmask-bundle-3.2.8' + ams.devext + '.js',
- function() {
- masks.each(function() {
- var input = $(this);
- var data = input.data();
- var dataOptions;
- if (typeof(data.inputMask) === 'object') {
- dataOptions = data.inputMask;
- } else {
- dataOptions = {
- mask: data.inputMask.toString()
- };
- }
- var settings = $.extend({}, dataOptions, data.amsInputmaskOptions);
- settings = ams.executeFunctionByName(data.amsInputmaskInitCallback, input, settings) || settings;
- var plugin = input.inputmask(settings);
- ams.executeFunctionByName(data.amsInputmaskAfterInitCallback, input, plugin, settings);
- });
- });
+ ams.ajax && ams.ajax.check($.fn.inputmask,
+ ams.baseURL + 'ext/jquery-inputmask-bundle-3.2.8' + ams.devext + '.js',
+ function() {
+ masks.each(function() {
+ var input = $(this);
+ var data = input.data();
+ var dataOptions;
+ if (typeof (data.inputMask) === 'object') {
+ dataOptions = data.inputMask;
+ } else {
+ dataOptions = {
+ mask: data.inputMask.toString()
+ };
+ }
+ var settings = $.extend({}, dataOptions, data.amsInputmaskOptions);
+ settings = ams.executeFunctionByName(data.amsInputmaskInitCallback, input, settings) || settings;
+ var plugin = input.inputmask(settings);
+ ams.executeFunctionByName(data.amsInputmaskAfterInitCallback, input, plugin, settings);
+ });
+ });
}
},
@@ -733,34 +737,34 @@
datepicker: function(element) {
var datepickers = $('.datepicker', element);
if (datepickers.length > 0) {
- ams.ajax.check($.fn.datetimepicker,
- ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
- function(first_load) {
- if (first_load) {
- ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback);
- }
- ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
- 'jquery-datetimepicker',
- function () {
- datepickers.each(function () {
- var input = $(this);
- var data = input.data();
- var dataOptions = {
- lang: data.amsDatetimepickerLang || ams.lang,
- format: data.amsDatetimepickerFormat || 'd/m/y',
- datepicker: true,
- dayOfWeekStart: 1,
- timepicker: false,
- closeOnDateSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
- weeks: data.amsDatetimepickerWeeks
- };
- var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
- settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
- var plugin = input.datetimepicker(settings);
- ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.datetimepicker,
+ ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
+ function(first_load) {
+ if (first_load) {
+ ams.dialog && ams.dialog.registerHideCallback(ams.helpers && ams.helpers.datetimepickerDialogHiddenCallback);
+ }
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
+ 'jquery-datetimepicker',
+ function() {
+ datepickers.each(function() {
+ var input = $(this);
+ var data = input.data();
+ var dataOptions = {
+ lang: data.amsDatetimepickerLang || ams.lang,
+ format: data.amsDatetimepickerFormat || 'd/m/y',
+ datepicker: true,
+ dayOfWeekStart: 1,
+ timepicker: false,
+ closeOnDateSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
+ weeks: data.amsDatetimepickerWeeks
+ };
+ var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
+ settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
+ var plugin = input.datetimepicker(settings);
+ ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
+ });
+ });
+ });
}
},
@@ -770,35 +774,35 @@
datetimepicker: function(element) {
var datetimepickers = $('.datetimepicker', element);
if (datetimepickers.length > 0) {
- ams.ajax.check($.fn.datetimepicker,
- ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
- function(first_load) {
- if (first_load) {
- ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback);
- }
- ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
- 'jquery-datetimepicker',
- function () {
- datetimepickers.each(function () {
- var input = $(this);
- var data = input.data();
- var dataOptions = {
- lang: data.amsDatetimepickerLang || ams.lang,
- format: data.amsDatetimepickerFormat || 'd/m/y H:i',
- datepicker: true,
- dayOfWeekStart: 1,
- timepicker: true,
- closeOnDateSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
- closeOnTimeSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
- weeks: data.amsDatetimepickerWeeks
- };
- var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
- settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
- var plugin = input.datetimepicker(settings);
- ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.datetimepicker,
+ ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
+ function(first_load) {
+ if (first_load) {
+ ams.dialog && ams.dialog.registerHideCallback(ams.helpers && ams.helpers.datetimepickerDialogHiddenCallback);
+ }
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
+ 'jquery-datetimepicker',
+ function() {
+ datetimepickers.each(function() {
+ var input = $(this);
+ var data = input.data();
+ var dataOptions = {
+ lang: data.amsDatetimepickerLang || ams.lang,
+ format: data.amsDatetimepickerFormat || 'd/m/y H:i',
+ datepicker: true,
+ dayOfWeekStart: 1,
+ timepicker: true,
+ closeOnDateSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
+ closeOnTimeSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
+ weeks: data.amsDatetimepickerWeeks
+ };
+ var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
+ settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
+ var plugin = input.datetimepicker(settings);
+ ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
+ });
+ });
+ });
}
},
@@ -808,32 +812,32 @@
timepicker: function(element) {
var timepickers = $('.timepicker', element);
if (timepickers.length > 0) {
- ams.ajax.check($.fn.datetimepicker,
- ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
- function(first_load) {
- if (first_load) {
- ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback);
- }
- ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
- 'jquery-datetimepicker',
- function() {
- timepickers.each(function () {
- var input = $(this);
- var data = input.data();
- var dataOptions = {
- lang: data.amsDatetimepickerLang || ams.lang,
- format: data.amsDatetimepickerFormat || 'H:i',
- datepicker: false,
- timepicker: true,
- closeOnTimeSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect
- };
- var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
- settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
- var plugin = input.datetimepicker(settings);
- ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.datetimepicker,
+ ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
+ function(first_load) {
+ if (first_load) {
+ ams.dialog && ams.dialog.registerHideCallback(ams.helpers && ams.helpers.datetimepickerDialogHiddenCallback);
+ }
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
+ 'jquery-datetimepicker',
+ function() {
+ timepickers.each(function() {
+ var input = $(this);
+ var data = input.data();
+ var dataOptions = {
+ lang: data.amsDatetimepickerLang || ams.lang,
+ format: data.amsDatetimepickerFormat || 'H:i',
+ datepicker: false,
+ timepicker: true,
+ closeOnTimeSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect
+ };
+ var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
+ settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
+ var plugin = input.datetimepicker(settings);
+ ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
+ });
+ });
+ });
}
},
@@ -843,25 +847,25 @@
colorpicker: function(element) {
var colorpickers = $('.colorpicker', element);
if (colorpickers.length > 0) {
- ams.ajax.check($.fn.minicolors,
- ams.baseURL + 'ext/jquery-minicolors' + ams.devext + '.js',
- function() {
- ams.getCSS(ams.baseURL + '../css/ext/jquery-minicolors' + ams.devext + '.css',
- 'jquery-minicolors',
- function () {
- colorpickers.each(function () {
- var input = $(this);
- var data = input.data();
- var dataOptions = {
- position: data.amsColorpickerPosition || input.closest('.input').data('ams-colorpicker-position') || 'bottom left'
- };
- var settings = $.extend({}, dataOptions, data.amsColorpickerOptions);
- settings = ams.executeFunctionByName(data.amsColorpickerInitCallback, input, settings) || settings;
- var plugin = input.minicolors(settings);
- ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.minicolors,
+ ams.baseURL + 'ext/jquery-minicolors' + ams.devext + '.js',
+ function() {
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-minicolors' + ams.devext + '.css',
+ 'jquery-minicolors',
+ function() {
+ colorpickers.each(function() {
+ var input = $(this);
+ var data = input.data();
+ var dataOptions = {
+ position: data.amsColorpickerPosition || input.closest('.input').data('ams-colorpicker-position') || 'bottom left'
+ };
+ var settings = $.extend({}, dataOptions, data.amsColorpickerOptions);
+ settings = ams.executeFunctionByName(data.amsColorpickerInitCallback, input, settings) || settings;
+ var plugin = input.minicolors(settings);
+ ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
+ });
+ });
+ });
}
},
@@ -871,27 +875,27 @@
dndupload: function(element) {
var uploads = $('.dndupload', element);
if (uploads.length > 0) {
- ams.ajax.check($.fn.dndupload,
- ams.baseURL + 'ext/jquery-dndupload' + ams.devext + '.js',
- function() {
- ams.getCSS(ams.baseURL + '../css/ext/jquery-dndupload' + ams.devext + '.css',
- 'jquery-dndupload',
- function () {
- uploads.each(function () {
- var upload = $(this);
- var data = upload.data();
- var dataOptions = {
- action: data.amsDnduploadAction || upload.attr('action') || 'upload-files',
- fieldname: data.amsDnduploadFieldname || 'files',
- autosubmit: data.amsDnduploadAutosubmit
- };
- var settings = $.extend({}, dataOptions, data.amsDnduploadOptions);
- settings = ams.executeFunctionByName(data.amsDnduploadInitCallback, upload, settings) || settings;
- var plugin = upload.dndupload(settings);
- ams.executeFunctionByName(data.amsDnduploadAfterInitcallback, upload, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.dndupload,
+ ams.baseURL + 'ext/jquery-dndupload' + ams.devext + '.js',
+ function() {
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-dndupload' + ams.devext + '.css',
+ 'jquery-dndupload',
+ function() {
+ uploads.each(function() {
+ var upload = $(this);
+ var data = upload.data();
+ var dataOptions = {
+ action: data.amsDnduploadAction || upload.attr('action') || 'upload-files',
+ fieldname: data.amsDnduploadFieldname || 'files',
+ autosubmit: data.amsDnduploadAutosubmit
+ };
+ var settings = $.extend({}, dataOptions, data.amsDnduploadOptions);
+ settings = ams.executeFunctionByName(data.amsDnduploadInitCallback, upload, settings) || settings;
+ var plugin = upload.dndupload(settings);
+ ams.executeFunctionByName(data.amsDnduploadAfterInitcallback, upload, plugin, settings);
+ });
+ });
+ });
}
},
@@ -901,92 +905,92 @@
validate: function(element) {
var forms = $('FORM:not([novalidate])', element);
if (forms.length > 0) {
- ams.ajax.check($.fn.validate,
- ams.baseURL + 'ext/jquery-validate-1.17.0' + ams.devext + '.js',
- function(first_load) {
- if (first_load) {
- $.validator.setDefaults({
- highlight: function(element) {
- $(element).closest('.form-group, label:not(:parents(.form-group))').addClass('state-error');
- },
- unhighlight: function(element) {
- $(element).closest('.form-group, label:not(:parents(.form-group))').removeClass('state-error');
- },
- errorElement: 'span',
- errorClass: 'state-error',
- errorPlacement: function(error, element) {
- var label = element.parents('label:first');
- if (label.length) {
- error.insertAfter(label);
- } else {
- error.insertAfter(element);
- }
- }
- });
- if (ams.plugins.i18n) {
- for (var key in ams.plugins.i18n.validate) {
- if (!ams.plugins.i18n.validate.hasOwnProperty(key)) {
- continue;
- }
- var message = ams.plugins.i18n.validate[key];
- if ((typeof(message) === 'string') &&
- (message.indexOf('{0}') > -1)) {
- ams.plugins.i18n.validate[key] = $.validator.format(message);
- }
- }
- $.extend($.validator.messages, ams.plugins.i18n.validate);
- }
- }
- forms.each(function() {
- var form = $(this);
- var data = form.data();
- var dataOptions = {
- ignore: null,
- submitHandler: form.attr('data-async') !== undefined ?
+ ams.ajax && ams.ajax.check($.fn.validate,
+ ams.baseURL + 'ext/jquery-validate-1.17.0' + ams.devext + '.js',
+ function(first_load) {
+ if (first_load) {
+ $.validator.setDefaults({
+ highlight: function(element) {
+ $(element).closest('.form-group, label:not(:parents(.form-group))').addClass('state-error');
+ },
+ unhighlight: function(element) {
+ $(element).closest('.form-group, label:not(:parents(.form-group))').removeClass('state-error');
+ },
+ errorElement: 'span',
+ errorClass: 'state-error',
+ errorPlacement: function(error, element) {
+ var label = element.parents('label:first');
+ if (label.length) {
+ error.insertAfter(label);
+ } else {
+ error.insertAfter(element);
+ }
+ }
+ });
+ if (ams.plugins && ams.plugins.i18n) {
+ for (var key in ams.plugins.i18n.validate) {
+ if (!ams.plugins.i18n.validate.hasOwnProperty(key)) {
+ continue;
+ }
+ var message = ams.plugins.i18n.validate[key];
+ if ((typeof (message) === 'string') &&
+ (message.indexOf('{0}') > -1)) {
+ ams.plugins.i18n.validate[key] = $.validator.format(message);
+ }
+ }
+ $.extend($.validator.messages, ams.plugins.i18n.validate);
+ }
+ }
+ forms.each(function() {
+ var form = $(this);
+ var data = form.data();
+ var dataOptions = {
+ ignore: null,
+ submitHandler: form.attr('data-async') !== undefined ?
data.amsFormSubmitHandler === undefined ?
- function() {
- // JQuery-form plug-in must be loaded synchronously!!
- // Otherwise, hidden input fields created by jquery-validate plug-in
- // and matching named buttons will be deleted (on first form submit)
- // before JQuery-form plug-in can get them when submitting the form...
- $('.state-error', form).removeClass('state-error');
- ams.ajax.check($.fn.ajaxSubmit,
- ams.baseURL + 'ext/jquery-form-3.49' + ams.devext + '.js');
- return ams.form.submit(form);
- }
- : ams.getFunctionByName(data.amsFormSubmitHandler)
+ function() {
+ // JQuery-form plug-in must be loaded synchronously!!
+ // Otherwise, hidden input fields created by jquery-validate plug-in
+ // and matching named buttons will be deleted (on first form submit)
+ // before JQuery-form plug-in can get them when submitting the form...
+ $('.state-error', form).removeClass('state-error');
+ ams.ajax && ams.ajax.check($.fn.ajaxSubmit,
+ ams.baseURL + 'ext/jquery-form-3.49' + ams.devext + '.js');
+ return ams.form && ams.form.submit(form);
+ }
+ : ams.getFunctionByName(data.amsFormSubmitHandler)
: undefined,
- invalidHandler: form.attr('data-async') !== undefined ?
- data.amsFormInvalidHandler === undefined ?
- function(event, validator) {
- $('.state-error', form).removeClass('state-error');
- for (var index=0; index < validator.errorList.length; index++) {
- var error = validator.errorList[index];
- var tabIndex = $(error.element).parents('.tab-pane').index() + 1;
- if (tabIndex > 0) {
- var navTabs = $('.nav-tabs', $(error.element).parents('.tabforms'));
- $('li:nth-child(' + tabIndex + ')', navTabs)
- .removeClassPrefix('state-')
- .addClass('state-error');
- $('li.state-error:first a', navTabs).click();
- }
- }
- }
- : ams.getFunctionByName(data.amsFormInvalidHandler)
- : undefined
- };
- $('[data-ams-validate-rules]', form).each(function(index) {
- if (index === 0) {
- dataOptions.rules = {};
- }
- dataOptions.rules[$(this).attr('name')] = $(this).data('ams-validate-rules');
- });
- var settings = $.extend({}, dataOptions, data.amsValidateOptions);
- settings = ams.executeFunctionByName(data.amsValidateInitCallback, form, settings) || settings;
- var plugin = form.validate(settings);
- ams.executeFunctionByName(data.amsValidateAfterInitCallback, form, plugin, settings);
- });
- });
+ invalidHandler: form.attr('data-async') !== undefined ?
+ data.amsFormInvalidHandler === undefined ?
+ function(event, validator) {
+ $('.state-error', form).removeClass('state-error');
+ for (var index = 0; index < validator.errorList.length; index++) {
+ var error = validator.errorList[index];
+ var tabIndex = $(error.element).parents('.tab-pane').index() + 1;
+ if (tabIndex > 0) {
+ var navTabs = $('.nav-tabs', $(error.element).parents('.tabforms'));
+ $('li:nth-child(' + tabIndex + ')', navTabs)
+ .removeClassPrefix('state-')
+ .addClass('state-error');
+ $('li.state-error:first a', navTabs).click();
+ }
+ }
+ }
+ : ams.getFunctionByName(data.amsFormInvalidHandler)
+ : undefined
+ };
+ $('[data-ams-validate-rules]', form).each(function(index) {
+ if (index === 0) {
+ dataOptions.rules = {};
+ }
+ dataOptions.rules[$(this).attr('name')] = $(this).data('ams-validate-rules');
+ });
+ var settings = $.extend({}, dataOptions, data.amsValidateOptions);
+ settings = ams.executeFunctionByName(data.amsValidateInitCallback, form, settings) || settings;
+ var plugin = form.validate(settings);
+ ams.executeFunctionByName(data.amsValidateAfterInitCallback, form, plugin, settings);
+ });
+ });
}
},
@@ -996,258 +1000,257 @@
datatable: function(element) {
var tables = $('.datatable', element);
if (tables.length > 0) {
- ams.ajax.check($.fn.dataTable,
- ams.baseURL + 'ext/jquery-dataTables-1.9.4' + ams.devext + '.js',
- function() {
- ams.ajax.check($.fn.dataTableExt.oPagination.bootstrap_full,
- ams.baseURL + 'myams-dataTables' + ams.devext + '.js',
- function() {
- $(tables).each(function () {
- var table = $(this);
- var data = table.data();
- var extensions = (data.amsDatatableExtensions || '').split(/\s+/);
- // Check DOM elements
- var sDom = data.amsDatatableSdom ||
- "W" +
- ((extensions.indexOf('colreorder') >= 0 ||
- extensions.indexOf('colreorderwithresize') >= 0) ? 'R' : '') +
- "<'dt-top-row'" +
- (extensions.indexOf('colvis') >= 0 ? 'C' : '') +
- ((data.amsDatatablePagination === false ||
- data.amsDatatablePaginationSize === false) ? '' : 'L') +
- (data.amsDatatableGlobalFilter === false ? '' : 'F') +
- ">r<'dt-wrapper't" +
- (extensions.indexOf('scroller') >= 0 ? 'S' : '') +
- "><'dt-row dt-bottom-row'<'row'<'col-sm-6'" +
- (data.amsDatatableInformation === false ? '' : 'i') +
- "><'col-sm-6 text-right'p>>";
+ ams.ajax && ams.ajax.check($.fn.dataTable,
+ ams.baseURL + 'ext/jquery-dataTables-1.9.4' + ams.devext + '.js',
+ function() {
+ ams.ajax.check($.fn.dataTableExt.oPagination.bootstrap_full,
+ ams.baseURL + 'myams-dataTables' + ams.devext + '.js',
+ function() {
+ $(tables).each(function() {
+ var table = $(this);
+ var data = table.data();
+ var extensions = (data.amsDatatableExtensions || '').split(/\s+/);
+ // Check DOM elements
+ var sDom = data.amsDatatableSdom ||
+ "W" +
+ ((extensions.indexOf('colreorder') >= 0 ||
+ extensions.indexOf('colreorderwithresize') >= 0) ? 'R' : '') +
+ "<'dt-top-row'" +
+ (extensions.indexOf('colvis') >= 0 ? 'C' : '') +
+ ((data.amsDatatablePagination === false ||
+ data.amsDatatablePaginationSize === false) ? '' : 'L') +
+ (data.amsDatatableGlobalFilter === false ? '' : 'F') +
+ ">r<'dt-wrapper't" +
+ (extensions.indexOf('scroller') >= 0 ? 'S' : '') +
+ "><'dt-row dt-bottom-row'<'row'<'col-sm-6'" +
+ (data.amsDatatableInformation === false ? '' : 'i') +
+ "><'col-sm-6 text-right'p>>";
- var index;
- // Check initial sorting
- var sorting = data.amsDatatableSorting;
- if (typeof(sorting) === 'string') {
- var sortings = sorting.split(';');
- sorting = [];
- for (index = 0; index < sortings.length; index++) {
- var colSorting = sortings[index].split(',');
- colSorting[0] = parseInt(colSorting[0]);
- sorting.push(colSorting);
- }
- }
- // Check columns sortings
- var columns = [];
- var column;
- var sortables = $('th', table).listattr('data-ams-datatable-sortable');
- for (index = 0; index < sortables.length; index++) {
- var sortable = sortables[index];
- if (sortable !== undefined) {
- column = columns[index] || {};
- column.bSortable = typeof(sortable) === 'string' ? JSON.parse(sortable) : sortable;
- columns[index] = column;
- } else {
- columns[index] = columns[index] || {};
- }
- }
- // Check columns types
- var sortTypes = $('th', table).listattr('data-ams-datatable-stype');
- for (index = 0; index < sortTypes.length; index++) {
- var sortType = sortTypes[index];
- if (sortType) {
- column = columns[index] || {};
- column.sType = sortType;
- columns[index] = column;
- } else {
- columns[index] = columns[index] || {};
- }
- }
- // Set options
- var dataOptions = {
- bJQueryUI: false,
- bServerSide: data.amsDatatableServerSide || false,
- sAjaxSource: data.amsDatatableServerSide === true ? data.amsDatatableAjaxSource : undefined,
- sServerMethod: data.amsDatatableServerSide === true ? 'POST' : undefined,
- bFilter: data.amsDatatableGlobalFilter !== false || extensions.indexOf('columnfilter') >= 0,
- bPaginate: data.amsDatatablePagination !== false,
- bInfo: data.amsDatatableInfo !== false,
- bSort: data.amsDatatableSort !== false,
- aaSorting: sorting,
- aoColumns: columns.length > 0 ? columns : undefined,
- bDeferRender: true,
- bAutoWidth: false,
- iDisplayLength: data.amsDatatableDisplayLength || 25,
- sPaginationType: data.amsDatatablePaginationType || 'bootstrap_full',
- sDom: sDom,
- oLanguage: ams.plugins.i18n.datatables,
- fnInitComplete: function (oSettings, json) {
- $('.ColVis_Button').addClass('btn btn-default btn-sm')
- .html((ams.plugins.i18n.datatables.sColumns || "Columns") +
- ' <i class="fa fa-fw fa-caret-down"></i>');
- }
- };
- var settings = $.extend({}, dataOptions, data.amsDatatableOptions);
- var checkers = [];
- var sources = [];
- var callbacks = [];
- if (extensions.length > 0) {
- for (index = 0; index < extensions.length; index++) {
- switch (extensions[index]) {
- case 'autofill':
- checkers.push($.fn.dataTable.AutoFill);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-autoFill' + ams.devext + '.js');
- break;
- case 'columnfilter':
- checkers.push($.fn.columnFilter);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-columnFilter' + ams.devext + '.js');
- break;
- case 'colreorder':
- checkers.push($.fn.dataTable.ColReorder);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-colReorder' + ams.devext + '.js');
- break;
- case 'colreorderwithresize':
- checkers.push(window.ColReorder);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-colReorderWithResize' + ams.devext + '.js');
- break;
- case 'colvis':
- checkers.push($.fn.dataTable.ColVis);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-colVis' + ams.devext + '.js');
- callbacks.push(function () {
- var cvDefault = {
- activate: 'click',
- sAlign: 'right'
- };
- settings.oColVis = $.extend({}, cvDefault, data.amsDatatableColvisOptions);
- });
- break;
- case 'editable':
- checkers.push($.fn.editable);
- sources.push(ams.baseURL + 'ext/jquery-jeditable' + ams.devext + '.js');
- checkers.push($.fn.makeEditable);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-editable' + ams.devext + '.js');
- break;
- case 'fixedcolumns':
- checkers.push($.fn.dataTable.FixedColumns);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-fixedColumns' + ams.devext + '.js');
- break;
- case 'fixedheader':
- checkers.push($.fn.dataTable.Fixedheader);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-fixedHeader' + ams.devext + '.js');
- break;
- case 'keytable':
- checkers.push(window.keyTable);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-keyTable' + ams.devext + '.js');
- break;
- case 'rowgrouping':
- checkers.push($.fn.rowGrouping);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-rowGrouping' + ams.devext + '.js');
- break;
- case 'rowreordering':
- checkers.push($.fn.rowReordering);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-rowReordering' + ams.devext + '.js');
- break;
- case 'scroller':
- checkers.push($.fn.dataTable.Scroller);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-scroller' + ams.devext + '.js');
- break;
- default:
- break;
- }
- }
- }
+ var index;
+ // Check initial sorting
+ var sorting = data.amsDatatableSorting;
+ if (typeof (sorting) === 'string') {
+ var sortings = sorting.split(';');
+ sorting = [];
+ for (index = 0; index < sortings.length; index++) {
+ var colSorting = sortings[index].split(',');
+ colSorting[0] = parseInt(colSorting[0]);
+ sorting.push(colSorting);
+ }
+ }
+ // Check columns sortings
+ var columns = [];
+ var column;
+ var sortables = $('th', table).listattr('data-ams-datatable-sortable');
+ for (index = 0; index < sortables.length; index++) {
+ var sortable = sortables[index];
+ if (sortable !== undefined) {
+ column = columns[index] || {};
+ column.bSortable = typeof (sortable) === 'string' ? JSON.parse(sortable) : sortable;
+ columns[index] = column;
+ } else {
+ columns[index] = columns[index] || {};
+ }
+ }
+ // Check columns types
+ var sortTypes = $('th', table).listattr('data-ams-datatable-stype');
+ for (index = 0; index < sortTypes.length; index++) {
+ var sortType = sortTypes[index];
+ if (sortType) {
+ column = columns[index] || {};
+ column.sType = sortType;
+ columns[index] = column;
+ } else {
+ columns[index] = columns[index] || {};
+ }
+ }
+ // Set options
+ var dataOptions = {
+ bJQueryUI: false,
+ bServerSide: data.amsDatatableServerSide || false,
+ sAjaxSource: data.amsDatatableServerSide === true ? data.amsDatatableAjaxSource : undefined,
+ sServerMethod: data.amsDatatableServerSide === true ? 'POST' : undefined,
+ bFilter: data.amsDatatableGlobalFilter !== false || extensions.indexOf('columnfilter') >= 0,
+ bPaginate: data.amsDatatablePagination !== false,
+ bInfo: data.amsDatatableInfo !== false,
+ bSort: data.amsDatatableSort !== false,
+ aaSorting: sorting,
+ aoColumns: columns.length > 0 ? columns : undefined,
+ bDeferRender: true,
+ bAutoWidth: false,
+ iDisplayLength: data.amsDatatableDisplayLength || 25,
+ sPaginationType: data.amsDatatablePaginationType || 'bootstrap_full',
+ sDom: sDom,
+ oLanguage: ams.plugins && ams.plugins.i18n.datatables,
+ fnInitComplete: function(oSettings, json) {
+ $('.ColVis_Button').addClass('btn btn-default btn-sm')
+ .html(((ams.plugins && ams.plugins.i18n.datatables.sColumns) || "Columns") +
+ ' <i class="fa fa-fw fa-caret-down"></i>');
+ }
+ };
+ var settings = $.extend({}, dataOptions, data.amsDatatableOptions);
+ var checkers = [];
+ var sources = [];
+ var callbacks = [];
+ if (extensions.length > 0) {
+ for (index = 0; index < extensions.length; index++) {
+ switch (extensions[index]) {
+ case 'autofill':
+ checkers.push($.fn.dataTable.AutoFill);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-autoFill' + ams.devext + '.js');
+ break;
+ case 'columnfilter':
+ checkers.push($.fn.columnFilter);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-columnFilter' + ams.devext + '.js');
+ break;
+ case 'colreorder':
+ checkers.push($.fn.dataTable.ColReorder);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-colReorder' + ams.devext + '.js');
+ break;
+ case 'colreorderwithresize':
+ checkers.push(window.ColReorder);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-colReorderWithResize' + ams.devext + '.js');
+ break;
+ case 'colvis':
+ checkers.push($.fn.dataTable.ColVis);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-colVis' + ams.devext + '.js');
+ callbacks.push(function() {
+ var cvDefault = {
+ activate: 'click',
+ sAlign: 'right'
+ };
+ settings.oColVis = $.extend({}, cvDefault, data.amsDatatableColvisOptions);
+ });
+ break;
+ case 'editable':
+ checkers.push($.fn.editable);
+ sources.push(ams.baseURL + 'ext/jquery-jeditable' + ams.devext + '.js');
+ checkers.push($.fn.makeEditable);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-editable' + ams.devext + '.js');
+ break;
+ case 'fixedcolumns':
+ checkers.push($.fn.dataTable.FixedColumns);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-fixedColumns' + ams.devext + '.js');
+ break;
+ case 'fixedheader':
+ checkers.push($.fn.dataTable.Fixedheader);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-fixedHeader' + ams.devext + '.js');
+ break;
+ case 'keytable':
+ checkers.push(window.keyTable);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-keyTable' + ams.devext + '.js');
+ break;
+ case 'rowgrouping':
+ checkers.push($.fn.rowGrouping);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-rowGrouping' + ams.devext + '.js');
+ break;
+ case 'rowreordering':
+ checkers.push($.fn.rowReordering);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-rowReordering' + ams.devext + '.js');
+ break;
+ case 'scroller':
+ checkers.push($.fn.dataTable.Scroller);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-scroller' + ams.devext + '.js');
+ break;
+ default:
+ break;
+ }
+ }
+ }
- function initTable() {
- settings = ams.executeFunctionByName(data.amsDatatableInitCallback, table, settings) || settings;
- try { // Some settings can easily generate DataTables exceptions...
- var plugin = table.dataTable(settings);
- ams.executeFunctionByName(data.amsDatatableAfterInitCallback, table, plugin, settings);
- if (extensions.length > 0) {
- for (index = 0; index < extensions.length; index++) {
- switch (extensions[index]) {
- case 'autofill':
- var afSettings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill);
- afSettings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, afSettings) || afSettings;
- table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined ?
- new $.fn.dataTable.AutoFill(table, afSettings)
- : ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, afSettings));
- break;
- case 'columnfilter':
- var cfDefault = {
- sPlaceHolder: 'head:after'
- };
- var cfSettings = $.extend({}, cfDefault, data.amsDatatableColumnfilterOptions, settings.columnfilter);
- cfSettings = ams.executeFunctionByName(data.amsDatatableColumnfilterInitCallback, table, cfSettings) || cfSettings;
- table.data('ams-columnfilter', data.amsDatatableColumnfilterConstructor === undefined ?
- plugin.columnFilter(cfSettings)
- : ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cfSettings));
- break;
- case 'editable':
- var edSettings = $.extend({}, data.amsDatatableEditableOptions, settings.editable);
- edSettings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, edSettings) || edSettings;
- table.data('ams-editable', data.amsDatatableEditableConstructor === undefined ?
- table.makeEditable(edSettings)
- : ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, edSettings));
- break;
- case 'fixedcolumns':
- var fcSettings = $.extend({}, data.amsDatatableFixedcolumnsOptions, settings.fixedcolumns);
- fcSettings = ams.executeFunctionByName(data.amsDatatableFixedcolumnsInitCallback, table, fcSettings) || fcSettings;
- table.data('ams-fixedcolumns', data.amsDatatableFixedcolumnsConstructor === undefined ?
- new $.fn.dataTable.FixedColumns(table, fcSettings)
- : ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fcSettings));
- break;
- case 'fixedheader':
- var fhSettings = $.extend({}, data.amsDatatableFixedheaderOptions, settings.fixedheader);
- fhSettings = ams.executeFunctionByName(data.amsDatatableFixedheadeInitCallback, table, fhSettings) || fhSettings;
- table.data('ams-fixedheader', data.amsDatatableFixedheaderConstructor === undefined ?
- new $.fn.dataTable.FixedHeader(table, fhSettings)
- : ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fhSettings));
- break;
- case 'keytable':
- var ktDefault = {
- table: table.get(0),
- datatable: plugin
- };
- var ktSettings = $.extend({}, ktDefault, data.amsDatatableKeytableOptions, settings.keytable);
- ktSettings = ams.executeFunctionByName(data.amsDatatableKeytableInitCallback, table, ktSettings) || ktSettings;
- table.data('ams-keytable', data.amsDatatableKeytableConstructor === undefined ?
- new KeyTable(ktSettings)
- : ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, ktSettings));
- break;
- case 'rowgrouping':
- var rgSettings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping);
- rgSettings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rgSettings) || rgSettings;
- table.data('ams-rowgrouping', data.amsDatatableRowgroupingConstructor === undefined ?
- table.rowGrouping(rgSettings)
- : ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rgSettings));
- break;
- case 'rowreordering':
- var rrSettings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering);
- rrSettings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rrSettings) || rrSettings;
- table.data('ams-rowreordering', data.amsDatatableRowreorderingConstructor === undefined ?
- table.rowReordering(rrSettings)
- : ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rrSettings));
- break;
- default:
- break;
- }
- }
- }
- if (data.amsDatatableFinalizeCallback) {
- var finalizers = data.amsDatatableFinalizeCallback.split(/\s+/);
- if (finalizers.length > 0) {
- for (index = 0; index < finalizers.length; index++) {
- ams.executeFunctionByName(finalizers[index], table, plugin, settings);
- }
- }
- }
- }
- catch (e) {
- }
- }
+ function initTable() {
+ settings = ams.executeFunctionByName(data.amsDatatableInitCallback, table, settings) || settings;
+ try { // Some settings can easily generate DataTables exceptions...
+ var plugin = table.dataTable(settings);
+ ams.executeFunctionByName(data.amsDatatableAfterInitCallback, table, plugin, settings);
+ if (extensions.length > 0) {
+ for (index = 0; index < extensions.length; index++) {
+ switch (extensions[index]) {
+ case 'autofill':
+ var afSettings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill);
+ afSettings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, afSettings) || afSettings;
+ table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined ?
+ new $.fn.dataTable.AutoFill(table, afSettings)
+ : ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, afSettings));
+ break;
+ case 'columnfilter':
+ var cfDefault = {
+ sPlaceHolder: 'head:after'
+ };
+ var cfSettings = $.extend({}, cfDefault, data.amsDatatableColumnfilterOptions, settings.columnfilter);
+ cfSettings = ams.executeFunctionByName(data.amsDatatableColumnfilterInitCallback, table, cfSettings) || cfSettings;
+ table.data('ams-columnfilter', data.amsDatatableColumnfilterConstructor === undefined ?
+ plugin.columnFilter(cfSettings)
+ : ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cfSettings));
+ break;
+ case 'editable':
+ var edSettings = $.extend({}, data.amsDatatableEditableOptions, settings.editable);
+ edSettings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, edSettings) || edSettings;
+ table.data('ams-editable', data.amsDatatableEditableConstructor === undefined ?
+ table.makeEditable(edSettings)
+ : ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, edSettings));
+ break;
+ case 'fixedcolumns':
+ var fcSettings = $.extend({}, data.amsDatatableFixedcolumnsOptions, settings.fixedcolumns);
+ fcSettings = ams.executeFunctionByName(data.amsDatatableFixedcolumnsInitCallback, table, fcSettings) || fcSettings;
+ table.data('ams-fixedcolumns', data.amsDatatableFixedcolumnsConstructor === undefined ?
+ new $.fn.dataTable.FixedColumns(table, fcSettings)
+ : ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fcSettings));
+ break;
+ case 'fixedheader':
+ var fhSettings = $.extend({}, data.amsDatatableFixedheaderOptions, settings.fixedheader);
+ fhSettings = ams.executeFunctionByName(data.amsDatatableFixedheadeInitCallback, table, fhSettings) || fhSettings;
+ table.data('ams-fixedheader', data.amsDatatableFixedheaderConstructor === undefined ?
+ new $.fn.dataTable.FixedHeader(table, fhSettings)
+ : ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fhSettings));
+ break;
+ case 'keytable':
+ var ktDefault = {
+ table: table.get(0),
+ datatable: plugin
+ };
+ var ktSettings = $.extend({}, ktDefault, data.amsDatatableKeytableOptions, settings.keytable);
+ ktSettings = ams.executeFunctionByName(data.amsDatatableKeytableInitCallback, table, ktSettings) || ktSettings;
+ table.data('ams-keytable', data.amsDatatableKeytableConstructor === undefined ?
+ new KeyTable(ktSettings)
+ : ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, ktSettings));
+ break;
+ case 'rowgrouping':
+ var rgSettings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping);
+ rgSettings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rgSettings) || rgSettings;
+ table.data('ams-rowgrouping', data.amsDatatableRowgroupingConstructor === undefined ?
+ table.rowGrouping(rgSettings)
+ : ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rgSettings));
+ break;
+ case 'rowreordering':
+ var rrSettings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering);
+ rrSettings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rrSettings) || rrSettings;
+ table.data('ams-rowreordering', data.amsDatatableRowreorderingConstructor === undefined ?
+ table.rowReordering(rrSettings)
+ : ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rrSettings));
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ if (data.amsDatatableFinalizeCallback) {
+ var finalizers = data.amsDatatableFinalizeCallback.split(/\s+/);
+ if (finalizers.length > 0) {
+ for (index = 0; index < finalizers.length; index++) {
+ ams.executeFunctionByName(finalizers[index], table, plugin, settings);
+ }
+ }
+ }
+ } catch (e) {
+ }
+ }
- callbacks.push(initTable);
- ams.ajax.check(checkers, sources, callbacks);
- });
- });
- });
+ callbacks.push(initTable);
+ ams.ajax && ams.ajax.check(checkers, sources, callbacks);
+ });
+ });
+ });
}
},
@@ -1257,68 +1260,68 @@
tablednd: function(element) {
var tables = $('.table-dnd', element);
if (tables.length > 0) {
- ams.ajax.check($.fn.tableDnD,
- ams.baseURL + 'ext/jquery-tablednd' + ams.devext + '.js',
- function() {
- tables.each(function() {
- var table = $(this);
- var data = table.data();
- if (data.amsTabledndDragHandle) {
- $('tr', table).addClass('no-drag-handle');
- } else {
- $(table).on('mouseover', 'tr', function () {
- $(this.cells[0]).addClass('drag-handle');
- }).on('mouseout', 'tr', function () {
- $(this.cells[0]).removeClass('drag-handle');
- });
- }
- var dataOptions = {
- onDragClass: data.amsTabledndDragClass || 'dragging-row',
- onDragStart: ams.getFunctionByName(data.amsTabledndDragStart),
- dragHandle: data.amsTabledndDragHandle,
- scrollAmount: data.amsTabledndScrollAmount,
- onAllowDrop: data.amsTabledndAllowDrop,
- onDrop: ams.getFunctionByName(data.amsTabledndDrop) || function(dnd_table, row) {
- var target = data.amsTabledndDropTarget;
- if (target) {
- // Disable row click handler
- $(row).data('ams-disabled-handlers', 'click');
- try {
- var rows = [];
- $(dnd_table.rows).each(function() {
- var rowId = $(this).data('ams-element-name');
- if (rowId) {
- rows.push(rowId);
- }
- });
- var localTarget = ams.getFunctionByName(target);
- if (typeof(localTarget) === 'function') {
- localTarget.call(table, dnd_table, rows);
- } else {
- if (!target.startsWith(window.location.protocol)) {
- var location = data.amsLocation;
- if (location) {
- target = location + '/' + target;
- }
- }
- ams.ajax.post(target, {names: JSON.stringify(rows)});
- }
- } finally {
- // Restore row click handler
- setTimeout(function() {
- $(row).removeData('ams-disabled-handlers');
- }, 50);
- }
- }
- return false;
- }
- };
- var settings = $.extend({}, dataOptions, data.amsTabledndOptions);
- settings = ams.executeFunctionByName(data.amsTabledndInitCallback, table, settings) || settings;
- var plugin = table.tableDnD(settings);
- ams.executeFunctionByName(data.amsTabledndAfterInitCallback, table, plugin, settings);
- });
- });
+ ams.ajax && ams.ajax.check($.fn.tableDnD,
+ ams.baseURL + 'ext/jquery-tablednd' + ams.devext + '.js',
+ function() {
+ tables.each(function() {
+ var table = $(this);
+ var data = table.data();
+ if (data.amsTabledndDragHandle) {
+ $('tr', table).addClass('no-drag-handle');
+ } else {
+ $(table).on('mouseover', 'tr', function() {
+ $(this.cells[0]).addClass('drag-handle');
+ }).on('mouseout', 'tr', function() {
+ $(this.cells[0]).removeClass('drag-handle');
+ });
+ }
+ var dataOptions = {
+ onDragClass: data.amsTabledndDragClass || 'dragging-row',
+ onDragStart: ams.getFunctionByName(data.amsTabledndDragStart),
+ dragHandle: data.amsTabledndDragHandle,
+ scrollAmount: data.amsTabledndScrollAmount,
+ onAllowDrop: data.amsTabledndAllowDrop,
+ onDrop: ams.getFunctionByName(data.amsTabledndDrop) || function(dnd_table, row) {
+ var target = data.amsTabledndDropTarget;
+ if (target) {
+ // Disable row click handler
+ $(row).data('ams-disabled-handlers', 'click');
+ try {
+ var rows = [];
+ $(dnd_table.rows).each(function() {
+ var rowId = $(this).data('ams-element-name');
+ if (rowId) {
+ rows.push(rowId);
+ }
+ });
+ var localTarget = ams.getFunctionByName(target);
+ if (typeof (localTarget) === 'function') {
+ localTarget.call(table, dnd_table, rows);
+ } else {
+ if (!target.startsWith(window.location.protocol)) {
+ var location = data.amsLocation;
+ if (location) {
+ target = location + '/' + target;
+ }
+ }
+ ams.ajax && ams.ajax.post(target, {names: JSON.stringify(rows)});
+ }
+ } finally {
+ // Restore row click handler
+ setTimeout(function() {
+ $(row).removeData('ams-disabled-handlers');
+ }, 50);
+ }
+ }
+ return false;
+ }
+ };
+ var settings = $.extend({}, dataOptions, data.amsTabledndOptions);
+ settings = ams.executeFunctionByName(data.amsTabledndInitCallback, table, settings) || settings;
+ var plugin = table.tableDnD(settings);
+ ams.executeFunctionByName(data.amsTabledndAfterInitCallback, table, plugin, settings);
+ });
+ });
}
},
@@ -1328,39 +1331,39 @@
wizard: function(element) {
var wizards = $('.wizard', element);
if (wizards.length > 0) {
- ams.ajax.check($.fn.bootstrapWizard,
- ams.baseURL + 'ext/bootstrap-wizard-1.4.2' + ams.devext + '.js',
- function() {
- wizards.each(function() {
- var wizard = $(this);
- var data = wizard.data();
- var dataOptions = {
- withVisible: data.amsWizardWithVisible === undefined ? true : data.amsWizardWithVisible,
- tabClass: data.amsWizardTabClass,
- firstSelector: data.amsWizardFirstSelector,
- previousSelector: data.amsWizardPreviousSelector,
- nextSelector: data.amsWizardNextSelector,
- lastSelector: data.amsWizardLastSelector,
- finishSelector: data.amsWizardFinishSelector,
- backSelector: data.amsWizardBackSelector,
- onInit: ams.getFunctionByName(data.amsWizardInit),
- onShow: ams.getFunctionByName(data.amsWizardShow),
- onNext: ams.getFunctionByName(data.amsWizardNext),
- onPrevious: ams.getFunctionByName(data.amsWizardPrevious),
- onFirst: ams.getFunctionByName(data.amsWizardFirst),
- onLast: ams.getFunctionByName(data.amsWizardLast),
- onBack: ams.getFunctionByName(data.amsWizardBack),
- onFinish: ams.getFunctionByName(data.amsWizardFinish),
- onTabChange: ams.getFunctionByName(data.amsWizardTabChange),
- onTabClick: ams.getFunctionByName(data.amsWizardTabClick),
- onTabShow: ams.getFunctionByName(data.amsWizardTabShow)
- };
- var settings = $.extend({}, dataOptions, data.amsWizardOptions);
- settings = ams.executeFunctionByName(data.amsWizardInitCallback, wizard, settings) || settings;
- var plugin = wizard.bootstrapWizard(settings);
- ams.executeFunctionByName(data.amsWizardAfterInitCallback, wizard, plugin, settings);
- });
- });
+ ams.ajax && ams.ajax.check($.fn.bootstrapWizard,
+ ams.baseURL + 'ext/bootstrap-wizard-1.4.2' + ams.devext + '.js',
+ function() {
+ wizards.each(function() {
+ var wizard = $(this);
+ var data = wizard.data();
+ var dataOptions = {
+ withVisible: data.amsWizardWithVisible === undefined ? true : data.amsWizardWithVisible,
+ tabClass: data.amsWizardTabClass,
+ firstSelector: data.amsWizardFirstSelector,
+ previousSelector: data.amsWizardPreviousSelector,
+ nextSelector: data.amsWizardNextSelector,
+ lastSelector: data.amsWizardLastSelector,
+ finishSelector: data.amsWizardFinishSelector,
+ backSelector: data.amsWizardBackSelector,
+ onInit: ams.getFunctionByName(data.amsWizardInit),
+ onShow: ams.getFunctionByName(data.amsWizardShow),
+ onNext: ams.getFunctionByName(data.amsWizardNext),
+ onPrevious: ams.getFunctionByName(data.amsWizardPrevious),
+ onFirst: ams.getFunctionByName(data.amsWizardFirst),
+ onLast: ams.getFunctionByName(data.amsWizardLast),
+ onBack: ams.getFunctionByName(data.amsWizardBack),
+ onFinish: ams.getFunctionByName(data.amsWizardFinish),
+ onTabChange: ams.getFunctionByName(data.amsWizardTabChange),
+ onTabClick: ams.getFunctionByName(data.amsWizardTabClick),
+ onTabShow: ams.getFunctionByName(data.amsWizardTabShow)
+ };
+ var settings = $.extend({}, dataOptions, data.amsWizardOptions);
+ settings = ams.executeFunctionByName(data.amsWizardInitCallback, wizard, settings) || settings;
+ var plugin = wizard.bootstrapWizard(settings);
+ ams.executeFunctionByName(data.amsWizardAfterInitCallback, wizard, plugin, settings);
+ });
+ });
}
},
@@ -1381,82 +1384,82 @@
var editors = $('.tinymce', element);
if (editors.length > 0) {
var baseURL = ams.baseURL + 'ext/tinymce' + (ams.devmode ? '/dev' : '');
- ams.ajax.check(window.tinymce,
- baseURL + '/tinymce' + ams.devext + '.js',
- function(first_load) {
+ ams.ajax && ams.ajax.check(window.tinymce,
+ baseURL + '/tinymce' + ams.devext + '.js',
+ function(first_load) {
- function initEditors() {
- editors.each(function() {
- var editor = $(this);
- var data = editor.data();
- var dataOptions = {
- theme: data.amsTinymceTheme || "modern",
- language: ams.lang,
- menubar: data.amsTinymceMenubar !== false,
- statusbar: data.amsTinymceStatusbar !== false,
- plugins: data.amsTinymcePlugins || [
- "advlist autosave autolink lists link charmap print preview hr anchor pagebreak",
- "searchreplace wordcount visualblocks visualchars code fullscreen",
- "insertdatetime nonbreaking save table contextmenu directionality",
- "emoticons paste textcolor colorpicker textpattern autoresize"
- ],
- toolbar: data.amsTinymceToolbar,
- toolbar1: data.amsTinymceToolbar1 === false ? false : data.amsTinymceToolbar1 ||
- "undo redo | pastetext | styleselect | bold italic | alignleft " +
- "aligncenter alignright alignjustify | bullist numlist " +
- "outdent indent",
- toolbar2: data.amsTinymceToolbar2 === false ? false : data.amsTinymceToolbar2 ||
- "forecolor backcolor emoticons | charmap link image media | " +
- "fullscreen preview print | code",
- content_css: data.amsTinymceContentCss,
- formats: data.amsTinymceFormats,
- style_formats: data.amsTinymceStyleFormats,
- block_formats: data.amsTinymceBlockFormats,
- valid_classes: data.amsTinymceValidClasses,
- image_advtab: true,
- image_list: ams.getFunctionByName(data.amsTinymceImageList) || data.amsTinymceImageList,
- image_class_list: data.amsTinymceImageClassList,
- link_list: ams.getFunctionByName(data.amsTinymceLinkList) || data.amsTinymceLinkList,
- link_class_list: data.amsTinymceLinkClassList,
- paste_as_text: data.amsTinymcePasteAsText === undefined ? true : data.amsTinymcePasteAsText,
- paste_auto_cleanup_on_paste: data.amsTinymcePasteAutoCleanup === undefined ? true : data.amsTinymcePasteAutoCleanup,
- paste_strip_class_attributes: data.amsTinymcePasteStripClassAttributes || 'all',
- paste_remove_spans: data.amsTinymcePaseRemoveSpans === undefined ? true : data.amsTinymcePasteRemoveSpans,
- paste_remove_styles: data.amsTinymcePasteRemoveStyles === undefined ? true : data.amsTinymcePasteRemoveStyles,
- height: data.amsTinymceHeight || 50,
- min_height: 50,
- resize: true,
- autoresize_min_height: 50,
- autoresize_max_height: 500
- };
- if (data.amsTinymceExternalPlugins) {
- var names = data.amsTinymceExternalPlugins.split(/\s+/);
- for (var index in names) {
- if (!names.hasOwnProperty(index)) {
- continue;
- }
- var pluginSrc = editor.data('ams-tinymce-plugin-' + names[index]);
- tinymce.PluginManager.load(names[index], ams.getSource(pluginSrc));
- }
- }
- var settings = $.extend({}, dataOptions, data.amsTinymceOptions);
- settings = ams.executeFunctionByName(data.amsTinymceInitCallback, editor, settings) || settings;
- var plugin = editor.tinymce(settings);
- ams.executeFunctionByName(data.amsTinymceAfterInitCallback, editor, plugin, settings);
- });
- }
+ function initEditors() {
+ editors.each(function() {
+ var editor = $(this);
+ var data = editor.data();
+ var dataOptions = {
+ theme: data.amsTinymceTheme || "modern",
+ language: ams.lang,
+ menubar: data.amsTinymceMenubar !== false,
+ statusbar: data.amsTinymceStatusbar !== false,
+ plugins: data.amsTinymcePlugins || [
+ "advlist autosave autolink lists link charmap print preview hr anchor pagebreak",
+ "searchreplace wordcount visualblocks visualchars code fullscreen",
+ "insertdatetime nonbreaking save table contextmenu directionality",
+ "emoticons paste textcolor colorpicker textpattern autoresize"
+ ],
+ toolbar: data.amsTinymceToolbar,
+ toolbar1: data.amsTinymceToolbar1 === false ? false : data.amsTinymceToolbar1 ||
+ "undo redo | pastetext | styleselect | bold italic | alignleft " +
+ "aligncenter alignright alignjustify | bullist numlist " +
+ "outdent indent",
+ toolbar2: data.amsTinymceToolbar2 === false ? false : data.amsTinymceToolbar2 ||
+ "forecolor backcolor emoticons | charmap link image media | " +
+ "fullscreen preview print | code",
+ content_css: data.amsTinymceContentCss,
+ formats: data.amsTinymceFormats,
+ style_formats: data.amsTinymceStyleFormats,
+ block_formats: data.amsTinymceBlockFormats,
+ valid_classes: data.amsTinymceValidClasses,
+ image_advtab: true,
+ image_list: ams.getFunctionByName(data.amsTinymceImageList) || data.amsTinymceImageList,
+ image_class_list: data.amsTinymceImageClassList,
+ link_list: ams.getFunctionByName(data.amsTinymceLinkList) || data.amsTinymceLinkList,
+ link_class_list: data.amsTinymceLinkClassList,
+ paste_as_text: data.amsTinymcePasteAsText === undefined ? true : data.amsTinymcePasteAsText,
+ paste_auto_cleanup_on_paste: data.amsTinymcePasteAutoCleanup === undefined ? true : data.amsTinymcePasteAutoCleanup,
+ paste_strip_class_attributes: data.amsTinymcePasteStripClassAttributes || 'all',
+ paste_remove_spans: data.amsTinymcePaseRemoveSpans === undefined ? true : data.amsTinymcePasteRemoveSpans,
+ paste_remove_styles: data.amsTinymcePasteRemoveStyles === undefined ? true : data.amsTinymcePasteRemoveStyles,
+ height: data.amsTinymceHeight || 50,
+ min_height: 50,
+ resize: true,
+ autoresize_min_height: 50,
+ autoresize_max_height: 500
+ };
+ if (data.amsTinymceExternalPlugins) {
+ var names = data.amsTinymceExternalPlugins.split(/\s+/);
+ for (var index in names) {
+ if (!names.hasOwnProperty(index)) {
+ continue;
+ }
+ var pluginSrc = editor.data('ams-tinymce-plugin-' + names[index]);
+ tinymce.PluginManager.load(names[index], ams.getSource(pluginSrc));
+ }
+ }
+ var settings = $.extend({}, dataOptions, data.amsTinymceOptions);
+ settings = ams.executeFunctionByName(data.amsTinymceInitCallback, editor, settings) || settings;
+ var plugin = editor.tinymce(settings);
+ ams.executeFunctionByName(data.amsTinymceAfterInitCallback, editor, plugin, settings);
+ });
+ }
- if (first_load) {
- ams.getScript(baseURL + '/jquery.tinymce' + ams.devext + '.js', function() {
- tinymce.baseURL = baseURL;
- tinymce.suffix = ams.devext;
- ams.skin.registerCleanCallback(cleanEditors);
- initEditors();
- });
- } else {
- initEditors();
- }
- });
+ if (first_load) {
+ ams.getScript(baseURL + '/jquery.tinymce' + ams.devext + '.js', function() {
+ tinymce.baseURL = baseURL;
+ tinymce.suffix = ams.devext;
+ ams.skin && ams.skin.registerCleanCallback(cleanEditors);
+ initEditors();
+ });
+ } else {
+ initEditors();
+ }
+ });
}
},
@@ -1466,48 +1469,48 @@
imgareaselect: function(element) {
var images = $('.imgareaselect', element);
if (images.length > 0) {
- ams.ajax.check($.fn.imgAreaSelect,
- ams.baseURL + 'ext/jquery-imgareaselect-0.9.11-rc1' + ams.devext + '.js',
- function() {
- ams.getCSS(ams.baseURL + '../css/ext/jquery-imgareaselect' + ams.devext + '.css',
- 'jquery-imgareaselect',
- function() {
- images.each(function () {
- var image = $(this);
- var data = image.data();
- var parent = data.amsImgareaselectParent ? image.parents(data.amsImgareaselectParent) : 'body';
- var dataOptions = {
- instance: true,
- handles: true,
- parent: parent,
- x1: data.amsImgareaselectX1 || 0,
- y1: data.amsImgareaselectY1 || 0,
- x2: data.amsImgareaselectX2 || data.amsImgareaselectImageWidth,
- y2: data.amsImgareaselectY2 || data.amsImgareaselectImageHeight,
- imageWidth: data.amsImgareaselectImageWidth,
- imageHeight: data.amsImgareaselectImageHeight,
- minWidth: 128,
- minHeight: 128,
- aspectRatio: data.amsImgareaselectRatio,
- onSelectEnd: ams.getFunctionByName(data.amsImgareaselectSelectEnd) || function (img, selection) {
- var target = data.amsImgareaselectTargetField || 'image_';
- $('input[name="' + target + 'x1"]', parent).val(selection.x1);
- $('input[name="' + target + 'y1"]', parent).val(selection.y1);
- $('input[name="' + target + 'x2"]', parent).val(selection.x2);
- $('input[name="' + target + 'y2"]', parent).val(selection.y2);
- }
- };
- var settings = $.extend({}, dataOptions, data.amsImgareaselectOptions);
- settings = ams.executeFunctionByName(data.amsImgareaselectInitCallback, image, settings) || settings;
- var plugin = image.imgAreaSelect(settings);
- ams.executeFunctionByName(data.amsImgareaselectAfterInitCallback, image, plugin, settings);
- // Add update timeout when plug-in is displayed into a modal dialog
- setTimeout(function () {
- plugin.update();
- }, 250);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.imgAreaSelect,
+ ams.baseURL + 'ext/jquery-imgareaselect-0.9.11-rc1' + ams.devext + '.js',
+ function() {
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-imgareaselect' + ams.devext + '.css',
+ 'jquery-imgareaselect',
+ function() {
+ images.each(function() {
+ var image = $(this);
+ var data = image.data();
+ var parent = data.amsImgareaselectParent ? image.parents(data.amsImgareaselectParent) : 'body';
+ var dataOptions = {
+ instance: true,
+ handles: true,
+ parent: parent,
+ x1: data.amsImgareaselectX1 || 0,
+ y1: data.amsImgareaselectY1 || 0,
+ x2: data.amsImgareaselectX2 || data.amsImgareaselectImageWidth,
+ y2: data.amsImgareaselectY2 || data.amsImgareaselectImageHeight,
+ imageWidth: data.amsImgareaselectImageWidth,
+ imageHeight: data.amsImgareaselectImageHeight,
+ minWidth: 128,
+ minHeight: 128,
+ aspectRatio: data.amsImgareaselectRatio,
+ onSelectEnd: ams.getFunctionByName(data.amsImgareaselectSelectEnd) || function(img, selection) {
+ var target = data.amsImgareaselectTargetField || 'image_';
+ $('input[name="' + target + 'x1"]', parent).val(selection.x1);
+ $('input[name="' + target + 'y1"]', parent).val(selection.y1);
+ $('input[name="' + target + 'x2"]', parent).val(selection.x2);
+ $('input[name="' + target + 'y2"]', parent).val(selection.y2);
+ }
+ };
+ var settings = $.extend({}, dataOptions, data.amsImgareaselectOptions);
+ settings = ams.executeFunctionByName(data.amsImgareaselectInitCallback, image, settings) || settings;
+ var plugin = image.imgAreaSelect(settings);
+ ams.executeFunctionByName(data.amsImgareaselectAfterInitCallback, image, plugin, settings);
+ // Add update timeout when plug-in is displayed into a modal dialog
+ setTimeout(function() {
+ plugin.update();
+ }, 250);
+ });
+ });
+ });
}
},
@@ -1517,97 +1520,97 @@
fancybox: function(element) {
var fancyboxes = $('.fancybox', element);
if (fancyboxes.length > 0) {
- ams.ajax.check($.fn.fancybox,
- ams.baseURL + 'ext/jquery-fancybox-2.1.5' + ams.devext + '.js',
- function() {
- ams.getCSS(ams.baseURL + '../css/ext/jquery-fancybox-2.1.5' + ams.devext + '.css',
- 'jquery-fancybox',
- function() {
- fancyboxes.each(function () {
- var fancybox = $(this);
- var data = fancybox.data();
- var elements = fancybox;
- var index,
- helper;
- if (data.amsFancyboxElements) {
- elements = $(data.amsFancyboxElements, fancybox);
- }
- var helpers = (data.amsFancyboxHelpers || '').split(/\s+/);
- if (helpers.length > 0) {
- for (index = 0; index < helpers.length; index++) {
- helper = helpers[index];
- switch (helper) {
- case 'buttons':
- ams.ajax.check($.fancybox.helpers.buttons,
- ams.baseURL + 'ext/fancybox-helpers/fancybox-buttons' + ams.devext + '.js');
- break;
- case 'thumbs':
- ams.ajax.check($.fancybox.helpers.thumbs,
- ams.baseURL + 'ext/fancybox-helpers/fancybox-thumbs' + ams.devext + '.js');
- break;
- case 'media':
- ams.ajax.check($.fancybox.helpers.media,
- ams.baseURL + 'ext/fancybox-helpers/fancybox-media' + ams.devext + '.js');
- break;
- default:
- break;
- }
- }
- }
- var dataOptions = {
- type: data.amsFancyboxType,
- padding: data.amsFancyboxPadding || 10,
- margin: data.amsFancyboxMargin || 10,
- loop: data.amsFancyboxLoop,
- beforeLoad: ams.getFunctionByName(data.amsFancyboxBeforeLoad) || function () {
- var title;
- if (data.amsFancyboxTitleGetter) {
- title = ams.executeFunctionByName(data.amsFancyboxTitleGetter, this);
- }
- if (!title) {
- var content = $('*:first', this.element);
- title = content.attr('original-title') || content.attr('title');
- if (!title) {
- title = $(this.element).attr('original-title') || $(this.element).attr('title');
- }
- }
- this.title = title;
- },
- afterLoad: ams.getFunctionByName(data.amsFancyboxAfterLoad),
- helpers: {
- title: {
- type: 'inside'
- }
- }
- };
- if (helpers.length > 0) {
- for (index = 0; index < helpers.length; index++) {
- helper = helpers[index];
- switch (helper) {
- case 'buttons':
- dataOptions.helpers.buttons = {
- position: data.amsFancyboxButtonsPosition || 'top'
- };
- break;
- case 'thumbs':
- dataOptions.helpers.thumbs = {
- width: data.amsFancyboxThumbsWidth || 50,
- height: data.amsFancyboxThumbsHeight || 50
- };
- break;
- case 'media':
- dataOptions.helpers.media = true;
- break;
- }
- }
- }
- var settings = $.extend({}, dataOptions, data.amsFancyboxOptions);
- settings = ams.executeFunctionByName(data.amsFancyboxInitCallback, fancybox, settings) || settings;
- var plugin = elements.fancybox(settings);
- ams.executeFunctionByName(data.amsFancyboxAfterInitCallback, fancybox, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.fancybox,
+ ams.baseURL + 'ext/jquery-fancybox-2.1.5' + ams.devext + '.js',
+ function() {
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-fancybox-2.1.5' + ams.devext + '.css',
+ 'jquery-fancybox',
+ function() {
+ fancyboxes.each(function() {
+ var fancybox = $(this);
+ var data = fancybox.data();
+ var elements = fancybox;
+ var index,
+ helper;
+ if (data.amsFancyboxElements) {
+ elements = $(data.amsFancyboxElements, fancybox);
+ }
+ var helpers = (data.amsFancyboxHelpers || '').split(/\s+/);
+ if (helpers.length > 0) {
+ for (index = 0; index < helpers.length; index++) {
+ helper = helpers[index];
+ switch (helper) {
+ case 'buttons':
+ ams.ajax && ams.ajax.check($.fancybox.helpers.buttons,
+ ams.baseURL + 'ext/fancybox-helpers/fancybox-buttons' + ams.devext + '.js');
+ break;
+ case 'thumbs':
+ ams.ajax && ams.ajax.check($.fancybox.helpers.thumbs,
+ ams.baseURL + 'ext/fancybox-helpers/fancybox-thumbs' + ams.devext + '.js');
+ break;
+ case 'media':
+ ams.ajax && ams.ajax.check($.fancybox.helpers.media,
+ ams.baseURL + 'ext/fancybox-helpers/fancybox-media' + ams.devext + '.js');
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ var dataOptions = {
+ type: data.amsFancyboxType,
+ padding: data.amsFancyboxPadding || 10,
+ margin: data.amsFancyboxMargin || 10,
+ loop: data.amsFancyboxLoop,
+ beforeLoad: ams.getFunctionByName(data.amsFancyboxBeforeLoad) || function() {
+ var title;
+ if (data.amsFancyboxTitleGetter) {
+ title = ams.executeFunctionByName(data.amsFancyboxTitleGetter, this);
+ }
+ if (!title) {
+ var content = $('*:first', this.element);
+ title = content.attr('original-title') || content.attr('title');
+ if (!title) {
+ title = $(this.element).attr('original-title') || $(this.element).attr('title');
+ }
+ }
+ this.title = title;
+ },
+ afterLoad: ams.getFunctionByName(data.amsFancyboxAfterLoad),
+ helpers: {
+ title: {
+ type: 'inside'
+ }
+ }
+ };
+ if (helpers.length > 0) {
+ for (index = 0; index < helpers.length; index++) {
+ helper = helpers[index];
+ switch (helper) {
+ case 'buttons':
+ dataOptions.helpers.buttons = {
+ position: data.amsFancyboxButtonsPosition || 'top'
+ };
+ break;
+ case 'thumbs':
+ dataOptions.helpers.thumbs = {
+ width: data.amsFancyboxThumbsWidth || 50,
+ height: data.amsFancyboxThumbsHeight || 50
+ };
+ break;
+ case 'media':
+ dataOptions.helpers.media = true;
+ break;
+ }
+ }
+ }
+ var settings = $.extend({}, dataOptions, data.amsFancyboxOptions);
+ settings = ams.executeFunctionByName(data.amsFancyboxInitCallback, fancybox, settings) || settings;
+ var plugin = elements.fancybox(settings);
+ ams.executeFunctionByName(data.amsFancyboxAfterInitCallback, fancybox, plugin, settings);
+ });
+ });
+ });
}
},
@@ -1617,45 +1620,45 @@
chart: function(element) {
var charts = $('.chart', element);
if (charts.length > 0) {
- ams.ajax.check($.fn.plot,
- ams.baseURL + 'flot/jquery.flot' + ams.devext + '.js',
- function() {
- charts.each(function() {
+ ams.ajax && ams.ajax.check($.fn.plot,
+ ams.baseURL + 'flot/jquery.flot' + ams.devext + '.js',
+ function() {
+ charts.each(function() {
- function checkPlugin(plugin) {
- for (var index in $.plot.plugins) {
- if ($.plot.plugins.hasOwnProperty(index)) {
- var pluginInfo = $.plot.plugins[index];
- if (pluginInfo.name === plugin) {
- return pluginInfo;
- }
- }
- }
- return null;
- }
+ function checkPlugin(plugin) {
+ for (var index in $.plot.plugins) {
+ if ($.plot.plugins.hasOwnProperty(index)) {
+ var pluginInfo = $.plot.plugins[index];
+ if (pluginInfo.name === plugin) {
+ return pluginInfo;
+ }
+ }
+ }
+ return null;
+ }
- var chart = $(this);
- var data = chart.data();
- var dataOptions = {};
- var plugins = (data.amsChartPlugins || '').split(/\s+/);
- if (plugins.length > 0) {
- for (var index in plugins) {
- if (plugins.hasOwnProperty(index)) {
- var pluginName = plugins[index];
- if (!checkPlugin(pluginName)) {
- ams.getScript(ams.baseURL + 'flot/jquery.flot.' + pluginName + ams.devext + '.js');
- }
- }
- }
- }
- var settings = $.extend({}, dataOptions, data.amsChartOptions);
- settings = ams.executeFunctionByName(data.amsChartInitCallback, chart, settings) || settings;
- var chartData = data.amsChartData;
- chartData = ams.executeFunctionByName(data.amsChartInitData, chart, chartData) || chartData;
- var plugin = chart.plot(chartData, settings);
- ams.executeFunctionByName(data.amsChartAfterInitCallback, chart, plugin, settings);
- });
- });
+ var chart = $(this);
+ var data = chart.data();
+ var dataOptions = {};
+ var plugins = (data.amsChartPlugins || '').split(/\s+/);
+ if (plugins.length > 0) {
+ for (var index in plugins) {
+ if (plugins.hasOwnProperty(index)) {
+ var pluginName = plugins[index];
+ if (!checkPlugin(pluginName)) {
+ ams.getScript(ams.baseURL + 'flot/jquery.flot.' + pluginName + ams.devext + '.js');
+ }
+ }
+ }
+ }
+ var settings = $.extend({}, dataOptions, data.amsChartOptions);
+ settings = ams.executeFunctionByName(data.amsChartInitCallback, chart, settings) || settings;
+ var chartData = data.amsChartData;
+ chartData = ams.executeFunctionByName(data.amsChartInitData, chart, chartData) || chartData;
+ var plugin = chart.plot(chartData, settings);
+ ams.executeFunctionByName(data.amsChartAfterInitCallback, chart, plugin, settings);
+ });
+ });
}
},
@@ -1665,11 +1668,11 @@
graphs: function(element) {
var graphs = $('.sparkline', element);
if (graphs.length > 0) {
- ams.ajax.check(ams.graphs,
- ams.baseURL + 'myams-graphs' + ams.devext + '.js',
- function() {
- ams.graphs.init(graphs);
- });
+ ams.ajax && ams.ajax.check(ams.graphs,
+ ams.baseURL + 'myams-graphs' + ams.devext + '.js',
+ function() {
+ ams.graphs.init(graphs);
+ });
}
},
@@ -1679,29 +1682,29 @@
scrollbars: function(element) {
var scrollbars = $('.scrollbar', element);
if (scrollbars.length > 0) {
- ams.ajax.check($.event.special.mousewheel,
- ams.baseURL + 'ext/jquery-mousewheel.min.js',
- function() {
- ams.ajax.check($.fn.mCustomScrollbar,
- ams.baseURL + 'ext/jquery-mCustomScrollbar' + ams.devext + '.js',
- function() {
- ams.getCSS(ams.baseURL + '../css/ext/jquery-mCustomScrollbar.css',
- 'jquery-mCustomScrollbar',
- function () {
- scrollbars.each(function () {
- var scrollbar = $(this);
- var data = scrollbar.data();
- var dataOptions = {
- theme: data.amsScrollbarTheme || 'light'
- };
- var settings = $.extend({}, dataOptions, data.amsScrollbarOptions);
- settings = ams.executeFunctionByName(data.amsScrollbarInitCallback, scrollbar, settings) || settings;
- var plugin = scrollbar.mCustomScrollbar(settings);
- ams.executeFunctionByName(data.amsScrollbarAfterInitCallback, scrollbar, plugin, settings);
- });
- });
- });
- });
+ ams.ajax && ams.ajax.check($.event.special.mousewheel,
+ ams.baseURL + 'ext/jquery-mousewheel.min.js',
+ function() {
+ ams.ajax.check($.fn.mCustomScrollbar,
+ ams.baseURL + 'ext/jquery-mCustomScrollbar' + ams.devext + '.js',
+ function() {
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-mCustomScrollbar.css',
+ 'jquery-mCustomScrollbar',
+ function() {
+ scrollbars.each(function() {
+ var scrollbar = $(this);
+ var data = scrollbar.data();
+ var dataOptions = {
+ theme: data.amsScrollbarTheme || 'light'
+ };
+ var settings = $.extend({}, dataOptions, data.amsScrollbarOptions);
+ settings = ams.executeFunctionByName(data.amsScrollbarInitCallback, scrollbar, settings) || settings;
+ var plugin = scrollbar.mCustomScrollbar(settings);
+ ams.executeFunctionByName(data.amsScrollbarAfterInitCallback, scrollbar, plugin, settings);
+ });
+ });
+ });
+ });
}
}
});
--- a/src/pyams_skin/resources/js/myams-plugins.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-plugins.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(e,a){var t=a.MyAMS;e.extend(t.plugins.enabled,{svg:function(a){var t=e(".svg-container",a);t.length>0&&t.each(function(){var a=e(this),t=e("svg",a),n=t.attr("width"),i=t.attr("height");n&&i&&t.get(0).setAttribute("viewBox","0 0 "+Math.round(parseFloat(n))+" "+Math.round(parseFloat(i))),t.attr("width","100%").attr("height","auto")})},hint:function(a){var n=e(".hint:not(:parents(.nohints))",a);n.length>0&&t.ajax.check(e.fn.tipsy,t.baseURL+"ext/jquery-tipsy"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-tipsy"+t.devext+".css","jquery-tipsy",function(){n.each(function(){var a=e(this),n=a.data(),i={html:void 0===n.amsHintHtml?(a.attr("title")||"").startsWith("<"):n.amsHintHtml,title:t.getFunctionByName(n.amsHintTitleGetter)||function(){var a=e(this),t=a.attr("original-title")||a.attr(n.amsHintTitleAttr||"title")||(n.amsHintHtml?a.html():a.text());return t=t.replace(/\?_="/,"?_="+(new Date).getTime()+'"')},opacity:n.amsHintOpacity||.95,gravity:n.amsHintGravity||"sw",offset:n.amsHintOffset||0},s=e.extend({},i,n.amsHintOptions);s=t.executeFunctionByName(n.amsHintInitCallback,a,s)||s;var r=a.tipsy(s);t.executeFunctionByName(n.amsHintAfterInitCallback,a,r,s)})})})},contextMenu:function(a){var n=e(".context-menu",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={menuSelector:n.amsContextmenuSelector,menuSelected:t.helpers.contextMenuHandler},s=e.extend({},i,n.amsContextmenuOptions);s=t.executeFunctionByName(n.amsContextmenuInitCallback,a,s)||s;var r=a.contextMenu(s);t.executeFunctionByName(n.amsContextmenuAfterInitCallback,a,r,s)})},switcher:function(a){e("LEGEND.switcher",a).each(function(){var a=e(this),t=a.parent("fieldset"),n=a.data();n.amsSwitcher||(e('<i class="fa fa-fw"></i>').prependTo(e(this)).addClass("open"===n.amsSwitcherState?n.amsSwitcherMinusClass||"fa-minus":n.amsSwitcherPlusClass||"fa-plus"),a.on("click",function(i){i.preventDefault();var s={};if(a.trigger("ams.switcher.before-switch",[a,s]),!s.veto)if(t.hasClass("switched")){t.removeClass("switched"),e(".fa",a).removeClass(n.amsSwitcherPlusClass||"fa-plus").addClass(n.amsSwitcherMinusClass||"fa-minus"),a.trigger("ams.switcher.opened",[a]);var r=a.attr("id");r&&e('legend.switcher[data-ams-switcher-sync="'+r+'"]',t).each(function(){var a=e(this);a.parents("fieldset").hasClass("switched")&&a.click()})}else t.addClass("switched"),e(".fa",a).removeClass(n.amsSwitcherMinusClass||"fa-minus").addClass(n.amsSwitcherPlusClass||"fa-plus"),a.trigger("ams.switcher.closed",[a])}),"open"!==n.amsSwitcherState&&t.addClass("switched"),a.data("ams-switcher","on"))})},checker:function(a){e("LEGEND.checker",a).each(function(){var a=e(this),n=a.parent("fieldset"),i=a.data();if(!i.amsChecker){var s=e('<label class="checkbox"></label>'),r=i.amsCheckerFieldname||"checker_"+t.generateId(),o=r.replace(/\./,"_"),c=i.amsCheckerHiddenPrefix,l=null,m=i.amsCheckerHiddenValueOn||"true",d=i.amsCheckerHiddenValueOff||"false",u=i.amsCheckerMarker||!1;c?l=e('<input type="hidden">').attr("name",c+r).val("on"===i.amsCheckerState?m:d).prependTo(a):u&&e('<input type="hidden">').attr("name",u).attr("value",1).prependTo(a);var b=e('<input type="checkbox">').attr("name",r).attr("id",o).data("ams-checker-hidden-input",l).data("ams-checker-init",!0).val(i.amsCheckerValue||!0).attr("checked","on"===i.amsCheckerState?"checked":null);i.amsCheckerReadonly?b.attr("disabled","disabled"):b.on("change",function(s){s.preventDefault();var r={},o=e(this).is(":checked");if(a.trigger("ams.checker.before-switch",[a,r]),r.veto)e(this).prop("checked",!o);else if(t.executeFunctionByName(i.amsCheckerChangeHandler,a,o),!i.amsCheckerCancelDefault){var c=b.data("ams-checker-hidden-input");o?("disable"===i.amsCheckerMode?(n.removeAttr("disabled"),e(".select2",n).removeAttr("disabled")):n.removeClass("switched"),c&&c.val(m),e("[data-required]",n).attr("required","required"),a.trigger("ams.checker.opened",[a])):("disable"===i.amsCheckerMode?(n.prop("disabled","disabled"),e(".select2",n).attr("disabled","disabled")):n.addClass("switched"),c&&c.val(d),e("[data-required]",n).removeAttr("required"),a.trigger("ams.checker.closed",[a]))}}),b.appendTo(s),e(">label",a).attr("for",b.attr("id")),s.append("<i></i>").prependTo(a);var h=e("[required]",n);h.attr("data-required",!0),"on"===i.amsCheckerState?b.attr("checked",!0):("disable"===i.amsCheckerMode?(n.attr("disabled","disabled"),e(".select2",n).attr("disabled","disabled")):n.addClass("switched"),h.removeAttr("required")),a.data("ams-checker","on")}})},slider:function(a){var n=e(".slider",a);n.length>0&&t.ajax.check(e.fn.slider,t.baseURL+"ext/bootstrap-slider-2.0.0"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i=e.extend({},{},a.data.amsSliderOptions);i=t.executeFunctionByName(n.amsSliderInitCallback,a,i)||i;var s=a.slider(i);t.executeFunctionByName(n.amsSliderAfterInitCallback,a,s,i)})})},draggable:function(a){var n=e(".draggable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={cursor:n.amsDraggableCursor||"move",containment:n.amsDraggableContainment,handle:n.amsDraggableHandle,connectToSortable:n.amsDraggableConnectSortable,helper:t.getFunctionByName(n.amsDraggableHelper)||n.amsDraggableHelper,start:t.getFunctionByName(n.amsDraggableStart),stop:t.getFunctionByName(n.amsDraggableStop)},s=e.extend({},i,n.amsDraggableOptions);s=t.executeFunctionByName(n.amsDraggableInitCallback,a,s)||s;var r=a.draggable(s);a.disableSelection(),t.executeFunctionByName(n.amsDraggableAfterInitCallback,a,r,s)})},droppable:function(a){var n=e(".droppable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={accept:n.amsdroppableAccept,drop:t.getFunctionByName(n.amsDroppableDrop)},s=e.extend({},i,n.amsDroppableOptions);s=t.executeFunctionByName(n.amsDroppableInitCallback,a,s)||s;var r=a.droppable(s);t.executeFunctionByName(n.amsDroppableAfterInitCallback,a,r,s)})},sortable:function(a){var n=e(".sortable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={items:n.amsSortableItems,handle:n.amsSortableHandle,helper:n.amsSortableHelper,connectWith:n.amsSortableConnectwith,start:t.getFunctionByName(n.amsSortableStart),over:t.getFunctionByName(n.amsSortableOver),containment:n.amsSortableContainment,placeholder:n.amsSortablePlaceholder,stop:t.getFunctionByName(n.amsSortableStop)},s=e.extend({},i,n.amsSortableOptions);s=t.executeFunctionByName(n.amsSortableInitCallback,a,s)||s;var r=a.sortable(s);a.disableSelection(),t.executeFunctionByName(n.amsSortableAfterInitCallback,a,r,s)})},resizable:function(a){var n=e(".resizable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={autoHide:!1===n.amsResizableAutohide||n.amsResizableAutohide,containment:n.amsResizableContainment,grid:n.amsResizableGrid,handles:n.amsResizableHandles,start:t.getFunctionByName(n.amsResizableStart),stop:t.getFunctionByName(n.amsResizableStop)},s=e.extend({},i,n.amsResizableOptions);s=t.executeFunctionByName(n.amsResizableInitCallback,a,s)||s;var r=a.resizable(s);a.disableSelection(),t.executeFunctionByName(n.amsResizableAfterInitCallback,a,r,s)})},typeahead:function(a){var n=e(".typeahead",a);n.length>0&&t.ajax.check(e.fn.typeahead,t.baseURL+"ext/jquery-typeahead"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i=e.extend({},{},n.amsTypeaheadOptions);i=t.executeFunctionByName(n.amsTypeaheadInitCallback,a,i)||i;var s=a.typeahead(i);t.executeFunctionByName(n.amsTypeaheadAfterInitCallback,a,s,i)})})},treeview:function(a){var n=e(".treeview",a);n.length>0&&t.ajax.check(e.fn.treview,t.baseURL+"ext/bootstrap-treeview"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/bootstrap-treeview"+t.devext+".css","bootstrap-treeview",function(){n.each(function(){var a=e(this),n=a.data(),i={data:n.amsTreeviewData,levels:n.amsTreeviewLevels,injectStyle:n.amsTreeviewInjectStyle,expandIcon:n.amsTreeviewExpandIcon||"fa fa-fw fa-plus-square-o",collapseIcon:n.amsTreeviewCollaspeIcon||"fa fa-fw fa-minus-square-o",emptyIcon:n.amsTreeviewEmptyIcon||"fa fa-fw",nodeIcon:n.amsTreeviewNodeIcon,selectedIcon:n.amsTreeviewSelectedIcon,checkedIcon:n.amsTreeviewCheckedIcon||"fa fa-fw fa-check-square-o",uncheckedIcon:n.amsTreeviewUncheckedIcon||"fa fa-fw fa-square-o",color:n.amsTreeviewColor,backColor:n.amsTreeviewBackColor,borderColor:n.amsTreeviewBorderColor,onHoverColor:n.amsTreeviewHoverColor,selectedColor:n.amsTreeviewSelectedColor,selectedBackColor:n.amsTreeviewSelectedBackColor,unselectableColor:n.amsTreeviewUnselectableColor||"rgba(1,1,1,0.25)",unselectableBackColor:n.amsTreeviewUnselectableBackColor||"rgba(1,1,1,0.25)",enableLinks:n.amsTreeviewEnableLinks,highlightSelected:n.amsTreeviewHighlightSelected,highlightSearchResults:n.amsTreeviewhighlightSearchResults,showBorder:n.amsTreeviewShowBorder,showIcon:n.amsTreeviewShowIcon,showCheckbox:n.amsTreeviewShowCheckbox,showTags:n.amsTreeviewShowTags,toggleUnselectable:n.amsTreeviewToggleUnselectable,multiSelect:n.amsTreeviewMultiSelect,onNodeChecked:t.getFunctionByName(n.amsTreeviewNodeChecked),onNodeCollapsed:t.getFunctionByName(n.amsTreeviewNodeCollapsed),onNodeDisabled:t.getFunctionByName(n.amsTreeviewNodeDisabled),onNodeEnabled:t.getFunctionByName(n.amsTreeviewNodeEnabled),onNodeExpanded:t.getFunctionByName(n.amsTreeviewNodeExpanded),onNodeSelected:t.getFunctionByName(n.amsTreeviewNodeSelected),onNodeUnchecked:t.getFunctionByName(n.amsTreeviewNodeUnchecked),onNodeUnselected:t.getFunctionByName(n.amsTreeviewNodeUnselected),onSearchComplete:t.getFunctionByName(n.amsTreeviewSearchComplete),onSearchCleared:t.getFunctionByName(n.amsTreeviewSearchCleared)},s=e.extend({},i,n.amsTreeviewOptions);s=t.executeFunctionByName(n.amsTreeviewInitcallback,a,s)||s;var r=a.treeview(s);t.executeFunctionByName(n.amsTreeviewAfterInitCallback,a,r,s)})})})},select2:function(a){var n=e(".select2",a);n.length>0&&t.ajax.check(e.fn.select2,t.baseURL+"ext/jquery-select2-3.5.4"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data();if(!n.select2){var i={placeholder:n.amsSelect2Placeholder,multiple:n.amsSelect2Multiple,minimumInputLength:n.amsSelect2MinimumInputLength||0,maximumSelectionSize:n.amsSelect2MaximumSelectionSize,openOnEnter:void 0===n.amsSelect2EnterOpen||n.amsSelect2EnterOpen,allowClear:void 0===n.amsSelect2AllowClear||n.amsSelect2AllowClear,width:n.amsSelect2Width||"100%",initSelection:t.getFunctionByName(n.amsSelect2InitSelection),formatSelection:void 0===n.amsSelect2FormatSelection?t.helpers.select2FormatSelection:t.getFunctionByName(n.amsSelect2FormatSelection),formatResult:t.getFunctionByName(n.amsSelect2FormatResult),formatMatches:void 0===n.amsSelect2FormatMatches?function(e){return 1===e?t.i18n.SELECT2_MATCH:e+t.i18n.SELECT2_MATCHES}:t.getFunctionByName(n.amsSelect2FormatMatches),formatNoMatches:void 0===n.amsSelect2FormatResult?function(e){return t.i18n.SELECT2_NOMATCHES}:t.getFunctionByName(n.amsSelect2FormatResult),formatInputTooShort:void 0===n.amsSelect2FormatInputTooShort?function(e,a){var n=a-e.length;return t.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,n).replace(/\{1\}/,1===n?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatInputTooShort),formatInputTooLong:void 0===n.amsSelect2FormatInputTooLong?function(e,a){var n=e.length-a;return t.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,n).replace(/\{1\}/,1===n?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatInputTooLong),formatSelectionTooBig:void 0===n.amsSelect2FormatSelectionTooBig?function(e){return t.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,e).replace(/\{1\}/,1===e?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatSelectionTooBig),formatLoadMore:void 0===n.amsSelect2FormatLoadMore?function(e){return t.i18n.SELECT2_LOADMORE}:t.getFunctionByName(n.amsSelect2FormatLoadMore),formatSearching:void 0===n.amsSelect2FormatSearching?function(){return t.i18n.SELECT2_SEARCHING}:t.getFunctionByName(n.amsSelect2FormatSearching),separator:n.amsSelect2Separator||",",tokenSeparators:n.amsSelect2TokensSeparators||[","],tokenizer:t.getFunctionByName(n.amsSelect2Tokenizer)};switch(a.context.type){case"text":case"hidden":if(!i.initSelection){var s=a.data("ams-select2-values");s&&(i.initSelection=function(a,t){var n=[];e(a.val().split(i.separator)).each(function(){n.push({id:this,text:s[this]||this})}),t(n)})}}a.attr("readonly")?"hidden"===a.attr("type")&&(i.query=function(){return[]}):n.amsSelect2Query?(i.query=t.getFunctionByName(n.amsSelect2Query),i.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2QueryUrl?(i.ajax={url:n.amsSelect2QueryUrl,quietMillis:n.amsSelect2QuietMillis||200,type:n.amsSelect2QueryType||"POST",dataType:n.amsSelect2QueryDatatype||"json",data:function(a,t,i){var s={};return s[n.amsSelect2QueryParamName||"query"]=a,s[n.amsSelect2PageParamName||"page"]=t,s[n.amsSelect2ContextParamName||"context"]=i,e.extend({},s,n.amsSelect2QueryOptions)},results:t.helpers.select2QueryUrlResultsCallback},i.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2QueryMethod?(i.query=function(i){var s={id:(new Date).getTime(),params:n.amsSelect2QueryParams||{},success:function(e){return t.helpers.select2QueryMethodSuccessCallback.call(a,e,"success",i)},error:t.error.show};s.params[n.amsSelect2QueryParamName||"query"]=i.term,s.params[n.amsSelect2PageParamName||"page"]=i.page,s.params[n.amsSelect2ContextParamName||"context"]=i.context,s=e.extend({},s,n.amsSelect2QueryOptions),s=t.executeFunctionByName(n.amsSelect2QueryInitCallback,a,s)||s,t.ajax.check(e.jsonRPC,t.baseURL+"ext/jquery-jsonrpc"+t.devext+".js",function(){e.jsonRPC.withOptions({endPoint:n.amsSelect2MethodTarget||t.jsonrpc.getAddr(),namespace:n.amsSelect2MethodNamespace,cache:!1},function(){e.jsonRPC.request(n.amsSelect2QueryMethod,s)})})},i.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2Tags?i.tags=n.amsSelect2Tags:n.amsSelect2Data&&(i.data=n.amsSelect2Data),n.amsSelect2EnableFreeTags&&(i.createSearchChoice=function(e){return{id:e,text:(n.amsSelect2FreeTagsPrefix||t.i18n.SELECT2_FREETAG_PREFIX)+e}});var r=e.extend({},i,n.amsSelect2Options);r=t.executeFunctionByName(n.amsSelect2InitCallback,a,r)||r;var o=a.select2(r);t.executeFunctionByName(n.amsSelect2AfterInitCallback,a,o,r),a.hasClass("ordered")&&t.ajax.check(e.fn.select2Sortable,t.baseURL+"ext/jquery-select2-sortable"+t.devext+".js",function(){a.select2Sortable({bindOrder:"sortableStop"})}),a.on("change",function(){void 0!==e(a.get(0).form).data("validator")&&e(a).valid()})}})})},maskedit:function(a){var n=e("[data-mask]",a);n.length>0&&t.ajax.check(e.fn.mask,t.baseURL+"ext/jquery-maskedinput-1.4.1"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i={placeholder:void 0===n.amsMaskeditPlaceholder?"X":n.amsMaskeditPlaceholder,complete:t.getFunctionByName(n.amsMaskeditComplete)},s=e.extend({},i,n.amsMaskeditOptions);s=t.executeFunctionByName(n.amsMaskeditInitCallback,a,s)||s;var r=a.mask(a.attr("data-mask"),s);t.executeFunctionByName(n.amsMaskeditAfterInitCallback,a,r,s)})})},inputmask:function(a){var n=e("input[data-input-mask]",a);n.length>0&&t.ajax.check(e.fn.inputmask,t.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+t.devext+".js",function(){n.each(function(){var a,n=e(this),i=n.data();a="object"==typeof i.inputMask?i.inputMask:{mask:i.inputMask.toString()};var s=e.extend({},a,i.amsInputmaskOptions);s=t.executeFunctionByName(i.amsInputmaskInitCallback,n,s)||s;var r=n.inputmask(s);t.executeFunctionByName(i.amsInputmaskAfterInitCallback,n,r,s)})})},datepicker:function(a){var n=e(".datepicker",a);n.length>0&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog.registerHideCallback(t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),i={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"d/m/y",datepicker:!0,dayOfWeekStart:1,timepicker:!1,closeOnDateSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,weeks:n.amsDatetimepickerWeeks},s=e.extend({},i,n.amsDatetimepickerOptions);s=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,s)||s;var r=a.datetimepicker(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},datetimepicker:function(a){var n=e(".datetimepicker",a);n.length>0&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog.registerHideCallback(t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),i={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"d/m/y H:i",datepicker:!0,dayOfWeekStart:1,timepicker:!0,closeOnDateSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,closeOnTimeSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,weeks:n.amsDatetimepickerWeeks},s=e.extend({},i,n.amsDatetimepickerOptions);s=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,s)||s;var r=a.datetimepicker(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},timepicker:function(a){var n=e(".timepicker",a);n.length>0&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog.registerHideCallback(t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),i={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"H:i",datepicker:!1,timepicker:!0,closeOnTimeSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect},s=e.extend({},i,n.amsDatetimepickerOptions);s=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,s)||s;var r=a.datetimepicker(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},colorpicker:function(a){var n=e(".colorpicker",a);n.length>0&&t.ajax.check(e.fn.minicolors,t.baseURL+"ext/jquery-minicolors"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-minicolors"+t.devext+".css","jquery-minicolors",function(){n.each(function(){var a=e(this),n=a.data(),i={position:n.amsColorpickerPosition||a.closest(".input").data("ams-colorpicker-position")||"bottom left"},s=e.extend({},i,n.amsColorpickerOptions);s=t.executeFunctionByName(n.amsColorpickerInitCallback,a,s)||s;var r=a.minicolors(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},dndupload:function(a){var n=e(".dndupload",a);n.length>0&&t.ajax.check(e.fn.dndupload,t.baseURL+"ext/jquery-dndupload"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-dndupload"+t.devext+".css","jquery-dndupload",function(){n.each(function(){var a=e(this),n=a.data(),i={action:n.amsDnduploadAction||a.attr("action")||"upload-files",fieldname:n.amsDnduploadFieldname||"files",autosubmit:n.amsDnduploadAutosubmit},s=e.extend({},i,n.amsDnduploadOptions);s=t.executeFunctionByName(n.amsDnduploadInitCallback,a,s)||s;var r=a.dndupload(s);t.executeFunctionByName(n.amsDnduploadAfterInitcallback,a,r,s)})})})},validate:function(a){var n=e("FORM:not([novalidate])",a);n.length>0&&t.ajax.check(e.fn.validate,t.baseURL+"ext/jquery-validate-1.17.0"+t.devext+".js",function(a){if(a&&(e.validator.setDefaults({highlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(e,a){var t=a.parents("label:first");t.length?e.insertAfter(t):e.insertAfter(a)}}),t.plugins.i18n)){for(var i in t.plugins.i18n.validate)if(t.plugins.i18n.validate.hasOwnProperty(i)){var s=t.plugins.i18n.validate[i];"string"==typeof s&&s.indexOf("{0}")>-1&&(t.plugins.i18n.validate[i]=e.validator.format(s))}e.extend(e.validator.messages,t.plugins.i18n.validate)}n.each(function(){var a=e(this),n=a.data(),i={ignore:null,submitHandler:void 0!==a.attr("data-async")?void 0===n.amsFormSubmitHandler?function(){return e(".state-error",a).removeClass("state-error"),t.ajax.check(e.fn.ajaxSubmit,t.baseURL+"ext/jquery-form-3.49"+t.devext+".js"),t.form.submit(a)}:t.getFunctionByName(n.amsFormSubmitHandler):void 0,invalidHandler:void 0!==a.attr("data-async")?void 0===n.amsFormInvalidHandler?function(t,n){e(".state-error",a).removeClass("state-error");for(var i=0;i<n.errorList.length;i++){var s=n.errorList[i],r=e(s.element).parents(".tab-pane").index()+1;if(r>0){var o=e(".nav-tabs",e(s.element).parents(".tabforms"));e("li:nth-child("+r+")",o).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",o).click()}}}:t.getFunctionByName(n.amsFormInvalidHandler):void 0};e("[data-ams-validate-rules]",a).each(function(a){0===a&&(i.rules={}),i.rules[e(this).attr("name")]=e(this).data("ams-validate-rules")});var s=e.extend({},i,n.amsValidateOptions);s=t.executeFunctionByName(n.amsValidateInitCallback,a,s)||s;var r=a.validate(s);t.executeFunctionByName(n.amsValidateAfterInitCallback,a,r,s)})})},datatable:function(a){var n=e(".datatable",a);n.length>0&&t.ajax.check(e.fn.dataTable,t.baseURL+"ext/jquery-dataTables-1.9.4"+t.devext+".js",function(){t.ajax.check(e.fn.dataTableExt.oPagination.bootstrap_full,t.baseURL+"myams-dataTables"+t.devext+".js",function(){e(n).each(function(){var a,n=e(this),i=n.data(),s=(i.amsDatatableExtensions||"").split(/\s+/),r=i.amsDatatableSdom||"W"+(s.indexOf("colreorder")>=0||s.indexOf("colreorderwithresize")>=0?"R":"")+"<'dt-top-row'"+(s.indexOf("colvis")>=0?"C":"")+(!1===i.amsDatatablePagination||!1===i.amsDatatablePaginationSize?"":"L")+(!1===i.amsDatatableGlobalFilter?"":"F")+">r<'dt-wrapper't"+(s.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(!1===i.amsDatatableInformation?"":"i")+"><'col-sm-6 text-right'p>>",o=i.amsDatatableSorting;if("string"==typeof o){var c=o.split(";");for(o=[],a=0;a<c.length;a++){var l=c[a].split(",");l[0]=parseInt(l[0]),o.push(l)}}var m,d=[],u=e("th",n).listattr("data-ams-datatable-sortable");for(a=0;a<u.length;a++){var b=u[a];void 0!==b?((m=d[a]||{}).bSortable="string"==typeof b?JSON.parse(b):b,d[a]=m):d[a]=d[a]||{}}var h=e("th",n).listattr("data-ams-datatable-stype");for(a=0;a<h.length;a++){var p=h[a];p?((m=d[a]||{}).sType=p,d[a]=m):d[a]=d[a]||{}}var f={bJQueryUI:!1,bServerSide:i.amsDatatableServerSide||!1,sAjaxSource:!0===i.amsDatatableServerSide?i.amsDatatableAjaxSource:void 0,sServerMethod:!0===i.amsDatatableServerSide?"POST":void 0,bFilter:!1!==i.amsDatatableGlobalFilter||s.indexOf("columnfilter")>=0,bPaginate:!1!==i.amsDatatablePagination,bInfo:!1!==i.amsDatatableInfo,bSort:!1!==i.amsDatatableSort,aaSorting:o,aoColumns:d.length>0?d:void 0,bDeferRender:!0,bAutoWidth:!1,iDisplayLength:i.amsDatatableDisplayLength||25,sPaginationType:i.amsDatatablePaginationType||"bootstrap_full",sDom:r,oLanguage:t.plugins.i18n.datatables,fnInitComplete:function(a,n){e(".ColVis_Button").addClass("btn btn-default btn-sm").html((t.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}},g=e.extend({},f,i.amsDatatableOptions),v=[],y=[],x=[];if(s.length>0)for(a=0;a<s.length;a++)switch(s[a]){case"autofill":v.push(e.fn.dataTable.AutoFill),y.push(t.baseURL+"ext/jquery-dataTables-autoFill"+t.devext+".js");break;case"columnfilter":v.push(e.fn.columnFilter),y.push(t.baseURL+"ext/jquery-dataTables-columnFilter"+t.devext+".js");break;case"colreorder":v.push(e.fn.dataTable.ColReorder),y.push(t.baseURL+"ext/jquery-dataTables-colReorder"+t.devext+".js");break;case"colreorderwithresize":v.push(window.ColReorder),y.push(t.baseURL+"ext/jquery-dataTables-colReorderWithResize"+t.devext+".js");break;case"colvis":v.push(e.fn.dataTable.ColVis),y.push(t.baseURL+"ext/jquery-dataTables-colVis"+t.devext+".js"),x.push(function(){g.oColVis=e.extend({},{activate:"click",sAlign:"right"},i.amsDatatableColvisOptions)});break;case"editable":v.push(e.fn.editable),y.push(t.baseURL+"ext/jquery-jeditable"+t.devext+".js"),v.push(e.fn.makeEditable),y.push(t.baseURL+"ext/jquery-dataTables-editable"+t.devext+".js");break;case"fixedcolumns":v.push(e.fn.dataTable.FixedColumns),y.push(t.baseURL+"ext/jquery-dataTables-fixedColumns"+t.devext+".js");break;case"fixedheader":v.push(e.fn.dataTable.Fixedheader),y.push(t.baseURL+"ext/jquery-dataTables-fixedHeader"+t.devext+".js");break;case"keytable":v.push(window.keyTable),y.push(t.baseURL+"ext/jquery-dataTables-keyTable"+t.devext+".js");break;case"rowgrouping":v.push(e.fn.rowGrouping),y.push(t.baseURL+"ext/jquery-dataTables-rowGrouping"+t.devext+".js");break;case"rowreordering":v.push(e.fn.rowReordering),y.push(t.baseURL+"ext/jquery-dataTables-rowReordering"+t.devext+".js");break;case"scroller":v.push(e.fn.dataTable.Scroller),y.push(t.baseURL+"ext/jquery-dataTables-scroller"+t.devext+".js")}x.push(function(){g=t.executeFunctionByName(i.amsDatatableInitCallback,n,g)||g;try{var r=n.dataTable(g);if(t.executeFunctionByName(i.amsDatatableAfterInitCallback,n,r,g),s.length>0)for(a=0;a<s.length;a++)switch(s[a]){case"autofill":var o=e.extend({},i.amsDatatableAutofillOptions,g.autofill);o=t.executeFunctionByName(i.amsDatatableAutofillInitCallback,n,o)||o,n.data("ams-autofill",void 0===i.amsDatatableAutofillConstructor?new e.fn.dataTable.AutoFill(n,o):t.executeFunctionByName(i.amsDatatableAutofillConstructor,n,r,o));break;case"columnfilter":var c=e.extend({},{sPlaceHolder:"head:after"},i.amsDatatableColumnfilterOptions,g.columnfilter);c=t.executeFunctionByName(i.amsDatatableColumnfilterInitCallback,n,c)||c,n.data("ams-columnfilter",void 0===i.amsDatatableColumnfilterConstructor?r.columnFilter(c):t.executeFunctionByName(i.amsDatatableColumnfilterConstructor,n,r,c));break;case"editable":var l=e.extend({},i.amsDatatableEditableOptions,g.editable);l=t.executeFunctionByName(i.amsDatatableEditableInitCallback,n,l)||l,n.data("ams-editable",void 0===i.amsDatatableEditableConstructor?n.makeEditable(l):t.executeFunctionByName(i.amsDatatableEditableConstructor,n,r,l));break;case"fixedcolumns":var m=e.extend({},i.amsDatatableFixedcolumnsOptions,g.fixedcolumns);m=t.executeFunctionByName(i.amsDatatableFixedcolumnsInitCallback,n,m)||m,n.data("ams-fixedcolumns",void 0===i.amsDatatableFixedcolumnsConstructor?new e.fn.dataTable.FixedColumns(n,m):t.executeFunctionByName(i.amsDatatableFixedcolumnsConstructor,n,r,m));break;case"fixedheader":var d=e.extend({},i.amsDatatableFixedheaderOptions,g.fixedheader);d=t.executeFunctionByName(i.amsDatatableFixedheadeInitCallback,n,d)||d,n.data("ams-fixedheader",void 0===i.amsDatatableFixedheaderConstructor?new e.fn.dataTable.FixedHeader(n,d):t.executeFunctionByName(i.amsDatatableFixedheaderConstructor,n,r,d));break;case"keytable":var u={table:n.get(0),datatable:r},b=e.extend({},u,i.amsDatatableKeytableOptions,g.keytable);b=t.executeFunctionByName(i.amsDatatableKeytableInitCallback,n,b)||b,n.data("ams-keytable",void 0===i.amsDatatableKeytableConstructor?new KeyTable(b):t.executeFunctionByName(i.amsDatatableKeytableConstructor,n,r,b));break;case"rowgrouping":var h=e.extend({},i.amsDatatableRowgroupingOptions,g.rowgrouping);h=t.executeFunctionByName(i.amsDatatableRowgroupingInitCallback,n,h)||h,n.data("ams-rowgrouping",void 0===i.amsDatatableRowgroupingConstructor?n.rowGrouping(h):t.executeFunctionByName(i.amsDatatableRowgroupingConstructor,n,r,h));break;case"rowreordering":var p=e.extend({},i.amsDatatableRowreorderingOptions,g.rowreordering);p=t.executeFunctionByName(i.amsDatatableRowreorderingInitCallback,n,p)||p,n.data("ams-rowreordering",void 0===i.amsDatatableRowreorderingConstructor?n.rowReordering(p):t.executeFunctionByName(i.amsDatatableRowreorderingConstructor,n,r,p))}if(i.amsDatatableFinalizeCallback){var f=i.amsDatatableFinalizeCallback.split(/\s+/);if(f.length>0)for(a=0;a<f.length;a++)t.executeFunctionByName(f[a],n,r,g)}}catch(e){}}),t.ajax.check(v,y,x)})})})},tablednd:function(a){var n=e(".table-dnd",a);n.length>0&&t.ajax.check(e.fn.tableDnD,t.baseURL+"ext/jquery-tablednd"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data();n.amsTabledndDragHandle?e("tr",a).addClass("no-drag-handle"):e(a).on("mouseover","tr",function(){e(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){e(this.cells[0]).removeClass("drag-handle")});var i={onDragClass:n.amsTabledndDragClass||"dragging-row",onDragStart:t.getFunctionByName(n.amsTabledndDragStart),dragHandle:n.amsTabledndDragHandle,scrollAmount:n.amsTabledndScrollAmount,onAllowDrop:n.amsTabledndAllowDrop,onDrop:t.getFunctionByName(n.amsTabledndDrop)||function(i,s){var r=n.amsTabledndDropTarget;if(r){e(s).data("ams-disabled-handlers","click");try{var o=[];e(i.rows).each(function(){var a=e(this).data("ams-element-name");a&&o.push(a)});var c=t.getFunctionByName(r);if("function"==typeof c)c.call(a,i,o);else{if(!r.startsWith(window.location.protocol)){var l=n.amsLocation;l&&(r=l+"/"+r)}t.ajax.post(r,{names:JSON.stringify(o)})}}finally{setTimeout(function(){e(s).removeData("ams-disabled-handlers")},50)}}return!1}},s=e.extend({},i,n.amsTabledndOptions);s=t.executeFunctionByName(n.amsTabledndInitCallback,a,s)||s;var r=a.tableDnD(s);t.executeFunctionByName(n.amsTabledndAfterInitCallback,a,r,s)})})},wizard:function(a){var n=e(".wizard",a);n.length>0&&t.ajax.check(e.fn.bootstrapWizard,t.baseURL+"ext/bootstrap-wizard-1.4.2"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i={withVisible:void 0===n.amsWizardWithVisible||n.amsWizardWithVisible,tabClass:n.amsWizardTabClass,firstSelector:n.amsWizardFirstSelector,previousSelector:n.amsWizardPreviousSelector,nextSelector:n.amsWizardNextSelector,lastSelector:n.amsWizardLastSelector,finishSelector:n.amsWizardFinishSelector,backSelector:n.amsWizardBackSelector,onInit:t.getFunctionByName(n.amsWizardInit),onShow:t.getFunctionByName(n.amsWizardShow),onNext:t.getFunctionByName(n.amsWizardNext),onPrevious:t.getFunctionByName(n.amsWizardPrevious),onFirst:t.getFunctionByName(n.amsWizardFirst),onLast:t.getFunctionByName(n.amsWizardLast),onBack:t.getFunctionByName(n.amsWizardBack),onFinish:t.getFunctionByName(n.amsWizardFinish),onTabChange:t.getFunctionByName(n.amsWizardTabChange),onTabClick:t.getFunctionByName(n.amsWizardTabClick),onTabShow:t.getFunctionByName(n.amsWizardTabShow)},s=e.extend({},i,n.amsWizardOptions);s=t.executeFunctionByName(n.amsWizardInitCallback,a,s)||s;var r=a.bootstrapWizard(s);t.executeFunctionByName(n.amsWizardAfterInitCallback,a,r,s)})})},tinymce:function(a){function n(){e(".tinymce",e(this)).each(function(){var a=tinymce.get(e(this).attr("id"));a&&a.remove()})}var i=e(".tinymce",a);if(i.length>0){var s=t.baseURL+"ext/tinymce"+(t.devmode?"/dev":"");t.ajax.check(window.tinymce,s+"/tinymce"+t.devext+".js",function(a){function r(){i.each(function(){var a=e(this),n=a.data(),i={theme:n.amsTinymceTheme||"modern",language:t.lang,menubar:!1!==n.amsTinymceMenubar,statusbar:!1!==n.amsTinymceStatusbar,plugins:n.amsTinymcePlugins||["advlist autosave autolink lists link charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code fullscreen","insertdatetime nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern autoresize"],toolbar:n.amsTinymceToolbar,toolbar1:!1!==n.amsTinymceToolbar1&&(n.amsTinymceToolbar1||"undo redo | pastetext | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),toolbar2:!1!==n.amsTinymceToolbar2&&(n.amsTinymceToolbar2||"forecolor backcolor emoticons | charmap link image media | fullscreen preview print | code"),content_css:n.amsTinymceContentCss,formats:n.amsTinymceFormats,style_formats:n.amsTinymceStyleFormats,block_formats:n.amsTinymceBlockFormats,valid_classes:n.amsTinymceValidClasses,image_advtab:!0,image_list:t.getFunctionByName(n.amsTinymceImageList)||n.amsTinymceImageList,image_class_list:n.amsTinymceImageClassList,link_list:t.getFunctionByName(n.amsTinymceLinkList)||n.amsTinymceLinkList,link_class_list:n.amsTinymceLinkClassList,paste_as_text:void 0===n.amsTinymcePasteAsText||n.amsTinymcePasteAsText,paste_auto_cleanup_on_paste:void 0===n.amsTinymcePasteAutoCleanup||n.amsTinymcePasteAutoCleanup,paste_strip_class_attributes:n.amsTinymcePasteStripClassAttributes||"all",paste_remove_spans:void 0===n.amsTinymcePaseRemoveSpans||n.amsTinymcePasteRemoveSpans,paste_remove_styles:void 0===n.amsTinymcePasteRemoveStyles||n.amsTinymcePasteRemoveStyles,height:n.amsTinymceHeight||50,min_height:50,resize:!0,autoresize_min_height:50,autoresize_max_height:500};if(n.amsTinymceExternalPlugins){var s=n.amsTinymceExternalPlugins.split(/\s+/);for(var r in s)if(s.hasOwnProperty(r)){var o=a.data("ams-tinymce-plugin-"+s[r]);tinymce.PluginManager.load(s[r],t.getSource(o))}}var c=e.extend({},i,n.amsTinymceOptions);c=t.executeFunctionByName(n.amsTinymceInitCallback,a,c)||c;var l=a.tinymce(c);t.executeFunctionByName(n.amsTinymceAfterInitCallback,a,l,c)})}a?t.getScript(s+"/jquery.tinymce"+t.devext+".js",function(){tinymce.baseURL=s,tinymce.suffix=t.devext,t.skin.registerCleanCallback(n),r()}):r()})}},imgareaselect:function(a){var n=e(".imgareaselect",a);n.length>0&&t.ajax.check(e.fn.imgAreaSelect,t.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-imgareaselect"+t.devext+".css","jquery-imgareaselect",function(){n.each(function(){var a=e(this),n=a.data(),i=n.amsImgareaselectParent?a.parents(n.amsImgareaselectParent):"body",s={instance:!0,handles:!0,parent:i,x1:n.amsImgareaselectX1||0,y1:n.amsImgareaselectY1||0,x2:n.amsImgareaselectX2||n.amsImgareaselectImageWidth,y2:n.amsImgareaselectY2||n.amsImgareaselectImageHeight,imageWidth:n.amsImgareaselectImageWidth,imageHeight:n.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:n.amsImgareaselectRatio,onSelectEnd:t.getFunctionByName(n.amsImgareaselectSelectEnd)||function(a,t){var s=n.amsImgareaselectTargetField||"image_";e('input[name="'+s+'x1"]',i).val(t.x1),e('input[name="'+s+'y1"]',i).val(t.y1),e('input[name="'+s+'x2"]',i).val(t.x2),e('input[name="'+s+'y2"]',i).val(t.y2)}},r=e.extend({},s,n.amsImgareaselectOptions);r=t.executeFunctionByName(n.amsImgareaselectInitCallback,a,r)||r;var o=a.imgAreaSelect(r);t.executeFunctionByName(n.amsImgareaselectAfterInitCallback,a,o,r),setTimeout(function(){o.update()},250)})})})},fancybox:function(a){var n=e(".fancybox",a);n.length>0&&t.ajax.check(e.fn.fancybox,t.baseURL+"ext/jquery-fancybox-2.1.5"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-fancybox-2.1.5"+t.devext+".css","jquery-fancybox",function(){n.each(function(){var a,n=e(this),i=n.data(),s=n;i.amsFancyboxElements&&(s=e(i.amsFancyboxElements,n));var r=(i.amsFancyboxHelpers||"").split(/\s+/);if(r.length>0)for(a=0;a<r.length;a++)switch(r[a]){case"buttons":t.ajax.check(e.fancybox.helpers.buttons,t.baseURL+"ext/fancybox-helpers/fancybox-buttons"+t.devext+".js");break;case"thumbs":t.ajax.check(e.fancybox.helpers.thumbs,t.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+t.devext+".js");break;case"media":t.ajax.check(e.fancybox.helpers.media,t.baseURL+"ext/fancybox-helpers/fancybox-media"+t.devext+".js")}var o={type:i.amsFancyboxType,padding:i.amsFancyboxPadding||10,margin:i.amsFancyboxMargin||10,loop:i.amsFancyboxLoop,beforeLoad:t.getFunctionByName(i.amsFancyboxBeforeLoad)||function(){var a;if(i.amsFancyboxTitleGetter&&(a=t.executeFunctionByName(i.amsFancyboxTitleGetter,this)),!a){var n=e("*:first",this.element);(a=n.attr("original-title")||n.attr("title"))||(a=e(this.element).attr("original-title")||e(this.element).attr("title"))}this.title=a},afterLoad:t.getFunctionByName(i.amsFancyboxAfterLoad),helpers:{title:{type:"inside"}}};if(r.length>0)for(a=0;a<r.length;a++)switch(r[a]){case"buttons":o.helpers.buttons={position:i.amsFancyboxButtonsPosition||"top"};break;case"thumbs":o.helpers.thumbs={width:i.amsFancyboxThumbsWidth||50,height:i.amsFancyboxThumbsHeight||50};break;case"media":o.helpers.media=!0}var c=e.extend({},o,i.amsFancyboxOptions);c=t.executeFunctionByName(i.amsFancyboxInitCallback,n,c)||c;var l=s.fancybox(c);t.executeFunctionByName(i.amsFancyboxAfterInitCallback,n,l,c)})})})},chart:function(a){var n=e(".chart",a);n.length>0&&t.ajax.check(e.fn.plot,t.baseURL+"flot/jquery.flot"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i=(n.amsChartPlugins||"").split(/\s+/);if(i.length>0)for(var s in i)if(i.hasOwnProperty(s)){var r=i[s];(function(a){for(var t in e.plot.plugins)if(e.plot.plugins.hasOwnProperty(t)){var n=e.plot.plugins[t];if(n.name===a)return n}return null})(r)||t.getScript(t.baseURL+"flot/jquery.flot."+r+t.devext+".js")}var o=e.extend({},{},n.amsChartOptions);o=t.executeFunctionByName(n.amsChartInitCallback,a,o)||o;var c=n.amsChartData;c=t.executeFunctionByName(n.amsChartInitData,a,c)||c;var l=a.plot(c,o);t.executeFunctionByName(n.amsChartAfterInitCallback,a,l,o)})})},graphs:function(a){var n=e(".sparkline",a);n.length>0&&t.ajax.check(t.graphs,t.baseURL+"myams-graphs"+t.devext+".js",function(){t.graphs.init(n)})},scrollbars:function(a){var n=e(".scrollbar",a);n.length>0&&t.ajax.check(e.event.special.mousewheel,t.baseURL+"ext/jquery-mousewheel.min.js",function(){t.ajax.check(e.fn.mCustomScrollbar,t.baseURL+"ext/jquery-mCustomScrollbar"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar",function(){n.each(function(){var a=e(this),n=a.data(),i={theme:n.amsScrollbarTheme||"light"},s=e.extend({},i,n.amsScrollbarOptions);s=t.executeFunctionByName(n.amsScrollbarInitCallback,a,s)||s;var r=a.mCustomScrollbar(s);t.executeFunctionByName(n.amsScrollbarAfterInitCallback,a,r,s)})})})})}})}(jQuery,this);
+!function(e,a){var t=a.MyAMS;e.extend(t.plugins.enabled,{svg:function(a){var t=e(".svg-container",a);t.length>0&&t.each(function(){var a=e(this),t=e("svg",a),n=t.attr("width"),i=t.attr("height");n&&i&&t.get(0).setAttribute("viewBox","0 0 "+Math.round(parseFloat(n))+" "+Math.round(parseFloat(i))),t.attr("width","100%").attr("height","auto")})},hint:function(a){var n=e(".hint:not(:parents(.nohints))",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.tipsy,t.baseURL+"ext/jquery-tipsy"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-tipsy"+t.devext+".css","jquery-tipsy",function(){n.each(function(){var a=e(this),n=a.data(),i={html:void 0===n.amsHintHtml?(a.attr("title")||"").startsWith("<"):n.amsHintHtml,title:t.getFunctionByName(n.amsHintTitleGetter)||function(){var a=e(this),t=a.attr("original-title")||a.attr(n.amsHintTitleAttr||"title")||(n.amsHintHtml?a.html():a.text());return t=t.replace(/\?_="/,"?_="+(new Date).getTime()+'"')},opacity:n.amsHintOpacity||.95,gravity:n.amsHintGravity||"sw",offset:n.amsHintOffset||0},s=e.extend({},i,n.amsHintOptions);s=t.executeFunctionByName(n.amsHintInitCallback,a,s)||s;var r=a.tipsy(s);t.executeFunctionByName(n.amsHintAfterInitCallback,a,r,s)})})})},contextMenu:function(a){var n=e(".context-menu",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={menuSelector:n.amsContextmenuSelector,menuSelected:t.helpers&&t.helpers.contextMenuHandler},s=e.extend({},i,n.amsContextmenuOptions);s=t.executeFunctionByName(n.amsContextmenuInitCallback,a,s)||s;var r=a.contextMenu(s);t.executeFunctionByName(n.amsContextmenuAfterInitCallback,a,r,s)})},switcher:function(a){e("LEGEND.switcher",a).each(function(){var a=e(this),t=a.parent("fieldset"),n=a.data();n.amsSwitcher||(e('<i class="fa fa-fw"></i>').prependTo(e(this)).addClass("open"===n.amsSwitcherState?n.amsSwitcherMinusClass||"fa-minus":n.amsSwitcherPlusClass||"fa-plus"),a.on("click",function(i){i.preventDefault();var s={};if(a.trigger("ams.switcher.before-switch",[a,s]),!s.veto)if(t.hasClass("switched")){t.removeClass("switched"),e(".fa",a).removeClass(n.amsSwitcherPlusClass||"fa-plus").addClass(n.amsSwitcherMinusClass||"fa-minus"),a.trigger("ams.switcher.opened",[a]);var r=a.attr("id");r&&e('legend.switcher[data-ams-switcher-sync="'+r+'"]',t).each(function(){var a=e(this);a.parents("fieldset").hasClass("switched")&&a.click()})}else t.addClass("switched"),e(".fa",a).removeClass(n.amsSwitcherMinusClass||"fa-minus").addClass(n.amsSwitcherPlusClass||"fa-plus"),a.trigger("ams.switcher.closed",[a])}),"open"!==n.amsSwitcherState&&t.addClass("switched"),a.data("ams-switcher","on"))})},checker:function(a){e("LEGEND.checker",a).each(function(){var a=e(this),n=a.parent("fieldset"),i=a.data();if(!i.amsChecker){var s=e('<label class="checkbox"></label>'),r=i.amsCheckerFieldname||"checker_"+t.generateId(),o=r.replace(/\./,"_"),l=i.amsCheckerHiddenPrefix,c=null,m=i.amsCheckerHiddenValueOn||"true",d=i.amsCheckerHiddenValueOff||"false",u=i.amsCheckerMarker||!1;l?c=e('<input type="hidden">').attr("name",l+r).val("on"===i.amsCheckerState?m:d).prependTo(a):u&&e('<input type="hidden">').attr("name",u).attr("value",1).prependTo(a);var b=e('<input type="checkbox">').attr("name",r).attr("id",o).data("ams-checker-hidden-input",c).data("ams-checker-init",!0).val(i.amsCheckerValue||!0).attr("checked","on"===i.amsCheckerState?"checked":null);i.amsCheckerReadonly?b.attr("disabled","disabled"):b.on("change",function(s){s.preventDefault();var r={},o=e(this).is(":checked");if(a.trigger("ams.checker.before-switch",[a,r]),r.veto)e(this).prop("checked",!o);else if(t.executeFunctionByName(i.amsCheckerChangeHandler,a,o),!i.amsCheckerCancelDefault){var l=b.data("ams-checker-hidden-input");o?("disable"===i.amsCheckerMode?(n.removeAttr("disabled"),e(".select2",n).removeAttr("disabled")):n.removeClass("switched"),l&&l.val(m),e("[data-required]",n).attr("required","required"),a.trigger("ams.checker.opened",[a])):("disable"===i.amsCheckerMode?(n.prop("disabled","disabled"),e(".select2",n).attr("disabled","disabled")):n.addClass("switched"),l&&l.val(d),e("[data-required]",n).removeAttr("required"),a.trigger("ams.checker.closed",[a]))}}),b.appendTo(s),e(">label",a).attr("for",b.attr("id")),s.append("<i></i>").prependTo(a);var h=e("[required]",n);h.attr("data-required",!0),"on"===i.amsCheckerState?b.attr("checked",!0):("disable"===i.amsCheckerMode?(n.attr("disabled","disabled"),e(".select2",n).attr("disabled","disabled")):n.addClass("switched"),h.removeAttr("required")),a.data("ams-checker","on")}})},slider:function(a){var n=e(".slider",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.slider,t.baseURL+"ext/bootstrap-slider-2.0.0"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i=e.extend({},{},a.data.amsSliderOptions);i=t.executeFunctionByName(n.amsSliderInitCallback,a,i)||i;var s=a.slider(i);t.executeFunctionByName(n.amsSliderAfterInitCallback,a,s,i)})})},draggable:function(a){var n=e(".draggable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={cursor:n.amsDraggableCursor||"move",containment:n.amsDraggableContainment,handle:n.amsDraggableHandle,connectToSortable:n.amsDraggableConnectSortable,helper:t.getFunctionByName(n.amsDraggableHelper)||n.amsDraggableHelper,start:t.getFunctionByName(n.amsDraggableStart),stop:t.getFunctionByName(n.amsDraggableStop)},s=e.extend({},i,n.amsDraggableOptions);s=t.executeFunctionByName(n.amsDraggableInitCallback,a,s)||s;var r=a.draggable(s);a.disableSelection(),t.executeFunctionByName(n.amsDraggableAfterInitCallback,a,r,s)})},droppable:function(a){var n=e(".droppable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={accept:n.amsdroppableAccept,drop:t.getFunctionByName(n.amsDroppableDrop)},s=e.extend({},i,n.amsDroppableOptions);s=t.executeFunctionByName(n.amsDroppableInitCallback,a,s)||s;var r=a.droppable(s);t.executeFunctionByName(n.amsDroppableAfterInitCallback,a,r,s)})},sortable:function(a){var n=e(".sortable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={items:n.amsSortableItems,handle:n.amsSortableHandle,helper:n.amsSortableHelper,connectWith:n.amsSortableConnectwith,start:t.getFunctionByName(n.amsSortableStart),over:t.getFunctionByName(n.amsSortableOver),containment:n.amsSortableContainment,placeholder:n.amsSortablePlaceholder,stop:t.getFunctionByName(n.amsSortableStop)},s=e.extend({},i,n.amsSortableOptions);s=t.executeFunctionByName(n.amsSortableInitCallback,a,s)||s;var r=a.sortable(s);a.disableSelection(),t.executeFunctionByName(n.amsSortableAfterInitCallback,a,r,s)})},resizable:function(a){var n=e(".resizable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),i={autoHide:!1===n.amsResizableAutohide||n.amsResizableAutohide,containment:n.amsResizableContainment,grid:n.amsResizableGrid,handles:n.amsResizableHandles,start:t.getFunctionByName(n.amsResizableStart),stop:t.getFunctionByName(n.amsResizableStop)},s=e.extend({},i,n.amsResizableOptions);s=t.executeFunctionByName(n.amsResizableInitCallback,a,s)||s;var r=a.resizable(s);a.disableSelection(),t.executeFunctionByName(n.amsResizableAfterInitCallback,a,r,s)})},typeahead:function(a){var n=e(".typeahead",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.typeahead,t.baseURL+"ext/jquery-typeahead"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i=e.extend({},{},n.amsTypeaheadOptions);i=t.executeFunctionByName(n.amsTypeaheadInitCallback,a,i)||i;var s=a.typeahead(i);t.executeFunctionByName(n.amsTypeaheadAfterInitCallback,a,s,i)})})},treeview:function(a){var n=e(".treeview",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.treview,t.baseURL+"ext/bootstrap-treeview"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/bootstrap-treeview"+t.devext+".css","bootstrap-treeview",function(){n.each(function(){var a=e(this),n=a.data(),i={data:n.amsTreeviewData,levels:n.amsTreeviewLevels,injectStyle:n.amsTreeviewInjectStyle,expandIcon:n.amsTreeviewExpandIcon||"fa fa-fw fa-plus-square-o",collapseIcon:n.amsTreeviewCollaspeIcon||"fa fa-fw fa-minus-square-o",emptyIcon:n.amsTreeviewEmptyIcon||"fa fa-fw",nodeIcon:n.amsTreeviewNodeIcon,selectedIcon:n.amsTreeviewSelectedIcon,checkedIcon:n.amsTreeviewCheckedIcon||"fa fa-fw fa-check-square-o",uncheckedIcon:n.amsTreeviewUncheckedIcon||"fa fa-fw fa-square-o",color:n.amsTreeviewColor,backColor:n.amsTreeviewBackColor,borderColor:n.amsTreeviewBorderColor,onHoverColor:n.amsTreeviewHoverColor,selectedColor:n.amsTreeviewSelectedColor,selectedBackColor:n.amsTreeviewSelectedBackColor,unselectableColor:n.amsTreeviewUnselectableColor||"rgba(1,1,1,0.25)",unselectableBackColor:n.amsTreeviewUnselectableBackColor||"rgba(1,1,1,0.25)",enableLinks:n.amsTreeviewEnableLinks,highlightSelected:n.amsTreeviewHighlightSelected,highlightSearchResults:n.amsTreeviewhighlightSearchResults,showBorder:n.amsTreeviewShowBorder,showIcon:n.amsTreeviewShowIcon,showCheckbox:n.amsTreeviewShowCheckbox,showTags:n.amsTreeviewShowTags,toggleUnselectable:n.amsTreeviewToggleUnselectable,multiSelect:n.amsTreeviewMultiSelect,onNodeChecked:t.getFunctionByName(n.amsTreeviewNodeChecked),onNodeCollapsed:t.getFunctionByName(n.amsTreeviewNodeCollapsed),onNodeDisabled:t.getFunctionByName(n.amsTreeviewNodeDisabled),onNodeEnabled:t.getFunctionByName(n.amsTreeviewNodeEnabled),onNodeExpanded:t.getFunctionByName(n.amsTreeviewNodeExpanded),onNodeSelected:t.getFunctionByName(n.amsTreeviewNodeSelected),onNodeUnchecked:t.getFunctionByName(n.amsTreeviewNodeUnchecked),onNodeUnselected:t.getFunctionByName(n.amsTreeviewNodeUnselected),onSearchComplete:t.getFunctionByName(n.amsTreeviewSearchComplete),onSearchCleared:t.getFunctionByName(n.amsTreeviewSearchCleared)},s=e.extend({},i,n.amsTreeviewOptions);s=t.executeFunctionByName(n.amsTreeviewInitcallback,a,s)||s;var r=a.treeview(s);t.executeFunctionByName(n.amsTreeviewAfterInitCallback,a,r,s)})})})},select2:function(a){var n=e(".select2",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.select2,t.baseURL+"ext/jquery-select2-3.5.4"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data();if(!n.select2){var i={placeholder:n.amsSelect2Placeholder,multiple:n.amsSelect2Multiple,minimumInputLength:n.amsSelect2MinimumInputLength||0,maximumSelectionSize:n.amsSelect2MaximumSelectionSize,openOnEnter:void 0===n.amsSelect2EnterOpen||n.amsSelect2EnterOpen,allowClear:void 0===n.amsSelect2AllowClear||n.amsSelect2AllowClear,width:n.amsSelect2Width||"100%",initSelection:t.getFunctionByName(n.amsSelect2InitSelection),formatSelection:void 0===n.amsSelect2FormatSelection?t.helpers&&t.helpers.select2FormatSelection:t.getFunctionByName(n.amsSelect2FormatSelection),formatResult:t.getFunctionByName(n.amsSelect2FormatResult),formatMatches:void 0===n.amsSelect2FormatMatches?function(e){return 1===e?t.i18n.SELECT2_MATCH:e+t.i18n.SELECT2_MATCHES}:t.getFunctionByName(n.amsSelect2FormatMatches),formatNoMatches:void 0===n.amsSelect2FormatResult?function(e){return t.i18n.SELECT2_NOMATCHES}:t.getFunctionByName(n.amsSelect2FormatResult),formatInputTooShort:void 0===n.amsSelect2FormatInputTooShort?function(e,a){var n=a-e.length;return t.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,n).replace(/\{1\}/,1===n?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatInputTooShort),formatInputTooLong:void 0===n.amsSelect2FormatInputTooLong?function(e,a){var n=e.length-a;return t.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,n).replace(/\{1\}/,1===n?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatInputTooLong),formatSelectionTooBig:void 0===n.amsSelect2FormatSelectionTooBig?function(e){return t.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,e).replace(/\{1\}/,1===e?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatSelectionTooBig),formatLoadMore:void 0===n.amsSelect2FormatLoadMore?function(e){return t.i18n.SELECT2_LOADMORE}:t.getFunctionByName(n.amsSelect2FormatLoadMore),formatSearching:void 0===n.amsSelect2FormatSearching?function(){return t.i18n.SELECT2_SEARCHING}:t.getFunctionByName(n.amsSelect2FormatSearching),separator:n.amsSelect2Separator||",",tokenSeparators:n.amsSelect2TokensSeparators||[","],tokenizer:t.getFunctionByName(n.amsSelect2Tokenizer)};switch(a.context.type){case"text":case"hidden":if(!i.initSelection){var s=a.data("ams-select2-values");s&&(i.initSelection=function(a,t){var n=[];e(a.val().split(i.separator)).each(function(){n.push({id:this,text:s[this]||this})}),t(n)})}}a.attr("readonly")?"hidden"===a.attr("type")&&(i.query=function(){return[]}):n.amsSelect2Query?(i.query=t.getFunctionByName(n.amsSelect2Query),i.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2QueryUrl?(i.ajax={url:n.amsSelect2QueryUrl,quietMillis:n.amsSelect2QuietMillis||200,type:n.amsSelect2QueryType||"POST",dataType:n.amsSelect2QueryDatatype||"json",data:function(a,t,i){var s={};return s[n.amsSelect2QueryParamName||"query"]=a,s[n.amsSelect2PageParamName||"page"]=t,s[n.amsSelect2ContextParamName||"context"]=i,e.extend({},s,n.amsSelect2QueryOptions)},results:t.helpers&&t.helpers.select2QueryUrlResultsCallback},i.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2QueryMethod?(i.query=function(i){var s={id:(new Date).getTime(),params:n.amsSelect2QueryParams||{},success:function(e){return t.helpers&&t.helpers.select2QueryMethodSuccessCallback.call(a,e,"success",i)},error:t.error&&t.error.show};s.params[n.amsSelect2QueryParamName||"query"]=i.term,s.params[n.amsSelect2PageParamName||"page"]=i.page,s.params[n.amsSelect2ContextParamName||"context"]=i.context,s=e.extend({},s,n.amsSelect2QueryOptions),s=t.executeFunctionByName(n.amsSelect2QueryInitCallback,a,s)||s,t.ajax&&t.ajax.check(e.jsonRPC,t.baseURL+"ext/jquery-jsonrpc"+t.devext+".js",function(){e.jsonRPC.withOptions({endPoint:n.amsSelect2MethodTarget||t.jsonrpc&&t.jsonrpc.getAddr(),namespace:n.amsSelect2MethodNamespace,cache:!1},function(){e.jsonRPC.request(n.amsSelect2QueryMethod,s)})})},i.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2Tags?i.tags=n.amsSelect2Tags:n.amsSelect2Data&&(i.data=n.amsSelect2Data),n.amsSelect2EnableFreeTags&&(i.createSearchChoice=function(e){return{id:e,text:(n.amsSelect2FreeTagsPrefix||t.i18n.SELECT2_FREETAG_PREFIX)+e}});var r=e.extend({},i,n.amsSelect2Options);r=t.executeFunctionByName(n.amsSelect2InitCallback,a,r)||r;var o=a.select2(r);t.executeFunctionByName(n.amsSelect2AfterInitCallback,a,o,r),a.hasClass("ordered")&&t.ajax&&t.ajax.check(e.fn.select2Sortable,t.baseURL+"ext/jquery-select2-sortable"+t.devext+".js",function(){a.select2Sortable({bindOrder:"sortableStop"})}),a.on("change",function(){void 0!==e(a.get(0).form).data("validator")&&e(a).valid()})}})})},maskedit:function(a){var n=e("[data-mask]",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.mask,t.baseURL+"ext/jquery-maskedinput-1.4.1"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i={placeholder:void 0===n.amsMaskeditPlaceholder?"X":n.amsMaskeditPlaceholder,complete:t.getFunctionByName(n.amsMaskeditComplete)},s=e.extend({},i,n.amsMaskeditOptions);s=t.executeFunctionByName(n.amsMaskeditInitCallback,a,s)||s;var r=a.mask(a.attr("data-mask"),s);t.executeFunctionByName(n.amsMaskeditAfterInitCallback,a,r,s)})})},inputmask:function(a){var n=e("input[data-input-mask]",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.inputmask,t.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+t.devext+".js",function(){n.each(function(){var a,n=e(this),i=n.data();a="object"==typeof i.inputMask?i.inputMask:{mask:i.inputMask.toString()};var s=e.extend({},a,i.amsInputmaskOptions);s=t.executeFunctionByName(i.amsInputmaskInitCallback,n,s)||s;var r=n.inputmask(s);t.executeFunctionByName(i.amsInputmaskAfterInitCallback,n,r,s)})})},datepicker:function(a){var n=e(".datepicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog&&t.dialog.registerHideCallback(t.helpers&&t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),i={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"d/m/y",datepicker:!0,dayOfWeekStart:1,timepicker:!1,closeOnDateSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,weeks:n.amsDatetimepickerWeeks},s=e.extend({},i,n.amsDatetimepickerOptions);s=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,s)||s;var r=a.datetimepicker(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},datetimepicker:function(a){var n=e(".datetimepicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog&&t.dialog.registerHideCallback(t.helpers&&t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),i={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"d/m/y H:i",datepicker:!0,dayOfWeekStart:1,timepicker:!0,closeOnDateSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,closeOnTimeSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,weeks:n.amsDatetimepickerWeeks},s=e.extend({},i,n.amsDatetimepickerOptions);s=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,s)||s;var r=a.datetimepicker(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},timepicker:function(a){var n=e(".timepicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog&&t.dialog.registerHideCallback(t.helpers&&t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),i={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"H:i",datepicker:!1,timepicker:!0,closeOnTimeSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect},s=e.extend({},i,n.amsDatetimepickerOptions);s=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,s)||s;var r=a.datetimepicker(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},colorpicker:function(a){var n=e(".colorpicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.minicolors,t.baseURL+"ext/jquery-minicolors"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-minicolors"+t.devext+".css","jquery-minicolors",function(){n.each(function(){var a=e(this),n=a.data(),i={position:n.amsColorpickerPosition||a.closest(".input").data("ams-colorpicker-position")||"bottom left"},s=e.extend({},i,n.amsColorpickerOptions);s=t.executeFunctionByName(n.amsColorpickerInitCallback,a,s)||s;var r=a.minicolors(s);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,s)})})})},dndupload:function(a){var n=e(".dndupload",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.dndupload,t.baseURL+"ext/jquery-dndupload"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-dndupload"+t.devext+".css","jquery-dndupload",function(){n.each(function(){var a=e(this),n=a.data(),i={action:n.amsDnduploadAction||a.attr("action")||"upload-files",fieldname:n.amsDnduploadFieldname||"files",autosubmit:n.amsDnduploadAutosubmit},s=e.extend({},i,n.amsDnduploadOptions);s=t.executeFunctionByName(n.amsDnduploadInitCallback,a,s)||s;var r=a.dndupload(s);t.executeFunctionByName(n.amsDnduploadAfterInitcallback,a,r,s)})})})},validate:function(a){var n=e("FORM:not([novalidate])",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.validate,t.baseURL+"ext/jquery-validate-1.17.0"+t.devext+".js",function(a){if(a&&(e.validator.setDefaults({highlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(e,a){var t=a.parents("label:first");t.length?e.insertAfter(t):e.insertAfter(a)}}),t.plugins&&t.plugins.i18n)){for(var i in t.plugins.i18n.validate)if(t.plugins.i18n.validate.hasOwnProperty(i)){var s=t.plugins.i18n.validate[i];"string"==typeof s&&s.indexOf("{0}")>-1&&(t.plugins.i18n.validate[i]=e.validator.format(s))}e.extend(e.validator.messages,t.plugins.i18n.validate)}n.each(function(){var a=e(this),n=a.data(),i={ignore:null,submitHandler:void 0!==a.attr("data-async")?void 0===n.amsFormSubmitHandler?function(){return e(".state-error",a).removeClass("state-error"),t.ajax&&t.ajax.check(e.fn.ajaxSubmit,t.baseURL+"ext/jquery-form-3.49"+t.devext+".js"),t.form&&t.form.submit(a)}:t.getFunctionByName(n.amsFormSubmitHandler):void 0,invalidHandler:void 0!==a.attr("data-async")?void 0===n.amsFormInvalidHandler?function(t,n){e(".state-error",a).removeClass("state-error");for(var i=0;i<n.errorList.length;i++){var s=n.errorList[i],r=e(s.element).parents(".tab-pane").index()+1;if(r>0){var o=e(".nav-tabs",e(s.element).parents(".tabforms"));e("li:nth-child("+r+")",o).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",o).click()}}}:t.getFunctionByName(n.amsFormInvalidHandler):void 0};e("[data-ams-validate-rules]",a).each(function(a){0===a&&(i.rules={}),i.rules[e(this).attr("name")]=e(this).data("ams-validate-rules")});var s=e.extend({},i,n.amsValidateOptions);s=t.executeFunctionByName(n.amsValidateInitCallback,a,s)||s;var r=a.validate(s);t.executeFunctionByName(n.amsValidateAfterInitCallback,a,r,s)})})},datatable:function(a){var n=e(".datatable",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.dataTable,t.baseURL+"ext/jquery-dataTables-1.9.4"+t.devext+".js",function(){t.ajax.check(e.fn.dataTableExt.oPagination.bootstrap_full,t.baseURL+"myams-dataTables"+t.devext+".js",function(){e(n).each(function(){var a,n=e(this),i=n.data(),s=(i.amsDatatableExtensions||"").split(/\s+/),r=i.amsDatatableSdom||"W"+(s.indexOf("colreorder")>=0||s.indexOf("colreorderwithresize")>=0?"R":"")+"<'dt-top-row'"+(s.indexOf("colvis")>=0?"C":"")+(!1===i.amsDatatablePagination||!1===i.amsDatatablePaginationSize?"":"L")+(!1===i.amsDatatableGlobalFilter?"":"F")+">r<'dt-wrapper't"+(s.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(!1===i.amsDatatableInformation?"":"i")+"><'col-sm-6 text-right'p>>",o=i.amsDatatableSorting;if("string"==typeof o){var l=o.split(";");for(o=[],a=0;a<l.length;a++){var c=l[a].split(",");c[0]=parseInt(c[0]),o.push(c)}}var m,d=[],u=e("th",n).listattr("data-ams-datatable-sortable");for(a=0;a<u.length;a++){var b=u[a];void 0!==b?((m=d[a]||{}).bSortable="string"==typeof b?JSON.parse(b):b,d[a]=m):d[a]=d[a]||{}}var h=e("th",n).listattr("data-ams-datatable-stype");for(a=0;a<h.length;a++){var p=h[a];p?((m=d[a]||{}).sType=p,d[a]=m):d[a]=d[a]||{}}var f={bJQueryUI:!1,bServerSide:i.amsDatatableServerSide||!1,sAjaxSource:!0===i.amsDatatableServerSide?i.amsDatatableAjaxSource:void 0,sServerMethod:!0===i.amsDatatableServerSide?"POST":void 0,bFilter:!1!==i.amsDatatableGlobalFilter||s.indexOf("columnfilter")>=0,bPaginate:!1!==i.amsDatatablePagination,bInfo:!1!==i.amsDatatableInfo,bSort:!1!==i.amsDatatableSort,aaSorting:o,aoColumns:d.length>0?d:void 0,bDeferRender:!0,bAutoWidth:!1,iDisplayLength:i.amsDatatableDisplayLength||25,sPaginationType:i.amsDatatablePaginationType||"bootstrap_full",sDom:r,oLanguage:t.plugins&&t.plugins.i18n.datatables,fnInitComplete:function(a,n){e(".ColVis_Button").addClass("btn btn-default btn-sm").html((t.plugins&&t.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}},g=e.extend({},f,i.amsDatatableOptions),x=[],v=[],y=[];if(s.length>0)for(a=0;a<s.length;a++)switch(s[a]){case"autofill":x.push(e.fn.dataTable.AutoFill),v.push(t.baseURL+"ext/jquery-dataTables-autoFill"+t.devext+".js");break;case"columnfilter":x.push(e.fn.columnFilter),v.push(t.baseURL+"ext/jquery-dataTables-columnFilter"+t.devext+".js");break;case"colreorder":x.push(e.fn.dataTable.ColReorder),v.push(t.baseURL+"ext/jquery-dataTables-colReorder"+t.devext+".js");break;case"colreorderwithresize":x.push(window.ColReorder),v.push(t.baseURL+"ext/jquery-dataTables-colReorderWithResize"+t.devext+".js");break;case"colvis":x.push(e.fn.dataTable.ColVis),v.push(t.baseURL+"ext/jquery-dataTables-colVis"+t.devext+".js"),y.push(function(){g.oColVis=e.extend({},{activate:"click",sAlign:"right"},i.amsDatatableColvisOptions)});break;case"editable":x.push(e.fn.editable),v.push(t.baseURL+"ext/jquery-jeditable"+t.devext+".js"),x.push(e.fn.makeEditable),v.push(t.baseURL+"ext/jquery-dataTables-editable"+t.devext+".js");break;case"fixedcolumns":x.push(e.fn.dataTable.FixedColumns),v.push(t.baseURL+"ext/jquery-dataTables-fixedColumns"+t.devext+".js");break;case"fixedheader":x.push(e.fn.dataTable.Fixedheader),v.push(t.baseURL+"ext/jquery-dataTables-fixedHeader"+t.devext+".js");break;case"keytable":x.push(window.keyTable),v.push(t.baseURL+"ext/jquery-dataTables-keyTable"+t.devext+".js");break;case"rowgrouping":x.push(e.fn.rowGrouping),v.push(t.baseURL+"ext/jquery-dataTables-rowGrouping"+t.devext+".js");break;case"rowreordering":x.push(e.fn.rowReordering),v.push(t.baseURL+"ext/jquery-dataTables-rowReordering"+t.devext+".js");break;case"scroller":x.push(e.fn.dataTable.Scroller),v.push(t.baseURL+"ext/jquery-dataTables-scroller"+t.devext+".js")}y.push(function(){g=t.executeFunctionByName(i.amsDatatableInitCallback,n,g)||g;try{var r=n.dataTable(g);if(t.executeFunctionByName(i.amsDatatableAfterInitCallback,n,r,g),s.length>0)for(a=0;a<s.length;a++)switch(s[a]){case"autofill":var o=e.extend({},i.amsDatatableAutofillOptions,g.autofill);o=t.executeFunctionByName(i.amsDatatableAutofillInitCallback,n,o)||o,n.data("ams-autofill",void 0===i.amsDatatableAutofillConstructor?new e.fn.dataTable.AutoFill(n,o):t.executeFunctionByName(i.amsDatatableAutofillConstructor,n,r,o));break;case"columnfilter":var l=e.extend({},{sPlaceHolder:"head:after"},i.amsDatatableColumnfilterOptions,g.columnfilter);l=t.executeFunctionByName(i.amsDatatableColumnfilterInitCallback,n,l)||l,n.data("ams-columnfilter",void 0===i.amsDatatableColumnfilterConstructor?r.columnFilter(l):t.executeFunctionByName(i.amsDatatableColumnfilterConstructor,n,r,l));break;case"editable":var c=e.extend({},i.amsDatatableEditableOptions,g.editable);c=t.executeFunctionByName(i.amsDatatableEditableInitCallback,n,c)||c,n.data("ams-editable",void 0===i.amsDatatableEditableConstructor?n.makeEditable(c):t.executeFunctionByName(i.amsDatatableEditableConstructor,n,r,c));break;case"fixedcolumns":var m=e.extend({},i.amsDatatableFixedcolumnsOptions,g.fixedcolumns);m=t.executeFunctionByName(i.amsDatatableFixedcolumnsInitCallback,n,m)||m,n.data("ams-fixedcolumns",void 0===i.amsDatatableFixedcolumnsConstructor?new e.fn.dataTable.FixedColumns(n,m):t.executeFunctionByName(i.amsDatatableFixedcolumnsConstructor,n,r,m));break;case"fixedheader":var d=e.extend({},i.amsDatatableFixedheaderOptions,g.fixedheader);d=t.executeFunctionByName(i.amsDatatableFixedheadeInitCallback,n,d)||d,n.data("ams-fixedheader",void 0===i.amsDatatableFixedheaderConstructor?new e.fn.dataTable.FixedHeader(n,d):t.executeFunctionByName(i.amsDatatableFixedheaderConstructor,n,r,d));break;case"keytable":var u={table:n.get(0),datatable:r},b=e.extend({},u,i.amsDatatableKeytableOptions,g.keytable);b=t.executeFunctionByName(i.amsDatatableKeytableInitCallback,n,b)||b,n.data("ams-keytable",void 0===i.amsDatatableKeytableConstructor?new KeyTable(b):t.executeFunctionByName(i.amsDatatableKeytableConstructor,n,r,b));break;case"rowgrouping":var h=e.extend({},i.amsDatatableRowgroupingOptions,g.rowgrouping);h=t.executeFunctionByName(i.amsDatatableRowgroupingInitCallback,n,h)||h,n.data("ams-rowgrouping",void 0===i.amsDatatableRowgroupingConstructor?n.rowGrouping(h):t.executeFunctionByName(i.amsDatatableRowgroupingConstructor,n,r,h));break;case"rowreordering":var p=e.extend({},i.amsDatatableRowreorderingOptions,g.rowreordering);p=t.executeFunctionByName(i.amsDatatableRowreorderingInitCallback,n,p)||p,n.data("ams-rowreordering",void 0===i.amsDatatableRowreorderingConstructor?n.rowReordering(p):t.executeFunctionByName(i.amsDatatableRowreorderingConstructor,n,r,p))}if(i.amsDatatableFinalizeCallback){var f=i.amsDatatableFinalizeCallback.split(/\s+/);if(f.length>0)for(a=0;a<f.length;a++)t.executeFunctionByName(f[a],n,r,g)}}catch(e){}}),t.ajax&&t.ajax.check(x,v,y)})})})},tablednd:function(a){var n=e(".table-dnd",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.tableDnD,t.baseURL+"ext/jquery-tablednd"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data();n.amsTabledndDragHandle?e("tr",a).addClass("no-drag-handle"):e(a).on("mouseover","tr",function(){e(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){e(this.cells[0]).removeClass("drag-handle")});var i={onDragClass:n.amsTabledndDragClass||"dragging-row",onDragStart:t.getFunctionByName(n.amsTabledndDragStart),dragHandle:n.amsTabledndDragHandle,scrollAmount:n.amsTabledndScrollAmount,onAllowDrop:n.amsTabledndAllowDrop,onDrop:t.getFunctionByName(n.amsTabledndDrop)||function(i,s){var r=n.amsTabledndDropTarget;if(r){e(s).data("ams-disabled-handlers","click");try{var o=[];e(i.rows).each(function(){var a=e(this).data("ams-element-name");a&&o.push(a)});var l=t.getFunctionByName(r);if("function"==typeof l)l.call(a,i,o);else{if(!r.startsWith(window.location.protocol)){var c=n.amsLocation;c&&(r=c+"/"+r)}t.ajax&&t.ajax.post(r,{names:JSON.stringify(o)})}}finally{setTimeout(function(){e(s).removeData("ams-disabled-handlers")},50)}}return!1}},s=e.extend({},i,n.amsTabledndOptions);s=t.executeFunctionByName(n.amsTabledndInitCallback,a,s)||s;var r=a.tableDnD(s);t.executeFunctionByName(n.amsTabledndAfterInitCallback,a,r,s)})})},wizard:function(a){var n=e(".wizard",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.bootstrapWizard,t.baseURL+"ext/bootstrap-wizard-1.4.2"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i={withVisible:void 0===n.amsWizardWithVisible||n.amsWizardWithVisible,tabClass:n.amsWizardTabClass,firstSelector:n.amsWizardFirstSelector,previousSelector:n.amsWizardPreviousSelector,nextSelector:n.amsWizardNextSelector,lastSelector:n.amsWizardLastSelector,finishSelector:n.amsWizardFinishSelector,backSelector:n.amsWizardBackSelector,onInit:t.getFunctionByName(n.amsWizardInit),onShow:t.getFunctionByName(n.amsWizardShow),onNext:t.getFunctionByName(n.amsWizardNext),onPrevious:t.getFunctionByName(n.amsWizardPrevious),onFirst:t.getFunctionByName(n.amsWizardFirst),onLast:t.getFunctionByName(n.amsWizardLast),onBack:t.getFunctionByName(n.amsWizardBack),onFinish:t.getFunctionByName(n.amsWizardFinish),onTabChange:t.getFunctionByName(n.amsWizardTabChange),onTabClick:t.getFunctionByName(n.amsWizardTabClick),onTabShow:t.getFunctionByName(n.amsWizardTabShow)},s=e.extend({},i,n.amsWizardOptions);s=t.executeFunctionByName(n.amsWizardInitCallback,a,s)||s;var r=a.bootstrapWizard(s);t.executeFunctionByName(n.amsWizardAfterInitCallback,a,r,s)})})},tinymce:function(a){function n(){e(".tinymce",e(this)).each(function(){var a=tinymce.get(e(this).attr("id"));a&&a.remove()})}var i=e(".tinymce",a);if(i.length>0){var s=t.baseURL+"ext/tinymce"+(t.devmode?"/dev":"");t.ajax&&t.ajax.check(window.tinymce,s+"/tinymce"+t.devext+".js",function(a){function r(){i.each(function(){var a=e(this),n=a.data(),i={theme:n.amsTinymceTheme||"modern",language:t.lang,menubar:!1!==n.amsTinymceMenubar,statusbar:!1!==n.amsTinymceStatusbar,plugins:n.amsTinymcePlugins||["advlist autosave autolink lists link charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code fullscreen","insertdatetime nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern autoresize"],toolbar:n.amsTinymceToolbar,toolbar1:!1!==n.amsTinymceToolbar1&&(n.amsTinymceToolbar1||"undo redo | pastetext | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),toolbar2:!1!==n.amsTinymceToolbar2&&(n.amsTinymceToolbar2||"forecolor backcolor emoticons | charmap link image media | fullscreen preview print | code"),content_css:n.amsTinymceContentCss,formats:n.amsTinymceFormats,style_formats:n.amsTinymceStyleFormats,block_formats:n.amsTinymceBlockFormats,valid_classes:n.amsTinymceValidClasses,image_advtab:!0,image_list:t.getFunctionByName(n.amsTinymceImageList)||n.amsTinymceImageList,image_class_list:n.amsTinymceImageClassList,link_list:t.getFunctionByName(n.amsTinymceLinkList)||n.amsTinymceLinkList,link_class_list:n.amsTinymceLinkClassList,paste_as_text:void 0===n.amsTinymcePasteAsText||n.amsTinymcePasteAsText,paste_auto_cleanup_on_paste:void 0===n.amsTinymcePasteAutoCleanup||n.amsTinymcePasteAutoCleanup,paste_strip_class_attributes:n.amsTinymcePasteStripClassAttributes||"all",paste_remove_spans:void 0===n.amsTinymcePaseRemoveSpans||n.amsTinymcePasteRemoveSpans,paste_remove_styles:void 0===n.amsTinymcePasteRemoveStyles||n.amsTinymcePasteRemoveStyles,height:n.amsTinymceHeight||50,min_height:50,resize:!0,autoresize_min_height:50,autoresize_max_height:500};if(n.amsTinymceExternalPlugins){var s=n.amsTinymceExternalPlugins.split(/\s+/);for(var r in s)if(s.hasOwnProperty(r)){var o=a.data("ams-tinymce-plugin-"+s[r]);tinymce.PluginManager.load(s[r],t.getSource(o))}}var l=e.extend({},i,n.amsTinymceOptions);l=t.executeFunctionByName(n.amsTinymceInitCallback,a,l)||l;var c=a.tinymce(l);t.executeFunctionByName(n.amsTinymceAfterInitCallback,a,c,l)})}a?t.getScript(s+"/jquery.tinymce"+t.devext+".js",function(){tinymce.baseURL=s,tinymce.suffix=t.devext,t.skin&&t.skin.registerCleanCallback(n),r()}):r()})}},imgareaselect:function(a){var n=e(".imgareaselect",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.imgAreaSelect,t.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-imgareaselect"+t.devext+".css","jquery-imgareaselect",function(){n.each(function(){var a=e(this),n=a.data(),i=n.amsImgareaselectParent?a.parents(n.amsImgareaselectParent):"body",s={instance:!0,handles:!0,parent:i,x1:n.amsImgareaselectX1||0,y1:n.amsImgareaselectY1||0,x2:n.amsImgareaselectX2||n.amsImgareaselectImageWidth,y2:n.amsImgareaselectY2||n.amsImgareaselectImageHeight,imageWidth:n.amsImgareaselectImageWidth,imageHeight:n.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:n.amsImgareaselectRatio,onSelectEnd:t.getFunctionByName(n.amsImgareaselectSelectEnd)||function(a,t){var s=n.amsImgareaselectTargetField||"image_";e('input[name="'+s+'x1"]',i).val(t.x1),e('input[name="'+s+'y1"]',i).val(t.y1),e('input[name="'+s+'x2"]',i).val(t.x2),e('input[name="'+s+'y2"]',i).val(t.y2)}},r=e.extend({},s,n.amsImgareaselectOptions);r=t.executeFunctionByName(n.amsImgareaselectInitCallback,a,r)||r;var o=a.imgAreaSelect(r);t.executeFunctionByName(n.amsImgareaselectAfterInitCallback,a,o,r),setTimeout(function(){o.update()},250)})})})},fancybox:function(a){var n=e(".fancybox",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.fancybox,t.baseURL+"ext/jquery-fancybox-2.1.5"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-fancybox-2.1.5"+t.devext+".css","jquery-fancybox",function(){n.each(function(){var a,n=e(this),i=n.data(),s=n;i.amsFancyboxElements&&(s=e(i.amsFancyboxElements,n));var r=(i.amsFancyboxHelpers||"").split(/\s+/);if(r.length>0)for(a=0;a<r.length;a++)switch(r[a]){case"buttons":t.ajax&&t.ajax.check(e.fancybox.helpers.buttons,t.baseURL+"ext/fancybox-helpers/fancybox-buttons"+t.devext+".js");break;case"thumbs":t.ajax&&t.ajax.check(e.fancybox.helpers.thumbs,t.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+t.devext+".js");break;case"media":t.ajax&&t.ajax.check(e.fancybox.helpers.media,t.baseURL+"ext/fancybox-helpers/fancybox-media"+t.devext+".js")}var o={type:i.amsFancyboxType,padding:i.amsFancyboxPadding||10,margin:i.amsFancyboxMargin||10,loop:i.amsFancyboxLoop,beforeLoad:t.getFunctionByName(i.amsFancyboxBeforeLoad)||function(){var a;if(i.amsFancyboxTitleGetter&&(a=t.executeFunctionByName(i.amsFancyboxTitleGetter,this)),!a){var n=e("*:first",this.element);(a=n.attr("original-title")||n.attr("title"))||(a=e(this.element).attr("original-title")||e(this.element).attr("title"))}this.title=a},afterLoad:t.getFunctionByName(i.amsFancyboxAfterLoad),helpers:{title:{type:"inside"}}};if(r.length>0)for(a=0;a<r.length;a++)switch(r[a]){case"buttons":o.helpers.buttons={position:i.amsFancyboxButtonsPosition||"top"};break;case"thumbs":o.helpers.thumbs={width:i.amsFancyboxThumbsWidth||50,height:i.amsFancyboxThumbsHeight||50};break;case"media":o.helpers.media=!0}var l=e.extend({},o,i.amsFancyboxOptions);l=t.executeFunctionByName(i.amsFancyboxInitCallback,n,l)||l;var c=s.fancybox(l);t.executeFunctionByName(i.amsFancyboxAfterInitCallback,n,c,l)})})})},chart:function(a){var n=e(".chart",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.plot,t.baseURL+"flot/jquery.flot"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),i=(n.amsChartPlugins||"").split(/\s+/);if(i.length>0)for(var s in i)if(i.hasOwnProperty(s)){var r=i[s];(function(a){for(var t in e.plot.plugins)if(e.plot.plugins.hasOwnProperty(t)){var n=e.plot.plugins[t];if(n.name===a)return n}return null})(r)||t.getScript(t.baseURL+"flot/jquery.flot."+r+t.devext+".js")}var o=e.extend({},{},n.amsChartOptions);o=t.executeFunctionByName(n.amsChartInitCallback,a,o)||o;var l=n.amsChartData;l=t.executeFunctionByName(n.amsChartInitData,a,l)||l;var c=a.plot(l,o);t.executeFunctionByName(n.amsChartAfterInitCallback,a,c,o)})})},graphs:function(a){var n=e(".sparkline",a);n.length>0&&t.ajax&&t.ajax.check(t.graphs,t.baseURL+"myams-graphs"+t.devext+".js",function(){t.graphs.init(n)})},scrollbars:function(a){var n=e(".scrollbar",a);n.length>0&&t.ajax&&t.ajax.check(e.event.special.mousewheel,t.baseURL+"ext/jquery-mousewheel.min.js",function(){t.ajax.check(e.fn.mCustomScrollbar,t.baseURL+"ext/jquery-mCustomScrollbar"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar",function(){n.each(function(){var a=e(this),n=a.data(),i={theme:n.amsScrollbarTheme||"light"},s=e.extend({},i,n.amsScrollbarOptions);s=t.executeFunctionByName(n.amsScrollbarInitCallback,a,s)||s;var r=a.mCustomScrollbar(s);t.executeFunctionByName(n.amsScrollbarAfterInitCallback,a,r,s)})})})})}})}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-require.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-require.js Thu Dec 13 14:28:29 2018 +0100
@@ -465,6 +465,75 @@
})(jQuery, this);
+(function($, globals) {
+
+ var ams = globals.MyAMS;
+
+ /**
+ * MyAMS locale strings
+ */
+ ams.i18n = {
+
+ INFO: "Information",
+ WARNING: "!! WARNING !!",
+ ERROR: "ERROR: ",
+
+ LOADING: "Loading...",
+ PROGRESS: "Processing",
+
+ 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",
+ CLIPBOARD_CHARACTER_COPY_OK: "Character copied to clipboard",
+ CLIPBOARD_TEXT_COPY_OK: "Text copied to clipboard",
+
+ 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"
+ };
+
+})(jQuery, this);
+
/**
* MyAMS extensions loader
* This extension can be used when application or site is only using the core MyAMS package, to
--- a/src/pyams_skin/resources/js/myams-require.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-require.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-"use strict";!function(s,e){var t=e.console;String.prototype.startsWith=function(t){var e=this.length,n=t.length;return!(e<n)&&this.substr(0,n)===t},String.prototype.endsWith=function(t){var e=this.length,n=t.length;return!(e<n)&&this.substr(e-n)===t},String.prototype.unserialize=function(t){for(var e=decodeURIComponent(this).split("&"),n={},r=0;r<e.length;r++){var i=e[r].split("=",2);n[i[0]]=i[1]}return n},Array.prototype.indexOf||(Array.prototype.indexOf=function(t,e){var n=this.length;for((e=(e=Number(e)||0)<0?Math.ceil(e):Math.floor(e))<0&&(e+=n);e<n;e++)if(e in this&&this[e]===t)return e;return-1}),s.expr[":"].hasvalue=function(t,e,n){return""!==s(t).val()},s.expr[":"].econtains=function(t,e,n){return(t.textContent||t.innerText||s(t).text()||"").toLowerCase()===n[3].toLowerCase()},s.expr[":"].withtext=function(t,e,n){return(t.textContent||t.innerText||s(t).text()||"")===n[3]},s.expr[":"].parents=function(t,e,n){return 0<s(t).parents(n[3]).length},void 0===s.scrollbarWidth&&(s.scrollbarWidth=function(){var t=s('<div style="width: 50px; height: 50px; overflow: auto"><div/></div>').appendTo("body"),e=t.children(),n=e.innerWidth()-e.height(99).innerWidth();return t.remove(),n}),s.fn.extend({exists:function(){return 0<s(this).length},objectOrParentWithClass:function(t){return this.hasClass(t)?this:this.parents("."+t)},listattr:function(t){var e=[];return this.each(function(){e.push(s(this).attr(t))}),e},style:function(t,e,n){if(void 0!==this.get(0)){var r=this.get(0).style;return void 0!==t?void 0!==e?(n=void 0!==n?n:"",r.setProperty(t,e,n),this):r.getPropertyValue(t):r}},removeClassPrefix:function(r){return this.each(function(t,e){var n=e.className.split(" ").map(function(t){return t.startsWith(r)?"":t});e.className=s.trim(n.join(" "))}),this}}),void 0===e.MyAMS&&(e.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var n,r=e.MyAMS,c=r;r.baseURL=(n=s('script[src*="/myams.js"], script[src*="/myams.min.js"], script[src*="/myams-core.js"], script[src*="/myams-core.min.js"], script[src*="/myams-require.js"], script[src*="/myams-require.min.js"]').attr("src"),c.devmode=n.indexOf(".min.js")<0,c.devext=c.devmode?"":".min",n.substring(0,n.lastIndexOf("/")+1)),r.log=function(){t&&t.debug&&t.debug(this,arguments)},r.getQueryVar=function(t,e){if(t.indexOf("?")<0)return!1;t.endsWith("&")||(t+="&");var n=new RegExp(".*?[&\\?]"+e+"=(.*?)&.*"),r=t.replace(n,"$1");return r!==t&&r},r.rgb2hex=function(t){return"#"+s.map(t.match(/\b(\d+)\b/g),function(t){return("0"+parseInt(t).toString(16)).slice(-2)}).join("")},r.generateId=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+t()+t()},r.generateUUID=function(){var n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===t?e:3&e|8).toString(16)})},r.getObject=function(t,e){if(t){if("string"!=typeof t)return t;var n=t.split(".");e=null==e?window:e;for(var r=0;r<n.length;r++)try{e=e[n[r]]}catch(t){return}return e}},r.getFunctionByName=function(t,e){if(void 0!==t){if("function"==typeof t)return t;var n=t.split("."),r=n.pop();e=null==e?window:e;for(var i=0;i<n.length;i++)try{e=e[n[i]]}catch(t){return}try{return e[r]}catch(t){return}}},r.executeFunctionByName=function(t,e){var n=c.getFunctionByName(t,window);if("function"==typeof n){var r=Array.prototype.slice.call(arguments,2);return n.apply(e,r)}},r.isInDOM=function(t){return!!(t=s(t)).exists()&&e.document.body.contains(t[0])},r.getSource=function(t){return t.replace(/{[^{}]*}/g,function(t){return c.getFunctionByName(t.substr(1,t.length-2))})},r.getScript=function(t,e,n,r){"object"==typeof e&&(r=n,n=e,e=null),void 0===n&&(n={});var i={dataType:"script",url:c.getSource(t),success:e,error:r||c.error.show,cache:!c.devmode,async:void 0===n.async?"function"==typeof e:n.async},o=s.extend({},i,n);return s.ajax(o)},r.getCSS=function(t,e,n,r){n&&(n=c.getFunctionByName(n));var i=s("HEAD"),o=s('style[data-ams-id="'+e+'"]',i);if(0===o.length){if(o=s("<style>").attr("data-ams-id",e).text('@import "'+c.getSource(t)+'";'),n)var a=setInterval(function(){try{o[0].sheet.cssRules;n.call(window,!0,r),clearInterval(a)}catch(t){}},10);o.appendTo(i)}else n&&n.call(window,!1,r)}}(jQuery,this),function(a,t){var s=t.MyAMS,c=[];s.require=function(t,e){for(var n=[],r=0;r<t.length;r++){var i=t[r];if(c.indexOf(i)<0){var o=s.baseURL+"myams-"+i+s.devext+".js";n.push(s.getScript(o,{async:!0},console.error)),c.push(i)}}0<n.length?a.when.apply(a,n).then(function(){e()}):e()}}(jQuery,this);
+"use strict";!function(e,t){var r=t.console;String.prototype.startsWith=function(e){var t=this.length,r=e.length;return!(t<r)&&this.substr(0,r)===e},String.prototype.endsWith=function(e){var t=this.length,r=e.length;return!(t<r)&&this.substr(t-r)===e},String.prototype.unserialize=function(e){for(var t=decodeURIComponent(this).split("&"),r={},n=0;n<t.length;n++){var o=t[n].split("=",2);r[o[0]]=o[1]}return r},Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var r=this.length;for((t=(t=Number(t)||0)<0?Math.ceil(t):Math.floor(t))<0&&(t+=r);t<r;t++)if(t in this&&this[t]===e)return t;return-1}),e.expr[":"].hasvalue=function(t,r,n){return""!==e(t).val()},e.expr[":"].econtains=function(t,r,n){return(t.textContent||t.innerText||e(t).text()||"").toLowerCase()===n[3].toLowerCase()},e.expr[":"].withtext=function(t,r,n){return(t.textContent||t.innerText||e(t).text()||"")===n[3]},e.expr[":"].parents=function(t,r,n){return e(t).parents(n[3]).length>0},void 0===e.scrollbarWidth&&(e.scrollbarWidth=function(){var t=e('<div style="width: 50px; height: 50px; overflow: auto"><div/></div>').appendTo("body"),r=t.children(),n=r.innerWidth()-r.height(99).innerWidth();return t.remove(),n}),e.fn.extend({exists:function(){return e(this).length>0},objectOrParentWithClass:function(e){return this.hasClass(e)?this:this.parents("."+e)},listattr:function(t){var r=[];return this.each(function(){r.push(e(this).attr(t))}),r},style:function(e,t,r){if(void 0!==this.get(0)){var n=this.get(0).style;return void 0!==e?void 0!==t?(r=void 0!==r?r:"",n.setProperty(e,t,r),this):n.getPropertyValue(e):n}},removeClassPrefix:function(t){return this.each(function(r,n){var o=n.className.split(" ").map(function(e){return e.startsWith(t)?"":e});n.className=e.trim(o.join(" "))}),this}}),void 0===t.MyAMS&&(t.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var n=t.MyAMS,o=n;n.baseURL=function(){var t=e('script[src*="/myams.js"], script[src*="/myams.min.js"], script[src*="/myams-core.js"], script[src*="/myams-core.min.js"], script[src*="/myams-require.js"], script[src*="/myams-require.min.js"]').attr("src");return o.devmode=t.indexOf(".min.js")<0,o.devext=o.devmode?"":".min",t.substring(0,t.lastIndexOf("/")+1)}(),n.log=function(){r&&r.debug&&r.debug(this,arguments)},n.getQueryVar=function(e,t){if(e.indexOf("?")<0)return!1;e.endsWith("&")||(e+="&");var r=new RegExp(".*?[&\\?]"+t+"=(.*?)&.*"),n=e.replace(r,"$1");return n!==e&&n},n.rgb2hex=function(t){return"#"+e.map(t.match(/\b(\d+)\b/g),function(e){return("0"+parseInt(e).toString(16)).slice(-2)}).join("")},n.generateId=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()+e()},n.generateUUID=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)})},n.getObject=function(e,t){if(e){if("string"!=typeof e)return e;var r=e.split(".");t=void 0===t||null===t?window:t;for(var n=0;n<r.length;n++)try{t=t[r[n]]}catch(e){return}return t}},n.getFunctionByName=function(e,t){if(void 0!==e){if("function"==typeof e)return e;var r=e.split("."),n=r.pop();t=void 0===t||null===t?window:t;for(var o=0;o<r.length;o++)try{t=t[r[o]]}catch(e){return}try{return t[n]}catch(e){return}}},n.executeFunctionByName=function(e,t){var r=o.getFunctionByName(e,window);if("function"==typeof r){var n=Array.prototype.slice.call(arguments,2);return r.apply(t,n)}},n.isInDOM=function(r){return!!(r=e(r)).exists()&&t.document.body.contains(r[0])},n.getSource=function(e){return e.replace(/{[^{}]*}/g,function(e){return o.getFunctionByName(e.substr(1,e.length-2))})},n.getScript=function(t,r,n,i){"object"==typeof r&&(i=n,n=r,r=null),void 0===n&&(n={});var a={dataType:"script",url:o.getSource(t),success:r,error:i||o.error.show,cache:!o.devmode,async:void 0===n.async?"function"==typeof r:n.async},s=e.extend({},a,n);return e.ajax(s)},n.getCSS=function(t,r,n,i){n&&(n=o.getFunctionByName(n));var a=e("HEAD"),s=e('style[data-ams-id="'+r+'"]',a);if(0===s.length){if(s=e("<style>").attr("data-ams-id",r).text('@import "'+o.getSource(t)+'";'),n)var c=setInterval(function(){try{s[0].sheet.cssRules;n.call(window,!0,i),clearInterval(c)}catch(e){}},10);s.appendTo(a)}else n&&n.call(window,!1,i)}}(jQuery,this),function(e,t){t.MyAMS.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",LOADING:"Loading...",PROGRESS:"Processing",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",CLIPBOARD_CHARACTER_COPY_OK:"Character copied to clipboard",CLIPBOARD_TEXT_COPY_OK:"Text copied to clipboard",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"}}(jQuery,this),function(e,t){var r=t.MyAMS,n=[];r.require=function(t,o){for(var i=[],a=0;a<t.length;a++){var s=t[a];if(n.indexOf(s)<0){var c=r.baseURL+"myams-"+s+r.devext+".js";i.push(r.getScript(c,{async:!0},console.error)),n.push(s)}}i.length>0?e.when.apply(e,i).then(function(){o()}):o()}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-skin.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-skin.js Thu Dec 13 14:28:29 2018 +0100
@@ -12,7 +12,6 @@
*/
_setPageHeight: function() {
var mainHeight = $('#main').height();
- var menuHeight = ams.leftPanel.height();
var windowHeight = $(window).height() - ams.navbarHeight;
if (mainHeight > windowHeight) {
ams.root.css('min-height', mainHeight + ams.navbarHeight);
@@ -38,16 +37,16 @@
* Show/hide shortcut buttons
*/
_showShortcutButtons: function() {
- ams.shortcuts.animate({
- height: 'show'
- }, 200, 'easeOutCirc');
+ ams.shortcuts && ams.shortcuts.animate({
+ height: 'show'
+ }, 200, 'easeOutCirc');
ams.root.addClass('shortcut-on');
},
_hideShortcutButtons: function() {
- ams.shortcuts.animate({
- height: 'hide'
- }, 300, 'easeOutCirc');
+ ams.shortcuts && ams.shortcuts.animate({
+ height: 'hide'
+ }, 300, 'easeOutCirc');
ams.root.removeClass('shortcut-on');
},
@@ -58,10 +57,10 @@
var badge = $('.badge', '#user-activity >span');
if (parseInt(badge.text()) > 0) {
badge.removeClass("hidden")
- .addClass("bg-color-red bounceIn animated");
+ .addClass("bg-color-red bounceIn animated");
} else {
badge.addClass("hidden")
- .removeClass("bg-color-red bounceIn animated");
+ .removeClass("bg-color-red bounceIn animated");
}
},
@@ -81,7 +80,7 @@
var target = $('[id="' + options.object_id + '"]');
target.replaceWith($(options.content));
target = $('[id="' + options.object_id + '"]');
- ams.initContent(target);
+ ams.initContent && ams.initContent(target);
return target;
},
@@ -103,7 +102,7 @@
}
var label = widget.parents('.input').last();
label.html(options.content);
- ams.initContent(label);
+ ams.initContent && ams.initContent(label);
return label;
},
@@ -114,7 +113,7 @@
var widget = $('[id="' + options.object_id + '"]').parents('.ams-widget:first');
widget.replaceWith($(options.table));
widget = $('[id="' + options.object_id + '"]').parents('.ams-widget:first');
- ams.initContent(widget);
+ ams.initContent && ams.initContent(widget);
return widget;
},
@@ -124,9 +123,11 @@
*/
refreshSwitchedTable: function(options) {
var widget = ams.skin.refreshTable(options);
- var legend = widget.siblings('legend');
- if (legend.parents('fieldset:first').hasClass('switched')) {
- legend.click();
+ if (widget) {
+ var legend = widget.siblings('legend');
+ if (legend.parents('fieldset:first').hasClass('switched')) {
+ legend.click();
+ }
}
},
@@ -138,7 +139,7 @@
var table = tr.parents('table').first();
var new_tr = $(options.row);
tr.replaceWith(new_tr);
- ams.initContent(new_tr);
+ ams.initContent && ams.initContent(new_tr);
if (table.hasClass('table-dnd')) {
new_tr.addClass('no-drag-handle');
table.tableDnDUpdate();
@@ -158,7 +159,7 @@
if (index > -1) {
var cell = $($('td', tr).get(index));
cell.html(options.cell);
- ams.initContent(cell);
+ ams.initContent && ams.initContent(cell);
}
},
@@ -171,21 +172,21 @@
if (switcher.hasClass('fa-plus-square-o')) {
var container = datatype.parents('table');
innerdiv.html('<h1 class="loading"><i class="fa fa-gear fa-spin"></i></h1>');
- ams.ajax.post(container.data('ams-location') + '/' + source.data('ams-switch-handler'),
- {object_name: datatype.data('ams-element-name')},
- function (result) {
- innerdiv.html(result);
- if (result) {
- ams.initContent(innerdiv);
- switcher.removeClass('fa-plus-square-o')
- .addClass('fa-minus-square-o');
- }
- });
+ ams.ajax && ams.ajax.post(container.data('ams-location') + '/' + source.data('ams-switch-handler'),
+ {object_name: datatype.data('ams-element-name')},
+ function(result) {
+ innerdiv.html(result);
+ if (result) {
+ ams.initContent && ams.initContent(innerdiv);
+ switcher.removeClass('fa-plus-square-o')
+ .addClass('fa-minus-square-o');
+ }
+ });
} else {
ams.skin.cleanContainer(innerdiv);
innerdiv.empty();
switcher.removeClass('fa-minus-square-o')
- .addClass('fa-plus-square-o');
+ .addClass('fa-plus-square-o');
}
},
@@ -196,22 +197,22 @@
if (ams.enableWidgets) {
var widgets = $('.ams-widget', element);
if (widgets.length > 0) {
- ams.ajax.check($.fn.MyAMSWidget,
- ams.baseURL + 'myams-widgets' + ams.devext + '.js',
- function () {
- widgets.each(function () {
- var widget = $(this);
- var data = widget.data();
- var dataOptions = {
- deleteSettingsKey: '#deletesettingskey-options',
- deletePositionKey: '#deletepositionkey-options'
- };
- var settings = $.extend({}, dataOptions, data.amsWidgetOptions);
- settings = ams.executeFunctionByName(data.amsWidgetInitcallback, widget, settings) || settings;
- widget.MyAMSWidget(settings);
- });
- globals.MyAMSWidget.initWidgetsGrid($('.ams-widget-grid', element));
- });
+ ams.ajax && ams.ajax.check($.fn.MyAMSWidget,
+ ams.baseURL + 'myams-widgets' + ams.devext + '.js',
+ function() {
+ widgets.each(function() {
+ var widget = $(this);
+ var data = widget.data();
+ var dataOptions = {
+ deleteSettingsKey: '#deletesettingskey-options',
+ deletePositionKey: '#deletepositionkey-options'
+ };
+ var settings = $.extend({}, dataOptions, data.amsWidgetOptions);
+ settings = ams.executeFunctionByName(data.amsWidgetInitcallback, widget, settings) || settings;
+ widget.MyAMSWidget(settings);
+ });
+ globals.MyAMSWidget.initWidgetsGrid($('.ams-widget-grid', element));
+ });
}
}
},
@@ -243,7 +244,7 @@
'<i class="fa fa-fw fa-warning"></i> ' + header +
'</h4>' +
(subtitle ? ('<p>' + subtitle + '</p>') : '');
- if (typeof(message) === 'string') {
+ if (typeof (message) === 'string') {
content += '<ul><li>' + message + '</li></ul>';
} else if (message) {
content += '<ul>';
@@ -266,73 +267,73 @@
* Big message box
*/
bigBox: function(options, callback) {
- ams.ajax.check(ams.notify,
- ams.baseURL + 'myams-notify' + ams.devext + '.js',
- function() {
- ams.notify.messageBox(options, callback);
- });
+ ams.ajax && ams.ajax.check(ams.notify,
+ ams.baseURL + 'myams-notify' + ams.devext + '.js',
+ function() {
+ ams.notify.messageBox(options, callback);
+ });
},
/**
* Medium notification message box, displayed on page's bottom right
*/
messageBox: function(status, options, callback) {
- if (typeof(status) === 'object') {
+ if (typeof (status) === 'object') {
callback = options;
options = status || {};
status = 'info';
}
- ams.ajax.check(ams.notify,
- ams.baseURL + 'myams-notify' + ams.devext + '.js',
- function() {
- switch (status) {
- case 'error':
- case 'danger':
- options.color = '#C46A69';
- break;
- case 'warning':
- options.color = '#C79121';
- break;
- case 'success':
- options.color = '#739E73';
- break;
- default:
- options.color = options.color || '#3276B1';
- }
- options.sound = false;
- ams.notify.bigBox(options, callback);
- });
+ ams.ajax && ams.ajax.check(ams.notify,
+ ams.baseURL + 'myams-notify' + ams.devext + '.js',
+ function() {
+ switch (status) {
+ case 'error':
+ case 'danger':
+ options.color = '#C46A69';
+ break;
+ case 'warning':
+ options.color = '#C79121';
+ break;
+ case 'success':
+ options.color = '#739E73';
+ break;
+ default:
+ options.color = options.color || '#3276B1';
+ }
+ options.sound = false;
+ ams.notify.bigBox(options, callback);
+ });
},
/**
* Small notification message box, displayed on page's top right
*/
smallBox: function(status, options, callback) {
- if (typeof(status) === 'object') {
+ if (typeof (status) === 'object') {
callback = options;
options = status || {};
status = 'info';
}
- ams.ajax.check(ams.notify,
- ams.baseURL + 'myams-notify' + ams.devext + '.js',
- function () {
- switch (status) {
- case 'error':
- case 'danger':
- options.color = '#C46A69';
- break;
- case 'warning':
- options.color = '#C79121';
- break;
- case 'success':
- options.color = '#739E73';
- break;
- default:
- options.color = options.color || '#3276B1';
- }
- options.sound = false;
- ams.notify.smallBox(options, callback);
- });
+ ams.ajax && ams.ajax.check(ams.notify,
+ ams.baseURL + 'myams-notify' + ams.devext + '.js',
+ function() {
+ switch (status) {
+ case 'error':
+ case 'danger':
+ options.color = '#C46A69';
+ break;
+ case 'warning':
+ options.color = '#C79121';
+ break;
+ case 'success':
+ options.color = '#739E73';
+ break;
+ default:
+ options.color = options.color || '#3276B1';
+ }
+ options.sound = false;
+ ams.notify.smallBox(options, callback);
+ });
},
/**
@@ -342,20 +343,20 @@
* @param options: scroll options
*/
scrollTo: function(element, options) {
- ams.ajax.check($.scrollTo,
- ams.baseURL + 'ext/jquery-scrollto-2.1.2' + ams.devext + '.js',
- function() {
- var body = $('body');
- var offset = options.offset || 0;
- if (body.hasClass('fixed-header')) {
- offset -= $('#header').height();
- }
- if (body.hasClass('fixed-ribbon')) {
- offset -= $('#ribbon').height();
- }
- options = $.extend({}, options, {offset: offset});
- $.scrollTo(element, options);
- });
+ ams.ajax && ams.ajax.check($.scrollTo,
+ ams.baseURL + 'ext/jquery-scrollto-2.1.2' + ams.devext + '.js',
+ function() {
+ var body = $('body');
+ var offset = options.offset || 0;
+ if (body.hasClass('fixed-header')) {
+ offset -= $('#header').height();
+ }
+ if (body.hasClass('fixed-ribbon')) {
+ offset -= $('#ribbon').height();
+ }
+ options = $.extend({}, options, {offset: offset});
+ $.scrollTo(element, options);
+ });
},
/**
@@ -366,8 +367,8 @@
$('li', crumb).not('.parent').remove();
if (!$('li', crumb).exists()) {
crumb.append($('<li></li>').append($('<a></a>').text(ams.i18n.HOME)
- .addClass('padding-right-5')
- .attr('href', $('nav a[href!="#"]:first').attr('href'))));
+ .addClass('padding-right-5')
+ .attr('href', $('nav a[href!="#"]:first').attr('href'))));
}
$('LI.active >A', 'nav').each(function() {
var menu = $(this);
@@ -377,8 +378,8 @@
.end()
.text());
var item = $("<li></li>").append(menu.attr('href').replace(/^#/, '') ?
- $("<a></a>").html(body).attr('href', menu.attr('href'))
- : body);
+ $("<a></a>").html(body).attr('href', menu.attr('href'))
+ : body);
crumb.append(item);
});
},
@@ -413,13 +414,15 @@
if (menu.exists()) {
updateActiveMenus(menu);
}
- ams.skin.loadURL(url, container, {afterLoadCallback: function() {
- var prefix = $('html head title').data('ams-title-prefix');
- document.title = (prefix ? prefix + ' > ' : '') +
- ($('[data-ams-page-title]:first', container).data('ams-page-title') ||
- menu.attr('title') ||
- document.title);
- }});
+ ams.skin.loadURL(url, container, {
+ afterLoadCallback: function() {
+ var prefix = $('html head title').data('ams-title-prefix');
+ document.title = (prefix ? prefix + ' > ' : '') +
+ ($('[data-ams-page-title]:first', container).data('ams-page-title') ||
+ menu.attr('title') ||
+ document.title);
+ }
+ });
} else {
var activeUrl = $('[data-ams-active-menu]').data('ams-active-menu');
if (activeUrl) {
@@ -471,7 +474,7 @@
*/
cleanContainer: function(container) {
var callbacks = ams.skin._clean_callbacks;
- for (var index=0; index < callbacks.length; index++) {
+ for (var index = 0; index < callbacks.length; index++) {
callbacks[index].call(container);
}
},
@@ -483,7 +486,7 @@
if (url.startsWith('#')) {
url = url.substr(1);
}
- if (typeof(options) === 'function') {
+ if (typeof (options) === 'function') {
callback = options;
options = {};
} else if (options === undefined) {
@@ -514,44 +517,46 @@
if (callback) {
ams.executeFunctionByName(callback, this, data, status, request, options);
} else {
- var response = ams.ajax.getResponse(request);
- var dataType = response.contentType;
- var result = response.data;
- $('.loading', container).remove();
- switch (dataType) {
- case 'json':
- ams.ajax.handleJSON(result, container);
- break;
- case 'script':
- break;
- case 'xml':
- break;
- case 'html':
+ var response = ams.ajax && ams.ajax.getResponse(request);
+ if (response) {
+ var dataType = response.contentType;
+ var result = response.data;
+ $('.loading', container).remove();
+ switch (dataType) {
+ case 'json':
+ ams.ajax.handleJSON(result, container);
+ break;
+ case 'script':
+ break;
+ case 'xml':
+ break;
+ case 'html':
/* falls through */
- case 'text':
+ case 'text':
/* falls through */
- default:
- // Show and init container
- container.parents('.hidden').removeClass('hidden');
- $('.alert', container.parents('.alerts-container')).remove();
- container.css({opacity: '0.0'})
- .html(data)
- .removeClass('hidden')
- .delay(50)
- .animate({opacity: '1.0'}, 300);
- ams.initContent(container);
- ams.form.setFocus(container);
+ default:
+ // Show and init container
+ container.parents('.hidden').removeClass('hidden');
+ $('.alert', container.parents('.alerts-container')).remove();
+ container.css({opacity: '0.0'})
+ .html(data)
+ .removeClass('hidden')
+ .delay(50)
+ .animate({opacity: '1.0'}, 300);
+ ams.initContent && ams.initContent(container);
+ ams.form && ams.form.setFocus(container);
+ }
+ if (options && options.afterLoadCallback) {
+ ams.executeFunctionByName(options.afterLoadCallback, this, options.afterLoadCallbackOptions);
+ }
+ ams.stats && ams.stats.logPageview();
}
- if (options && options.afterLoadCallback) {
- ams.executeFunctionByName(options.afterLoadCallback, this, options.afterLoadCallbackOptions);
- }
- ams.stats.logPageview();
}
},
error: function(request, errorOptions, error) {
container.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> ' +
- ams.i18n.ERROR + error + '</h3>' +
- request.responseText);
+ ams.i18n.ERROR + error + '</h3>' +
+ request.responseText);
if (options && options.afterErrorCallback) {
ams.executeFunctionByName(options.afterErrorCallback, this);
}
@@ -571,13 +576,13 @@
switch (handlerType) {
case 'json':
var method = options.method || 'setUserLanguage';
- ams.jsonrpc.post(method, {lang: lang}, function() {
+ ams.jsonrpc && ams.jsonrpc.post(method, {lang: lang}, function() {
window.location.reload(true);
});
break;
case 'ajax':
var href = options.href || 'setUserLanguage';
- ams.ajax.post(href, {lang: lang}, function() {
+ ams.ajax && ams.ajax.post(href, {lang: lang}, function() {
window.location.reload(true);
});
break;
--- a/src/pyams_skin/resources/js/myams-skin.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-skin.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(e,a){var t=a.MyAMS;t.skin={_setPageHeight:function(){var a=e("#main").height(),i=(t.leftPanel.height(),e(window).height()-t.navbarHeight);a>i?t.root.css("min-height",a+t.navbarHeight):t.root.css("min-height",i),t.leftPanel.css("min-height",i),t.leftPanel.css("max-height",i)},_checkMobileWidth:function(){e(window).width()<979?t.root.addClass("mobile-view-activated"):t.root.hasClass("mobile-view-activated")&&t.root.removeClass("mobile-view-activated")},_showShortcutButtons:function(){t.shortcuts.animate({height:"show"},200,"easeOutCirc"),t.root.addClass("shortcut-on")},_hideShortcutButtons:function(){t.shortcuts.animate({height:"hide"},300,"easeOutCirc"),t.root.removeClass("shortcut-on")},checkNotification:function(){var a=e(".badge","#user-activity >span");parseInt(a.text())>0?a.removeClass("hidden").addClass("bg-color-red bounceIn animated"):a.addClass("hidden").removeClass("bg-color-red bounceIn animated")},refreshNotificationsPanel:function(a){var t=e(this);t.addClass("disabled"),e("i",t).addClass("fa-spin"),e('input[name="activity"]:checked',"#user-activity").change(),e("i",t).removeClass("fa-spin"),t.removeClass("disabled")},refreshContent:function(a){var i=e('[id="'+a.object_id+'"]');return i.replaceWith(e(a.content)),i=e('[id="'+a.object_id+'"]'),t.initContent(i),i},refreshImage:function(a){e('img[src^="'+a.src+'"]').attr("src",a.target)},refreshWidget:function(a){var i=e('[id="'+a.parent_id+'"]'),n=e('[name="'+a.widget_name+'"]',i);n.exists()||(n=e('[name="'+a.widget_name+':list"]',i));var s=n.parents(".input").last();return s.html(a.content),t.initContent(s),s},refreshTable:function(a){var i=e('[id="'+a.object_id+'"]').parents(".ams-widget:first");return i.replaceWith(e(a.table)),i=e('[id="'+a.object_id+'"]').parents(".ams-widget:first"),t.initContent(i),i},refreshSwitchedTable:function(e){var a=t.skin.refreshTable(e).siblings("legend");a.parents("fieldset:first").hasClass("switched")&&a.click()},refreshRow:function(a){var i=e('tr[id="'+a.object_id+'"]'),n=i.parents("table").first(),s=e(a.row);return i.replaceWith(s),t.initContent(s),n.hasClass("table-dnd")&&(s.addClass("no-drag-handle"),n.tableDnDUpdate()),s},refreshRowCell:function(a){var i=e('tr[id="'+a.object_id+'"]'),n=i.parents("table").first(),s=e("tr",e("thead",n)),o=e('th[data-ams-column-name="'+a.col_name+'"]',s),r=e("th",s).index(o);if(r>-1){var l=e(e("td",i).get(r));l.html(a.cell),t.initContent(l)}},switchCellContent:function(a){var i=e(this),n=e("i.switch",i),s=i.parents("td"),o=e(i.data("ams-switch-target")||".inner-table-form",s),r=i.parents("tr");if(n.hasClass("fa-plus-square-o")){var l=r.parents("table");o.html('<h1 class="loading"><i class="fa fa-gear fa-spin"></i></h1>'),t.ajax.post(l.data("ams-location")+"/"+i.data("ams-switch-handler"),{object_name:r.data("ams-element-name")},function(e){o.html(e),e&&(t.initContent(o),n.removeClass("fa-plus-square-o").addClass("fa-minus-square-o"))})}else t.skin.cleanContainer(o),o.empty(),n.removeClass("fa-minus-square-o").addClass("fa-plus-square-o")},_initDesktopWidgets:function(i){if(t.enableWidgets){var n=e(".ams-widget",i);n.length>0&&t.ajax.check(e.fn.MyAMSWidget,t.baseURL+"myams-widgets"+t.devext+".js",function(){n.each(function(){var a=e(this),i=a.data(),n=e.extend({},{deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"},i.amsWidgetOptions);n=t.executeFunctionByName(i.amsWidgetInitcallback,a,n)||n,a.MyAMSWidget(n)}),a.MyAMSWidget.initWidgetsGrid(e(".ams-widget-grid",i))})}},_initMobileWidgets:function(e){t.enableMobile&&t.enableWidgets&&t.skin._initDesktopWidgets(e)},alert:function(a,i,n,s,o,r){"error"===i&&(i="danger"),e(".alert-"+i,a).not(".persistent").remove();var l='<div class="'+(r?"margin-10":"")+" alert alert-block alert-"+i+' padding-5 fade in"><a class="close" data-dismiss="alert"><i class="fa fa-check"></i></a><h4 class="alert-heading"><i class="fa fa-fw fa-warning"></i> '+n+"</h4>"+(o?"<p>"+o+"</p>":"");if("string"==typeof s)l+="<ul><li>"+s+"</li></ul>";else if(s){l+="<ul>";for(var c in s)e.isNumeric(c)&&(l+="<li>"+s[c]+"</li>");l+="</ul>"}e(l+="</div>").insertBefore(a),a.exists&&t.skin.scrollTo(a,{offset:{top:-50}})},bigBox:function(e,a){t.ajax.check(t.notify,t.baseURL+"myams-notify"+t.devext+".js",function(){t.notify.messageBox(e,a)})},messageBox:function(e,a,i){"object"==typeof e&&(i=a,a=e||{},e="info"),t.ajax.check(t.notify,t.baseURL+"myams-notify"+t.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,t.notify.bigBox(a,i)})},smallBox:function(e,a,i){"object"==typeof e&&(i=a,a=e||{},e="info"),t.ajax.check(t.notify,t.baseURL+"myams-notify"+t.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,t.notify.smallBox(a,i)})},scrollTo:function(a,i){t.ajax.check(e.scrollTo,t.baseURL+"ext/jquery-scrollto-2.1.2"+t.devext+".js",function(){var t=e("body"),n=i.offset||0;t.hasClass("fixed-header")&&(n-=e("#header").height()),t.hasClass("fixed-ribbon")&&(n-=e("#ribbon").height()),i=e.extend({},i,{offset:n}),e.scrollTo(a,i)})},_drawBreadCrumb:function(){var a=e("OL.breadcrumb","#ribbon");e("li",a).not(".parent").remove(),e("li",a).exists()||a.append(e("<li></li>").append(e("<a></a>").text(t.i18n.HOME).addClass("padding-right-5").attr("href",e('nav a[href!="#"]:first').attr("href")))),e("LI.active >A","nav").each(function(){var t=e(this),i=e.trim(t.clone().children(".badge").remove().end().text()),n=e("<li></li>").append(t.attr("href").replace(/^#/,"")?e("<a></a>").html(i).attr("href",t.attr("href")):i);a.append(n)})},checkURL:function(){function a(a){e(".active",n).removeClass("active"),a.addClass("open").addClass("active"),a.parents("li").addClass("open active").children("ul").addClass("active").show(),a.parents("li:first").removeClass("open"),a.parents("ul").addClass(a.attr("href").replace(/^#/,"")?"active":"").show()}var i,n=e("nav"),s=location.hash,o=s.replace(/^#/,"");if(o){var r=e("#content");r.exists()||(r=e("body")),(i=e('A[href="'+s+'"]',n)).exists()&&a(i),t.skin.loadURL(o,r,{afterLoadCallback:function(){var a=e("html head title").data("ams-title-prefix");document.title=(a?a+" > ":"")+(e("[data-ams-page-title]:first",r).data("ams-page-title")||i.attr("title")||document.title)}})}else{var l=e("[data-ams-active-menu]").data("ams-active-menu");(i=l?e('A[href="'+l+'"]',n):e('>UL >LI >A[href!="#"]',n).first()).exists()&&(a(i),l?t.skin._drawBreadCrumb():window.location.hash=i.attr("href"))}},_clean_callbacks:[],registerCleanCallback:function(e){var a=t.skin._clean_callbacks;a.indexOf(e)<0&&a.push(e)},unregisterCleanCallback:function(e){var a=t.skin._clean_callbacks,i=a.indexOf(e);i>=0&&a.splice(i,1)},cleanContainer:function(e){for(var a=t.skin._clean_callbacks,i=0;i<a.length;i++)a[i].call(e)},loadURL:function(a,i,n,s){a.startsWith("#")&&(a=a.substr(1)),"function"==typeof n?(s=n,n={}):void 0===n&&(n={}),i=e(i);var o={type:"GET",url:a,dataType:"html",cache:!1,beforeSend:function(){if(n&&n.preLoadCallback&&t.executeFunctionByName(n.preLoadCallback,this,n.preLoadCallbackOptions),t.skin.cleanContainer(i),i.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> '+t.i18n.LOADING+" </h1>"),i[0]===e("#content")[0]){t.skin._drawBreadCrumb();var a=e("html head title").data("ams-title-prefix");document.title=(a?a+" > ":"")+e(".breadcrumb LI:last-child").text(),e("html, body").animate({scrollTop:0},"fast")}else i.animate({scrollTop:0},"fast")},success:function(a,o,r){if(s)t.executeFunctionByName(s,this,a,o,r,n);else{var l=t.ajax.getResponse(r),c=l.contentType,d=l.data;switch(e(".loading",i).remove(),c){case"json":t.ajax.handleJSON(d,i);break;case"script":case"xml":break;case"html":case"text":default:i.parents(".hidden").removeClass("hidden"),e(".alert",i.parents(".alerts-container")).remove(),i.css({opacity:"0.0"}).html(a).removeClass("hidden").delay(50).animate({opacity:"1.0"},300),t.initContent(i),t.form.setFocus(i)}n&&n.afterLoadCallback&&t.executeFunctionByName(n.afterLoadCallback,this,n.afterLoadCallbackOptions),t.stats.logPageview()}},error:function(e,a,s){i.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> '+t.i18n.ERROR+s+"</h3>"+e.responseText),n&&n.afterErrorCallback&&t.executeFunctionByName(n.afterErrorCallback,this)},async:void 0===n.async||n.async},r=e.extend({},o,n);e.ajax(r)},setLanguage:function(e,a){var i=a.lang;switch(a.handler_type||"json"){case"json":var n=a.method||"setUserLanguage";t.jsonrpc.post(n,{lang:i},function(){window.location.reload(!0)});break;case"ajax":var s=a.href||"setUserLanguage";t.ajax.post(s,{lang:i},function(){window.location.reload(!0)})}},logout:function(){window.location=t.loginURL}}}(jQuery,this);
+!function(e,a){var t=a.MyAMS;t.skin={_setPageHeight:function(){var a=e("#main").height(),i=e(window).height()-t.navbarHeight;a>i?t.root.css("min-height",a+t.navbarHeight):t.root.css("min-height",i),t.leftPanel.css("min-height",i),t.leftPanel.css("max-height",i)},_checkMobileWidth:function(){e(window).width()<979?t.root.addClass("mobile-view-activated"):t.root.hasClass("mobile-view-activated")&&t.root.removeClass("mobile-view-activated")},_showShortcutButtons:function(){t.shortcuts&&t.shortcuts.animate({height:"show"},200,"easeOutCirc"),t.root.addClass("shortcut-on")},_hideShortcutButtons:function(){t.shortcuts&&t.shortcuts.animate({height:"hide"},300,"easeOutCirc"),t.root.removeClass("shortcut-on")},checkNotification:function(){var a=e(".badge","#user-activity >span");parseInt(a.text())>0?a.removeClass("hidden").addClass("bg-color-red bounceIn animated"):a.addClass("hidden").removeClass("bg-color-red bounceIn animated")},refreshNotificationsPanel:function(a){var t=e(this);t.addClass("disabled"),e("i",t).addClass("fa-spin"),e('input[name="activity"]:checked',"#user-activity").change(),e("i",t).removeClass("fa-spin"),t.removeClass("disabled")},refreshContent:function(a){var i=e('[id="'+a.object_id+'"]');return i.replaceWith(e(a.content)),i=e('[id="'+a.object_id+'"]'),t.initContent&&t.initContent(i),i},refreshImage:function(a){e('img[src^="'+a.src+'"]').attr("src",a.target)},refreshWidget:function(a){var i=e('[id="'+a.parent_id+'"]'),n=e('[name="'+a.widget_name+'"]',i);n.exists()||(n=e('[name="'+a.widget_name+':list"]',i));var s=n.parents(".input").last();return s.html(a.content),t.initContent&&t.initContent(s),s},refreshTable:function(a){var i=e('[id="'+a.object_id+'"]').parents(".ams-widget:first");return i.replaceWith(e(a.table)),i=e('[id="'+a.object_id+'"]').parents(".ams-widget:first"),t.initContent&&t.initContent(i),i},refreshSwitchedTable:function(e){var a=t.skin.refreshTable(e);if(a){var i=a.siblings("legend");i.parents("fieldset:first").hasClass("switched")&&i.click()}},refreshRow:function(a){var i=e('tr[id="'+a.object_id+'"]'),n=i.parents("table").first(),s=e(a.row);return i.replaceWith(s),t.initContent&&t.initContent(s),n.hasClass("table-dnd")&&(s.addClass("no-drag-handle"),n.tableDnDUpdate()),s},refreshRowCell:function(a){var i=e('tr[id="'+a.object_id+'"]'),n=i.parents("table").first(),s=e("tr",e("thead",n)),o=e('th[data-ams-column-name="'+a.col_name+'"]',s),r=e("th",s).index(o);if(r>-1){var l=e(e("td",i).get(r));l.html(a.cell),t.initContent&&t.initContent(l)}},switchCellContent:function(a){var i=e(this),n=e("i.switch",i),s=i.parents("td"),o=e(i.data("ams-switch-target")||".inner-table-form",s),r=i.parents("tr");if(n.hasClass("fa-plus-square-o")){var l=r.parents("table");o.html('<h1 class="loading"><i class="fa fa-gear fa-spin"></i></h1>'),t.ajax&&t.ajax.post(l.data("ams-location")+"/"+i.data("ams-switch-handler"),{object_name:r.data("ams-element-name")},function(e){o.html(e),e&&(t.initContent&&t.initContent(o),n.removeClass("fa-plus-square-o").addClass("fa-minus-square-o"))})}else t.skin.cleanContainer(o),o.empty(),n.removeClass("fa-minus-square-o").addClass("fa-plus-square-o")},_initDesktopWidgets:function(i){if(t.enableWidgets){var n=e(".ams-widget",i);n.length>0&&t.ajax&&t.ajax.check(e.fn.MyAMSWidget,t.baseURL+"myams-widgets"+t.devext+".js",function(){n.each(function(){var a=e(this),i=a.data(),n=e.extend({},{deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"},i.amsWidgetOptions);n=t.executeFunctionByName(i.amsWidgetInitcallback,a,n)||n,a.MyAMSWidget(n)}),a.MyAMSWidget.initWidgetsGrid(e(".ams-widget-grid",i))})}},_initMobileWidgets:function(e){t.enableMobile&&t.enableWidgets&&t.skin._initDesktopWidgets(e)},alert:function(a,i,n,s,o,r){"error"===i&&(i="danger"),e(".alert-"+i,a).not(".persistent").remove();var l='<div class="'+(r?"margin-10":"")+" alert alert-block alert-"+i+' padding-5 fade in"><a class="close" data-dismiss="alert"><i class="fa fa-check"></i></a><h4 class="alert-heading"><i class="fa fa-fw fa-warning"></i> '+n+"</h4>"+(o?"<p>"+o+"</p>":"");if("string"==typeof s)l+="<ul><li>"+s+"</li></ul>";else if(s){l+="<ul>";for(var c in s)e.isNumeric(c)&&(l+="<li>"+s[c]+"</li>");l+="</ul>"}e(l+="</div>").insertBefore(a),a.exists&&t.skin.scrollTo(a,{offset:{top:-50}})},bigBox:function(e,a){t.ajax&&t.ajax.check(t.notify,t.baseURL+"myams-notify"+t.devext+".js",function(){t.notify.messageBox(e,a)})},messageBox:function(e,a,i){"object"==typeof e&&(i=a,a=e||{},e="info"),t.ajax&&t.ajax.check(t.notify,t.baseURL+"myams-notify"+t.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,t.notify.bigBox(a,i)})},smallBox:function(e,a,i){"object"==typeof e&&(i=a,a=e||{},e="info"),t.ajax&&t.ajax.check(t.notify,t.baseURL+"myams-notify"+t.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,t.notify.smallBox(a,i)})},scrollTo:function(a,i){t.ajax&&t.ajax.check(e.scrollTo,t.baseURL+"ext/jquery-scrollto-2.1.2"+t.devext+".js",function(){var t=e("body"),n=i.offset||0;t.hasClass("fixed-header")&&(n-=e("#header").height()),t.hasClass("fixed-ribbon")&&(n-=e("#ribbon").height()),i=e.extend({},i,{offset:n}),e.scrollTo(a,i)})},_drawBreadCrumb:function(){var a=e("OL.breadcrumb","#ribbon");e("li",a).not(".parent").remove(),e("li",a).exists()||a.append(e("<li></li>").append(e("<a></a>").text(t.i18n.HOME).addClass("padding-right-5").attr("href",e('nav a[href!="#"]:first').attr("href")))),e("LI.active >A","nav").each(function(){var t=e(this),i=e.trim(t.clone().children(".badge").remove().end().text()),n=e("<li></li>").append(t.attr("href").replace(/^#/,"")?e("<a></a>").html(i).attr("href",t.attr("href")):i);a.append(n)})},checkURL:function(){function a(a){e(".active",n).removeClass("active"),a.addClass("open").addClass("active"),a.parents("li").addClass("open active").children("ul").addClass("active").show(),a.parents("li:first").removeClass("open"),a.parents("ul").addClass(a.attr("href").replace(/^#/,"")?"active":"").show()}var i,n=e("nav"),s=location.hash,o=s.replace(/^#/,"");if(o){var r=e("#content");r.exists()||(r=e("body")),(i=e('A[href="'+s+'"]',n)).exists()&&a(i),t.skin.loadURL(o,r,{afterLoadCallback:function(){var a=e("html head title").data("ams-title-prefix");document.title=(a?a+" > ":"")+(e("[data-ams-page-title]:first",r).data("ams-page-title")||i.attr("title")||document.title)}})}else{var l=e("[data-ams-active-menu]").data("ams-active-menu");(i=l?e('A[href="'+l+'"]',n):e('>UL >LI >A[href!="#"]',n).first()).exists()&&(a(i),l?t.skin._drawBreadCrumb():window.location.hash=i.attr("href"))}},_clean_callbacks:[],registerCleanCallback:function(e){var a=t.skin._clean_callbacks;a.indexOf(e)<0&&a.push(e)},unregisterCleanCallback:function(e){var a=t.skin._clean_callbacks,i=a.indexOf(e);i>=0&&a.splice(i,1)},cleanContainer:function(e){for(var a=t.skin._clean_callbacks,i=0;i<a.length;i++)a[i].call(e)},loadURL:function(a,i,n,s){a.startsWith("#")&&(a=a.substr(1)),"function"==typeof n?(s=n,n={}):void 0===n&&(n={}),i=e(i);var o={type:"GET",url:a,dataType:"html",cache:!1,beforeSend:function(){if(n&&n.preLoadCallback&&t.executeFunctionByName(n.preLoadCallback,this,n.preLoadCallbackOptions),t.skin.cleanContainer(i),i.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> '+t.i18n.LOADING+" </h1>"),i[0]===e("#content")[0]){t.skin._drawBreadCrumb();var a=e("html head title").data("ams-title-prefix");document.title=(a?a+" > ":"")+e(".breadcrumb LI:last-child").text(),e("html, body").animate({scrollTop:0},"fast")}else i.animate({scrollTop:0},"fast")},success:function(a,o,r){if(s)t.executeFunctionByName(s,this,a,o,r,n);else{var l=t.ajax&&t.ajax.getResponse(r);if(l){var c=l.contentType,d=l.data;switch(e(".loading",i).remove(),c){case"json":t.ajax.handleJSON(d,i);break;case"script":case"xml":break;case"html":case"text":default:i.parents(".hidden").removeClass("hidden"),e(".alert",i.parents(".alerts-container")).remove(),i.css({opacity:"0.0"}).html(a).removeClass("hidden").delay(50).animate({opacity:"1.0"},300),t.initContent&&t.initContent(i),t.form&&t.form.setFocus(i)}n&&n.afterLoadCallback&&t.executeFunctionByName(n.afterLoadCallback,this,n.afterLoadCallbackOptions),t.stats&&t.stats.logPageview()}}},error:function(e,a,s){i.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> '+t.i18n.ERROR+s+"</h3>"+e.responseText),n&&n.afterErrorCallback&&t.executeFunctionByName(n.afterErrorCallback,this)},async:void 0===n.async||n.async},r=e.extend({},o,n);e.ajax(r)},setLanguage:function(e,a){var i=a.lang;switch(a.handler_type||"json"){case"json":var n=a.method||"setUserLanguage";t.jsonrpc&&t.jsonrpc.post(n,{lang:i},function(){window.location.reload(!0)});break;case"ajax":var s=a.href||"setUserLanguage";t.ajax&&t.ajax.post(s,{lang:i},function(){window.location.reload(!0)})}},logout:function(){window.location=t.loginURL}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-tree.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-tree.js Thu Dec 13 14:28:29 2018 +0100
@@ -34,7 +34,7 @@
var sourceName = tr.data('ams-element-name');
switcher.removeClass('fa-plus-square-o')
.addClass('fa-cog fa-spin');
- ams.ajax.post(location + '/' + sourceName + '/' + treeNodesTarget, {
+ ams.ajax && ams.ajax.post(location + '/' + sourceName + '/' + treeNodesTarget, {
can_sort: !$('td.sorter', tr).is(':empty')
}, function(result, status) {
if (result.length > 0) {
@@ -42,8 +42,8 @@
for (var index = 0; index < result.length; index++) {
var new_row = $(result[index]);
new_row.insertAfter(old_row)
- .addClass('no-drag-handle');
- ams.initContent(new_row);
+ .addClass('no-drag-handle');
+ ams.initContent && ams.initContent(new_row);
old_row = new_row;
}
if (table.hasClass('table-dnd')) {
@@ -51,7 +51,7 @@
}
}
switcher.removeClass('fa-cog fa-spin')
- .addClass('fa-minus-square-o');
+ .addClass('fa-minus-square-o');
});
}
},
@@ -67,14 +67,14 @@
if (switcher.hasClass('fa-minus-square-o')) {
$('tr[data-ams-tree-node-parent-id]').filter('tr[data-ams-tree-node-parent-id!="' + tableID + '"]').remove();
$('i.switch', table).removeClass('fa-minus-square-o')
- .addClass('fa-plus-square-o');
+ .addClass('fa-plus-square-o');
} else {
var tr = $('tbody tr', table).first();
var location = table.data('ams-location') || '';
var target = table.data('ams-tree-nodes-target') || 'get-tree.json';
switcher.removeClass('fa-plus-square-o')
- .addClass('fa-cog fa-spin');
- ams.ajax.post(location + '/' + target, {
+ .addClass('fa-cog fa-spin');
+ ams.ajax && ams.ajax.post(location + '/' + target, {
can_sort: !$('td.sorter', tr).is(':empty')
}, function(result, status) {
$('tr[data-ams-tree-node-id]', table).remove();
@@ -87,16 +87,16 @@
new_row.insertAfter(old_row);
}
new_row.addClass('no-drag-handle');
- ams.initContent(new_row);
+ ams.initContent && ams.initContent(new_row);
old_row = new_row;
}
if (table.hasClass('table-dnd')) {
table.tableDnDUpdate();
}
$('i.switch', table).removeClass('fa-plus-square-o')
- .addClass('fa-minus-square-o');
+ .addClass('fa-minus-square-o');
switcher.removeClass('fa-cog fa-spin')
- .addClass('fa-minus-square-o');
+ .addClass('fa-minus-square-o');
});
}
},
@@ -158,7 +158,7 @@
}
// Call ordering target
var localTarget = ams.getFunctionByName(target);
- if (typeof(localTarget) === 'function') {
+ if (typeof (localTarget) === 'function') {
localTarget.call(table, dnd_table, post_data);
} else {
if (!target.startsWith(window.location.protocol)) {
@@ -174,7 +174,7 @@
order: JSON.stringify($('tr[data-ams-tree-node-id]').listattr('data-ams-tree-node-id')),
can_sort: !$('td.sorter', row).is(':empty')
};
- ams.ajax.post(target, post_data, function(result) {
+ ams.ajax && ams.ajax.post(target, post_data, function(result) {
function removeChildRows(rowID) {
var childs = $('tr[data-ams-tree-node-parent-id="' + rowID + '"]');
@@ -206,7 +206,7 @@
new_row.prependTo(body)
.addClass('no-drag-handle');
}
- ams.initContent(new_row);
+ ams.initContent && ams.initContent(new_row);
old_row = new_row;
}
}
--- a/src/pyams_skin/resources/js/myams-tree.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-tree.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(a,e){var t=e.MyAMS;t.tree={switchTableNode:function(){function e(t){a('tr[data-ams-tree-node-parent-id="'+t+'"]').each(function(){var t=a(this);e(t.data("ams-tree-node-id")),t.remove()})}var s=a(this),r=a("i.switch",s),n=s.parents("tr").first(),d=n.parents("table").first();if(r.hasClass("fa-minus-square-o"))e(n.data("ams-tree-node-id")),r.removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var o=n.data("ams-location")||d.data("ams-location")||"",i=n.data("ams-tree-nodes-target")||d.data("ams-tree-nodes-target")||"get-tree-nodes.json",l=n.data("ams-element-name");r.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),t.ajax.post(o+"/"+l+"/"+i,{can_sort:!a("td.sorter",n).is(":empty")},function(e,s){if(e.length>0){for(var o=n,i=0;i<e.length;i++){var l=a(e[i]);l.insertAfter(o).addClass("no-drag-handle"),t.initContent(l),o=l}d.hasClass("table-dnd")&&d.tableDnDUpdate()}r.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},switchTree:function(){var e=a(this),s=a("i.switch",e),r=a(this).parents("table").first(),n=r.data("ams-tree-node-id");if(s.hasClass("fa-minus-square-o"))a("tr[data-ams-tree-node-parent-id]").filter('tr[data-ams-tree-node-parent-id!="'+n+'"]').remove(),a("i.switch",r).removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var d=a("tbody tr",r).first(),o=r.data("ams-location")||"",i=r.data("ams-tree-nodes-target")||"get-tree.json";s.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),t.ajax.post(o+"/"+i,{can_sort:!a("td.sorter",d).is(":empty")},function(e,n){a("tr[data-ams-tree-node-id]",r).remove();for(var d=null,o=0;o<e.length;o++){var i=a(e[o]);null===d?i.appendTo(a("tbody",r)):i.insertAfter(d),i.addClass("no-drag-handle"),t.initContent(i),d=i}r.hasClass("table-dnd")&&r.tableDnDUpdate(),a("i.switch",r).removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),s.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},sortTree:function(e,s){var r=a(e).data(),n=r.amsTabledndDropTarget;if(n){(s=a(s)).data("ams-disabled-handlers","click");try{var d=s.parents("table").first().data("ams-tree-node-id"),o=s.data("ams-tree-node-id"),i=s.data("ams-tree-node-parent-id"),l=s.prev("tr");if(l.exists()){var f=l.data("ams-tree-node-id"),m=a(".switch",l);if(m.hasClass("fa-minus-square-o"))if(i===f)var u="reorder";else u="reparent";else u=i===(f=l.data("ams-tree-node-parent-id"))?"reorder":"reparent"}else m=null,u=i===(f=d)?"reorder":"reparent";var p=t.getFunctionByName(n);if("function"==typeof p)p.call(table,e,v);else{if(!n.startsWith(window.location.protocol)){var c=r.amsLocation;c&&(n=c+"/"+n)}var v={action:u,child:o,parent:f,order:JSON.stringify(a("tr[data-ams-tree-node-id]").listattr("data-ams-tree-node-id")),can_sort:!a("td.sorter",s).is(":empty")};t.ajax.post(n,v,function(e){function r(e){a('tr[data-ams-tree-node-parent-id="'+e+'"]').each(function(){var e=a(this);r(e.attr("data-ams-tree-node-id")),e.remove()})}if(e.status)t.ajax.handleJSON(e);else{var n=a(s).parents("tbody").first();if(r(o),"reparent"===v.action){r(f),s.remove();for(var d=a('tr[data-ams-tree-node-id="'+f+'"]'),i=0;i<e.length;i++){var l=a(e[i]);d.exists()?l.insertAfter(d).addClass("no-drag-handle"):l.prependTo(n).addClass("no-drag-handle"),t.initContent(l),d=l}}a("tr").parents("table").tableDnDUpdate()}})}}finally{setTimeout(function(){a(s).removeData("ams-disabled-handlers")},50)}}return!1}}}(jQuery,this);
+!function(a,e){var t=e.MyAMS;t.tree={switchTableNode:function(){function e(t){a('tr[data-ams-tree-node-parent-id="'+t+'"]').each(function(){var t=a(this);e(t.data("ams-tree-node-id")),t.remove()})}var s=a(this),r=a("i.switch",s),n=s.parents("tr").first(),d=n.parents("table").first();if(r.hasClass("fa-minus-square-o"))e(n.data("ams-tree-node-id")),r.removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var o=n.data("ams-location")||d.data("ams-location")||"",i=n.data("ams-tree-nodes-target")||d.data("ams-tree-nodes-target")||"get-tree-nodes.json",l=n.data("ams-element-name");r.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),t.ajax&&t.ajax.post(o+"/"+l+"/"+i,{can_sort:!a("td.sorter",n).is(":empty")},function(e,s){if(e.length>0){for(var o=n,i=0;i<e.length;i++){var l=a(e[i]);l.insertAfter(o).addClass("no-drag-handle"),t.initContent&&t.initContent(l),o=l}d.hasClass("table-dnd")&&d.tableDnDUpdate()}r.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},switchTree:function(){var e=a(this),s=a("i.switch",e),r=a(this).parents("table").first(),n=r.data("ams-tree-node-id");if(s.hasClass("fa-minus-square-o"))a("tr[data-ams-tree-node-parent-id]").filter('tr[data-ams-tree-node-parent-id!="'+n+'"]').remove(),a("i.switch",r).removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var d=a("tbody tr",r).first(),o=r.data("ams-location")||"",i=r.data("ams-tree-nodes-target")||"get-tree.json";s.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),t.ajax&&t.ajax.post(o+"/"+i,{can_sort:!a("td.sorter",d).is(":empty")},function(e,n){a("tr[data-ams-tree-node-id]",r).remove();for(var d=null,o=0;o<e.length;o++){var i=a(e[o]);null===d?i.appendTo(a("tbody",r)):i.insertAfter(d),i.addClass("no-drag-handle"),t.initContent&&t.initContent(i),d=i}r.hasClass("table-dnd")&&r.tableDnDUpdate(),a("i.switch",r).removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),s.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},sortTree:function(e,s){var r=a(e).data(),n=r.amsTabledndDropTarget;if(n){(s=a(s)).data("ams-disabled-handlers","click");try{var d=s.parents("table").first().data("ams-tree-node-id"),o=s.data("ams-tree-node-id"),i=s.data("ams-tree-node-parent-id"),l=s.prev("tr");if(l.exists()){var f=l.data("ams-tree-node-id"),m=a(".switch",l);if(m.hasClass("fa-minus-square-o"))if(i===f)var u="reorder";else u="reparent";else u=i===(f=l.data("ams-tree-node-parent-id"))?"reorder":"reparent"}else m=null,u=i===(f=d)?"reorder":"reparent";var p=t.getFunctionByName(n);if("function"==typeof p)p.call(table,e,v);else{if(!n.startsWith(window.location.protocol)){var c=r.amsLocation;c&&(n=c+"/"+n)}var v={action:u,child:o,parent:f,order:JSON.stringify(a("tr[data-ams-tree-node-id]").listattr("data-ams-tree-node-id")),can_sort:!a("td.sorter",s).is(":empty")};t.ajax&&t.ajax.post(n,v,function(e){function r(e){a('tr[data-ams-tree-node-parent-id="'+e+'"]').each(function(){var e=a(this);r(e.attr("data-ams-tree-node-id")),e.remove()})}if(e.status)t.ajax.handleJSON(e);else{var n=a(s).parents("tbody").first();if(r(o),"reparent"===v.action){r(f),s.remove();for(var d=a('tr[data-ams-tree-node-id="'+f+'"]'),i=0;i<e.length;i++){var l=a(e[i]);d.exists()?l.insertAfter(d).addClass("no-drag-handle"):l.prependTo(n).addClass("no-drag-handle"),t.initContent&&t.initContent(l),d=l}}a("tr").parents("table").tableDnDUpdate()}})}}finally{setTimeout(function(){a(s).removeData("ams-disabled-handlers")},50)}}return!1}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-widgets.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-widgets.js Thu Dec 13 14:28:29 2018 +0100
@@ -25,11 +25,11 @@
var minutes = checkValue(date.getMinutes());
var seconds = checkValue(date.getSeconds());
return options.timestampFormat.replace(/%d%/g, day)
- .replace(/%m%/g, month)
- .replace(/%y%/g, year)
- .replace(/%h%/g, hours)
- .replace(/%i%/g, minutes)
- .replace(/%s%/g, seconds);
+ .replace(/%m%/g, month)
+ .replace(/%y%/g, year)
+ .replace(/%h%/g, hours)
+ .replace(/%i%/g, minutes)
+ .replace(/%s%/g, seconds);
}
@@ -97,19 +97,19 @@
}
if (widget.style) {
mywidget.removeClassPrefix('ams-widget-color-')
- .addClass(widget.style)
- .attr('data-widget-attstyle', widget.style);
+ .addClass(widget.style)
+ .attr('data-widget-attstyle', widget.style);
}
if (widget.hidden === 1) {
mywidget.hide(1);
} else {
mywidget.show(1)
- .removeAttr('data-widget-hidden');
+ .removeAttr('data-widget-hidden');
}
if (widget.collapsed === 1) {
mywidget.addClass('ams-widget-collapsed')
- .children('div')
- .hide(1);
+ .children('div')
+ .hide(1);
}
var title = mywidget.children('header').children('h2');
if (title.text() !== widget.title) {
@@ -155,19 +155,19 @@
indicator: data.amsWidgetIndicator,
indicatorTime: data.amsWidgetIndicatorTime,
ajax: data.amsWidgetAjax,
- timestampPlaceholder : data.amsWidgetTimestampPlaceholder,
- timestampFormat : data.amsWidgetTimestampFormat,
- refreshButton : data.amsWidgetRefreshButton,
- refreshClass : data.amsWidgetRefreshClass,
- errorLabel : data.amsWidgetErrorLabel,
- updatedLabel : data.amsWidgetUpdatedLabel,
- refreshLabel : data.amsWidgetRefreshLabel,
- deleteLabel : data.amsWidgetDeleteLabel,
- afterLoad : ams.getFunctionByName(data.amsWidgetAfterLoadCallback),
- rtl : data.amsWidgetRtl,
- onChange : ams.getFunctionByName(data.amsWidgetChangeCallback),
- onSave : ams.getFunctionByName(data.amsWidgetSaveCallback),
- ajax_nav : ams.ajax_nav
+ timestampPlaceholder: data.amsWidgetTimestampPlaceholder,
+ timestampFormat: data.amsWidgetTimestampFormat,
+ refreshButton: data.amsWidgetRefreshButton,
+ refreshClass: data.amsWidgetRefreshClass,
+ errorLabel: data.amsWidgetErrorLabel,
+ updatedLabel: data.amsWidgetUpdatedLabel,
+ refreshLabel: data.amsWidgetRefreshLabel,
+ deleteLabel: data.amsWidgetDeleteLabel,
+ afterLoad: ams.getFunctionByName(data.amsWidgetAfterLoadCallback),
+ rtl: data.amsWidgetRtl,
+ onChange: ams.getFunctionByName(data.amsWidgetChangeCallback),
+ onSave: ams.getFunctionByName(data.amsWidgetSaveCallback),
+ ajax_nav: ams.ajax_nav
};
var widgetOptions = $.extend({}, self.options, data_options);
var header = widget.children('header');
@@ -184,7 +184,7 @@
}
if (data.widgetCollapsed === true) {
widget.addClass('ams-widget-collapsed')
- .children('div').hide();
+ .children('div').hide();
}
if (widgetOptions.customButton &&
(data.widgetCustombutton === undefined) &&
@@ -195,21 +195,21 @@
}
if (widgetOptions.deleteButton && (data.widgetDeleteButton === undefined)) {
deleteBtn = '<a href="#" class="button-icon ams-widget-delete-btn hint" title="' + MyAMSWidget.i18n.DELETE_BTN + '" data-ams-hint-gravity="se">' +
- '<i class="' + widgetOptions.deleteClass + '"></i></a>';
+ '<i class="' + widgetOptions.deleteClass + '"></i></a>';
} else {
deleteBtn = "";
}
if (widgetOptions.editButton && (data.widgetEditButton === undefined)) {
var editClass = widgetOptions.editClass.split('|')[0];
editBtn = '<a href="#" class="button-icon ams-widget-edit-btn hint" title="' + MyAMSWidget.i18n.EDIT_BTN + '" data-ams-hint-gravity="se">' +
- '<i class="' + editClass + '"></i></a>';
+ '<i class="' + editClass + '"></i></a>';
} else {
editBtn = "";
}
if (widgetOptions.fullscreenButton && (data.widgetFullscreenButton === undefined)) {
var fullscreenClass = widgetOptions.fullscreenClass.split('|')[0];
fullscreenBtn = '<a href="#" class="button-icon ams-widget-fullscreen-btn hint" title="' + MyAMSWidget.i18n.FULLSCREEN_BTN + '" data-ams-hint-gravity="se">' +
- '<i class="' + fullscreenClass + '"></i></a>';
+ '<i class="' + fullscreenClass + '"></i></a>';
} else {
fullscreenBtn = "";
}
@@ -223,7 +223,7 @@
toggleSettings = toggleClass[0];
}
toggleBtn = '<a href="#" class="button-icon ams-widget-toggle-btn hint" title="' + MyAMSWidget.i18n.COLLAPSE_BTN + '" data-ams-hint-gravity="se">' +
- '<i class="' + toggleSettings + '"></i></a>';
+ '<i class="' + toggleSettings + '"></i></a>';
} else {
toggleBtn = "";
}
@@ -231,16 +231,16 @@
(data.widgetRefreshButton === undefined) &&
data.widgetLoad) {
refreshBtn = '<a href="#" class="button-icon ams-widget-refresh-btn hint" title="' + MyAMSWidget.i18n.REFRESH_BTN + '" data-loading-text=" ' + MyAMSWidget.i18n.LOADING_MSG + ' " data-ams-hint-gravity="se">' +
- '<i class="' + widgetOptions.refreshClass + '"></i></a>';
+ '<i class="' + widgetOptions.refreshClass + '"></i></a>';
} else {
refreshBtn = "";
}
var buttons = widgetOptions.buttonsOrder.replace(/%refresh%/, refreshBtn)
- .replace(/%custom%/, customBtn)
- .replace(/%edit%/, editBtn)
- .replace(/%toggle%/, toggleBtn)
- .replace(/%fullscreen%/, fullscreenBtn)
- .replace(/%delete%/, deleteBtn);
+ .replace(/%custom%/, customBtn)
+ .replace(/%edit%/, editBtn)
+ .replace(/%toggle%/, toggleBtn)
+ .replace(/%fullscreen%/, fullscreenBtn)
+ .replace(/%delete%/, deleteBtn);
if (refreshBtn || customBtn || editBtn || toggleBtn || fullscreenBtn || deleteBtn) {
header.prepend('<div class="ams-widget-ctrls">' + buttons + '</div>');
}
@@ -253,10 +253,10 @@
}
header.append('<span class="ams-widget-loader"><i class="fa fa-refresh fa-spin"></i></span>');
widget.attr('role', 'widget')
- .children('div').attr('role', 'content')
- .prev('header').attr('role', 'heading')
- .children('div').attr('role', 'menu');
- ams.plugins.enabled.hint(header);
+ .children('div').attr('role', 'content')
+ .prev('header').attr('role', 'heading')
+ .children('div').attr('role', 'menu');
+ ams.plugins && ams.plugins.enabled.hint && ams.plugins.enabled.hint(header);
}
widget.data('widget-options', widgetOptions);
if (self.options.hiddenButtons) {
@@ -347,7 +347,8 @@
result = parseInt(self.storage.getItem(uid)) === uid;
self.storage.removeItem(uid);
return result;
- } catch (e) {}
+ } catch (e) {
+ }
}();
if (use_storage) {
self.settingsKey = "AMS_settings_" + location.pathname + location.hash + "_" + self.gridId;
@@ -367,15 +368,15 @@
var self = this;
if (self.options.indicator) {
widget.find('.ams-widget-loader')
- .stop(true, true)
- .fadeIn(100)
- .delay(self.options.indicatorTime)
- .fadeOut(100);
+ .stop(true, true)
+ .fadeIn(100)
+ .delay(self.options.indicatorTime)
+ .fadeOut(100);
}
},
_loadAjaxFile: function(url, widget, loader) {
- ams.skin.loadURL(url, widget.find('.widget-body'));
+ ams.skin && ams.skin.loadURL(url, widget.find('.widget-body'));
},
_saveWidgetSettings: function() {
@@ -397,7 +398,7 @@
if (self.settings !== gridSettingsStr) {
self.storage.setItem(self.settingsKey, gridSettingsStr);
}
- if (typeof(self.options.onSave) === 'function') {
+ if (typeof (self.options.onSave) === 'function') {
self.options.onSave.call(this, null, gridSettings);
}
}
@@ -408,9 +409,9 @@
self._getSettings();
if (self.storage) {
var gridPosition = [];
- self.grid.find(self.options.subgrid + ".sortable-grid").each(function () {
+ self.grid.find(self.options.subgrid + ".sortable-grid").each(function() {
var subgridPosition = [];
- $(this).children(self.options.widgets).each(function () {
+ $(this).children(self.options.widgets).each(function() {
var subObj = {};
subObj.id = $(this).attr("id");
subgridPosition.push(subObj);
@@ -422,7 +423,7 @@
if (self.position !== gridPositionStr) {
self.storage.setItem(self.positionKey, gridPositionStr);
}
- if (typeof(self.options.onSave) === 'function') {
+ if (typeof (self.options.onSave) === 'function') {
self.options.onSave.call(this, null, gridPosition);
}
}
@@ -436,9 +437,9 @@
var widgets = mode.find(self.options.widgets);
var windowHeight = $(window).height();
var headerHeight = widgets.children('header')
- .height();
+ .height();
widgets.children('div')
- .height(windowHeight - headerHeight - 15);
+ .height(windowHeight - headerHeight - 15);
}
}
@@ -460,11 +461,11 @@
}
if (canToggle !== false) {
button.children().removeClass(toggleClass[1])
- .addClass(toggleClass[0]);
+ .addClass(toggleClass[0]);
widget.removeClass('ams-widget-collapsed')
- .children('[role=content]').slideDown(widgetOptions.toggleSpeed, function() {
- self._saveWidgetSettings();
- });
+ .children('[role=content]').slideDown(widgetOptions.toggleSpeed, function() {
+ self._saveWidgetSettings();
+ });
}
} else {
if (widgetOptions.onToggle) {
@@ -472,11 +473,11 @@
}
if (canToggle !== false) {
button.children().removeClass(toggleClass[0])
- .addClass(toggleClass[1]);
+ .addClass(toggleClass[1]);
widget.addClass('ams-widget-collapsed')
- .children('[role=content]').slideUp(widgetOptions.toggleSpeed, function() {
- self._saveWidgetSettings();
- });
+ .children('[role=content]').slideUp(widgetOptions.toggleSpeed, function() {
+ self._saveWidgetSettings();
+ });
}
}
});
@@ -496,38 +497,38 @@
if ($('#ams-widget-fullscreen-mode').length > 0) {
$('.nooverflow').removeClass('nooverflow');
widget.unwrap('<div>')
- .children('div')
- .removeAttr('style')
- .end()
- .find('.ams-widget-fullscreen-btn')
- .children()
- .removeClass(fullscreenClass[1])
- .addClass(fullscreenClass[0])
- .parents(self.controls)
- .children('a')
- .show();
+ .children('div')
+ .removeAttr('style')
+ .end()
+ .find('.ams-widget-fullscreen-btn')
+ .children()
+ .removeClass(fullscreenClass[1])
+ .addClass(fullscreenClass[0])
+ .parents(self.controls)
+ .children('a')
+ .show();
if (content.hasClass('ams-widget-visible')) {
content.hide()
- .removeClass('ams-widget-visible');
+ .removeClass('ams-widget-visible');
}
} else {
$('body').addClass('nooverflow');
widget.wrap('<div id="ams-widget-fullscreen-mode"></div>')
- .parent()
- .find('.ams-widget-fullscreen-btn')
- .children()
- .removeClass(fullscreenClass[0])
- .addClass(fullscreenClass[1])
- .parents(self.controls)
- .children('a:not(.ams-widget-fullscreen-btn)')
- .hide();
+ .parent()
+ .find('.ams-widget-fullscreen-btn')
+ .children()
+ .removeClass(fullscreenClass[0])
+ .addClass(fullscreenClass[1])
+ .parents(self.controls)
+ .children('a:not(.ams-widget-fullscreen-btn)')
+ .hide();
if (content.is(':hidden')) {
content.show()
- .addClass('ams-widget-visible');
+ .addClass('ams-widget-visible');
}
}
setFullscreenHeight();
- if (typeof(widgetOptions.onFullscreen) === 'function') {
+ if (typeof (widgetOptions.onFullscreen) === 'function') {
widgetOptions.onFullscreen.call(this, widget);
}
});
@@ -546,26 +547,26 @@
var placeholder = widget.find(widgetOptions.editPlaceholder);
if (placeholder.is(':visible')) {
button.children()
- .removeClass(editClass[1])
- .addClass(editClass[0]);
+ .removeClass(editClass[1])
+ .addClass(editClass[0]);
placeholder.slideUp(widgetOptions.editSpeed, function() {
self._saveWidgetSettings();
});
} else {
button.children()
- .removeClass(editClass[0])
- .addClass(editClass[1]);
+ .removeClass(editClass[0])
+ .addClass(editClass[1]);
placeholder.slideDown(widgetOptions.editSpeed);
}
- if (typeof(widgetOptions.onEdit) === 'function') {
+ if (typeof (widgetOptions.onEdit) === 'function') {
widgetOptions.onEdit.call(this, widget);
}
});
$(self.options.editPlaceholder).find('input').keyup(function() {
$(this).parents(self.options.widgets)
- .children('header')
- .children('h2')
- .text($(this).val());
+ .children('header')
+ .children('h2')
+ .text($(this).val());
});
// Custom button
@@ -578,15 +579,15 @@
self._runLoaderWidget(widget);
if (button.children('.' + customClass[0]).length > 0) {
button.children()
- .removeClass(customClass[0])
- .addClass(customClass[1]);
- if (typeof(widgetOptions.customStart) === 'function') {
+ .removeClass(customClass[0])
+ .addClass(customClass[1]);
+ if (typeof (widgetOptions.customStart) === 'function') {
widgetOptions.customStart.call(this, widget);
}
} else {
button.children('.' + customClass[1])
- .addClass(customClass[0]);
- if (typeof(widgetOptions.customEnd) === 'function') {
+ .addClass(customClass[0]);
+ if (typeof (widgetOptions.customEnd) === 'function') {
widgetOptions.customEnd.call(this, widget);
}
}
@@ -601,25 +602,25 @@
var widgetOptions = widget.data('widget-options');
var wId = widget.attr('id');
var title = widget.children('header').children('h2').text();
- ams.ajax.check(MyAMS.notify,
- ams.baseURL + 'myams-notify' + (ams.devmode ? '.js' : '.min.js'),
- function() {
- ams.notify.messageBox({
- title: '<i class="fa fa-times" style="color: #ed1c24;"></i> ' + widgetOptions.deleteLabel + ' "' + title + '"',
- content: MyAMSWidget.i18n.DELETE_MSG,
- buttons: "[" + ams.i18n.BTN_OK + "][" + ams.i18n.BTN_CANCEL + "]"
- }, function(buttonPressed) {
- if (buttonPressed === ams.i18n.BTN_OK) {
- self._runLoaderWidget(widget);
- $('#' + wId).fadeOut(widgetOptions.deleteSpeed, function() {
- button.remove();
- if (typeof(widgetOptions.onDelete) === 'function') {
- widgetOptions.onDelete.call(this, widget);
- }
- });
- }
- });
- });
+ ams.ajax && ams.ajax.check(MyAMS.notify,
+ ams.baseURL + 'myams-notify' + (ams.devmode ? '.js' : '.min.js'),
+ function() {
+ ams.notify.messageBox({
+ title: '<i class="fa fa-times" style="color: #ed1c24;"></i> ' + widgetOptions.deleteLabel + ' "' + title + '"',
+ content: MyAMSWidget.i18n.DELETE_MSG,
+ buttons: "[" + ams.i18n.BTN_OK + "][" + ams.i18n.BTN_CANCEL + "]"
+ }, function(buttonPressed) {
+ if (buttonPressed === ams.i18n.BTN_OK) {
+ self._runLoaderWidget(widget);
+ $('#' + wId).fadeOut(widgetOptions.deleteSpeed, function() {
+ button.remove();
+ if (typeof (widgetOptions.onDelete) === 'function') {
+ widgetOptions.onDelete.call(this, widget);
+ }
+ });
+ }
+ });
+ });
});
// Refresh button
@@ -644,21 +645,21 @@
var MyAMSWidget = {
i18n: $.extend({
- SETTINGS_KEY_LABEL: "Reset settings?",
- POSITION_KEY_LABEL: "Reset position?",
- TIMESTAMP_FORMAT: "Last update: %d%/%m%/%y% %h%:%i%:%s",
- ERROR_LABEL: "An error occured: ",
- UPDATED_LABEL: "Last update: ",
- REFRESH_LABEL: "Refresh",
- EDIT_BTN: "Edit title",
- DELETE_BTN: "Delete",
- DELETE_LABEL: "Remove component: ",
- DELETE_MSG: "WARNING: this action can't be undone!",
- FULLSCREEN_BTN: "Fullscreen",
- COLLAPSE_BTN: "Collapse",
- REFRESH_BTN: "Reload content",
- LOADING_MSG: "Loading..."
- }, ams.plugins.i18n.widgets),
+ SETTINGS_KEY_LABEL: "Reset settings?",
+ POSITION_KEY_LABEL: "Reset position?",
+ TIMESTAMP_FORMAT: "Last update: %d%/%m%/%y% %h%:%i%:%s",
+ ERROR_LABEL: "An error occured: ",
+ UPDATED_LABEL: "Last update: ",
+ REFRESH_LABEL: "Refresh",
+ EDIT_BTN: "Edit title",
+ DELETE_BTN: "Delete",
+ DELETE_LABEL: "Remove component: ",
+ DELETE_MSG: "WARNING: this action can't be undone!",
+ FULLSCREEN_BTN: "Fullscreen",
+ COLLAPSE_BTN: "Collapse",
+ REFRESH_BTN: "Reload content",
+ LOADING_MSG: "Loading..."
+ }, ams.plugins.i18n.widgets),
initWidgetsGrid: function(grid) {
if (!grid.exists()) {
@@ -668,27 +669,27 @@
if (options.sortable && $.ui) {
var sortItem = grid.find('.sortable-grid').not("[data-widget-excludegrid]");
sortItem.sortable({
- items: sortItem.find('.ams-widget-sortable'),
- connectWith: sortItem,
- placeholder: options.placeholderClass,
- cursor: 'move',
- revert: true,
- opacity: options.opacity,
- delay: 200,
- cancel: '.button-icon, #ams-widget-fullscreen-mode >div',
- zIndex: 10000,
- handle: options.dragHandle,
- forcePlaceholderSize: true,
- forceHelperSize: true,
- update: function(event, ui) {
- var widget = ui.item.data('AMSWidget');
- widget._runLoaderWidget(widget.widget);
- widget._saveWidgetPosition();
- if (typeof(options.onChange) === 'function') {
- options.onChange.call(this, ui.item);
- }
- }
- });
+ items: sortItem.find('.ams-widget-sortable'),
+ connectWith: sortItem,
+ placeholder: options.placeholderClass,
+ cursor: 'move',
+ revert: true,
+ opacity: options.opacity,
+ delay: 200,
+ cancel: '.button-icon, #ams-widget-fullscreen-mode >div',
+ zIndex: 10000,
+ handle: options.dragHandle,
+ forcePlaceholderSize: true,
+ forceHelperSize: true,
+ update: function(event, ui) {
+ var widget = ui.item.data('AMSWidget');
+ widget._runLoaderWidget(widget.widget);
+ widget._saveWidgetPosition();
+ if (typeof (options.onChange) === 'function') {
+ options.onChange.call(this, ui.item);
+ }
+ }
+ });
}
}
};
@@ -739,19 +740,19 @@
indicator: true,
indicatorTime: 600,
ajax: true,
- timestampPlaceholder : '.ams-widget-timestamp',
- timestampFormat : MyAMSWidget.i18n.TIMESTAMP_FORMAT,
- refreshButton : true,
- refreshButtonClass : 'fa fa-refresh',
- errorLabel : MyAMSWidget.i18n.ERROR_LABEL,
- updatedLabel : MyAMSWidget.i18n.UPDATED_LABEL,
- refreshLabel : MyAMSWidget.i18n.REFRESH_LABEL,
- deleteLabel : MyAMSWidget.i18n.DELETE_LABEL,
- afterLoad : null,
- rtl : false,
- onChange : null,
- onSave : null,
- ajax_nav : ams.ajax_nav
+ timestampPlaceholder: '.ams-widget-timestamp',
+ timestampFormat: MyAMSWidget.i18n.TIMESTAMP_FORMAT,
+ refreshButton: true,
+ refreshButtonClass: 'fa fa-refresh',
+ errorLabel: MyAMSWidget.i18n.ERROR_LABEL,
+ updatedLabel: MyAMSWidget.i18n.UPDATED_LABEL,
+ refreshLabel: MyAMSWidget.i18n.REFRESH_LABEL,
+ deleteLabel: MyAMSWidget.i18n.DELETE_LABEL,
+ afterLoad: null,
+ rtl: false,
+ onChange: null,
+ onSave: null,
+ ajax_nav: ams.ajax_nav
};
globals.MyAMSWidget = MyAMSWidget;
@@ -759,70 +760,70 @@
$.fn.extend({
- MyAMSWidget: function(options) {
- return this.each(function() {
- var widget = $(this);
- var data = widget.data('AMSWidget');
- if (!data) {
- var grid = widget.parents(options.grid || MyAMSWidget.defaults.grid);
- var grid_options = {};
- if (grid.exists()) {
- var grid_data = grid.data();
- grid_options = {
- grid: grid_data.amsWidgetGrid,
- subgrid: grid_data.amsWidgetSubgrid,
- controls: grid_data.amsWidgetControls,
- storage: grid_data.amsWidgetStorage,
- deleteSettingsKey: grid_data.amsWidgetDeleteSettingsKey,
- deletePositionKey: grid_data.amsWidgetDeletePositionKey,
- sortable: grid_data.amsWidgetSortable,
- hiddenButtons: grid_data.amsWidgetHiddenButtons,
- toggleButton: grid_data.amsWidgetToggleButton,
- toggleClass: grid_data.amsWidgetToggleClass,
- onToggle: ams.getFunctionByName(grid_data.amsWidgetToggleCallback),
- deleteButton: grid_data.amsWidgetDeleteButton,
- deleteClass: grid_data.amsWidgetDeleteClass,
- onDelete: ams.getFunctionByName(grid_data.amsWidgetDeleteCallback),
- editButton: grid_data.amsWidgetEditButton,
- editPlaceholder: grid_data.amsWidgetEditPlaceholder,
- editClass: grid_data.amsWidgetEditClass,
- onEdit: ams.getFunctionByName(grid_data.amsWidgetEditCallback),
- fullscreenButton: grid_data.amsWidgetFullscreenButton,
- fullscreenClass: grid_data.amsWidgetFullscreenClass,
- fullscreenDiff: grid_data.amsWidgetFullscreenDiff,
- onFullscreen: ams.getFunctionByName(grid_data.amsWidgetFullscreenCallback),
- customButton: grid_data.amsWidgetCustomButton,
- customClass: grid_data.amsWidgetCustomClass,
- customStart: ams.getFunctionByName(grid_data.amsWidgetCustomStartCallback),
- customEnd: ams.getFunctionByName(grid_data.amsWidgetCustomStartCallback),
- buttonsOrder: grid_data.amsWidgetButtonsOrder,
- opacity: grid_data.amsWidgetOpacity,
- dragHandle: grid_data.amsWidgetDragHandle,
- placeholderClass: grid_data.amsWidgetPlaceholderClass,
- indicator: grid_data.amsWidgetIndicator,
- indicatorTime: grid_data.amsWidgetIndicatorTime,
- ajax: grid_data.amsWidgetAjax,
- timestampPlaceholder : grid_data.amsWidgetTimestampPlaceholder,
- timestampFormat : grid_data.amsWidgetTimestampFormat,
- refreshButton : grid_data.amsWidgetRefreshButton,
- refreshClass : grid_data.amsWidgetRefreshClass,
- errorLabel : grid_data.amsWidgetErrorLabel,
- updatedLabel : grid_data.amsWidgetUpdatedLabel,
- refreshLabel : grid_data.amsWidgetRefreshLabel,
- deleteLabel : grid_data.amsWidgetDeleteLabel,
- afterLoad : ams.getFunctionByName(grid_data.amsWidgetAfterLoadCallback),
- rtl : grid_data.amsWidgetRtl,
- onChange : ams.getFunctionByName(grid_data.amsWidgetChangeCallback),
- onSave : ams.getFunctionByName(grid_data.amsWidgetSaveCallback),
- ajax_nav : ams.ajax_nav
- };
+ MyAMSWidget: function(options) {
+ return this.each(function() {
+ var widget = $(this);
+ var data = widget.data('AMSWidget');
+ if (!data) {
+ var grid = widget.parents(options.grid || MyAMSWidget.defaults.grid);
+ var grid_options = {};
+ if (grid.exists()) {
+ var grid_data = grid.data();
+ grid_options = {
+ grid: grid_data.amsWidgetGrid,
+ subgrid: grid_data.amsWidgetSubgrid,
+ controls: grid_data.amsWidgetControls,
+ storage: grid_data.amsWidgetStorage,
+ deleteSettingsKey: grid_data.amsWidgetDeleteSettingsKey,
+ deletePositionKey: grid_data.amsWidgetDeletePositionKey,
+ sortable: grid_data.amsWidgetSortable,
+ hiddenButtons: grid_data.amsWidgetHiddenButtons,
+ toggleButton: grid_data.amsWidgetToggleButton,
+ toggleClass: grid_data.amsWidgetToggleClass,
+ onToggle: ams.getFunctionByName(grid_data.amsWidgetToggleCallback),
+ deleteButton: grid_data.amsWidgetDeleteButton,
+ deleteClass: grid_data.amsWidgetDeleteClass,
+ onDelete: ams.getFunctionByName(grid_data.amsWidgetDeleteCallback),
+ editButton: grid_data.amsWidgetEditButton,
+ editPlaceholder: grid_data.amsWidgetEditPlaceholder,
+ editClass: grid_data.amsWidgetEditClass,
+ onEdit: ams.getFunctionByName(grid_data.amsWidgetEditCallback),
+ fullscreenButton: grid_data.amsWidgetFullscreenButton,
+ fullscreenClass: grid_data.amsWidgetFullscreenClass,
+ fullscreenDiff: grid_data.amsWidgetFullscreenDiff,
+ onFullscreen: ams.getFunctionByName(grid_data.amsWidgetFullscreenCallback),
+ customButton: grid_data.amsWidgetCustomButton,
+ customClass: grid_data.amsWidgetCustomClass,
+ customStart: ams.getFunctionByName(grid_data.amsWidgetCustomStartCallback),
+ customEnd: ams.getFunctionByName(grid_data.amsWidgetCustomStartCallback),
+ buttonsOrder: grid_data.amsWidgetButtonsOrder,
+ opacity: grid_data.amsWidgetOpacity,
+ dragHandle: grid_data.amsWidgetDragHandle,
+ placeholderClass: grid_data.amsWidgetPlaceholderClass,
+ indicator: grid_data.amsWidgetIndicator,
+ indicatorTime: grid_data.amsWidgetIndicatorTime,
+ ajax: grid_data.amsWidgetAjax,
+ timestampPlaceholder: grid_data.amsWidgetTimestampPlaceholder,
+ timestampFormat: grid_data.amsWidgetTimestampFormat,
+ refreshButton: grid_data.amsWidgetRefreshButton,
+ refreshClass: grid_data.amsWidgetRefreshClass,
+ errorLabel: grid_data.amsWidgetErrorLabel,
+ updatedLabel: grid_data.amsWidgetUpdatedLabel,
+ refreshLabel: grid_data.amsWidgetRefreshLabel,
+ deleteLabel: grid_data.amsWidgetDeleteLabel,
+ afterLoad: ams.getFunctionByName(grid_data.amsWidgetAfterLoadCallback),
+ rtl: grid_data.amsWidgetRtl,
+ onChange: ams.getFunctionByName(grid_data.amsWidgetChangeCallback),
+ onSave: ams.getFunctionByName(grid_data.amsWidgetSaveCallback),
+ ajax_nav: ams.ajax_nav
+ };
+ }
+ var settings = $.fn.extend({}, grid_options, widget.data('ams-widget-options') || {}, options);
+ widget.data('AMSWidget', new Widget(widget, settings));
+ }
+ });
}
- var settings = $.fn.extend({}, grid_options, widget.data('ams-widget-options') || {}, options);
- widget.data('AMSWidget', new Widget(widget, settings));
- }
- });
- }
- });
+ });
})(jQuery, this);
--- a/src/pyams_skin/resources/js/myams-widgets.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-widgets.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(e,t){"use strict";function i(t,i){this.widget=t,this.options=e.extend({},a.defaults,i),this.grid=this.widget.parents(this.options.grid),this.hasGrid=this.grid.exists(),this.gridId=this.grid.attr("id"),this.controls=this.options.controls,this.toggleClass=this.options.toggleClass.split("|"),this.editClass=this.options.editClass.split("|"),this.fullscreenClass=this.options.fullscreenClass.split("|"),this.customClass=this.options.customClass.split("|"),this.init()}var s=t.MyAMS;i.prototype={init:function(){var i,n=this;if(!0===n.options.rtl&&e("body").addClass("rtl"),n.grid.each(function(){e(this).addClass("sortable-grid")}),n._getSettings(),n.hasGrid&&n.storage){var d;if(n.position){var o=JSON.parse(n.position);for(d in o.grid)if(o.grid.hasOwnProperty(d)){var l=n.grid.find(n.options.subgrid+".sortable-grid").eq(d);for(var r in o.grid[d].section)o.grid[d].section.hasOwnProperty(r)&&l.append(e("#"+o.grid[d].section[r].id))}}if(n.settings){var g=JSON.parse(n.settings);for(d in g.widget)if(g.widget.hasOwnProperty(d)&&(i=g.widget[d]).id){var c=e("#"+i.id);if(c.exists()){i.style&&c.removeClassPrefix("ams-widget-color-").addClass(i.style).attr("data-widget-attstyle",i.style),1===i.hidden?c.hide(1):c.show(1).removeAttr("data-widget-hidden"),1===i.collapsed&&c.addClass("ams-widget-collapsed").children("div").hide(1);var m=c.children("header").children("h2");m.text()!==i.title&&m.text(i.title)}}}}var u=(i=n.widget).data(),h={grid:u.amsWidgetGrid,subgrid:u.amsWudgetSubgrid,widgets:u.amsWidgetWidgets,controls:u.amsWidgetControls,storage:u.amsWidgetStorage,deleteSettingsKey:u.amsWidgetDeleteSettingsKey,deletePositionKey:u.amsWidgetDeletePositionKey,sortable:u.amsWidgetSortable,hiddenButtons:u.amsWidgetHiddenButtons,toggleButton:u.amsWidgetToggleButton,toggleClass:u.amsWidgetToggleClass,onToggle:s.getFunctionByName(u.amsWidgetToggleCallback),deleteButton:u.amsWidgetDeleteButton,deleteClass:u.amsWidgetDeleteClass,onDelete:s.getFunctionByName(u.amsWidgetDeleteCallback),editButton:u.amsWidgetEditButton,editPlaceholder:u.amsWidgetEditPlaceholder,editClass:u.amsWidgetEditClass,onEdit:s.getFunctionByName(u.amsWidgetEditCallback),fullscreenButton:u.amsWidgetFullscreenButton,fullscreenClass:u.amsWidgetFullscreenClass,fullscreenDiff:u.amsWidgetFullscreenDiff,onFullscreen:s.getFunctionByName(u.amsWidgetFullscreenCallback),customButton:u.amsWidgetCustomButton,customClass:u.amsWidgetCustomClass,customStart:s.getFunctionByName(u.amsWidgetCustomStartCallback),customEnd:s.getFunctionByName(u.amsWidgetCustomEndCallback),buttonsOrder:u.amsWidgetButtonsOrder,opacity:u.amsWidgetOpacity,dragHandle:u.amsWidgetDragHandle,placeholderClass:u.amsWidgetPlaceholderClass,indicator:u.amsWidgetIndicator,indicatorTime:u.amsWidgetIndicatorTime,ajax:u.amsWidgetAjax,timestampPlaceholder:u.amsWidgetTimestampPlaceholder,timestampFormat:u.amsWidgetTimestampFormat,refreshButton:u.amsWidgetRefreshButton,refreshClass:u.amsWidgetRefreshClass,errorLabel:u.amsWidgetErrorLabel,updatedLabel:u.amsWidgetUpdatedLabel,refreshLabel:u.amsWidgetRefreshLabel,deleteLabel:u.amsWidgetDeleteLabel,afterLoad:s.getFunctionByName(u.amsWidgetAfterLoadCallback),rtl:u.amsWidgetRtl,onChange:s.getFunctionByName(u.amsWidgetChangeCallback),onSave:s.getFunctionByName(u.amsWidgetSaveCallback),ajax_nav:s.ajax_nav},f=e.extend({},n.options,h),p=i.children("header");if(!p.parent().attr("role")){var v,C,w,W,b,y;if(!0===u.widgetHidden&&i.hide(),!0===u.widgetCollapsed&&i.addClass("ams-widget-collapsed").children("div").hide(),v=f.customButton&&void 0===u.widgetCustombutton&&0!==n.customClass[0].length?'<a href="#" class="button-icon ams-widget-custom-btn"><i class="'+n.customClass[0]+'"></i></a>':"",C=f.deleteButton&&void 0===u.widgetDeleteButton?'<a href="#" class="button-icon ams-widget-delete-btn hint" title="'+a.i18n.DELETE_BTN+'" data-ams-hint-gravity="se"><i class="'+f.deleteClass+'"></i></a>':"",f.editButton&&void 0===u.widgetEditButton){var B=f.editClass.split("|")[0];w='<a href="#" class="button-icon ams-widget-edit-btn hint" title="'+a.i18n.EDIT_BTN+'" data-ams-hint-gravity="se"><i class="'+B+'"></i></a>'}else w="";if(f.fullscreenButton&&void 0===u.widgetFullscreenButton){var E=f.fullscreenClass.split("|")[0];W='<a href="#" class="button-icon ams-widget-fullscreen-btn hint" title="'+a.i18n.FULLSCREEN_BTN+'" data-ams-hint-gravity="se"><i class="'+E+'"></i></a>'}else W="";if(f.toggleButton&&void 0===u.widgetToggleButton){var S,L=f.toggleClass.split("|");S=!0===i.dataWidgetCollapsed||i.hasClass("ams-widget-collapsed")?L[1]:L[0],b='<a href="#" class="button-icon ams-widget-toggle-btn hint" title="'+a.i18n.COLLAPSE_BTN+'" data-ams-hint-gravity="se"><i class="'+S+'"></i></a>'}else b="";y=f.refreshButton&&void 0===u.widgetRefreshButton&&u.widgetLoad?'<a href="#" class="button-icon ams-widget-refresh-btn hint" title="'+a.i18n.REFRESH_BTN+'" data-loading-text=" '+a.i18n.LOADING_MSG+' " data-ams-hint-gravity="se"><i class="'+f.refreshClass+'"></i></a>':"";var _=f.buttonsOrder.replace(/%refresh%/,y).replace(/%custom%/,v).replace(/%edit%/,w).replace(/%toggle%/,b).replace(/%fullscreen%/,W).replace(/%delete%/,C);(y||v||w||b||W||C)&&p.prepend('<div class="ams-widget-ctrls">'+_+"</div>"),f.sortable&&void 0===u.widgetSortable&&i.addClass("ams-widget-sortable");var T=i.find(f.editPlaceholder);T.length>0&&T.find("input").val(e.trim(p.children("h2").text())),p.append('<span class="ams-widget-loader"><i class="fa fa-refresh fa-spin"></i></span>'),i.attr("role","widget").children("div").attr("role","content").prev("header").attr("role","heading").children("div").attr("role","menu"),s.plugins.enabled.hint(p)}i.data("widget-options",f),n.options.hiddenButtons&&e(n.controls).hide(),i.find("[data-widget-load]").each(function(){var t=e(this),i=t.children(),s=t.data("widget-load"),a=1e3*t.data("widget-refresh");t.find(".ams-widget-ajax-placeholder").length<=0&&(t.children("widget-body").append('<div class="ams-widget-ajax-placeholder">'+n.options.loadingLabel+"</div>"),a>0?(n.loadAjaxFile(t,s,i),setInterval(function(){n._loadAjaxFile(t,s,i)},a)):n._loadAjaxFile(t,s,i))}),n.options.hiddenButtons&&n.widget.children("header").hover(function(){e(this).children(n.controls).stop(!0,!0).fadeTo(100,1)},function(){e(this).children(n.controls).stop(!0,!0).fadeTo(100,0)}),n._setClickEvents(),e(n.options.deleteSettingsKey).on(n.clickEvent,this,function(e){n.storage&&t.confirm&&t.confirm(n.options.settingsKeyLabel)&&n.storage.removeItem(n.settingsKey),e.preventDefault()}),e(n.options.deletePositionKey).on(n.clickEvent,this,function(e){n.storage&&t.confirm&&t.confirm(n.options.positionKeyLabel)&&n.storage.removeItem(n.positionKey),e.preventDefault()}),n.storage&&((null===n.settingsKey||n.settingsKey.length<1)&&n._saveWidgetSettings(),(null===n.positionKey||n.positionKey.length<1)&&n._saveWidgetPosition()),n.grid.data("ams-widgets-loaded",!0)},destroy:function(){var e=this;e.widgets.off("click",e._setClickEvents()),e.element.removeData("AMSWidget")},_getSettings:function(){var e=this;if(e.hasGrid&&e.gridId)switch(e.options.storage){case"local":e.storage=localStorage;break;case"session":e.storage=sessionStorage;break;default:e.storage=null}else e.storage=null;null!==e.storage&&function(){var t,i=+new Date;try{return e.storage.setItem(i,i),t=parseInt(e.storage.getItem(i))===i,e.storage.removeItem(i),t}catch(e){}}()&&(e.settingsKey="AMS_settings_"+location.pathname+location.hash+"_"+e.gridId,e.settings=e.storage.getItem(e.settingsKey),e.positionKey="AMS_position_"+location.pathname+location.hash+"_"+e.gridId,e.position=e.storage.getItem(e.positionKey)),"ontouchstart"in t||t.DocumentTouch&&t.document instanceof t.DocumentTouch?e.clickEvent="touchstart":e.clickEvent="click"},_runLoaderWidget:function(e){var t=this;t.options.indicator&&e.find(".ams-widget-loader").stop(!0,!0).fadeIn(100).delay(t.options.indicatorTime).fadeOut(100)},_loadAjaxFile:function(e,t,i){s.skin.loadURL(e,t.find(".widget-body"))},_saveWidgetSettings:function(){var t=this;if(t._getSettings(),t.storage){var i=[];t.grid.find(t.options.widgets).each(function(){var t=e(this),s={};s.id=t.attr("id"),s.style=t.attr("data-widget-attstyle"),s.title=t.children("header").children("h2").text(),s.hidden=t.is(":hidden")?1:0,s.collapsed=t.hasClass("ams-widget-collapsed")?1:0,i.push(s)});var s=JSON.stringify({widget:i});t.settings!==s&&t.storage.setItem(t.settingsKey,s),"function"==typeof t.options.onSave&&t.options.onSave.call(this,null,i)}},_saveWidgetPosition:function(){var t=this;if(t._getSettings(),t.storage){var i=[];t.grid.find(t.options.subgrid+".sortable-grid").each(function(){var s=[];e(this).children(t.options.widgets).each(function(){var t={};t.id=e(this).attr("id"),s.push(t)});var a={section:s};i.push(a)});var s=JSON.stringify({grid:i});t.position!==s&&t.storage.setItem(t.positionKey,s),"function"==typeof t.options.onSave&&t.options.onSave.call(this,null,i)}},_setClickEvents:function(){function t(){var t=e("#ams-widget-fullscreen-mode");if(t.length>0){var s=t.find(i.options.widgets),a=e(window).height(),n=s.children("header").height();s.children("div").height(a-n-15)}}var i=this;i._getSettings(),i.widget.on(i.clickEvent,".ams-widget-toggle-btn",function(t){t.preventDefault();var s=e(this),a=s.parents(i.options.widgets).first(),n=a.data("widget-options"),d=n.toggleClass.split("|");i._runLoaderWidget(a);var o=!0;a.hasClass("ams-widget-collapsed")?(n.onToggle&&(o=n.onToggle.call(this,a,"expand")),!1!==o&&(s.children().removeClass(d[1]).addClass(d[0]),a.removeClass("ams-widget-collapsed").children("[role=content]").slideDown(n.toggleSpeed,function(){i._saveWidgetSettings()}))):(n.onToggle&&(o=n.onToggle.call(this,a,"collapse")),!1!==o&&(s.children().removeClass(d[0]).addClass(d[1]),a.addClass("ams-widget-collapsed").children("[role=content]").slideUp(n.toggleSpeed,function(){i._saveWidgetSettings()})))}),i.widget.on("dblclick","header",function(t){e(".ams-widget-toggle-btn",this).click()}),i.widget.on(i.clickEvent,".ams-widget-fullscreen-btn",function(s){s.preventDefault();var a=e(this).parents(i.options.widgets),n=a.data("widget-options"),d=n.fullscreenClass.split("|"),o=a.children("div");i._runLoaderWidget(a),e("#ams-widget-fullscreen-mode").length>0?(e(".nooverflow").removeClass("nooverflow"),a.unwrap("<div>").children("div").removeAttr("style").end().find(".ams-widget-fullscreen-btn").children().removeClass(d[1]).addClass(d[0]).parents(i.controls).children("a").show(),o.hasClass("ams-widget-visible")&&o.hide().removeClass("ams-widget-visible")):(e("body").addClass("nooverflow"),a.wrap('<div id="ams-widget-fullscreen-mode"></div>').parent().find(".ams-widget-fullscreen-btn").children().removeClass(d[0]).addClass(d[1]).parents(i.controls).children("a:not(.ams-widget-fullscreen-btn)").hide(),o.is(":hidden")&&o.show().addClass("ams-widget-visible")),t(),"function"==typeof n.onFullscreen&&n.onFullscreen.call(this,a)}),e(window).resize(function(){t()}),i.widget.on(i.clickEvent,".ams-widget-edit-btn",function(t){t.preventDefault();var s=e(this),a=s.parents(i.options.widgets),n=a.data("widget-options"),d=n.editClass.split("|");i._runLoaderWidget(a);var o=a.find(n.editPlaceholder);o.is(":visible")?(s.children().removeClass(d[1]).addClass(d[0]),o.slideUp(n.editSpeed,function(){i._saveWidgetSettings()})):(s.children().removeClass(d[0]).addClass(d[1]),o.slideDown(n.editSpeed)),"function"==typeof n.onEdit&&n.onEdit.call(this,a)}),e(i.options.editPlaceholder).find("input").keyup(function(){e(this).parents(i.options.widgets).children("header").children("h2").text(e(this).val())}),i.widget.on(i.clickEvent,".ams-widget-custom-btn",function(t){t.preventDefault();var s=e(this),a=s.parents(i.options.widgets),n=a.data("widget-options"),d=n.customClass.split("|");i._runLoaderWidget(a),s.children("."+d[0]).length>0?(s.children().removeClass(d[0]).addClass(d[1]),"function"==typeof n.customStart&&n.customStart.call(this,a)):(s.children("."+d[1]).addClass(d[0]),"function"==typeof n.customEnd&&n.customEnd.call(this,a)),i._saveWidgetSettings()}),i.widget.on(i.clickEvent,".ams-widget-delete-btn",function(t){t.preventDefault();var n=e(this),d=n.parents(i.options.widgets),o=d.data("widget-options"),l=d.attr("id"),r=d.children("header").children("h2").text();s.ajax.check(MyAMS.notify,s.baseURL+"myams-notify"+(s.devmode?".js":".min.js"),function(){s.notify.messageBox({title:'<i class="fa fa-times" style="color: #ed1c24;"></i> '+o.deleteLabel+' "'+r+'"',content:a.i18n.DELETE_MSG,buttons:"["+s.i18n.BTN_OK+"]["+s.i18n.BTN_CANCEL+"]"},function(t){t===s.i18n.BTN_OK&&(i._runLoaderWidget(d),e("#"+l).fadeOut(o.deleteSpeed,function(){n.remove(),"function"==typeof o.onDelete&&o.onDelete.call(this,d)}))})})}),i.widget.on(i.clickEvent,".ams-widget-refresh-btn",function(t){t.preventDefault();var s=e(this),a=s.parents(i.options.widgets),n=a.data("widget-load"),d=a.children();s.button("loading"),d.addClass("widget-body-ajax-loading"),setTimeout(function(){s.button("reset"),d.removeClass("widget-body-ajax-loading"),i._loadAjaxFile(a,n,d)},1e3)})}};var a={i18n:e.extend({SETTINGS_KEY_LABEL:"Reset settings?",POSITION_KEY_LABEL:"Reset position?",TIMESTAMP_FORMAT:"Last update: %d%/%m%/%y% %h%:%i%:%s",ERROR_LABEL:"An error occured: ",UPDATED_LABEL:"Last update: ",REFRESH_LABEL:"Refresh",EDIT_BTN:"Edit title",DELETE_BTN:"Delete",DELETE_LABEL:"Remove component: ",DELETE_MSG:"WARNING: this action can't be undone!",FULLSCREEN_BTN:"Fullscreen",COLLAPSE_BTN:"Collapse",REFRESH_BTN:"Reload content",LOADING_MSG:"Loading..."},s.plugins.i18n.widgets),initWidgetsGrid:function(t){if(t.exists()){var i=e(".ams-widget:first",t).data("AMSWidget").options;if(i.sortable&&e.ui){var s=t.find(".sortable-grid").not("[data-widget-excludegrid]");s.sortable({items:s.find(".ams-widget-sortable"),connectWith:s,placeholder:i.placeholderClass,cursor:"move",revert:!0,opacity:i.opacity,delay:200,cancel:".button-icon, #ams-widget-fullscreen-mode >div",zIndex:1e4,handle:i.dragHandle,forcePlaceholderSize:!0,forceHelperSize:!0,update:function(e,t){var s=t.item.data("AMSWidget");s._runLoaderWidget(s.widget),s._saveWidgetPosition(),"function"==typeof i.onChange&&i.onChange.call(this,t.item)}})}}}};a.defaults={grid:".ams-widget-grid",subgrid:"section",widgets:".ams-widget",controls:".ams-widget-ctrls",storage:"local",deleteSettingsKey:"",settingsKeyLabel:a.i18n.SETTINGS_KEY_LABEL,deletePositionKey:"",positionKeyLabel:a.i18n.POSITION_KEY_LABEL,sortable:!1,hiddenButtons:!1,toggleButton:!1,toggleClass:"fa fa-minus|fa fa-plus",toggleSpeed:200,onToggle:null,deleteButton:!1,deleteClass:"fa fa-times",deleteSpeed:200,onDelete:null,editButton:!1,editPlaceholder:".ams-widget-editbox",editClass:"fa fa-cog|fa fa-save",editSpeed:200,onEdit:null,fullscreenButton:!1,fullscreenClass:"fa fa-expand|fa fa-compress",fullscreenDiff:3,onFullscreen:null,customButton:!1,customClass:"folder-10|next-10",customStart:null,customEnd:null,buttonsOrder:"%refresh% %custom% %edit% %toggle% %fullscreen% %delete%",opacity:1,dragHandle:"> header",placeholderClass:"ams-widget-placeholder",indicator:!0,indicatorTime:600,ajax:!0,timestampPlaceholder:".ams-widget-timestamp",timestampFormat:a.i18n.TIMESTAMP_FORMAT,refreshButton:!0,refreshButtonClass:"fa fa-refresh",errorLabel:a.i18n.ERROR_LABEL,updatedLabel:a.i18n.UPDATED_LABEL,refreshLabel:a.i18n.REFRESH_LABEL,deleteLabel:a.i18n.DELETE_LABEL,afterLoad:null,rtl:!1,onChange:null,onSave:null,ajax_nav:s.ajax_nav},t.MyAMSWidget=a,e.fn.extend({MyAMSWidget:function(t){return this.each(function(){var n=e(this);if(!n.data("AMSWidget")){var d=n.parents(t.grid||a.defaults.grid),o={};if(d.exists()){var l=d.data();o={grid:l.amsWidgetGrid,subgrid:l.amsWidgetSubgrid,controls:l.amsWidgetControls,storage:l.amsWidgetStorage,deleteSettingsKey:l.amsWidgetDeleteSettingsKey,deletePositionKey:l.amsWidgetDeletePositionKey,sortable:l.amsWidgetSortable,hiddenButtons:l.amsWidgetHiddenButtons,toggleButton:l.amsWidgetToggleButton,toggleClass:l.amsWidgetToggleClass,onToggle:s.getFunctionByName(l.amsWidgetToggleCallback),deleteButton:l.amsWidgetDeleteButton,deleteClass:l.amsWidgetDeleteClass,onDelete:s.getFunctionByName(l.amsWidgetDeleteCallback),editButton:l.amsWidgetEditButton,editPlaceholder:l.amsWidgetEditPlaceholder,editClass:l.amsWidgetEditClass,onEdit:s.getFunctionByName(l.amsWidgetEditCallback),fullscreenButton:l.amsWidgetFullscreenButton,fullscreenClass:l.amsWidgetFullscreenClass,fullscreenDiff:l.amsWidgetFullscreenDiff,onFullscreen:s.getFunctionByName(l.amsWidgetFullscreenCallback),customButton:l.amsWidgetCustomButton,customClass:l.amsWidgetCustomClass,customStart:s.getFunctionByName(l.amsWidgetCustomStartCallback),customEnd:s.getFunctionByName(l.amsWidgetCustomStartCallback),buttonsOrder:l.amsWidgetButtonsOrder,opacity:l.amsWidgetOpacity,dragHandle:l.amsWidgetDragHandle,placeholderClass:l.amsWidgetPlaceholderClass,indicator:l.amsWidgetIndicator,indicatorTime:l.amsWidgetIndicatorTime,ajax:l.amsWidgetAjax,timestampPlaceholder:l.amsWidgetTimestampPlaceholder,timestampFormat:l.amsWidgetTimestampFormat,refreshButton:l.amsWidgetRefreshButton,refreshClass:l.amsWidgetRefreshClass,errorLabel:l.amsWidgetErrorLabel,updatedLabel:l.amsWidgetUpdatedLabel,refreshLabel:l.amsWidgetRefreshLabel,deleteLabel:l.amsWidgetDeleteLabel,afterLoad:s.getFunctionByName(l.amsWidgetAfterLoadCallback),rtl:l.amsWidgetRtl,onChange:s.getFunctionByName(l.amsWidgetChangeCallback),onSave:s.getFunctionByName(l.amsWidgetSaveCallback),ajax_nav:s.ajax_nav}}var r=e.fn.extend({},o,n.data("ams-widget-options")||{},t);n.data("AMSWidget",new i(n,r))}})}})}(jQuery,this);
+!function(e,t){"use strict";function i(t,i){this.widget=t,this.options=e.extend({},a.defaults,i),this.grid=this.widget.parents(this.options.grid),this.hasGrid=this.grid.exists(),this.gridId=this.grid.attr("id"),this.controls=this.options.controls,this.toggleClass=this.options.toggleClass.split("|"),this.editClass=this.options.editClass.split("|"),this.fullscreenClass=this.options.fullscreenClass.split("|"),this.customClass=this.options.customClass.split("|"),this.init()}var s=t.MyAMS;i.prototype={init:function(){var i,n=this;if(!0===n.options.rtl&&e("body").addClass("rtl"),n.grid.each(function(){e(this).addClass("sortable-grid")}),n._getSettings(),n.hasGrid&&n.storage){var d;if(n.position){var o=JSON.parse(n.position);for(d in o.grid)if(o.grid.hasOwnProperty(d)){var l=n.grid.find(n.options.subgrid+".sortable-grid").eq(d);for(var r in o.grid[d].section)o.grid[d].section.hasOwnProperty(r)&&l.append(e("#"+o.grid[d].section[r].id))}}if(n.settings){var g=JSON.parse(n.settings);for(d in g.widget)if(g.widget.hasOwnProperty(d)&&(i=g.widget[d]).id){var c=e("#"+i.id);if(c.exists()){i.style&&c.removeClassPrefix("ams-widget-color-").addClass(i.style).attr("data-widget-attstyle",i.style),1===i.hidden?c.hide(1):c.show(1).removeAttr("data-widget-hidden"),1===i.collapsed&&c.addClass("ams-widget-collapsed").children("div").hide(1);var u=c.children("header").children("h2");u.text()!==i.title&&u.text(i.title)}}}}var m=(i=n.widget).data(),h={grid:m.amsWidgetGrid,subgrid:m.amsWudgetSubgrid,widgets:m.amsWidgetWidgets,controls:m.amsWidgetControls,storage:m.amsWidgetStorage,deleteSettingsKey:m.amsWidgetDeleteSettingsKey,deletePositionKey:m.amsWidgetDeletePositionKey,sortable:m.amsWidgetSortable,hiddenButtons:m.amsWidgetHiddenButtons,toggleButton:m.amsWidgetToggleButton,toggleClass:m.amsWidgetToggleClass,onToggle:s.getFunctionByName(m.amsWidgetToggleCallback),deleteButton:m.amsWidgetDeleteButton,deleteClass:m.amsWidgetDeleteClass,onDelete:s.getFunctionByName(m.amsWidgetDeleteCallback),editButton:m.amsWidgetEditButton,editPlaceholder:m.amsWidgetEditPlaceholder,editClass:m.amsWidgetEditClass,onEdit:s.getFunctionByName(m.amsWidgetEditCallback),fullscreenButton:m.amsWidgetFullscreenButton,fullscreenClass:m.amsWidgetFullscreenClass,fullscreenDiff:m.amsWidgetFullscreenDiff,onFullscreen:s.getFunctionByName(m.amsWidgetFullscreenCallback),customButton:m.amsWidgetCustomButton,customClass:m.amsWidgetCustomClass,customStart:s.getFunctionByName(m.amsWidgetCustomStartCallback),customEnd:s.getFunctionByName(m.amsWidgetCustomEndCallback),buttonsOrder:m.amsWidgetButtonsOrder,opacity:m.amsWidgetOpacity,dragHandle:m.amsWidgetDragHandle,placeholderClass:m.amsWidgetPlaceholderClass,indicator:m.amsWidgetIndicator,indicatorTime:m.amsWidgetIndicatorTime,ajax:m.amsWidgetAjax,timestampPlaceholder:m.amsWidgetTimestampPlaceholder,timestampFormat:m.amsWidgetTimestampFormat,refreshButton:m.amsWidgetRefreshButton,refreshClass:m.amsWidgetRefreshClass,errorLabel:m.amsWidgetErrorLabel,updatedLabel:m.amsWidgetUpdatedLabel,refreshLabel:m.amsWidgetRefreshLabel,deleteLabel:m.amsWidgetDeleteLabel,afterLoad:s.getFunctionByName(m.amsWidgetAfterLoadCallback),rtl:m.amsWidgetRtl,onChange:s.getFunctionByName(m.amsWidgetChangeCallback),onSave:s.getFunctionByName(m.amsWidgetSaveCallback),ajax_nav:s.ajax_nav},f=e.extend({},n.options,h),p=i.children("header");if(!p.parent().attr("role")){var v,C,w,W,b,y;if(!0===m.widgetHidden&&i.hide(),!0===m.widgetCollapsed&&i.addClass("ams-widget-collapsed").children("div").hide(),v=f.customButton&&void 0===m.widgetCustombutton&&0!==n.customClass[0].length?'<a href="#" class="button-icon ams-widget-custom-btn"><i class="'+n.customClass[0]+'"></i></a>':"",C=f.deleteButton&&void 0===m.widgetDeleteButton?'<a href="#" class="button-icon ams-widget-delete-btn hint" title="'+a.i18n.DELETE_BTN+'" data-ams-hint-gravity="se"><i class="'+f.deleteClass+'"></i></a>':"",f.editButton&&void 0===m.widgetEditButton){var B=f.editClass.split("|")[0];w='<a href="#" class="button-icon ams-widget-edit-btn hint" title="'+a.i18n.EDIT_BTN+'" data-ams-hint-gravity="se"><i class="'+B+'"></i></a>'}else w="";if(f.fullscreenButton&&void 0===m.widgetFullscreenButton){var E=f.fullscreenClass.split("|")[0];W='<a href="#" class="button-icon ams-widget-fullscreen-btn hint" title="'+a.i18n.FULLSCREEN_BTN+'" data-ams-hint-gravity="se"><i class="'+E+'"></i></a>'}else W="";if(f.toggleButton&&void 0===m.widgetToggleButton){var S,L=f.toggleClass.split("|");S=!0===i.dataWidgetCollapsed||i.hasClass("ams-widget-collapsed")?L[1]:L[0],b='<a href="#" class="button-icon ams-widget-toggle-btn hint" title="'+a.i18n.COLLAPSE_BTN+'" data-ams-hint-gravity="se"><i class="'+S+'"></i></a>'}else b="";y=f.refreshButton&&void 0===m.widgetRefreshButton&&m.widgetLoad?'<a href="#" class="button-icon ams-widget-refresh-btn hint" title="'+a.i18n.REFRESH_BTN+'" data-loading-text=" '+a.i18n.LOADING_MSG+' " data-ams-hint-gravity="se"><i class="'+f.refreshClass+'"></i></a>':"";var _=f.buttonsOrder.replace(/%refresh%/,y).replace(/%custom%/,v).replace(/%edit%/,w).replace(/%toggle%/,b).replace(/%fullscreen%/,W).replace(/%delete%/,C);(y||v||w||b||W||C)&&p.prepend('<div class="ams-widget-ctrls">'+_+"</div>"),f.sortable&&void 0===m.widgetSortable&&i.addClass("ams-widget-sortable");var T=i.find(f.editPlaceholder);T.length>0&&T.find("input").val(e.trim(p.children("h2").text())),p.append('<span class="ams-widget-loader"><i class="fa fa-refresh fa-spin"></i></span>'),i.attr("role","widget").children("div").attr("role","content").prev("header").attr("role","heading").children("div").attr("role","menu"),s.plugins&&s.plugins.enabled.hint&&s.plugins.enabled.hint(p)}i.data("widget-options",f),n.options.hiddenButtons&&e(n.controls).hide(),i.find("[data-widget-load]").each(function(){var t=e(this),i=t.children(),s=t.data("widget-load"),a=1e3*t.data("widget-refresh");t.find(".ams-widget-ajax-placeholder").length<=0&&(t.children("widget-body").append('<div class="ams-widget-ajax-placeholder">'+n.options.loadingLabel+"</div>"),a>0?(n.loadAjaxFile(t,s,i),setInterval(function(){n._loadAjaxFile(t,s,i)},a)):n._loadAjaxFile(t,s,i))}),n.options.hiddenButtons&&n.widget.children("header").hover(function(){e(this).children(n.controls).stop(!0,!0).fadeTo(100,1)},function(){e(this).children(n.controls).stop(!0,!0).fadeTo(100,0)}),n._setClickEvents(),e(n.options.deleteSettingsKey).on(n.clickEvent,this,function(e){n.storage&&t.confirm&&t.confirm(n.options.settingsKeyLabel)&&n.storage.removeItem(n.settingsKey),e.preventDefault()}),e(n.options.deletePositionKey).on(n.clickEvent,this,function(e){n.storage&&t.confirm&&t.confirm(n.options.positionKeyLabel)&&n.storage.removeItem(n.positionKey),e.preventDefault()}),n.storage&&((null===n.settingsKey||n.settingsKey.length<1)&&n._saveWidgetSettings(),(null===n.positionKey||n.positionKey.length<1)&&n._saveWidgetPosition()),n.grid.data("ams-widgets-loaded",!0)},destroy:function(){var e=this;e.widgets.off("click",e._setClickEvents()),e.element.removeData("AMSWidget")},_getSettings:function(){var e=this;if(e.hasGrid&&e.gridId)switch(e.options.storage){case"local":e.storage=localStorage;break;case"session":e.storage=sessionStorage;break;default:e.storage=null}else e.storage=null;null!==e.storage&&function(){var t,i=+new Date;try{return e.storage.setItem(i,i),t=parseInt(e.storage.getItem(i))===i,e.storage.removeItem(i),t}catch(e){}}()&&(e.settingsKey="AMS_settings_"+location.pathname+location.hash+"_"+e.gridId,e.settings=e.storage.getItem(e.settingsKey),e.positionKey="AMS_position_"+location.pathname+location.hash+"_"+e.gridId,e.position=e.storage.getItem(e.positionKey)),"ontouchstart"in t||t.DocumentTouch&&t.document instanceof t.DocumentTouch?e.clickEvent="touchstart":e.clickEvent="click"},_runLoaderWidget:function(e){var t=this;t.options.indicator&&e.find(".ams-widget-loader").stop(!0,!0).fadeIn(100).delay(t.options.indicatorTime).fadeOut(100)},_loadAjaxFile:function(e,t,i){s.skin&&s.skin.loadURL(e,t.find(".widget-body"))},_saveWidgetSettings:function(){var t=this;if(t._getSettings(),t.storage){var i=[];t.grid.find(t.options.widgets).each(function(){var t=e(this),s={};s.id=t.attr("id"),s.style=t.attr("data-widget-attstyle"),s.title=t.children("header").children("h2").text(),s.hidden=t.is(":hidden")?1:0,s.collapsed=t.hasClass("ams-widget-collapsed")?1:0,i.push(s)});var s=JSON.stringify({widget:i});t.settings!==s&&t.storage.setItem(t.settingsKey,s),"function"==typeof t.options.onSave&&t.options.onSave.call(this,null,i)}},_saveWidgetPosition:function(){var t=this;if(t._getSettings(),t.storage){var i=[];t.grid.find(t.options.subgrid+".sortable-grid").each(function(){var s=[];e(this).children(t.options.widgets).each(function(){var t={};t.id=e(this).attr("id"),s.push(t)});var a={section:s};i.push(a)});var s=JSON.stringify({grid:i});t.position!==s&&t.storage.setItem(t.positionKey,s),"function"==typeof t.options.onSave&&t.options.onSave.call(this,null,i)}},_setClickEvents:function(){function t(){var t=e("#ams-widget-fullscreen-mode");if(t.length>0){var s=t.find(i.options.widgets),a=e(window).height(),n=s.children("header").height();s.children("div").height(a-n-15)}}var i=this;i._getSettings(),i.widget.on(i.clickEvent,".ams-widget-toggle-btn",function(t){t.preventDefault();var s=e(this),a=s.parents(i.options.widgets).first(),n=a.data("widget-options"),d=n.toggleClass.split("|");i._runLoaderWidget(a);var o=!0;a.hasClass("ams-widget-collapsed")?(n.onToggle&&(o=n.onToggle.call(this,a,"expand")),!1!==o&&(s.children().removeClass(d[1]).addClass(d[0]),a.removeClass("ams-widget-collapsed").children("[role=content]").slideDown(n.toggleSpeed,function(){i._saveWidgetSettings()}))):(n.onToggle&&(o=n.onToggle.call(this,a,"collapse")),!1!==o&&(s.children().removeClass(d[0]).addClass(d[1]),a.addClass("ams-widget-collapsed").children("[role=content]").slideUp(n.toggleSpeed,function(){i._saveWidgetSettings()})))}),i.widget.on("dblclick","header",function(t){e(".ams-widget-toggle-btn",this).click()}),i.widget.on(i.clickEvent,".ams-widget-fullscreen-btn",function(s){s.preventDefault();var a=e(this).parents(i.options.widgets),n=a.data("widget-options"),d=n.fullscreenClass.split("|"),o=a.children("div");i._runLoaderWidget(a),e("#ams-widget-fullscreen-mode").length>0?(e(".nooverflow").removeClass("nooverflow"),a.unwrap("<div>").children("div").removeAttr("style").end().find(".ams-widget-fullscreen-btn").children().removeClass(d[1]).addClass(d[0]).parents(i.controls).children("a").show(),o.hasClass("ams-widget-visible")&&o.hide().removeClass("ams-widget-visible")):(e("body").addClass("nooverflow"),a.wrap('<div id="ams-widget-fullscreen-mode"></div>').parent().find(".ams-widget-fullscreen-btn").children().removeClass(d[0]).addClass(d[1]).parents(i.controls).children("a:not(.ams-widget-fullscreen-btn)").hide(),o.is(":hidden")&&o.show().addClass("ams-widget-visible")),t(),"function"==typeof n.onFullscreen&&n.onFullscreen.call(this,a)}),e(window).resize(function(){t()}),i.widget.on(i.clickEvent,".ams-widget-edit-btn",function(t){t.preventDefault();var s=e(this),a=s.parents(i.options.widgets),n=a.data("widget-options"),d=n.editClass.split("|");i._runLoaderWidget(a);var o=a.find(n.editPlaceholder);o.is(":visible")?(s.children().removeClass(d[1]).addClass(d[0]),o.slideUp(n.editSpeed,function(){i._saveWidgetSettings()})):(s.children().removeClass(d[0]).addClass(d[1]),o.slideDown(n.editSpeed)),"function"==typeof n.onEdit&&n.onEdit.call(this,a)}),e(i.options.editPlaceholder).find("input").keyup(function(){e(this).parents(i.options.widgets).children("header").children("h2").text(e(this).val())}),i.widget.on(i.clickEvent,".ams-widget-custom-btn",function(t){t.preventDefault();var s=e(this),a=s.parents(i.options.widgets),n=a.data("widget-options"),d=n.customClass.split("|");i._runLoaderWidget(a),s.children("."+d[0]).length>0?(s.children().removeClass(d[0]).addClass(d[1]),"function"==typeof n.customStart&&n.customStart.call(this,a)):(s.children("."+d[1]).addClass(d[0]),"function"==typeof n.customEnd&&n.customEnd.call(this,a)),i._saveWidgetSettings()}),i.widget.on(i.clickEvent,".ams-widget-delete-btn",function(t){t.preventDefault();var n=e(this),d=n.parents(i.options.widgets),o=d.data("widget-options"),l=d.attr("id"),r=d.children("header").children("h2").text();s.ajax&&s.ajax.check(MyAMS.notify,s.baseURL+"myams-notify"+(s.devmode?".js":".min.js"),function(){s.notify.messageBox({title:'<i class="fa fa-times" style="color: #ed1c24;"></i> '+o.deleteLabel+' "'+r+'"',content:a.i18n.DELETE_MSG,buttons:"["+s.i18n.BTN_OK+"]["+s.i18n.BTN_CANCEL+"]"},function(t){t===s.i18n.BTN_OK&&(i._runLoaderWidget(d),e("#"+l).fadeOut(o.deleteSpeed,function(){n.remove(),"function"==typeof o.onDelete&&o.onDelete.call(this,d)}))})})}),i.widget.on(i.clickEvent,".ams-widget-refresh-btn",function(t){t.preventDefault();var s=e(this),a=s.parents(i.options.widgets),n=a.data("widget-load"),d=a.children();s.button("loading"),d.addClass("widget-body-ajax-loading"),setTimeout(function(){s.button("reset"),d.removeClass("widget-body-ajax-loading"),i._loadAjaxFile(a,n,d)},1e3)})}};var a={i18n:e.extend({SETTINGS_KEY_LABEL:"Reset settings?",POSITION_KEY_LABEL:"Reset position?",TIMESTAMP_FORMAT:"Last update: %d%/%m%/%y% %h%:%i%:%s",ERROR_LABEL:"An error occured: ",UPDATED_LABEL:"Last update: ",REFRESH_LABEL:"Refresh",EDIT_BTN:"Edit title",DELETE_BTN:"Delete",DELETE_LABEL:"Remove component: ",DELETE_MSG:"WARNING: this action can't be undone!",FULLSCREEN_BTN:"Fullscreen",COLLAPSE_BTN:"Collapse",REFRESH_BTN:"Reload content",LOADING_MSG:"Loading..."},s.plugins.i18n.widgets),initWidgetsGrid:function(t){if(t.exists()){var i=e(".ams-widget:first",t).data("AMSWidget").options;if(i.sortable&&e.ui){var s=t.find(".sortable-grid").not("[data-widget-excludegrid]");s.sortable({items:s.find(".ams-widget-sortable"),connectWith:s,placeholder:i.placeholderClass,cursor:"move",revert:!0,opacity:i.opacity,delay:200,cancel:".button-icon, #ams-widget-fullscreen-mode >div",zIndex:1e4,handle:i.dragHandle,forcePlaceholderSize:!0,forceHelperSize:!0,update:function(e,t){var s=t.item.data("AMSWidget");s._runLoaderWidget(s.widget),s._saveWidgetPosition(),"function"==typeof i.onChange&&i.onChange.call(this,t.item)}})}}}};a.defaults={grid:".ams-widget-grid",subgrid:"section",widgets:".ams-widget",controls:".ams-widget-ctrls",storage:"local",deleteSettingsKey:"",settingsKeyLabel:a.i18n.SETTINGS_KEY_LABEL,deletePositionKey:"",positionKeyLabel:a.i18n.POSITION_KEY_LABEL,sortable:!1,hiddenButtons:!1,toggleButton:!1,toggleClass:"fa fa-minus|fa fa-plus",toggleSpeed:200,onToggle:null,deleteButton:!1,deleteClass:"fa fa-times",deleteSpeed:200,onDelete:null,editButton:!1,editPlaceholder:".ams-widget-editbox",editClass:"fa fa-cog|fa fa-save",editSpeed:200,onEdit:null,fullscreenButton:!1,fullscreenClass:"fa fa-expand|fa fa-compress",fullscreenDiff:3,onFullscreen:null,customButton:!1,customClass:"folder-10|next-10",customStart:null,customEnd:null,buttonsOrder:"%refresh% %custom% %edit% %toggle% %fullscreen% %delete%",opacity:1,dragHandle:"> header",placeholderClass:"ams-widget-placeholder",indicator:!0,indicatorTime:600,ajax:!0,timestampPlaceholder:".ams-widget-timestamp",timestampFormat:a.i18n.TIMESTAMP_FORMAT,refreshButton:!0,refreshButtonClass:"fa fa-refresh",errorLabel:a.i18n.ERROR_LABEL,updatedLabel:a.i18n.UPDATED_LABEL,refreshLabel:a.i18n.REFRESH_LABEL,deleteLabel:a.i18n.DELETE_LABEL,afterLoad:null,rtl:!1,onChange:null,onSave:null,ajax_nav:s.ajax_nav},t.MyAMSWidget=a,e.fn.extend({MyAMSWidget:function(t){return this.each(function(){var n=e(this);if(!n.data("AMSWidget")){var d=n.parents(t.grid||a.defaults.grid),o={};if(d.exists()){var l=d.data();o={grid:l.amsWidgetGrid,subgrid:l.amsWidgetSubgrid,controls:l.amsWidgetControls,storage:l.amsWidgetStorage,deleteSettingsKey:l.amsWidgetDeleteSettingsKey,deletePositionKey:l.amsWidgetDeletePositionKey,sortable:l.amsWidgetSortable,hiddenButtons:l.amsWidgetHiddenButtons,toggleButton:l.amsWidgetToggleButton,toggleClass:l.amsWidgetToggleClass,onToggle:s.getFunctionByName(l.amsWidgetToggleCallback),deleteButton:l.amsWidgetDeleteButton,deleteClass:l.amsWidgetDeleteClass,onDelete:s.getFunctionByName(l.amsWidgetDeleteCallback),editButton:l.amsWidgetEditButton,editPlaceholder:l.amsWidgetEditPlaceholder,editClass:l.amsWidgetEditClass,onEdit:s.getFunctionByName(l.amsWidgetEditCallback),fullscreenButton:l.amsWidgetFullscreenButton,fullscreenClass:l.amsWidgetFullscreenClass,fullscreenDiff:l.amsWidgetFullscreenDiff,onFullscreen:s.getFunctionByName(l.amsWidgetFullscreenCallback),customButton:l.amsWidgetCustomButton,customClass:l.amsWidgetCustomClass,customStart:s.getFunctionByName(l.amsWidgetCustomStartCallback),customEnd:s.getFunctionByName(l.amsWidgetCustomStartCallback),buttonsOrder:l.amsWidgetButtonsOrder,opacity:l.amsWidgetOpacity,dragHandle:l.amsWidgetDragHandle,placeholderClass:l.amsWidgetPlaceholderClass,indicator:l.amsWidgetIndicator,indicatorTime:l.amsWidgetIndicatorTime,ajax:l.amsWidgetAjax,timestampPlaceholder:l.amsWidgetTimestampPlaceholder,timestampFormat:l.amsWidgetTimestampFormat,refreshButton:l.amsWidgetRefreshButton,refreshClass:l.amsWidgetRefreshClass,errorLabel:l.amsWidgetErrorLabel,updatedLabel:l.amsWidgetUpdatedLabel,refreshLabel:l.amsWidgetRefreshLabel,deleteLabel:l.amsWidgetDeleteLabel,afterLoad:s.getFunctionByName(l.amsWidgetAfterLoadCallback),rtl:l.amsWidgetRtl,onChange:s.getFunctionByName(l.amsWidgetChangeCallback),onSave:s.getFunctionByName(l.amsWidgetSaveCallback),ajax_nav:s.ajax_nav}}var r=e.fn.extend({},o,n.data("ams-widget-options")||{},t);n.data("AMSWidget",new i(n,r))}})}})}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-xmlrpc.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-xmlrpc.js Thu Dec 13 14:28:29 2018 +0100
@@ -26,38 +26,37 @@
* - @callback: name of a callback which will be called on server response
*/
post: function(url, method, data, options, callback) {
- ams.ajax.check($.xmlrpc,
- ams.baseURL + 'ext/jquery-xmlrpc' + ams.devext + '.js',
- function() {
- if (typeof(options) === 'function') {
- callback = options;
- options = {};
- }
- else if (!options) {
- options = {};
- }
- if (typeof(callback) === 'undefined') {
- callback = options.callback;
- }
- if (typeof(callback) === 'string') {
- callback = ams.getFunctionByName(callback);
- }
- delete options.callback;
+ ams.ajax && ams.ajax.check($.xmlrpc,
+ ams.baseURL + 'ext/jquery-xmlrpc' + ams.devext + '.js',
+ function() {
+ if (typeof (options) === 'function') {
+ callback = options;
+ options = {};
+ } else if (!options) {
+ options = {};
+ }
+ if (typeof (callback) === 'undefined') {
+ callback = options.callback;
+ }
+ if (typeof (callback) === 'string') {
+ callback = ams.getFunctionByName(callback);
+ }
+ delete options.callback;
- var result;
- var defaults = {
- url: ams.xmlrpc.getAddr(url),
- methodName: method,
- params: data,
- success: callback || function(response /*, status, xhr*/) {
- result = response;
- },
- error: ams.error.show
- };
- var settings = $.extend({}, defaults, options);
- $.xmlrpc(settings);
- return result;
- });
+ var result;
+ var defaults = {
+ url: ams.xmlrpc.getAddr(url),
+ methodName: method,
+ params: data,
+ success: callback || function(response /*, status, xhr*/) {
+ result = response;
+ },
+ error: ams.error && ams.error.show
+ };
+ var settings = $.extend({}, defaults, options);
+ $.xmlrpc(settings);
+ return result;
+ });
}
};
--- a/src/pyams_skin/resources/js/myams-xmlrpc.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-xmlrpc.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-!function(e,r){var t=r.MyAMS;t.xmlrpc={getAddr:function(r){var t=(r||e("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return t.substr(0,t.lastIndexOf("/")+1)},post:function(r,c,n,a,o){t.ajax.check(e.xmlrpc,t.baseURL+"ext/jquery-xmlrpc"+t.devext+".js",function(){"function"==typeof a?(o=a,a={}):a||(a={}),void 0===o&&(o=a.callback),"string"==typeof o&&(o=t.getFunctionByName(o)),delete a.callback;var l,s={url:t.xmlrpc.getAddr(r),methodName:c,params:n,success:o||function(e){l=e},error:t.error.show},u=e.extend({},s,a);return e.xmlrpc(u),l})}}}(jQuery,this);
+!function(r,e){var t=e.MyAMS;t.xmlrpc={getAddr:function(e){var t=(e||r("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return t.substr(0,t.lastIndexOf("/")+1)},post:function(e,c,n,a,o){t.ajax&&t.ajax.check(r.xmlrpc,t.baseURL+"ext/jquery-xmlrpc"+t.devext+".js",function(){"function"==typeof a?(o=a,a={}):a||(a={}),void 0===o&&(o=a.callback),"string"==typeof o&&(o=t.getFunctionByName(o)),delete a.callback;var l,s={url:t.xmlrpc.getAddr(e),methodName:c,params:n,success:o||function(r){l=r},error:t.error&&t.error.show},u=r.extend({},s,a);return r.xmlrpc(u),l})}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams.js Thu Dec 13 14:28:29 2018 +0100
@@ -465,6 +465,75 @@
})(jQuery, this);
+(function($, globals) {
+
+ var ams = globals.MyAMS;
+
+ /**
+ * MyAMS locale strings
+ */
+ ams.i18n = {
+
+ INFO: "Information",
+ WARNING: "!! WARNING !!",
+ ERROR: "ERROR: ",
+
+ LOADING: "Loading...",
+ PROGRESS: "Processing",
+
+ 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",
+ CLIPBOARD_CHARACTER_COPY_OK: "Character copied to clipboard",
+ CLIPBOARD_TEXT_COPY_OK: "Text copied to clipboard",
+
+ 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"
+ };
+
+})(jQuery, this);
+
/**
* MyAMS UTF-8 features
*/
@@ -581,7 +650,7 @@
var invokedOn = $(this).data("invokedOn");
var selectedMenu = $(e.target);
settings.menuSelected.call(this, invokedOn, selectedMenu);
- ams.event.stop(e);
+ ams.event && ams.event.stop(e);
});
return false;
});
@@ -817,14 +886,13 @@
}
}
if (copied) {
- ams.skin.smallBox('success',
- {
- title: text.length > 1
- ? ams.i18n.CLIPBOARD_TEXT_COPY_OK
- : ams.i18n.CLIPBOARD_CHARACTER_COPY_OK,
- icon: 'fa fa-fw fa-info-circle font-xs align-top margin-top-10',
- timeout: 3000
- });
+ ams.skin && ams.skin.smallBox('success', {
+ title: text.length > 1
+ ? ams.i18n.CLIPBOARD_TEXT_COPY_OK
+ : ams.i18n.CLIPBOARD_CHARACTER_COPY_OK,
+ icon: 'fa fa-fw fa-info-circle font-xs align-top margin-top-10',
+ timeout: 3000
+ });
} else if (globals.prompt) {
globals.prompt(ams.i18n.CLIPBOARD_COPY, text);
}
@@ -865,22 +933,26 @@
if (response && response.statusText && response.statusText.toUpperCase() === 'OK') {
return;
}
- response = ams.ajax.getResponse(response);
- if (response.contentType === 'json') {
- ams.ajax.handleJSON(response.data);
+ response = ams.ajax && ams.ajax.getResponse(response);
+ if (response) {
+ if (response.contentType === 'json') {
+ ams.ajax.handleJSON(response.data);
+ } else {
+ var title = error || event.statusText || event.type;
+ var message = response.responseText;
+ ams.skin && ams.skin.messageBox('error', {
+ title: ams.i18n.ERROR_OCCURED,
+ content: '<h4>' + title + '</h4><p>' + (message || '') + '</p>',
+ icon: 'fa fa-warning animated shake',
+ timeout: 10000
+ });
+ }
+ if (console) {
+ console.error && console.error(event);
+ console.debug && console.debug(response);
+ }
} else {
- var title = error || event.statusText || event.type;
- var message = response.responseText;
- ams.skin.messageBox('error', {
- title: ams.i18n.ERROR_OCCURED,
- content: '<h4>' + title + '</h4><p>' + (message || '') + '</p>',
- icon: 'fa fa-warning animated shake',
- timeout: 10000
- });
- }
- if (console) {
- console.error && console.error(event);
- console.debug && console.debug(response);
+ console.error && console.error("Missing MyAMS AJAX module!")
}
},
@@ -891,20 +963,24 @@
if (!error) {
return;
}
- var response = ams.ajax.getResponse(request);
- if (response.contentType === 'json') {
- ams.ajax.handleJSON(response.data);
+ var response = ams.ajax && ams.ajax.getResponse(request);
+ if (response) {
+ if (response.contentType === 'json') {
+ ams.ajax.handleJSON(response.data);
+ } else {
+ ams.skin.messageBox('error', {
+ title: ams.i18n.ERRORS_OCCURED,
+ content: '<h4>' + status + '</h4><p>' + error + '</p>',
+ icon: "fa fa-warning animated shake",
+ timeout: 10000
+ });
+ }
+ if (console) {
+ console.error && console.error(error);
+ console.debug && console.debug(request);
+ }
} else {
- ams.skin.messageBox('error', {
- title: ams.i18n.ERRORS_OCCURED,
- content: '<h4>' + status + '</h4><p>' + error + '</p>',
- icon: "fa fa-warning animated shake",
- timeout: 10000
- });
- }
- if (console) {
- console.error && console.error(error);
- console.debug && console.debug(request);
+ console.error && console.error("Missing MyAMS AJAX module!")
}
}
};
@@ -1160,14 +1236,14 @@
}
break;
case 'error':
- ams.form.showErrors(form, result);
+ ams.form && ams.form.showErrors(form, result);
break;
case 'info':
case 'success':
if (form !== undefined) {
- ams.form.resetChanged(form);
+ ams.form && ams.form.resetChanged(form);
if (result.close_form !== false) {
- ams.dialog.close(form);
+ ams.dialog && ams.dialog.close(form);
}
}
break;
@@ -1178,20 +1254,20 @@
case 'callback':
case 'callbacks':
if (form !== undefined) {
- ams.form.resetChanged(form);
+ ams.form && ams.form.resetChanged(form);
if (result.close_form !== false) {
- ams.dialog.close(form);
+ ams.dialog && ams.dialog.close(form);
}
}
break;
case 'modal':
- ams.dialog.open(result.location);
+ ams.dialog && ams.dialog.open(result.location);
break;
case 'reload':
if (form !== undefined) {
- ams.form.resetChanged(form);
+ ams.form && ams.form.resetChanged(form);
if (result.close_form !== false) {
- ams.dialog.close(form);
+ ams.dialog && ams.dialog.close(form);
}
}
url = result.location || window.location.hash;
@@ -1199,7 +1275,7 @@
url = url.substr(1);
}
var loadTarget = $(result.target || target || '#content');
- ams.skin.loadURL(url, loadTarget, {
+ ams.skin && ams.skin.loadURL(url, loadTarget, {
preLoadCallback: ams.getFunctionByName(result.pre_reload) || function() {
$('[data-ams-pre-reload]', loadTarget).each(function() {
ams.executeFunctionByName($(this).data('ams-pre-reload'));
@@ -1216,9 +1292,9 @@
break;
case 'redirect':
if (form !== undefined) {
- ams.form.resetChanged(form);
+ ams.form && ams.form.resetChanged(form);
if (result.close_form === true) {
- ams.dialog.close(form);
+ ams.dialog && ams.dialog.close(form);
}
}
url = result.location || window.location.href;
@@ -1251,7 +1327,7 @@
container.text(content.text);
} else {
container.html(content.html);
- ams.initContent(container);
+ ams.initContent && ams.initContent(container);
}
if (!content.keep_hidden) {
container.removeClass('hidden');
@@ -1266,7 +1342,7 @@
container.text(content.text);
} else {
container.html(content.html);
- ams.initContent(container);
+ ams.initContent && ams.initContent(container);
}
if (!content.keep_hidden) {
container.removeClass('hidden');
@@ -1279,32 +1355,32 @@
message = result.message;
if (typeof(message) === 'string') {
if ((status === 'info') || (status === 'success')) {
- ams.skin.smallBox(status, {
- title: message,
- icon: 'fa fa-fw fa-info-circle font-xs align-top margin-top-10',
- timeout: 3000
- });
+ ams.skin && ams.skin.smallBox(status, {
+ title: message,
+ icon: 'fa fa-fw fa-info-circle font-xs align-top margin-top-10',
+ timeout: 3000
+ });
} else {
- ams.skin.alert($(form || '#content'), status, message);
+ ams.skin && ams.skin.alert($(form || '#content'), status, message);
}
} else {
- ams.skin.alert($(message.target || target || form || '#content'),
- message.status || 'success',
- message.header,
- message.body,
- message.subtitle);
+ ams.skin && ams.skin.alert($(message.target || target || form || '#content'),
+ message.status || 'success',
+ message.header,
+ message.body,
+ message.subtitle);
}
}
if (result.smallbox) {
message = result.smallbox;
if (typeof(message) === 'string') {
- ams.skin.smallBox(result.smallbox_status || status, {
+ ams.skin && ams.skin.smallBox(result.smallbox_status || status, {
title: result.smallbox,
icon: result.smallbox_icon || 'fa fa-fw fa-info-circle font-xs align-top margin-top-10',
timeout: result.smallbox_timeout || 3000
});
} else {
- ams.skin.smallBox(message.status || status, {
+ ams.skin && ams.skin.smallBox(message.status || status, {
title: message.message,
icon: message.icon || 'fa fa-fw fa-info-circle font-xs align-top margin-top-10',
timeout: message.timeout || 3000
@@ -1314,23 +1390,23 @@
if (result.messagebox) {
message = result.messagebox;
if (typeof(message) === 'string') {
- ams.skin.messageBox('info', {
- title: ams.i18n.ERROR_OCCURED,
- content: message,
- timeout: 10000
- });
+ ams.skin && ams.skin.messageBox('info', {
+ title: ams.i18n.ERROR_OCCURED,
+ content: message,
+ timeout: 10000
+ });
} else {
var messageStatus = message.status || 'info';
if (messageStatus === 'error' && form && target) {
ams.executeFunctionByName(form.data('ams-form-submit-error') || 'MyAMS.form.finalizeSubmitOnError', form, target);
}
- ams.skin.messageBox(messageStatus, {
- title: message.title || ams.i18n.ERROR_OCCURED,
- content: message.content,
- icon: message.icon,
- number: message.number,
- timeout: message.timeout === null ? undefined : (message.timeout || 10000)
- });
+ ams.skin && ams.skin.messageBox(messageStatus, {
+ title: message.title || ams.i18n.ERROR_OCCURED,
+ content: message.content,
+ icon: message.icon,
+ number: message.number,
+ timeout: message.timeout === null ? undefined : (message.timeout || 10000)
+ });
}
}
if (result.event) {
@@ -1401,51 +1477,50 @@
* - @callback: name of a callback which will be called on server response
*/
query: function(query, method, options, callback) {
- ams.ajax.check($.jsonRPC,
- ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
- function() {
- if (typeof(options) === 'function') {
- callback = options;
- options = {};
- }
- else if (!options) {
- options = {};
- }
- if (callback === 'undefined') {
- callback = options.callback;
- }
- if (typeof(callback) === 'string') {
- callback = ams.getFunctionByName(callback);
- }
- delete options.callback;
-
- var params = {};
- if (typeof(query) === 'string') {
- params.query = query;
- } else if (typeof(query) === 'object') {
- $.extend(params, query);
- }
- $.extend(params, options);
-
- var result;
- var defaults = {
- id: new Date().getTime(),
- params: params,
- success: callback || function(data) {
- result = data;
- },
- error: ams.error.show
- };
- var settings = $.extend({}, defaults, options);
- $.jsonRPC.withOptions({
- endPoint: ams.jsonrpc.getAddr(options.url),
- namespace: options.namespace,
- cache: false
- }, function() {
- $.jsonRPC.request(method, settings);
- });
- return result;
- });
+ ams.ajax && ams.ajax.check($.jsonRPC,
+ ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
+ function() {
+ if (typeof (options) === 'function') {
+ callback = options;
+ options = {};
+ } else if (!options) {
+ options = {};
+ }
+ if (callback === 'undefined') {
+ callback = options.callback;
+ }
+ if (typeof (callback) === 'string') {
+ callback = ams.getFunctionByName(callback);
+ }
+ delete options.callback;
+
+ var params = {};
+ if (typeof (query) === 'string') {
+ params.query = query;
+ } else if (typeof (query) === 'object') {
+ $.extend(params, query);
+ }
+ $.extend(params, options);
+
+ var result;
+ var defaults = {
+ id: new Date().getTime(),
+ params: params,
+ success: callback || function(data) {
+ result = data;
+ },
+ error: ams.error && ams.error.show
+ };
+ var settings = $.extend({}, defaults, options);
+ $.jsonRPC.withOptions({
+ endPoint: ams.jsonrpc.getAddr(options.url),
+ namespace: options.namespace,
+ cache: false
+ }, function() {
+ $.jsonRPC.request(method, settings);
+ });
+ return result;
+ });
},
/**
@@ -1457,43 +1532,42 @@
* - @callback: name of a callback which will be called on server response
*/
post: function(method, data, options, callback) {
- ams.ajax.check($.jsonRPC,
- ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
- function() {
- if (typeof(options) === 'function') {
- callback = options;
- options = {};
- }
- else if (!options) {
- options = {};
- }
- if (typeof(callback) === 'undefined') {
- callback = options.callback;
- }
- if (typeof(callback) === 'string') {
- callback = ams.getFunctionByName(callback);
- }
- delete options.callback;
-
- var result;
- var defaults = {
- id: new Date().getTime(),
- params: data,
- success: callback || function(data) {
- result = data;
- },
- error: ams.error.show
- };
- var settings = $.extend({}, defaults, options);
- $.jsonRPC.withOptions({
- endPoint: ams.jsonrpc.getAddr(options.url),
- namespace: options.namespace,
- cache: false
- }, function() {
- $.jsonRPC.request(method, settings);
- });
- return result;
- });
+ ams.ajax && ams.ajax.check($.jsonRPC,
+ ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
+ function() {
+ if (typeof (options) === 'function') {
+ callback = options;
+ options = {};
+ } else if (!options) {
+ options = {};
+ }
+ if (typeof (callback) === 'undefined') {
+ callback = options.callback;
+ }
+ if (typeof (callback) === 'string') {
+ callback = ams.getFunctionByName(callback);
+ }
+ delete options.callback;
+
+ var result;
+ var defaults = {
+ id: new Date().getTime(),
+ params: data,
+ success: callback || function(data) {
+ result = data;
+ },
+ error: ams.error && ams.error.show
+ };
+ var settings = $.extend({}, defaults, options);
+ $.jsonRPC.withOptions({
+ endPoint: ams.jsonrpc.getAddr(options.url),
+ namespace: options.namespace,
+ cache: false
+ }, function() {
+ $.jsonRPC.request(method, settings);
+ });
+ return result;
+ });
}
};
@@ -1527,38 +1601,37 @@
* - @callback: name of a callback which will be called on server response
*/
post: function(url, method, data, options, callback) {
- ams.ajax.check($.xmlrpc,
- ams.baseURL + 'ext/jquery-xmlrpc' + ams.devext + '.js',
- function() {
- if (typeof(options) === 'function') {
- callback = options;
- options = {};
- }
- else if (!options) {
- options = {};
- }
- if (typeof(callback) === 'undefined') {
- callback = options.callback;
- }
- if (typeof(callback) === 'string') {
- callback = ams.getFunctionByName(callback);
- }
- delete options.callback;
-
- var result;
- var defaults = {
- url: ams.xmlrpc.getAddr(url),
- methodName: method,
- params: data,
- success: callback || function(response /*, status, xhr*/) {
- result = response;
- },
- error: ams.error.show
- };
- var settings = $.extend({}, defaults, options);
- $.xmlrpc(settings);
- return result;
- });
+ ams.ajax && ams.ajax.check($.xmlrpc,
+ ams.baseURL + 'ext/jquery-xmlrpc' + ams.devext + '.js',
+ function() {
+ if (typeof (options) === 'function') {
+ callback = options;
+ options = {};
+ } else if (!options) {
+ options = {};
+ }
+ if (typeof (callback) === 'undefined') {
+ callback = options.callback;
+ }
+ if (typeof (callback) === 'string') {
+ callback = ams.getFunctionByName(callback);
+ }
+ delete options.callback;
+
+ var result;
+ var defaults = {
+ url: ams.xmlrpc.getAddr(url),
+ methodName: method,
+ params: data,
+ success: callback || function(response /*, status, xhr*/) {
+ result = response;
+ },
+ error: ams.error && ams.error.show
+ };
+ var settings = $.extend({}, defaults, options);
+ $.xmlrpc(settings);
+ return result;
+ });
}
};
@@ -1670,7 +1743,7 @@
cancelCallback.call(element);
}
} else {
- ams.skin.bigBox({
+ ams.skin && ams.skin.bigBox({
title: ams.i18n.WARNING,
content: '<i class="text-danger fa fa-2x fa-bell shake animated"></i> ' + ams.i18n.FORM_CHANGED_WARNING,
buttons: ams.i18n.BTN_OK_CANCEL
@@ -1717,7 +1790,7 @@
// Prevent multiple submits of the same form
if (form.data('submitted')) {
if (!form.data('ams-form-hide-submitted')) {
- ams.skin.messageBox('warning', {
+ ams.skin && ams.skin.messageBox('warning', {
title: ams.i18n.WAIT,
content: ams.i18n.FORM_SUBMITTED,
icon: 'fa fa-save shake animated',
@@ -1727,7 +1800,7 @@
return false;
}
// Check submit validators
- if (!ams.form._checkSubmitValidators(form)) {
+ if (ams.form && !ams.form._checkSubmitValidators(form)) {
return false;
}
// Remove remaining status messages
@@ -1739,283 +1812,283 @@
button.data('ams-progress-content', button.html());
button.button('loading');
}
- ams.ajax.check($.fn.ajaxSubmit,
- ams.baseURL + 'ext/jquery-form-3.49' + ams.devext + '.js',
- function() {
-
- function _submitAjaxForm(form, options) {
-
- var button,
- buttonData,
- buttonTarget;
- var data = form.data();
- var formOptions = data.amsFormOptions;
- var formData;
- var formDataCallback;
-
- var progressHandler;
- var progressInterval;
- var progressCallback;
- var progressEndCallback;
-
- // Inner progress status handler
- function _getProgress(handler, progress_id) {
-
- var interval;
-
- function _clearProgressStatus() {
- clearInterval(interval);
- ams.form.resetAfterSubmit(form, button);
- button.html(button.data('ams-progress-content'));
- ams.executeFunctionByName(progressEndCallback, form, button);
- ams.form.resetChanged(form);
- }
-
- function _getProgressStatus() {
- ams.ajax.post(handler,
- {progress_id: progress_id},
- {error: _clearProgressStatus},
- ams.getFunctionByName(progressCallback) || function(result, status) {
- if (status === 'success') {
- if (result.status === 'running') {
- if (result.message) {
- button.text(result.message);
- } else {
- var text = button.data('ams-progress-text') || ams.i18n.PROGRESS;
- if (result.current) {
- text += ': ' + result.current + '/ ' + (result.length || 100);
- } else {
- text += '...';
- }
- button.text(text);
- }
- } else if (result.status === 'finished') {
- _clearProgressStatus();
- }
- } else {
- _clearProgressStatus();
- }
- });
- }
-
- button.button('loading');
- interval = setInterval(_getProgressStatus, progressInterval);
- }
-
- // Initialize form data
- if (submitOptions) {
- formDataCallback = submitOptions.formDataInitCallback;
- }
- if (formDataCallback) {
- delete submitOptions.formDataInitCallback;
- } else {
- formDataCallback = data.amsFormDataInitCallback;
- }
- if (formDataCallback) {
- var veto = {};
- formData = ams.executeFunctionByName(formDataCallback, form, veto);
- if (veto.veto) {
- button = form.data('ams-submit-button');
- if (button) {
- button.button('reset');
- }
- ams.form.finalizeSubmitFooter.call(form);
- return false;
- }
- } else {
- formData = data.amsFormData || {};
- }
-
- // Check submit button for custom action handler and target
- button = $(form.data('ams-submit-button'));
- if (button && button.exists()) {
- buttonData = button.data();
- buttonTarget = buttonData.amsFormSubmitTarget;
- } else {
- buttonData = {};
- }
-
- // Check action URL
- var url;
- var formHandler = handler || buttonData.amsFormHandler || data.amsFormHandler || '';
- if (formHandler.startsWith(window.location.protocol)) {
- url = formHandler;
- } else {
- var action = buttonData.amsFormAction || form.attr('action').replace(/#/, '');
- if (action.startsWith(window.location.protocol)) {
- url = action;
- } else {
- url = ams.ajax.getAddr() + action;
- }
- url += formHandler;
- }
- progressHandler = buttonData.amsProgressHandler || data.amsProgressHandler || '';
- progressInterval = buttonData.amsProgressInterval || data.amsProgressInterval || 1000;
- progressCallback = buttonData.amsProgressCallback || data.amsProgressCallback;
- progressEndCallback = buttonData.amsProgressEndCallback || data.amsProgressEndCallback;
-
- // Initialize submit target with AJAX indicator
- var target = null;
- if (submitOptions && submitOptions.initSubmitTarget) {
- ams.executeFunctionByName(submitOptions.initSubmitTarget, form);
- } else {
- if (data.amsFormInitSubmitTarget) {
- target = $(buttonTarget || data.amsFormSubmitTarget || '#content');
- ams.executeFunctionByName(data.amsFormInitSubmit || 'MyAMS.form.initSubmit', form, target);
- } else if (!data.amsFormHideSubmitFooter) {
- ams.executeFunctionByName(data.amsFormInitSubmit || 'MyAMS.form.initSubmitFooter', form);
- }
- }
-
- // Complete form data
- if (submitOptions) {
- formData = $.extend({}, formData, submitOptions.form_data);
- }
-
- // Check progress handler
- var hasUpload;
- if (progressHandler) {
- formData.progress_id = ams.generateUUID();
- } else {
- // Check progress meter via Apache progress module
- hasUpload = typeof(options.uuid) !== 'undefined';
- if (hasUpload) {
- if (url.indexOf('X-Progress-ID') < 0) {
- url += "?X-Progress-ID=" + options.uuid;
- }
- delete options.uuid;
- }
- }
-
- // Initialize default AJAX settings
- var defaults = {
- url: url,
- type: 'post',
- cache: false,
- data: formData,
- dataType: data.amsFormDatatype,
- beforeSerialize: function(/*form, options*/) {
- if (typeof(globals.tinyMCE) !== 'undefined') {
- globals.tinyMCE.triggerSave();
- }
- },
- beforeSubmit: function(data, form /*, options*/) {
- form.data('submitted', true);
- },
- error: function(request, status, error, form) {
- if (target) {
- ams.executeFunctionByName(data.amsFormSubmitError || 'MyAMS.form.finalizeSubmitOnError', form, target);
- }
- ams.form.resetAfterSubmit(form);
- },
- iframe: hasUpload
- };
-
- // Initialize IFrame for custom download target
- var downloadTarget = (submitOptions && submitOptions.downloadTarget) || data.amsFormDownloadTarget;
- if (downloadTarget) {
- var iframe = $('iframe[name="' + downloadTarget + '"]');
- if (!iframe.exists()) {
- iframe = $('<iframe></iframe>').hide()
- .attr('name', downloadTarget)
- .appendTo($('body'));
- }
- defaults = $.extend({}, defaults, {
- iframe: true,
- iframeTarget: iframe,
- success: function(result, status, request, form) {
- var modal = $(form).parents('.modal-dialog');
- if (modal.exists()) {
- ams.dialog.close(form);
- } else {
- var callback;
- var button = form.data('ams-submit-button');
- if (button) {
- callback = button.data('ams-form-submit-callback');
- }
- if (!callback) {
- callback = ams.getFunctionByName(data.amsFormSubmitCallback) || ams.form._submitCallback;
- }
- try {
- callback.call(form, result, status, request, form);
- } finally {
- ams.form.resetAfterSubmit(form);
- ams.form.resetChanged(form);
- }
- }
- }
- });
- } else {
- defaults = $.extend({}, defaults, {
- error: function(request, status, error, form) {
- if (target) {
- ams.executeFunctionByName(data.amsFormSubmitError || 'MyAMS.form.finalizeSubmitOnError', form, target);
- }
- ams.form.resetAfterSubmit(form);
- },
- success: function(result, status, request, form) {
- var callback;
- var button = form.data('ams-submit-button');
- if (button) {
- callback = button.data('ams-form-submit-callback');
- }
- if (!callback) {
- callback = ams.getFunctionByName(data.amsFormSubmitCallback) || ams.form._submitCallback;
- }
- try {
- callback.call(form, result, status, request, form);
- } finally {
- ams.form.resetAfterSubmit(form);
- ams.form.resetChanged(form);
- }
- },
- iframe: hasUpload
- });
- }
- var settings = $.extend({}, defaults, options, formOptions, submitOptions);
-
- // Initialize progress handler
- if (progressHandler) {
- _getProgress(progressHandler, formData.progress_id);
- }
-
- // Submit form
- $(form).ajaxSubmit(settings);
-
- // If external download target is specified, reset form submit button and footer
- if (downloadTarget) {
- var modal = $(form).parents('.modal-dialog');
- var keepModal = modal.exists() && button.exists() && button.data('ams-keep-modal');
- if (modal.exists() && (keepModal !== true)) {
- ams.dialog.close(form);
- } else {
- if (!progressHandler) {
- setTimeout(function () {
- ams.form.resetAfterSubmit(form, button);
- ams.form.resetChanged(form);
- }, button.data('ams-form-reset-timeout') || 2000);
- }
- }
- }
- }
-
- var hasUpload = (form.data('ams-form-ignore-uploads') !== true) &&
- ($('INPUT[type="file"]', form).length > 0);
- if (hasUpload) {
- // JQuery-progressbar plug-in must be loaded synchronously!!
- // Otherwise, hidden input fields created by jquery-validate plug-in
- // and matching named buttons will be deleted (on first form submit)
- // before JQuery-form plug-in can get them when submitting the form...
- ams.ajax.check($.progressBar,
- ams.baseURL + 'ext/jquery-progressbar' + ams.devext + '.js');
- var settings = $.extend({}, {
- uuid: $.progressBar.submit(form)
- });
- _submitAjaxForm(form, settings);
- } else {
- _submitAjaxForm(form, {});
- }
- });
+ ams.ajax && ams.ajax.check($.fn.ajaxSubmit,
+ ams.baseURL + 'ext/jquery-form-3.49' + ams.devext + '.js',
+ function() {
+
+ function _submitAjaxForm(form, options) {
+
+ var button,
+ buttonData,
+ buttonTarget;
+ var data = form.data();
+ var formOptions = data.amsFormOptions;
+ var formData;
+ var formDataCallback;
+
+ var progressHandler;
+ var progressInterval;
+ var progressCallback;
+ var progressEndCallback;
+
+ // Inner progress status handler
+ function _getProgress(handler, progress_id) {
+
+ var interval;
+
+ function _clearProgressStatus() {
+ clearInterval(interval);
+ ams.form.resetAfterSubmit(form, button);
+ button.html(button.data('ams-progress-content'));
+ ams.executeFunctionByName(progressEndCallback, form, button);
+ ams.form.resetChanged(form);
+ }
+
+ function _getProgressStatus() {
+ ams.ajax && ams.ajax.post(handler,
+ {progress_id: progress_id},
+ {error: _clearProgressStatus},
+ ams.getFunctionByName(progressCallback) || function(result, status) {
+ if (status === 'success') {
+ if (result.status === 'running') {
+ if (result.message) {
+ button.text(result.message);
+ } else {
+ var text = button.data('ams-progress-text') || ams.i18n.PROGRESS;
+ if (result.current) {
+ text += ': ' + result.current + '/ ' + (result.length || 100);
+ } else {
+ text += '...';
+ }
+ button.text(text);
+ }
+ } else if (result.status === 'finished') {
+ _clearProgressStatus();
+ }
+ } else {
+ _clearProgressStatus();
+ }
+ });
+ }
+
+ button.button('loading');
+ interval = setInterval(_getProgressStatus, progressInterval);
+ }
+
+ // Initialize form data
+ if (submitOptions) {
+ formDataCallback = submitOptions.formDataInitCallback;
+ }
+ if (formDataCallback) {
+ delete submitOptions.formDataInitCallback;
+ } else {
+ formDataCallback = data.amsFormDataInitCallback;
+ }
+ if (formDataCallback) {
+ var veto = {};
+ formData = ams.executeFunctionByName(formDataCallback, form, veto);
+ if (veto.veto) {
+ button = form.data('ams-submit-button');
+ if (button) {
+ button.button('reset');
+ }
+ ams.form.finalizeSubmitFooter.call(form);
+ return false;
+ }
+ } else {
+ formData = data.amsFormData || {};
+ }
+
+ // Check submit button for custom action handler and target
+ button = $(form.data('ams-submit-button'));
+ if (button && button.exists()) {
+ buttonData = button.data();
+ buttonTarget = buttonData.amsFormSubmitTarget;
+ } else {
+ buttonData = {};
+ }
+
+ // Check action URL
+ var url;
+ var formHandler = handler || buttonData.amsFormHandler || data.amsFormHandler || '';
+ if (formHandler.startsWith(window.location.protocol)) {
+ url = formHandler;
+ } else {
+ var action = buttonData.amsFormAction || form.attr('action').replace(/#/, '');
+ if (action.startsWith(window.location.protocol)) {
+ url = action;
+ } else {
+ url = ams.ajax && (ams.ajax.getAddr() + action);
+ }
+ url += formHandler;
+ }
+ progressHandler = buttonData.amsProgressHandler || data.amsProgressHandler || '';
+ progressInterval = buttonData.amsProgressInterval || data.amsProgressInterval || 1000;
+ progressCallback = buttonData.amsProgressCallback || data.amsProgressCallback;
+ progressEndCallback = buttonData.amsProgressEndCallback || data.amsProgressEndCallback;
+
+ // Initialize submit target with AJAX indicator
+ var target = null;
+ if (submitOptions && submitOptions.initSubmitTarget) {
+ ams.executeFunctionByName(submitOptions.initSubmitTarget, form);
+ } else {
+ if (data.amsFormInitSubmitTarget) {
+ target = $(buttonTarget || data.amsFormSubmitTarget || '#content');
+ ams.executeFunctionByName(data.amsFormInitSubmit || 'MyAMS.form.initSubmit', form, target);
+ } else if (!data.amsFormHideSubmitFooter) {
+ ams.executeFunctionByName(data.amsFormInitSubmit || 'MyAMS.form.initSubmitFooter', form);
+ }
+ }
+
+ // Complete form data
+ if (submitOptions) {
+ formData = $.extend({}, formData, submitOptions.form_data);
+ }
+
+ // Check progress handler
+ var hasUpload;
+ if (progressHandler) {
+ formData.progress_id = ams.generateUUID();
+ } else {
+ // Check progress meter via Apache progress module
+ hasUpload = typeof (options.uuid) !== 'undefined';
+ if (hasUpload) {
+ if (url.indexOf('X-Progress-ID') < 0) {
+ url += "?X-Progress-ID=" + options.uuid;
+ }
+ delete options.uuid;
+ }
+ }
+
+ // Initialize default AJAX settings
+ var defaults = {
+ url: url,
+ type: 'post',
+ cache: false,
+ data: formData,
+ dataType: data.amsFormDatatype,
+ beforeSerialize: function(/*form, options*/) {
+ if (typeof (globals.tinyMCE) !== 'undefined') {
+ globals.tinyMCE.triggerSave();
+ }
+ },
+ beforeSubmit: function(data, form /*, options*/) {
+ form.data('submitted', true);
+ },
+ error: function(request, status, error, form) {
+ if (target) {
+ ams.executeFunctionByName(data.amsFormSubmitError || 'MyAMS.form.finalizeSubmitOnError', form, target);
+ }
+ ams.form.resetAfterSubmit(form);
+ },
+ iframe: hasUpload
+ };
+
+ // Initialize IFrame for custom download target
+ var downloadTarget = (submitOptions && submitOptions.downloadTarget) || data.amsFormDownloadTarget;
+ if (downloadTarget) {
+ var iframe = $('iframe[name="' + downloadTarget + '"]');
+ if (!iframe.exists()) {
+ iframe = $('<iframe></iframe>').hide()
+ .attr('name', downloadTarget)
+ .appendTo($('body'));
+ }
+ defaults = $.extend({}, defaults, {
+ iframe: true,
+ iframeTarget: iframe,
+ success: function(result, status, request, form) {
+ var modal = $(form).parents('.modal-dialog');
+ if (modal.exists()) {
+ ams.dialog && ams.dialog.close(form);
+ } else {
+ var callback;
+ var button = form.data('ams-submit-button');
+ if (button) {
+ callback = button.data('ams-form-submit-callback');
+ }
+ if (!callback) {
+ callback = ams.getFunctionByName(data.amsFormSubmitCallback) || ams.form._submitCallback;
+ }
+ try {
+ callback.call(form, result, status, request, form);
+ } finally {
+ ams.form.resetAfterSubmit(form);
+ ams.form.resetChanged(form);
+ }
+ }
+ }
+ });
+ } else {
+ defaults = $.extend({}, defaults, {
+ error: function(request, status, error, form) {
+ if (target) {
+ ams.executeFunctionByName(data.amsFormSubmitError || 'MyAMS.form.finalizeSubmitOnError', form, target);
+ }
+ ams.form.resetAfterSubmit(form);
+ },
+ success: function(result, status, request, form) {
+ var callback;
+ var button = form.data('ams-submit-button');
+ if (button) {
+ callback = button.data('ams-form-submit-callback');
+ }
+ if (!callback) {
+ callback = ams.getFunctionByName(data.amsFormSubmitCallback) || ams.form._submitCallback;
+ }
+ try {
+ callback.call(form, result, status, request, form);
+ } finally {
+ ams.form.resetAfterSubmit(form);
+ ams.form.resetChanged(form);
+ }
+ },
+ iframe: hasUpload
+ });
+ }
+ var settings = $.extend({}, defaults, options, formOptions, submitOptions);
+
+ // Initialize progress handler
+ if (progressHandler) {
+ _getProgress(progressHandler, formData.progress_id);
+ }
+
+ // Submit form
+ $(form).ajaxSubmit(settings);
+
+ // If external download target is specified, reset form submit button and footer
+ if (downloadTarget) {
+ var modal = $(form).parents('.modal-dialog');
+ var keepModal = modal.exists() && button.exists() && button.data('ams-keep-modal');
+ if (modal.exists() && (keepModal !== true)) {
+ ams.dialog && ams.dialog.close(form);
+ } else {
+ if (!progressHandler) {
+ setTimeout(function() {
+ ams.form.resetAfterSubmit(form, button);
+ ams.form.resetChanged(form);
+ }, button.data('ams-form-reset-timeout') || 2000);
+ }
+ }
+ }
+ }
+
+ var hasUpload = (form.data('ams-form-ignore-uploads') !== true) &&
+ ($('INPUT[type="file"]', form).length > 0);
+ if (hasUpload) {
+ // JQuery-progressbar plug-in must be loaded synchronously!!
+ // Otherwise, hidden input fields created by jquery-validate plug-in
+ // and matching named buttons will be deleted (on first form submit)
+ // before JQuery-form plug-in can get them when submitting the form...
+ ams.ajax && ams.ajax.check($.progressBar,
+ ams.baseURL + 'ext/jquery-progressbar' + ams.devext + '.js');
+ var settings = $.extend({}, {
+ uuid: $.progressBar.submit(form)
+ });
+ _submitAjaxForm(form, settings);
+ } else {
+ _submitAjaxForm(form, {});
+ }
+ });
return false;
},
@@ -2135,9 +2208,11 @@
if (data.amsFormDatatype) {
dataType = data.amsFormDatatype;
} else {
- var response = ams.ajax.getResponse(request);
- dataType = response.contentType;
- result = response.data;
+ var response = ams.ajax && ams.ajax.getResponse(request);
+ if (response) {
+ dataType = response.contentType;
+ result = response.data;
+ }
}
var target;
@@ -2149,7 +2224,7 @@
switch (dataType) {
case 'json':
- ams.ajax.handleJSON(result, form, target);
+ ams.ajax && ams.ajax.handleJSON(result, form, target);
break;
case 'script':
break;
@@ -2162,7 +2237,7 @@
default:
ams.form.resetChanged(form);
if (button && (button.data('ams-keep-modal') !== true)) {
- ams.dialog.close(form);
+ ams.dialog && ams.dialog.close(form);
}
if (!target.exists()) {
target = $('body');
@@ -2173,7 +2248,7 @@
.html(result)
.delay(50)
.animate({opacity: '1.0'}, 300);
- ams.initContent(target);
+ ams.initContent && ams.initContent(target);
ams.form.setFocus(target);
}
var callback = request.getResponseHeader('X-AMS-Callback');
@@ -2230,7 +2305,7 @@
}
if (output.length > 0) {
var header = output.length === 1 ? ams.i18n.ERROR_OCCURED : ams.i18n.ERRORS_OCCURED;
- ams.skin.alert(form, 'danger', header, output);
+ ams.skin && ams.skin.alert(form, 'danger', header, output);
return false;
} else {
return result;
@@ -2253,10 +2328,10 @@
showErrors: function(form, errors) {
var header;
if (typeof(errors) === 'string') {
- ams.skin.alert(form, 'error', ams.i18n.ERROR_OCCURED, errors);
+ ams.skin && ams.skin.alert(form, 'error', ams.i18n.ERROR_OCCURED, errors);
} else if (errors instanceof Array) {
header = errors.length === 1 ? ams.i18n.ERROR_OCCURED : ams.i18n.ERRORS_OCCURED;
- ams.skin.alert(form, 'error', header, errors);
+ ams.skin && ams.skin.alert(form, 'error', header, errors);
} else {
$('.state-error', form).removeClass('state-error');
header = errors.error_header ||
@@ -2303,7 +2378,7 @@
}
}
}
- ams.skin.alert($('.form-group:first', form), errors.error_level || 'error', header, message, errors.error_message);
+ ams.skin && ams.skin.alert($('.form-group:first', form), errors.error_level || 'error', header, message, errors.error_message);
}
}
};
@@ -2381,106 +2456,106 @@
* Modal dialog opener
*/
open: function(source, options, callbacks) {
- ams.ajax.check($.fn.modalmanager,
- ams.baseURL + 'ext/bootstrap-modalmanager' + ams.devext + '.js',
- function() {
- ams.ajax.check($.fn.modal.defaults,
- ams.baseURL + 'ext/bootstrap-modal' + ams.devext + '.js',
- function(first_load) {
- if (first_load) {
- $(document).off('click.modal');
- $.fn.modal.defaults.spinner = $.fn.modalmanager.defaults.spinner =
- '<div class="loading-spinner" style="width: 200px; margin-left: -100px;">' +
- '<div class="progress progress-striped active">' +
- '<div class="progress-bar" style="width: 100%;"></div>' +
- '</div>' +
- '</div>';
- }
-
- var sourceData;
- var url;
- if (typeof(source) === 'string') {
- sourceData = {};
- url = source;
- } else {
- sourceData = source.data();
- url = source.attr('href') || sourceData.amsUrl;
- var url_getter = ams.getFunctionByName(url);
- if (typeof(url_getter) === 'function') {
- url = url_getter.call(source);
- }
- }
- if (!url) {
- return;
- }
- $('body').modalmanager('loading');
- if (url.indexOf('#') === 0) {
- // Inner hidden modal dialog
- $(url).modal('show');
- } else {
- // Remote URL modal dialog
- $.ajax({
- url: url,
- type: 'get',
- cache: sourceData.amsAllowCache === undefined ? false : sourceData.amsAllowCache,
- data: options,
- success: function(data, status, request) {
- $('body').modalmanager('removeLoading');
- var response = ams.ajax.getResponse(request);
- var dataType = response.contentType;
- var result = response.data;
- switch (dataType) {
- case 'json':
- ams.ajax.handleJSON(result, $($(source).data('ams-json-target') || '#content'));
- break;
- case 'script':
- break;
- case 'xml':
- break;
- case 'html':
- /* falls through */
- case 'text':
- /* falls through */
- default:
- var content = $(result);
- var dialog = $('.modal-dialog', content.wrap('<div></div>').parent());
- var dialogData = dialog.data() || {};
- var dataOptions = {
- backdrop: 'static',
- overflow: dialogData.amsModalOverflow || '.modal-viewport',
- maxHeight: dialogData.amsModalMaxHeight === undefined ?
- function() {
- return $(window).height() -
- $('.modal-header', content).outerHeight(true) -
- $('footer', content).outerHeight(true) - 85;
- }
- : ams.getFunctionByName(dialogData.amsModalMaxHeight)
- };
- var settings = $.extend({}, dataOptions, dialogData.amsModalOptions);
- settings = ams.executeFunctionByName(dialogData.amsModalInitCallback, dialog, settings) || settings;
- if (callbacks) {
- if (callbacks.shown) {
- ams.dialog.registerShownCallback(callbacks.shown, content);
- }
- if (callbacks.hide) {
- ams.dialog.registerHideCallback(callbacks.hide, content);
- }
- }
- $('<div>').addClass('modal fade')
- .append(content)
- .modal(settings)
- .on('shown', ams.dialog.shown)
- .on('hidden', ams.dialog.hidden);
- ams.initContent(content);
- if (sourceData.amsLogEvent !== false) {
- ams.stats.logPageview(url);
- }
- }
- }
- });
- }
- });
- });
+ ams.ajax && ams.ajax.check($.fn.modalmanager,
+ ams.baseURL + 'ext/bootstrap-modalmanager' + ams.devext + '.js',
+ function() {
+ ams.ajax.check($.fn.modal.defaults,
+ ams.baseURL + 'ext/bootstrap-modal' + ams.devext + '.js',
+ function(first_load) {
+ if (first_load) {
+ $(document).off('click.modal');
+ $.fn.modal.defaults.spinner = $.fn.modalmanager.defaults.spinner =
+ '<div class="loading-spinner" style="width: 200px; margin-left: -100px;">' +
+ '<div class="progress progress-striped active">' +
+ '<div class="progress-bar" style="width: 100%;"></div>' +
+ '</div>' +
+ '</div>';
+ }
+
+ var sourceData;
+ var url;
+ if (typeof (source) === 'string') {
+ sourceData = {};
+ url = source;
+ } else {
+ sourceData = source.data();
+ url = source.attr('href') || sourceData.amsUrl;
+ var url_getter = ams.getFunctionByName(url);
+ if (typeof (url_getter) === 'function') {
+ url = url_getter.call(source);
+ }
+ }
+ if (!url) {
+ return;
+ }
+ $('body').modalmanager('loading');
+ if (url.indexOf('#') === 0) {
+ // Inner hidden modal dialog
+ $(url).modal('show');
+ } else {
+ // Remote URL modal dialog
+ $.ajax({
+ url: url,
+ type: 'get',
+ cache: sourceData.amsAllowCache === undefined ? false : sourceData.amsAllowCache,
+ data: options,
+ success: function(data, status, request) {
+ $('body').modalmanager('removeLoading');
+ var response = ams.ajax.getResponse(request);
+ var dataType = response.contentType;
+ var result = response.data;
+ switch (dataType) {
+ case 'json':
+ ams.ajax.handleJSON(result, $($(source).data('ams-json-target') || '#content'));
+ break;
+ case 'script':
+ break;
+ case 'xml':
+ break;
+ case 'html':
+ /* falls through */
+ case 'text':
+ /* falls through */
+ default:
+ var content = $(result);
+ var dialog = $('.modal-dialog', content.wrap('<div></div>').parent());
+ var dialogData = dialog.data() || {};
+ var dataOptions = {
+ backdrop: 'static',
+ overflow: dialogData.amsModalOverflow || '.modal-viewport',
+ maxHeight: dialogData.amsModalMaxHeight === undefined ?
+ function() {
+ return $(window).height() -
+ $('.modal-header', content).outerHeight(true) -
+ $('footer', content).outerHeight(true) - 85;
+ }
+ : ams.getFunctionByName(dialogData.amsModalMaxHeight)
+ };
+ var settings = $.extend({}, dataOptions, dialogData.amsModalOptions);
+ settings = ams.executeFunctionByName(dialogData.amsModalInitCallback, dialog, settings) || settings;
+ if (callbacks) {
+ if (callbacks.shown) {
+ ams.dialog.registerShownCallback(callbacks.shown, content);
+ }
+ if (callbacks.hide) {
+ ams.dialog.registerHideCallback(callbacks.hide, content);
+ }
+ }
+ $('<div>').addClass('modal fade')
+ .append(content)
+ .modal(settings)
+ .on('shown', ams.dialog.shown)
+ .on('hidden', ams.dialog.hidden);
+ ams.initContent && ams.initContent(content);
+ if (sourceData.amsLogEvent !== false) {
+ ams.stats && ams.stats.logPageview(url);
+ }
+ }
+ }
+ });
+ }
+ });
+ });
},
/**
@@ -2554,7 +2629,7 @@
}
}
- ams.form.setFocus(modal);
+ ams.form && ams.form.setFocus(modal);
},
/**
@@ -2580,7 +2655,7 @@
hidden: function(e) {
var modal = e.target;
// Call registered cleaning callbacks
- ams.skin.cleanContainer(modal);
+ ams.skin && ams.skin.cleanContainer(modal);
// Check for hidden callbacks defined via data API
$('[data-ams-hidden-callback]', modal).each(function() {
var callback = ams.getFunctionByName($(this).data('ams-hidden-callback'));
@@ -2673,7 +2748,7 @@
select2QueryUrlResultsCallback: function(data, page, context) {
switch (data.status) {
case 'error':
- ams.skin.messageBox('error', {
+ ams.skin && ams.skin.messageBox('error', {
title: ams.i18n.ERROR_OCCURED,
content: '<h4>' + data.error_message + '</h4>',
icon: "fa fa-warning animated shake",
@@ -2682,7 +2757,7 @@
break;
case 'modal':
$(this).data('select2').dropdown.hide();
- ams.dialog.open(data.location);
+ ams.dialog && ams.dialog.open(data.location);
break;
default:
return {
@@ -2703,7 +2778,7 @@
}
switch (result.status) {
case 'error':
- ams.skin.messageBox('error', {
+ ams.skin && ams.skin.messageBox('error', {
title: ams.i18n.ERROR_OCCURED,
content: '<h4>' + result.error_message + '</h4>',
icon: "fa fa-warning animated shake",
@@ -2712,7 +2787,7 @@
break;
case 'modal':
$(this).data('select2').dropdown.hide();
- ams.dialog.open(result.location);
+ ams.dialog && ams.dialog.open(result.location);
break;
default:
options.callback({
@@ -2737,7 +2812,7 @@
ams.getFunctionByName(data.amsSelect2HelperCallback) || function(result) {
if (result) {
target.html(result);
- ams.initContent(target);
+ ams.initContent && ams.initContent(target);
} else {
target.empty();
}
@@ -2748,17 +2823,17 @@
break;
case 'json-rpc':
target.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>');
- ams.jsonrpc.post(data.amsSelect2HelperMethod,
- {value: source.val()},
- {url: data.amsSelect2HelperUrl},
- ams.getFunctionByName(data.amsSelect2HelperCallback) || function(result) {
- if (result.result) {
- target.html(result.result);
- ams.initContent(target);
- } else {
- target.empty();
- }
- });
+ ams.jsonrpc && ams.jsonrpc.post(data.amsSelect2HelperMethod,
+ {value: source.val()},
+ {url: data.amsSelect2HelperUrl},
+ ams.getFunctionByName(data.amsSelect2HelperCallback) || function(result) {
+ if (result.result) {
+ target.html(result.result);
+ ams.initContent && ams.initContent(target);
+ } else {
+ target.empty();
+ }
+ });
break;
default:
var callback = data.amsSelect2HelperCallback;
@@ -2775,13 +2850,13 @@
}
var menuData = menu.data();
if (menuData.toggle === 'modal') {
- ams.dialog.open(menu);
+ ams.dialog && ams.dialog.open(menu);
} else {
var href = menu.attr('href') || menuData.amsUrl;
if (!href || href.startsWith('javascript') || menu.attr('target')) {
return;
}
- ams.event.stop();
+ ams.event && ams.event.stop();
var hrefGetter = ams.getFunctionByName(href);
if (typeof(hrefGetter) === 'function') {
href = hrefGetter.call(menu, target);
@@ -2795,11 +2870,11 @@
href = href.replace(/\%23/, '#');
target = menu.data('ams-target');
if (target) {
- ams.form.confirmChangedForm(target, function () {
- ams.skin.loadURL(href, target, menu.data('ams-link-options'), menu.data('ams-link-callback'));
+ ams.form && ams.form.confirmChangedForm(target, function () {
+ ams.skin && ams.skin.loadURL(href, target, menu.data('ams-link-options'), menu.data('ams-link-callback'));
});
} else {
- ams.form.confirmChangedForm(function () {
+ ams.form && ams.form.confirmChangedForm(function () {
if (href.startsWith('#')) {
if (href !== location.hash) {
if (ams.root.hasClass('mobile-view-activated')) {
@@ -2869,6 +2944,8 @@
*/
(function($, globals) {
+ "use strict";
+
var ams = globals.MyAMS;
ams.plugins = {
@@ -2890,7 +2967,7 @@
var disabled = [];
$('[data-ams-plugins-disabled]', element).each(function() {
var plugins = $(this).data('ams-plugins-disabled').split(/\s+/);
- for (var index=0; index < plugins.length; index++) {
+ for (var index = 0; index < plugins.length; index++) {
disabled.push(plugins[index]);
}
});
@@ -2905,9 +2982,9 @@
var plugin = plugins[name];
plugin.css = plugin.css || new_plugin.css;
plugin.callbacks.push({
- callback: new_plugin.callback,
- context: new_plugin.context
- });
+ callback: new_plugin.callback,
+ context: new_plugin.context
+ });
if (new_plugin.register) {
plugin.register = true;
}
@@ -2935,7 +3012,7 @@
var source = $(this);
var amsPlugins = source.data('ams-plugins');
- if (typeof(amsPlugins) === 'string') {
+ if (typeof (amsPlugins) === 'string') {
var names = source.data('ams-plugins').split(/\s+/);
for (var index = 0; index < names.length; index++) {
name = names[index];
@@ -2967,7 +3044,7 @@
var callbacks = plugin.callbacks,
callback;
if (callbacks && callbacks.length) {
- for (index=0; index < callbacks.length; index++) {
+ for (index = 0; index < callbacks.length; index++) {
callback = callbacks[index];
callback.callback = ams.getFunctionByName(callback.callback);
if (plugin.register !== false) {
@@ -2987,7 +3064,7 @@
// If running in async mode, newly registered plug-ins are run
// before callback is called so we call plug-in manually
if ((reload !== true) && callbacks && callbacks.length && (plugin.async !== false)) {
- for (index=0; index < callbacks.length; index++) {
+ for (index = 0; index < callbacks.length; index++) {
callback = callbacks[index];
ams.executeFunctionByName(callback.callback, element, callback.context);
}
@@ -2998,7 +3075,7 @@
// 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++) {
+ for (index = 0; index < enabled.length; index++) {
var callback = enabled[index];
if (callback && callback.context && !ams.isInDOM(callback.context)) {
enabled[index] = null;
@@ -3031,14 +3108,14 @@
}
var callbacks = ams.plugins.enabled[index];
if (callbacks) {
- switch (typeof(callbacks)) {
+ switch (typeof (callbacks)) {
case 'function':
callbacks(element);
break;
default:
for (var cbIndex = 0; cbIndex < callbacks.length; cbIndex++) {
var callback = callbacks[cbIndex];
- switch (typeof(callback)) {
+ switch (typeof (callback)) {
case 'function':
callback(element);
break;
@@ -3067,7 +3144,7 @@
for (var name in data) {
if (data.hasOwnProperty(name)) {
var elementData = data[name];
- if (typeof(elementData) !== 'string') {
+ if (typeof (elementData) !== 'string') {
elementData = JSON.stringify(elementData);
}
dataElement.attr('data-' + name, elementData);
@@ -3085,7 +3162,7 @@
* @callback: a callback function which can be called after plug-in registry
*/
register: function(plugin, name, callback) {
- if (typeof(name) === 'function') {
+ if (typeof (name) === 'function') {
callback = name;
name = null;
}
@@ -3096,10 +3173,10 @@
}
return;
}
- if (typeof(plugin) === 'object') {
+ if (typeof (plugin) === 'object') {
var src = plugin.src;
if (src) {
- ams.ajax.check(plugin.callback, src, function(first_load) {
+ ams.ajax && ams.ajax.check(plugin.callback, src, function(first_load) {
if (first_load) {
ams.plugins.enabled[name] = ams.getFunctionByName(plugin.callback);
if (plugin.css) {
@@ -3119,7 +3196,7 @@
ams.executeFunctionByName(callback);
}
}
- } else if (typeof(plugin) === 'function') {
+ } else if (typeof (plugin) === 'function') {
ams.plugins.enabled[name] = plugin;
if (callback) {
ams.executeFunctionByName(callback);
@@ -3128,6 +3205,31 @@
}
};
+ ams.plugins.i18n = {
+ widgets: {},
+ validate: {},
+ datatables: {},
+ fancybox: {
+ ERROR: "Can't load requested content.",
+ RETRY: "Please check URL or try again later.",
+ CLOSE: "Close",
+ NEXT: "Next",
+ PREVIOUS: "Previous"
+ },
+ dndupload: {
+ FILES_SELECTED: '{count} files selected',
+ CHOOSE_FILE: 'Select file(s)',
+ ADD_INFO: 'to add them to current folder,',
+ DRAG_FILE: 'or drag and drop them here!',
+ UPLOAD: 'Upload',
+ UPLOADING: 'Uploading…',
+ DONE: 'Done!',
+ UPLOAD_MORE: 'Upload more?',
+ ERROR: 'Error!',
+ TRY_AGAIN: 'Try again?'
+ }
+ };
+
})(jQuery, this);
/**
@@ -3176,10 +3278,10 @@
if (width && height) {
svg.get(0).setAttribute('viewBox',
'0 0 ' + Math.round(parseFloat(width)) + ' ' +
- Math.round(parseFloat(height)));
+ Math.round(parseFloat(height)));
}
svg.attr('width', '100%')
- .attr('height', 'auto');
+ .attr('height', 'auto');
})
}
},
@@ -3190,35 +3292,35 @@
hint: function(element) {
var hints = $('.hint:not(:parents(.nohints))', element);
if (hints.length > 0) {
- ams.ajax.check($.fn.tipsy,
- ams.baseURL + 'ext/jquery-tipsy' + ams.devext + '.js',
- function() {
- ams.getCSS(ams.baseURL + '../css/ext/jquery-tipsy' + ams.devext + '.css',
- 'jquery-tipsy', function() {
- hints.each(function () {
- var hint = $(this);
- var data = hint.data();
- var dataOptions = {
- html: data.amsHintHtml === undefined ? (hint.attr('title') || '').startsWith('<') : data.amsHintHtml,
- title: ams.getFunctionByName(data.amsHintTitleGetter) || function () {
- var hint = $(this);
- var result = hint.attr('original-title') ||
- hint.attr(data.amsHintTitleAttr || 'title') ||
- (data.amsHintHtml ? hint.html() : hint.text());
- result = result.replace(/\?_="/, '?_=' + new Date().getTime() + '"');
- return result;
- },
- opacity: data.amsHintOpacity || 0.95,
- gravity: data.amsHintGravity || 'sw',
- offset: data.amsHintOffset || 0
- };
- var settings = $.extend({}, dataOptions, data.amsHintOptions);
- settings = ams.executeFunctionByName(data.amsHintInitCallback, hint, settings) || settings;
- var plugin = hint.tipsy(settings);
- ams.executeFunctionByName(data.amsHintAfterInitCallback, hint, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.tipsy,
+ ams.baseURL + 'ext/jquery-tipsy' + ams.devext + '.js',
+ function() {
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-tipsy' + ams.devext + '.css',
+ 'jquery-tipsy', function() {
+ hints.each(function() {
+ var hint = $(this);
+ var data = hint.data();
+ var dataOptions = {
+ html: data.amsHintHtml === undefined ? (hint.attr('title') || '').startsWith('<') : data.amsHintHtml,
+ title: ams.getFunctionByName(data.amsHintTitleGetter) || function() {
+ var hint = $(this);
+ var result = hint.attr('original-title') ||
+ hint.attr(data.amsHintTitleAttr || 'title') ||
+ (data.amsHintHtml ? hint.html() : hint.text());
+ result = result.replace(/\?_="/, '?_=' + new Date().getTime() + '"');
+ return result;
+ },
+ opacity: data.amsHintOpacity || 0.95,
+ gravity: data.amsHintGravity || 'sw',
+ offset: data.amsHintOffset || 0
+ };
+ var settings = $.extend({}, dataOptions, data.amsHintOptions);
+ settings = ams.executeFunctionByName(data.amsHintInitCallback, hint, settings) || settings;
+ var plugin = hint.tipsy(settings);
+ ams.executeFunctionByName(data.amsHintAfterInitCallback, hint, plugin, settings);
+ });
+ });
+ });
}
},
@@ -3233,7 +3335,7 @@
var data = menu.data();
var dataOptions = {
menuSelector: data.amsContextmenuSelector,
- menuSelected: ams.helpers.contextMenuHandler
+ menuSelected: ams.helpers && ams.helpers.contextMenuHandler
};
var settings = $.extend({}, dataOptions, data.amsContextmenuOptions);
settings = ams.executeFunctionByName(data.amsContextmenuInitCallback, menu, settings) || settings;
@@ -3255,8 +3357,8 @@
$('<i class="fa fa-fw"></i>')
.prependTo($(this))
.addClass(data.amsSwitcherState === 'open' ?
- (data.amsSwitcherMinusClass || 'fa-minus') :
- (data.amsSwitcherPlusClass || 'fa-plus'));
+ (data.amsSwitcherMinusClass || 'fa-minus') :
+ (data.amsSwitcherPlusClass || 'fa-plus'));
legend.on('click', function(e) {
e.preventDefault();
var veto = {};
@@ -3267,11 +3369,11 @@
if (fieldset.hasClass('switched')) {
fieldset.removeClass('switched');
$('.fa', legend).removeClass(data.amsSwitcherPlusClass || 'fa-plus')
- .addClass(data.amsSwitcherMinusClass || 'fa-minus');
+ .addClass(data.amsSwitcherMinusClass || 'fa-minus');
legend.trigger('ams.switcher.opened', [legend]);
var id = legend.attr('id');
if (id) {
- $('legend.switcher[data-ams-switcher-sync="'+id+'"]', fieldset).each(function() {
+ $('legend.switcher[data-ams-switcher-sync="' + id + '"]', fieldset).each(function() {
var switcher = $(this);
if (switcher.parents('fieldset').hasClass('switched')) {
switcher.click();
@@ -3281,7 +3383,7 @@
} else {
fieldset.addClass('switched');
$('.fa', legend).removeClass(data.amsSwitcherMinusClass || 'fa-minus')
- .addClass(data.amsSwitcherPlusClass || 'fa-plus');
+ .addClass(data.amsSwitcherPlusClass || 'fa-plus');
legend.trigger('ams.switcher.closed', [legend]);
}
});
@@ -3303,7 +3405,7 @@
var data = legend.data();
if (!data.amsChecker) {
var checker = $('<label class="checkbox"></label>');
- var fieldname = data.amsCheckerFieldname || ('checker_'+ams.generateId());
+ var fieldname = data.amsCheckerFieldname || ('checker_' + ams.generateId());
var checkboxId = fieldname.replace(/\./, '_');
var prefix = data.amsCheckerHiddenPrefix;
var hidden = null;
@@ -3312,19 +3414,19 @@
var marker = data.amsCheckerMarker || false;
if (prefix) {
hidden = $('<input type="hidden">').attr('name', prefix + fieldname)
- .val(data.amsCheckerState === 'on' ? checkedValue : uncheckedValue)
- .prependTo(legend);
+ .val(data.amsCheckerState === 'on' ? checkedValue : uncheckedValue)
+ .prependTo(legend);
} else if (marker) {
$('<input type="hidden">').attr('name', marker)
- .attr('value', 1)
- .prependTo(legend);
+ .attr('value', 1)
+ .prependTo(legend);
}
var input = $('<input type="checkbox">').attr('name', fieldname)
- .attr('id', checkboxId)
- .data('ams-checker-hidden-input', hidden)
- .data('ams-checker-init', true)
- .val(data.amsCheckerValue || true)
- .attr('checked', data.amsCheckerState === 'on' ? 'checked' : null);
+ .attr('id', checkboxId)
+ .data('ams-checker-hidden-input', hidden)
+ .data('ams-checker-init', true)
+ .val(data.amsCheckerValue || true)
+ .attr('checked', data.amsCheckerState === 'on' ? 'checked' : null);
if (data.amsCheckerReadonly) {
input.attr('disabled', 'disabled');
} else {
@@ -3372,7 +3474,7 @@
input.appendTo(checker);
$('>label', legend).attr('for', input.attr('id'));
checker.append('<i></i>')
- .prependTo(legend);
+ .prependTo(legend);
var required = $('[required]', fieldset);
required.attr('data-required', true);
if (data.amsCheckerState === 'on') {
@@ -3397,19 +3499,19 @@
slider: function(element) {
var sliders = $('.slider', element);
if (sliders.length > 0) {
- ams.ajax.check($.fn.slider,
- ams.baseURL + 'ext/bootstrap-slider-2.0.0' + ams.devext + '.js',
- function() {
- sliders.each(function() {
- var slider = $(this);
- var data = slider.data();
- var dataOptions = {};
- var settings = $.extend({}, dataOptions, slider.data.amsSliderOptions);
- settings = ams.executeFunctionByName(data.amsSliderInitCallback, slider, settings) || settings;
- var plugin = slider.slider(settings);
- ams.executeFunctionByName(data.amsSliderAfterInitCallback, slider, plugin, settings);
- });
- });
+ ams.ajax && ams.ajax.check($.fn.slider,
+ ams.baseURL + 'ext/bootstrap-slider-2.0.0' + ams.devext + '.js',
+ function() {
+ sliders.each(function() {
+ var slider = $(this);
+ var data = slider.data();
+ var dataOptions = {};
+ var settings = $.extend({}, dataOptions, slider.data.amsSliderOptions);
+ settings = ams.executeFunctionByName(data.amsSliderInitCallback, slider, settings) || settings;
+ var plugin = slider.slider(settings);
+ ams.executeFunctionByName(data.amsSliderAfterInitCallback, slider, plugin, settings);
+ });
+ });
}
},
@@ -3522,19 +3624,19 @@
typeahead: function(element) {
var typeaheads = $('.typeahead', element);
if (typeaheads.length > 0) {
- ams.ajax.check($.fn.typeahead,
- ams.baseURL + 'ext/jquery-typeahead' + ams.devext + '.js',
- function() {
- typeaheads.each(function() {
- var input = $(this);
- var data = input.data();
- var dataOptions = {};
- var settings = $.extend({}, dataOptions, data.amsTypeaheadOptions);
- settings = ams.executeFunctionByName(data.amsTypeaheadInitCallback, input, settings) || settings;
- var plugin = input.typeahead(settings);
- ams.executeFunctionByName(data.amsTypeaheadAfterInitCallback, input, plugin, settings);
- });
- });
+ ams.ajax && ams.ajax.check($.fn.typeahead,
+ ams.baseURL + 'ext/jquery-typeahead' + ams.devext + '.js',
+ function() {
+ typeaheads.each(function() {
+ var input = $(this);
+ var data = input.data();
+ var dataOptions = {};
+ var settings = $.extend({}, dataOptions, data.amsTypeaheadOptions);
+ settings = ams.executeFunctionByName(data.amsTypeaheadInitCallback, input, settings) || settings;
+ var plugin = input.typeahead(settings);
+ ams.executeFunctionByName(data.amsTypeaheadAfterInitCallback, input, plugin, settings);
+ });
+ });
}
},
@@ -3544,61 +3646,61 @@
treeview: function(element) {
var treeviews = $('.treeview', element);
if (treeviews.length > 0) {
- ams.ajax.check($.fn.treview,
- ams.baseURL + 'ext/bootstrap-treeview' + ams.devext + '.js',
- function() {
- ams.getCSS(ams.baseURL + '../css/ext/bootstrap-treeview' + ams.devext + '.css',
- 'bootstrap-treeview',
- function() {
- treeviews.each(function () {
- var treeview = $(this);
- var data = treeview.data();
- var dataOptions = {
- data: data.amsTreeviewData,
- levels: data.amsTreeviewLevels,
- injectStyle: data.amsTreeviewInjectStyle,
- expandIcon: data.amsTreeviewExpandIcon || 'fa fa-fw fa-plus-square-o',
- collapseIcon: data.amsTreeviewCollaspeIcon || 'fa fa-fw fa-minus-square-o',
- emptyIcon: data.amsTreeviewEmptyIcon || 'fa fa-fw',
- nodeIcon: data.amsTreeviewNodeIcon,
- selectedIcon: data.amsTreeviewSelectedIcon,
- checkedIcon: data.amsTreeviewCheckedIcon || 'fa fa-fw fa-check-square-o',
- uncheckedIcon: data.amsTreeviewUncheckedIcon || 'fa fa-fw fa-square-o',
- color: data.amsTreeviewColor,
- backColor: data.amsTreeviewBackColor,
- borderColor: data.amsTreeviewBorderColor,
- onHoverColor: data.amsTreeviewHoverColor,
- selectedColor: data.amsTreeviewSelectedColor,
- selectedBackColor: data.amsTreeviewSelectedBackColor,
- unselectableColor: data.amsTreeviewUnselectableColor || 'rgba(1,1,1,0.25)',
- unselectableBackColor: data.amsTreeviewUnselectableBackColor || 'rgba(1,1,1,0.25)',
- enableLinks: data.amsTreeviewEnableLinks,
- highlightSelected: data.amsTreeviewHighlightSelected,
- highlightSearchResults: data.amsTreeviewhighlightSearchResults,
- showBorder: data.amsTreeviewShowBorder,
- showIcon: data.amsTreeviewShowIcon,
- showCheckbox: data.amsTreeviewShowCheckbox,
- showTags: data.amsTreeviewShowTags,
- toggleUnselectable: data.amsTreeviewToggleUnselectable,
- multiSelect: data.amsTreeviewMultiSelect,
- onNodeChecked: ams.getFunctionByName(data.amsTreeviewNodeChecked),
- onNodeCollapsed: ams.getFunctionByName(data.amsTreeviewNodeCollapsed),
- onNodeDisabled: ams.getFunctionByName(data.amsTreeviewNodeDisabled),
- onNodeEnabled: ams.getFunctionByName(data.amsTreeviewNodeEnabled),
- onNodeExpanded: ams.getFunctionByName(data.amsTreeviewNodeExpanded),
- onNodeSelected: ams.getFunctionByName(data.amsTreeviewNodeSelected),
- onNodeUnchecked: ams.getFunctionByName(data.amsTreeviewNodeUnchecked),
- onNodeUnselected: ams.getFunctionByName(data.amsTreeviewNodeUnselected),
- onSearchComplete: ams.getFunctionByName(data.amsTreeviewSearchComplete),
- onSearchCleared: ams.getFunctionByName(data.amsTreeviewSearchCleared)
- };
- var settings = $.extend({}, dataOptions, data.amsTreeviewOptions);
- settings = ams.executeFunctionByName(data.amsTreeviewInitcallback, treeview, settings) || settings;
- var plugin = treeview.treeview(settings);
- ams.executeFunctionByName(data.amsTreeviewAfterInitCallback, treeview, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.treview,
+ ams.baseURL + 'ext/bootstrap-treeview' + ams.devext + '.js',
+ function() {
+ ams.getCSS(ams.baseURL + '../css/ext/bootstrap-treeview' + ams.devext + '.css',
+ 'bootstrap-treeview',
+ function() {
+ treeviews.each(function() {
+ var treeview = $(this);
+ var data = treeview.data();
+ var dataOptions = {
+ data: data.amsTreeviewData,
+ levels: data.amsTreeviewLevels,
+ injectStyle: data.amsTreeviewInjectStyle,
+ expandIcon: data.amsTreeviewExpandIcon || 'fa fa-fw fa-plus-square-o',
+ collapseIcon: data.amsTreeviewCollaspeIcon || 'fa fa-fw fa-minus-square-o',
+ emptyIcon: data.amsTreeviewEmptyIcon || 'fa fa-fw',
+ nodeIcon: data.amsTreeviewNodeIcon,
+ selectedIcon: data.amsTreeviewSelectedIcon,
+ checkedIcon: data.amsTreeviewCheckedIcon || 'fa fa-fw fa-check-square-o',
+ uncheckedIcon: data.amsTreeviewUncheckedIcon || 'fa fa-fw fa-square-o',
+ color: data.amsTreeviewColor,
+ backColor: data.amsTreeviewBackColor,
+ borderColor: data.amsTreeviewBorderColor,
+ onHoverColor: data.amsTreeviewHoverColor,
+ selectedColor: data.amsTreeviewSelectedColor,
+ selectedBackColor: data.amsTreeviewSelectedBackColor,
+ unselectableColor: data.amsTreeviewUnselectableColor || 'rgba(1,1,1,0.25)',
+ unselectableBackColor: data.amsTreeviewUnselectableBackColor || 'rgba(1,1,1,0.25)',
+ enableLinks: data.amsTreeviewEnableLinks,
+ highlightSelected: data.amsTreeviewHighlightSelected,
+ highlightSearchResults: data.amsTreeviewhighlightSearchResults,
+ showBorder: data.amsTreeviewShowBorder,
+ showIcon: data.amsTreeviewShowIcon,
+ showCheckbox: data.amsTreeviewShowCheckbox,
+ showTags: data.amsTreeviewShowTags,
+ toggleUnselectable: data.amsTreeviewToggleUnselectable,
+ multiSelect: data.amsTreeviewMultiSelect,
+ onNodeChecked: ams.getFunctionByName(data.amsTreeviewNodeChecked),
+ onNodeCollapsed: ams.getFunctionByName(data.amsTreeviewNodeCollapsed),
+ onNodeDisabled: ams.getFunctionByName(data.amsTreeviewNodeDisabled),
+ onNodeEnabled: ams.getFunctionByName(data.amsTreeviewNodeEnabled),
+ onNodeExpanded: ams.getFunctionByName(data.amsTreeviewNodeExpanded),
+ onNodeSelected: ams.getFunctionByName(data.amsTreeviewNodeSelected),
+ onNodeUnchecked: ams.getFunctionByName(data.amsTreeviewNodeUnchecked),
+ onNodeUnselected: ams.getFunctionByName(data.amsTreeviewNodeUnselected),
+ onSearchComplete: ams.getFunctionByName(data.amsTreeviewSearchComplete),
+ onSearchCleared: ams.getFunctionByName(data.amsTreeviewSearchCleared)
+ };
+ var settings = $.extend({}, dataOptions, data.amsTreeviewOptions);
+ settings = ams.executeFunctionByName(data.amsTreeviewInitcallback, treeview, settings) || settings;
+ var plugin = treeview.treeview(settings);
+ ams.executeFunctionByName(data.amsTreeviewAfterInitCallback, treeview, plugin, settings);
+ });
+ });
+ });
}
},
@@ -3608,195 +3710,199 @@
select2: function(element) {
var selects = $('.select2', element);
if (selects.length > 0) {
- ams.ajax.check($.fn.select2,
- ams.baseURL + 'ext/jquery-select2-3.5.4' + ams.devext + '.js',
- function() {
- selects.each(function() {
- var select = $(this);
- var data = select.data();
- if (data.select2) {
- // Already initialized
- return;
- }
- var dataOptions = {
- placeholder: data.amsSelect2Placeholder,
- multiple: data.amsSelect2Multiple,
- minimumInputLength: data.amsSelect2MinimumInputLength || 0,
- maximumSelectionSize: data.amsSelect2MaximumSelectionSize,
- openOnEnter: data.amsSelect2EnterOpen === undefined ? true : data.amsSelect2EnterOpen,
- allowClear: data.amsSelect2AllowClear === undefined ? true : data.amsSelect2AllowClear,
- width: data.amsSelect2Width || '100%',
- initSelection: ams.getFunctionByName(data.amsSelect2InitSelection),
- formatSelection: data.amsSelect2FormatSelection === undefined ?
- ams.helpers.select2FormatSelection
- : ams.getFunctionByName(data.amsSelect2FormatSelection),
- formatResult: ams.getFunctionByName(data.amsSelect2FormatResult),
- formatMatches: data.amsSelect2FormatMatches === undefined ?
- function(matches) {
- if (matches === 1) {
- return ams.i18n.SELECT2_MATCH;
- } else {
- return matches + ams.i18n.SELECT2_MATCHES;
- }
- }
- : ams.getFunctionByName(data.amsSelect2FormatMatches),
- formatNoMatches: data.amsSelect2FormatResult === undefined ?
- function(term) {
- return ams.i18n.SELECT2_NOMATCHES;
- }
- : ams.getFunctionByName(data.amsSelect2FormatResult),
- formatInputTooShort: data.amsSelect2FormatInputTooShort === undefined ?
- function(input, min) {
- var n = min - input.length;
- return ams.i18n.SELECT2_INPUT_TOOSHORT
- .replace(/\{0\}/, n)
- .replace(/\{1\}/, n === 1 ? "" : ams.i18n.SELECT2_PLURAL);
- }
- : ams.getFunctionByName(data.amsSelect2FormatInputTooShort),
- formatInputTooLong: data.amsSelect2FormatInputTooLong === undefined ?
- function(input, max) {
- var n = input.length - max;
- return ams.i18n.SELECT2_INPUT_TOOLONG
- .replace(/\{0\}/, n)
- .replace(/\{1\}/, n === 1 ? "" : ams.i18n.SELECT2_PLURAL);
- }
- : ams.getFunctionByName(data.amsSelect2FormatInputTooLong),
- formatSelectionTooBig: data.amsSelect2FormatSelectionTooBig === undefined ?
- function(limit) {
- return ams.i18n.SELECT2_SELECTION_TOOBIG
- .replace(/\{0\}/, limit)
- .replace(/\{1\}/, limit === 1 ? "" : ams.i18n.SELECT2_PLURAL);
- }
- : ams.getFunctionByName(data.amsSelect2FormatSelectionTooBig),
- formatLoadMore: data.amsSelect2FormatLoadMore === undefined ?
- function (pageNumber) {
- return ams.i18n.SELECT2_LOADMORE;
- }
- : ams.getFunctionByName(data.amsSelect2FormatLoadMore),
- formatSearching: data.amsSelect2FormatSearching === undefined ?
- function() {
- return ams.i18n.SELECT2_SEARCHING;
- }
- : ams.getFunctionByName(data.amsSelect2FormatSearching),
- separator: data.amsSelect2Separator || ',',
- tokenSeparators: data.amsSelect2TokensSeparators || [','],
- tokenizer: ams.getFunctionByName(data.amsSelect2Tokenizer)
- };
-
- switch (select.context.type) {
- case 'text':
- case 'hidden':
- if (!dataOptions.initSelection) {
- var valuesData = select.data('ams-select2-values');
- if (valuesData) {
- dataOptions.initSelection = function(element, callback) {
- var data = [];
- $(element.val().split(dataOptions.separator)).each(function() {
- data.push({id: this,
- text: valuesData[this] || this});
- });
- callback(data);
- };
- }
- }
- break;
- default:
- break;
- }
-
- if (select.attr('readonly')) {
- if (select.attr('type') === 'hidden') {
- dataOptions.query = function () {
- return [];
- };
- }
- } else if (data.amsSelect2Query) {
- // Custom query method
- dataOptions.query = ams.getFunctionByName(data.amsSelect2Query);
- dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
- } else if (data.amsSelect2QueryUrl) {
- // AJAX query
- dataOptions.ajax = {
- url: data.amsSelect2QueryUrl,
- quietMillis: data.amsSelect2QuietMillis || 200,
- type: data.amsSelect2QueryType || 'POST',
- dataType: data.amsSelect2QueryDatatype || 'json',
- data: function(term, page, context) {
- var options = {};
- options[data.amsSelect2QueryParamName || 'query'] = term;
- options[data.amsSelect2PageParamName || 'page'] = page;
- options[data.amsSelect2ContextParamName || 'context'] = context;
- return $.extend({}, options, data.amsSelect2QueryOptions);
- },
- results: ams.helpers.select2QueryUrlResultsCallback
- };
- dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
- } else if (data.amsSelect2QueryMethod) {
- // JSON-RPC query
- dataOptions.query = function(options) {
- var settings = {
- id: new Date().getTime(),
- params: data.amsSelect2QueryParams || {},
- success: function(result) {
- return ams.helpers.select2QueryMethodSuccessCallback.call(select, result, 'success', options);
- },
- error: ams.error.show
- };
- settings.params[data.amsSelect2QueryParamName || 'query'] = options.term;
- settings.params[data.amsSelect2PageParamName || 'page'] = options.page;
- settings.params[data.amsSelect2ContextParamName || 'context'] = options.context;
- settings = $.extend({}, settings, data.amsSelect2QueryOptions);
- settings = ams.executeFunctionByName(data.amsSelect2QueryInitCallback, select, settings) || settings;
- ams.ajax.check($.jsonRPC,
- ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
- function() {
- $.jsonRPC.withOptions({
- endPoint: data.amsSelect2MethodTarget || ams.jsonrpc.getAddr(),
- namespace: data.amsSelect2MethodNamespace,
- cache: false
- }, function() {
- $.jsonRPC.request(data.amsSelect2QueryMethod, settings);
- });
- });
- };
- dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
- } else if (data.amsSelect2Tags) {
- // Tags mode
- dataOptions.tags = data.amsSelect2Tags;
- } else if (data.amsSelect2Data) {
- // Provided data mode
- dataOptions.data = data.amsSelect2Data;
- }
-
- if (data.amsSelect2EnableFreeTags) {
- dataOptions.createSearchChoice = function(term) {
- return {id: term,
- text: (data.amsSelect2FreeTagsPrefix || ams.i18n.SELECT2_FREETAG_PREFIX) + term};
- };
- }
-
- var settings = $.extend({}, dataOptions, data.amsSelect2Options);
- settings = ams.executeFunctionByName(data.amsSelect2InitCallback, select, settings) || settings;
- var plugin = select.select2(settings);
- ams.executeFunctionByName(data.amsSelect2AfterInitCallback, select, plugin, settings);
- if (select.hasClass('ordered')) {
- ams.ajax.check($.fn.select2Sortable,
- ams.baseURL + 'ext/jquery-select2-sortable' + ams.devext + '.js',
+ ams.ajax && ams.ajax.check($.fn.select2,
+ ams.baseURL + 'ext/jquery-select2-3.5.4' + ams.devext + '.js',
+ function() {
+ selects.each(function() {
+ var select = $(this);
+ var data = select.data();
+ if (data.select2) {
+ // Already initialized
+ return;
+ }
+ var dataOptions = {
+ placeholder: data.amsSelect2Placeholder,
+ multiple: data.amsSelect2Multiple,
+ minimumInputLength: data.amsSelect2MinimumInputLength || 0,
+ maximumSelectionSize: data.amsSelect2MaximumSelectionSize,
+ openOnEnter: data.amsSelect2EnterOpen === undefined ? true : data.amsSelect2EnterOpen,
+ allowClear: data.amsSelect2AllowClear === undefined ? true : data.amsSelect2AllowClear,
+ width: data.amsSelect2Width || '100%',
+ initSelection: ams.getFunctionByName(data.amsSelect2InitSelection),
+ formatSelection: data.amsSelect2FormatSelection === undefined
+ ? ams.helpers && ams.helpers.select2FormatSelection
+ : ams.getFunctionByName(data.amsSelect2FormatSelection),
+ formatResult: ams.getFunctionByName(data.amsSelect2FormatResult),
+ formatMatches: data.amsSelect2FormatMatches === undefined ?
+ function(matches) {
+ if (matches === 1) {
+ return ams.i18n.SELECT2_MATCH;
+ } else {
+ return matches + ams.i18n.SELECT2_MATCHES;
+ }
+ }
+ : ams.getFunctionByName(data.amsSelect2FormatMatches),
+ formatNoMatches: data.amsSelect2FormatResult === undefined ?
+ function(term) {
+ return ams.i18n.SELECT2_NOMATCHES;
+ }
+ : ams.getFunctionByName(data.amsSelect2FormatResult),
+ formatInputTooShort: data.amsSelect2FormatInputTooShort === undefined ?
+ function(input, min) {
+ var n = min - input.length;
+ return ams.i18n.SELECT2_INPUT_TOOSHORT
+ .replace(/\{0\}/, n)
+ .replace(/\{1\}/, n === 1 ? "" : ams.i18n.SELECT2_PLURAL);
+ }
+ : ams.getFunctionByName(data.amsSelect2FormatInputTooShort),
+ formatInputTooLong: data.amsSelect2FormatInputTooLong === undefined ?
+ function(input, max) {
+ var n = input.length - max;
+ return ams.i18n.SELECT2_INPUT_TOOLONG
+ .replace(/\{0\}/, n)
+ .replace(/\{1\}/, n === 1 ? "" : ams.i18n.SELECT2_PLURAL);
+ }
+ : ams.getFunctionByName(data.amsSelect2FormatInputTooLong),
+ formatSelectionTooBig: data.amsSelect2FormatSelectionTooBig === undefined ?
+ function(limit) {
+ return ams.i18n.SELECT2_SELECTION_TOOBIG
+ .replace(/\{0\}/, limit)
+ .replace(/\{1\}/, limit === 1 ? "" : ams.i18n.SELECT2_PLURAL);
+ }
+ : ams.getFunctionByName(data.amsSelect2FormatSelectionTooBig),
+ formatLoadMore: data.amsSelect2FormatLoadMore === undefined ?
+ function(pageNumber) {
+ return ams.i18n.SELECT2_LOADMORE;
+ }
+ : ams.getFunctionByName(data.amsSelect2FormatLoadMore),
+ formatSearching: data.amsSelect2FormatSearching === undefined ?
function() {
- select.select2Sortable({
- bindOrder: 'sortableStop'
- });
- });
- }
-
- select.on('change', function() {
- var validator = $(select.get(0).form).data('validator');
- if (validator !== undefined) {
- $(select).valid();
- }
- });
- });
- });
+ return ams.i18n.SELECT2_SEARCHING;
+ }
+ : ams.getFunctionByName(data.amsSelect2FormatSearching),
+ separator: data.amsSelect2Separator || ',',
+ tokenSeparators: data.amsSelect2TokensSeparators || [','],
+ tokenizer: ams.getFunctionByName(data.amsSelect2Tokenizer)
+ };
+
+ switch (select.context.type) {
+ case 'text':
+ case 'hidden':
+ if (!dataOptions.initSelection) {
+ var valuesData = select.data('ams-select2-values');
+ if (valuesData) {
+ dataOptions.initSelection = function(element, callback) {
+ var data = [];
+ $(element.val().split(dataOptions.separator)).each(function() {
+ data.push({
+ id: this,
+ text: valuesData[this] || this
+ });
+ });
+ callback(data);
+ };
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ if (select.attr('readonly')) {
+ if (select.attr('type') === 'hidden') {
+ dataOptions.query = function() {
+ return [];
+ };
+ }
+ } else if (data.amsSelect2Query) {
+ // Custom query method
+ dataOptions.query = ams.getFunctionByName(data.amsSelect2Query);
+ dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
+ } else if (data.amsSelect2QueryUrl) {
+ // AJAX query
+ dataOptions.ajax = {
+ url: data.amsSelect2QueryUrl,
+ quietMillis: data.amsSelect2QuietMillis || 200,
+ type: data.amsSelect2QueryType || 'POST',
+ dataType: data.amsSelect2QueryDatatype || 'json',
+ data: function(term, page, context) {
+ var options = {};
+ options[data.amsSelect2QueryParamName || 'query'] = term;
+ options[data.amsSelect2PageParamName || 'page'] = page;
+ options[data.amsSelect2ContextParamName || 'context'] = context;
+ return $.extend({}, options, data.amsSelect2QueryOptions);
+ },
+ results: ams.helpers && ams.helpers.select2QueryUrlResultsCallback
+ };
+ dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
+ } else if (data.amsSelect2QueryMethod) {
+ // JSON-RPC query
+ dataOptions.query = function(options) {
+ var settings = {
+ id: new Date().getTime(),
+ params: data.amsSelect2QueryParams || {},
+ success: function(result) {
+ return ams.helpers && ams.helpers.select2QueryMethodSuccessCallback.call(select, result, 'success', options);
+ },
+ error: ams.error && ams.error.show
+ };
+ settings.params[data.amsSelect2QueryParamName || 'query'] = options.term;
+ settings.params[data.amsSelect2PageParamName || 'page'] = options.page;
+ settings.params[data.amsSelect2ContextParamName || 'context'] = options.context;
+ settings = $.extend({}, settings, data.amsSelect2QueryOptions);
+ settings = ams.executeFunctionByName(data.amsSelect2QueryInitCallback, select, settings) || settings;
+ ams.ajax && ams.ajax.check($.jsonRPC,
+ ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
+ function() {
+ $.jsonRPC.withOptions({
+ endPoint: data.amsSelect2MethodTarget || (ams.jsonrpc && ams.jsonrpc.getAddr()),
+ namespace: data.amsSelect2MethodNamespace,
+ cache: false
+ }, function() {
+ $.jsonRPC.request(data.amsSelect2QueryMethod, settings);
+ });
+ });
+ };
+ dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
+ } else if (data.amsSelect2Tags) {
+ // Tags mode
+ dataOptions.tags = data.amsSelect2Tags;
+ } else if (data.amsSelect2Data) {
+ // Provided data mode
+ dataOptions.data = data.amsSelect2Data;
+ }
+
+ if (data.amsSelect2EnableFreeTags) {
+ dataOptions.createSearchChoice = function(term) {
+ return {
+ id: term,
+ text: (data.amsSelect2FreeTagsPrefix || ams.i18n.SELECT2_FREETAG_PREFIX) + term
+ };
+ };
+ }
+
+ var settings = $.extend({}, dataOptions, data.amsSelect2Options);
+ settings = ams.executeFunctionByName(data.amsSelect2InitCallback, select, settings) || settings;
+ var plugin = select.select2(settings);
+ ams.executeFunctionByName(data.amsSelect2AfterInitCallback, select, plugin, settings);
+ if (select.hasClass('ordered')) {
+ ams.ajax && ams.ajax.check($.fn.select2Sortable,
+ ams.baseURL + 'ext/jquery-select2-sortable' + ams.devext + '.js',
+ function() {
+ select.select2Sortable({
+ bindOrder: 'sortableStop'
+ });
+ });
+ }
+
+ select.on('change', function() {
+ var validator = $(select.get(0).form).data('validator');
+ if (validator !== undefined) {
+ $(select).valid();
+ }
+ });
+ });
+ });
}
},
@@ -3806,22 +3912,22 @@
maskedit: function(element) {
var masks = $('[data-mask]', element);
if (masks.length > 0) {
- ams.ajax.check($.fn.mask,
- ams.baseURL + 'ext/jquery-maskedinput-1.4.1' + ams.devext + '.js',
- function() {
- masks.each(function() {
- var mask = $(this);
- var data = mask.data();
- var dataOptions = {
- placeholder: data.amsMaskeditPlaceholder === undefined ? 'X' : data.amsMaskeditPlaceholder,
- complete: ams.getFunctionByName(data.amsMaskeditComplete)
- };
- var settings = $.extend({}, dataOptions, data.amsMaskeditOptions);
- settings = ams.executeFunctionByName(data.amsMaskeditInitCallback, mask, settings) || settings;
- var plugin = mask.mask(mask.attr('data-mask'), settings);
- ams.executeFunctionByName(data.amsMaskeditAfterInitCallback, mask, plugin, settings);
- });
- });
+ ams.ajax && ams.ajax.check($.fn.mask,
+ ams.baseURL + 'ext/jquery-maskedinput-1.4.1' + ams.devext + '.js',
+ function() {
+ masks.each(function() {
+ var mask = $(this);
+ var data = mask.data();
+ var dataOptions = {
+ placeholder: data.amsMaskeditPlaceholder === undefined ? 'X' : data.amsMaskeditPlaceholder,
+ complete: ams.getFunctionByName(data.amsMaskeditComplete)
+ };
+ var settings = $.extend({}, dataOptions, data.amsMaskeditOptions);
+ settings = ams.executeFunctionByName(data.amsMaskeditInitCallback, mask, settings) || settings;
+ var plugin = mask.mask(mask.attr('data-mask'), settings);
+ ams.executeFunctionByName(data.amsMaskeditAfterInitCallback, mask, plugin, settings);
+ });
+ });
}
},
@@ -3836,26 +3942,26 @@
inputmask: function(element) {
var masks = $('input[data-input-mask]', element);
if (masks.length > 0) {
- ams.ajax.check($.fn.inputmask,
- ams.baseURL + 'ext/jquery-inputmask-bundle-3.2.8' + ams.devext + '.js',
- function() {
- masks.each(function() {
- var input = $(this);
- var data = input.data();
- var dataOptions;
- if (typeof(data.inputMask) === 'object') {
- dataOptions = data.inputMask;
- } else {
- dataOptions = {
- mask: data.inputMask.toString()
- };
- }
- var settings = $.extend({}, dataOptions, data.amsInputmaskOptions);
- settings = ams.executeFunctionByName(data.amsInputmaskInitCallback, input, settings) || settings;
- var plugin = input.inputmask(settings);
- ams.executeFunctionByName(data.amsInputmaskAfterInitCallback, input, plugin, settings);
- });
- });
+ ams.ajax && ams.ajax.check($.fn.inputmask,
+ ams.baseURL + 'ext/jquery-inputmask-bundle-3.2.8' + ams.devext + '.js',
+ function() {
+ masks.each(function() {
+ var input = $(this);
+ var data = input.data();
+ var dataOptions;
+ if (typeof (data.inputMask) === 'object') {
+ dataOptions = data.inputMask;
+ } else {
+ dataOptions = {
+ mask: data.inputMask.toString()
+ };
+ }
+ var settings = $.extend({}, dataOptions, data.amsInputmaskOptions);
+ settings = ams.executeFunctionByName(data.amsInputmaskInitCallback, input, settings) || settings;
+ var plugin = input.inputmask(settings);
+ ams.executeFunctionByName(data.amsInputmaskAfterInitCallback, input, plugin, settings);
+ });
+ });
}
},
@@ -3865,34 +3971,34 @@
datepicker: function(element) {
var datepickers = $('.datepicker', element);
if (datepickers.length > 0) {
- ams.ajax.check($.fn.datetimepicker,
- ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
- function(first_load) {
- if (first_load) {
- ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback);
- }
- ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
- 'jquery-datetimepicker',
- function () {
- datepickers.each(function () {
- var input = $(this);
- var data = input.data();
- var dataOptions = {
- lang: data.amsDatetimepickerLang || ams.lang,
- format: data.amsDatetimepickerFormat || 'd/m/y',
- datepicker: true,
- dayOfWeekStart: 1,
- timepicker: false,
- closeOnDateSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
- weeks: data.amsDatetimepickerWeeks
- };
- var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
- settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
- var plugin = input.datetimepicker(settings);
- ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.datetimepicker,
+ ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
+ function(first_load) {
+ if (first_load) {
+ ams.dialog && ams.dialog.registerHideCallback(ams.helpers && ams.helpers.datetimepickerDialogHiddenCallback);
+ }
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
+ 'jquery-datetimepicker',
+ function() {
+ datepickers.each(function() {
+ var input = $(this);
+ var data = input.data();
+ var dataOptions = {
+ lang: data.amsDatetimepickerLang || ams.lang,
+ format: data.amsDatetimepickerFormat || 'd/m/y',
+ datepicker: true,
+ dayOfWeekStart: 1,
+ timepicker: false,
+ closeOnDateSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
+ weeks: data.amsDatetimepickerWeeks
+ };
+ var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
+ settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
+ var plugin = input.datetimepicker(settings);
+ ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
+ });
+ });
+ });
}
},
@@ -3902,35 +4008,35 @@
datetimepicker: function(element) {
var datetimepickers = $('.datetimepicker', element);
if (datetimepickers.length > 0) {
- ams.ajax.check($.fn.datetimepicker,
- ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
- function(first_load) {
- if (first_load) {
- ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback);
- }
- ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
- 'jquery-datetimepicker',
- function () {
- datetimepickers.each(function () {
- var input = $(this);
- var data = input.data();
- var dataOptions = {
- lang: data.amsDatetimepickerLang || ams.lang,
- format: data.amsDatetimepickerFormat || 'd/m/y H:i',
- datepicker: true,
- dayOfWeekStart: 1,
- timepicker: true,
- closeOnDateSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
- closeOnTimeSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
- weeks: data.amsDatetimepickerWeeks
- };
- var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
- settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
- var plugin = input.datetimepicker(settings);
- ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.datetimepicker,
+ ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
+ function(first_load) {
+ if (first_load) {
+ ams.dialog && ams.dialog.registerHideCallback(ams.helpers && ams.helpers.datetimepickerDialogHiddenCallback);
+ }
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
+ 'jquery-datetimepicker',
+ function() {
+ datetimepickers.each(function() {
+ var input = $(this);
+ var data = input.data();
+ var dataOptions = {
+ lang: data.amsDatetimepickerLang || ams.lang,
+ format: data.amsDatetimepickerFormat || 'd/m/y H:i',
+ datepicker: true,
+ dayOfWeekStart: 1,
+ timepicker: true,
+ closeOnDateSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
+ closeOnTimeSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
+ weeks: data.amsDatetimepickerWeeks
+ };
+ var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
+ settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
+ var plugin = input.datetimepicker(settings);
+ ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
+ });
+ });
+ });
}
},
@@ -3940,32 +4046,32 @@
timepicker: function(element) {
var timepickers = $('.timepicker', element);
if (timepickers.length > 0) {
- ams.ajax.check($.fn.datetimepicker,
- ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
- function(first_load) {
- if (first_load) {
- ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback);
- }
- ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
- 'jquery-datetimepicker',
- function() {
- timepickers.each(function () {
- var input = $(this);
- var data = input.data();
- var dataOptions = {
- lang: data.amsDatetimepickerLang || ams.lang,
- format: data.amsDatetimepickerFormat || 'H:i',
- datepicker: false,
- timepicker: true,
- closeOnTimeSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect
- };
- var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
- settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
- var plugin = input.datetimepicker(settings);
- ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.datetimepicker,
+ ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
+ function(first_load) {
+ if (first_load) {
+ ams.dialog && ams.dialog.registerHideCallback(ams.helpers && ams.helpers.datetimepickerDialogHiddenCallback);
+ }
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
+ 'jquery-datetimepicker',
+ function() {
+ timepickers.each(function() {
+ var input = $(this);
+ var data = input.data();
+ var dataOptions = {
+ lang: data.amsDatetimepickerLang || ams.lang,
+ format: data.amsDatetimepickerFormat || 'H:i',
+ datepicker: false,
+ timepicker: true,
+ closeOnTimeSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect
+ };
+ var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
+ settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
+ var plugin = input.datetimepicker(settings);
+ ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
+ });
+ });
+ });
}
},
@@ -3975,25 +4081,25 @@
colorpicker: function(element) {
var colorpickers = $('.colorpicker', element);
if (colorpickers.length > 0) {
- ams.ajax.check($.fn.minicolors,
- ams.baseURL + 'ext/jquery-minicolors' + ams.devext + '.js',
- function() {
- ams.getCSS(ams.baseURL + '../css/ext/jquery-minicolors' + ams.devext + '.css',
- 'jquery-minicolors',
- function () {
- colorpickers.each(function () {
- var input = $(this);
- var data = input.data();
- var dataOptions = {
- position: data.amsColorpickerPosition || input.closest('.input').data('ams-colorpicker-position') || 'bottom left'
- };
- var settings = $.extend({}, dataOptions, data.amsColorpickerOptions);
- settings = ams.executeFunctionByName(data.amsColorpickerInitCallback, input, settings) || settings;
- var plugin = input.minicolors(settings);
- ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.minicolors,
+ ams.baseURL + 'ext/jquery-minicolors' + ams.devext + '.js',
+ function() {
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-minicolors' + ams.devext + '.css',
+ 'jquery-minicolors',
+ function() {
+ colorpickers.each(function() {
+ var input = $(this);
+ var data = input.data();
+ var dataOptions = {
+ position: data.amsColorpickerPosition || input.closest('.input').data('ams-colorpicker-position') || 'bottom left'
+ };
+ var settings = $.extend({}, dataOptions, data.amsColorpickerOptions);
+ settings = ams.executeFunctionByName(data.amsColorpickerInitCallback, input, settings) || settings;
+ var plugin = input.minicolors(settings);
+ ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
+ });
+ });
+ });
}
},
@@ -4003,27 +4109,27 @@
dndupload: function(element) {
var uploads = $('.dndupload', element);
if (uploads.length > 0) {
- ams.ajax.check($.fn.dndupload,
- ams.baseURL + 'ext/jquery-dndupload' + ams.devext + '.js',
- function() {
- ams.getCSS(ams.baseURL + '../css/ext/jquery-dndupload' + ams.devext + '.css',
- 'jquery-dndupload',
- function () {
- uploads.each(function () {
- var upload = $(this);
- var data = upload.data();
- var dataOptions = {
- action: data.amsDnduploadAction || upload.attr('action') || 'upload-files',
- fieldname: data.amsDnduploadFieldname || 'files',
- autosubmit: data.amsDnduploadAutosubmit
- };
- var settings = $.extend({}, dataOptions, data.amsDnduploadOptions);
- settings = ams.executeFunctionByName(data.amsDnduploadInitCallback, upload, settings) || settings;
- var plugin = upload.dndupload(settings);
- ams.executeFunctionByName(data.amsDnduploadAfterInitcallback, upload, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.dndupload,
+ ams.baseURL + 'ext/jquery-dndupload' + ams.devext + '.js',
+ function() {
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-dndupload' + ams.devext + '.css',
+ 'jquery-dndupload',
+ function() {
+ uploads.each(function() {
+ var upload = $(this);
+ var data = upload.data();
+ var dataOptions = {
+ action: data.amsDnduploadAction || upload.attr('action') || 'upload-files',
+ fieldname: data.amsDnduploadFieldname || 'files',
+ autosubmit: data.amsDnduploadAutosubmit
+ };
+ var settings = $.extend({}, dataOptions, data.amsDnduploadOptions);
+ settings = ams.executeFunctionByName(data.amsDnduploadInitCallback, upload, settings) || settings;
+ var plugin = upload.dndupload(settings);
+ ams.executeFunctionByName(data.amsDnduploadAfterInitcallback, upload, plugin, settings);
+ });
+ });
+ });
}
},
@@ -4033,92 +4139,92 @@
validate: function(element) {
var forms = $('FORM:not([novalidate])', element);
if (forms.length > 0) {
- ams.ajax.check($.fn.validate,
- ams.baseURL + 'ext/jquery-validate-1.17.0' + ams.devext + '.js',
- function(first_load) {
- if (first_load) {
- $.validator.setDefaults({
- highlight: function(element) {
- $(element).closest('.form-group, label:not(:parents(.form-group))').addClass('state-error');
- },
- unhighlight: function(element) {
- $(element).closest('.form-group, label:not(:parents(.form-group))').removeClass('state-error');
- },
- errorElement: 'span',
- errorClass: 'state-error',
- errorPlacement: function(error, element) {
- var label = element.parents('label:first');
- if (label.length) {
- error.insertAfter(label);
- } else {
- error.insertAfter(element);
- }
- }
- });
- if (ams.plugins.i18n) {
- for (var key in ams.plugins.i18n.validate) {
- if (!ams.plugins.i18n.validate.hasOwnProperty(key)) {
- continue;
- }
- var message = ams.plugins.i18n.validate[key];
- if ((typeof(message) === 'string') &&
- (message.indexOf('{0}') > -1)) {
- ams.plugins.i18n.validate[key] = $.validator.format(message);
- }
- }
- $.extend($.validator.messages, ams.plugins.i18n.validate);
- }
- }
- forms.each(function() {
- var form = $(this);
- var data = form.data();
- var dataOptions = {
- ignore: null,
- submitHandler: form.attr('data-async') !== undefined ?
+ ams.ajax && ams.ajax.check($.fn.validate,
+ ams.baseURL + 'ext/jquery-validate-1.17.0' + ams.devext + '.js',
+ function(first_load) {
+ if (first_load) {
+ $.validator.setDefaults({
+ highlight: function(element) {
+ $(element).closest('.form-group, label:not(:parents(.form-group))').addClass('state-error');
+ },
+ unhighlight: function(element) {
+ $(element).closest('.form-group, label:not(:parents(.form-group))').removeClass('state-error');
+ },
+ errorElement: 'span',
+ errorClass: 'state-error',
+ errorPlacement: function(error, element) {
+ var label = element.parents('label:first');
+ if (label.length) {
+ error.insertAfter(label);
+ } else {
+ error.insertAfter(element);
+ }
+ }
+ });
+ if (ams.plugins && ams.plugins.i18n) {
+ for (var key in ams.plugins.i18n.validate) {
+ if (!ams.plugins.i18n.validate.hasOwnProperty(key)) {
+ continue;
+ }
+ var message = ams.plugins.i18n.validate[key];
+ if ((typeof (message) === 'string') &&
+ (message.indexOf('{0}') > -1)) {
+ ams.plugins.i18n.validate[key] = $.validator.format(message);
+ }
+ }
+ $.extend($.validator.messages, ams.plugins.i18n.validate);
+ }
+ }
+ forms.each(function() {
+ var form = $(this);
+ var data = form.data();
+ var dataOptions = {
+ ignore: null,
+ submitHandler: form.attr('data-async') !== undefined ?
data.amsFormSubmitHandler === undefined ?
- function() {
- // JQuery-form plug-in must be loaded synchronously!!
- // Otherwise, hidden input fields created by jquery-validate plug-in
- // and matching named buttons will be deleted (on first form submit)
- // before JQuery-form plug-in can get them when submitting the form...
- $('.state-error', form).removeClass('state-error');
- ams.ajax.check($.fn.ajaxSubmit,
- ams.baseURL + 'ext/jquery-form-3.49' + ams.devext + '.js');
- return ams.form.submit(form);
- }
- : ams.getFunctionByName(data.amsFormSubmitHandler)
+ function() {
+ // JQuery-form plug-in must be loaded synchronously!!
+ // Otherwise, hidden input fields created by jquery-validate plug-in
+ // and matching named buttons will be deleted (on first form submit)
+ // before JQuery-form plug-in can get them when submitting the form...
+ $('.state-error', form).removeClass('state-error');
+ ams.ajax && ams.ajax.check($.fn.ajaxSubmit,
+ ams.baseURL + 'ext/jquery-form-3.49' + ams.devext + '.js');
+ return ams.form && ams.form.submit(form);
+ }
+ : ams.getFunctionByName(data.amsFormSubmitHandler)
: undefined,
- invalidHandler: form.attr('data-async') !== undefined ?
- data.amsFormInvalidHandler === undefined ?
- function(event, validator) {
- $('.state-error', form).removeClass('state-error');
- for (var index=0; index < validator.errorList.length; index++) {
- var error = validator.errorList[index];
- var tabIndex = $(error.element).parents('.tab-pane').index() + 1;
- if (tabIndex > 0) {
- var navTabs = $('.nav-tabs', $(error.element).parents('.tabforms'));
- $('li:nth-child(' + tabIndex + ')', navTabs)
- .removeClassPrefix('state-')
- .addClass('state-error');
- $('li.state-error:first a', navTabs).click();
- }
- }
- }
- : ams.getFunctionByName(data.amsFormInvalidHandler)
- : undefined
- };
- $('[data-ams-validate-rules]', form).each(function(index) {
- if (index === 0) {
- dataOptions.rules = {};
- }
- dataOptions.rules[$(this).attr('name')] = $(this).data('ams-validate-rules');
- });
- var settings = $.extend({}, dataOptions, data.amsValidateOptions);
- settings = ams.executeFunctionByName(data.amsValidateInitCallback, form, settings) || settings;
- var plugin = form.validate(settings);
- ams.executeFunctionByName(data.amsValidateAfterInitCallback, form, plugin, settings);
- });
- });
+ invalidHandler: form.attr('data-async') !== undefined ?
+ data.amsFormInvalidHandler === undefined ?
+ function(event, validator) {
+ $('.state-error', form).removeClass('state-error');
+ for (var index = 0; index < validator.errorList.length; index++) {
+ var error = validator.errorList[index];
+ var tabIndex = $(error.element).parents('.tab-pane').index() + 1;
+ if (tabIndex > 0) {
+ var navTabs = $('.nav-tabs', $(error.element).parents('.tabforms'));
+ $('li:nth-child(' + tabIndex + ')', navTabs)
+ .removeClassPrefix('state-')
+ .addClass('state-error');
+ $('li.state-error:first a', navTabs).click();
+ }
+ }
+ }
+ : ams.getFunctionByName(data.amsFormInvalidHandler)
+ : undefined
+ };
+ $('[data-ams-validate-rules]', form).each(function(index) {
+ if (index === 0) {
+ dataOptions.rules = {};
+ }
+ dataOptions.rules[$(this).attr('name')] = $(this).data('ams-validate-rules');
+ });
+ var settings = $.extend({}, dataOptions, data.amsValidateOptions);
+ settings = ams.executeFunctionByName(data.amsValidateInitCallback, form, settings) || settings;
+ var plugin = form.validate(settings);
+ ams.executeFunctionByName(data.amsValidateAfterInitCallback, form, plugin, settings);
+ });
+ });
}
},
@@ -4128,258 +4234,257 @@
datatable: function(element) {
var tables = $('.datatable', element);
if (tables.length > 0) {
- ams.ajax.check($.fn.dataTable,
- ams.baseURL + 'ext/jquery-dataTables-1.9.4' + ams.devext + '.js',
- function() {
- ams.ajax.check($.fn.dataTableExt.oPagination.bootstrap_full,
- ams.baseURL + 'myams-dataTables' + ams.devext + '.js',
- function() {
- $(tables).each(function () {
- var table = $(this);
- var data = table.data();
- var extensions = (data.amsDatatableExtensions || '').split(/\s+/);
- // Check DOM elements
- var sDom = data.amsDatatableSdom ||
- "W" +
- ((extensions.indexOf('colreorder') >= 0 ||
- extensions.indexOf('colreorderwithresize') >= 0) ? 'R' : '') +
- "<'dt-top-row'" +
- (extensions.indexOf('colvis') >= 0 ? 'C' : '') +
- ((data.amsDatatablePagination === false ||
- data.amsDatatablePaginationSize === false) ? '' : 'L') +
- (data.amsDatatableGlobalFilter === false ? '' : 'F') +
- ">r<'dt-wrapper't" +
- (extensions.indexOf('scroller') >= 0 ? 'S' : '') +
- "><'dt-row dt-bottom-row'<'row'<'col-sm-6'" +
- (data.amsDatatableInformation === false ? '' : 'i') +
- "><'col-sm-6 text-right'p>>";
-
- var index;
- // Check initial sorting
- var sorting = data.amsDatatableSorting;
- if (typeof(sorting) === 'string') {
- var sortings = sorting.split(';');
- sorting = [];
- for (index = 0; index < sortings.length; index++) {
- var colSorting = sortings[index].split(',');
- colSorting[0] = parseInt(colSorting[0]);
- sorting.push(colSorting);
- }
- }
- // Check columns sortings
- var columns = [];
- var column;
- var sortables = $('th', table).listattr('data-ams-datatable-sortable');
- for (index = 0; index < sortables.length; index++) {
- var sortable = sortables[index];
- if (sortable !== undefined) {
- column = columns[index] || {};
- column.bSortable = typeof(sortable) === 'string' ? JSON.parse(sortable) : sortable;
- columns[index] = column;
- } else {
- columns[index] = columns[index] || {};
- }
- }
- // Check columns types
- var sortTypes = $('th', table).listattr('data-ams-datatable-stype');
- for (index = 0; index < sortTypes.length; index++) {
- var sortType = sortTypes[index];
- if (sortType) {
- column = columns[index] || {};
- column.sType = sortType;
- columns[index] = column;
- } else {
- columns[index] = columns[index] || {};
- }
- }
- // Set options
- var dataOptions = {
- bJQueryUI: false,
- bServerSide: data.amsDatatableServerSide || false,
- sAjaxSource: data.amsDatatableServerSide === true ? data.amsDatatableAjaxSource : undefined,
- sServerMethod: data.amsDatatableServerSide === true ? 'POST' : undefined,
- bFilter: data.amsDatatableGlobalFilter !== false || extensions.indexOf('columnfilter') >= 0,
- bPaginate: data.amsDatatablePagination !== false,
- bInfo: data.amsDatatableInfo !== false,
- bSort: data.amsDatatableSort !== false,
- aaSorting: sorting,
- aoColumns: columns.length > 0 ? columns : undefined,
- bDeferRender: true,
- bAutoWidth: false,
- iDisplayLength: data.amsDatatableDisplayLength || 25,
- sPaginationType: data.amsDatatablePaginationType || 'bootstrap_full',
- sDom: sDom,
- oLanguage: ams.plugins.i18n.datatables,
- fnInitComplete: function (oSettings, json) {
- $('.ColVis_Button').addClass('btn btn-default btn-sm')
- .html((ams.plugins.i18n.datatables.sColumns || "Columns") +
- ' <i class="fa fa-fw fa-caret-down"></i>');
- }
- };
- var settings = $.extend({}, dataOptions, data.amsDatatableOptions);
- var checkers = [];
- var sources = [];
- var callbacks = [];
- if (extensions.length > 0) {
- for (index = 0; index < extensions.length; index++) {
- switch (extensions[index]) {
- case 'autofill':
- checkers.push($.fn.dataTable.AutoFill);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-autoFill' + ams.devext + '.js');
- break;
- case 'columnfilter':
- checkers.push($.fn.columnFilter);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-columnFilter' + ams.devext + '.js');
- break;
- case 'colreorder':
- checkers.push($.fn.dataTable.ColReorder);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-colReorder' + ams.devext + '.js');
- break;
- case 'colreorderwithresize':
- checkers.push(window.ColReorder);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-colReorderWithResize' + ams.devext + '.js');
- break;
- case 'colvis':
- checkers.push($.fn.dataTable.ColVis);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-colVis' + ams.devext + '.js');
- callbacks.push(function () {
- var cvDefault = {
- activate: 'click',
- sAlign: 'right'
- };
- settings.oColVis = $.extend({}, cvDefault, data.amsDatatableColvisOptions);
- });
- break;
- case 'editable':
- checkers.push($.fn.editable);
- sources.push(ams.baseURL + 'ext/jquery-jeditable' + ams.devext + '.js');
- checkers.push($.fn.makeEditable);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-editable' + ams.devext + '.js');
- break;
- case 'fixedcolumns':
- checkers.push($.fn.dataTable.FixedColumns);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-fixedColumns' + ams.devext + '.js');
- break;
- case 'fixedheader':
- checkers.push($.fn.dataTable.Fixedheader);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-fixedHeader' + ams.devext + '.js');
- break;
- case 'keytable':
- checkers.push(window.keyTable);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-keyTable' + ams.devext + '.js');
- break;
- case 'rowgrouping':
- checkers.push($.fn.rowGrouping);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-rowGrouping' + ams.devext + '.js');
- break;
- case 'rowreordering':
- checkers.push($.fn.rowReordering);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-rowReordering' + ams.devext + '.js');
- break;
- case 'scroller':
- checkers.push($.fn.dataTable.Scroller);
- sources.push(ams.baseURL + 'ext/jquery-dataTables-scroller' + ams.devext + '.js');
- break;
- default:
- break;
- }
- }
- }
-
- function initTable() {
- settings = ams.executeFunctionByName(data.amsDatatableInitCallback, table, settings) || settings;
- try { // Some settings can easily generate DataTables exceptions...
- var plugin = table.dataTable(settings);
- ams.executeFunctionByName(data.amsDatatableAfterInitCallback, table, plugin, settings);
- if (extensions.length > 0) {
- for (index = 0; index < extensions.length; index++) {
- switch (extensions[index]) {
- case 'autofill':
- var afSettings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill);
- afSettings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, afSettings) || afSettings;
- table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined ?
- new $.fn.dataTable.AutoFill(table, afSettings)
- : ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, afSettings));
- break;
- case 'columnfilter':
- var cfDefault = {
- sPlaceHolder: 'head:after'
- };
- var cfSettings = $.extend({}, cfDefault, data.amsDatatableColumnfilterOptions, settings.columnfilter);
- cfSettings = ams.executeFunctionByName(data.amsDatatableColumnfilterInitCallback, table, cfSettings) || cfSettings;
- table.data('ams-columnfilter', data.amsDatatableColumnfilterConstructor === undefined ?
- plugin.columnFilter(cfSettings)
- : ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cfSettings));
- break;
- case 'editable':
- var edSettings = $.extend({}, data.amsDatatableEditableOptions, settings.editable);
- edSettings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, edSettings) || edSettings;
- table.data('ams-editable', data.amsDatatableEditableConstructor === undefined ?
- table.makeEditable(edSettings)
- : ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, edSettings));
- break;
- case 'fixedcolumns':
- var fcSettings = $.extend({}, data.amsDatatableFixedcolumnsOptions, settings.fixedcolumns);
- fcSettings = ams.executeFunctionByName(data.amsDatatableFixedcolumnsInitCallback, table, fcSettings) || fcSettings;
- table.data('ams-fixedcolumns', data.amsDatatableFixedcolumnsConstructor === undefined ?
- new $.fn.dataTable.FixedColumns(table, fcSettings)
- : ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fcSettings));
- break;
- case 'fixedheader':
- var fhSettings = $.extend({}, data.amsDatatableFixedheaderOptions, settings.fixedheader);
- fhSettings = ams.executeFunctionByName(data.amsDatatableFixedheadeInitCallback, table, fhSettings) || fhSettings;
- table.data('ams-fixedheader', data.amsDatatableFixedheaderConstructor === undefined ?
- new $.fn.dataTable.FixedHeader(table, fhSettings)
- : ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fhSettings));
- break;
- case 'keytable':
- var ktDefault = {
- table: table.get(0),
- datatable: plugin
- };
- var ktSettings = $.extend({}, ktDefault, data.amsDatatableKeytableOptions, settings.keytable);
- ktSettings = ams.executeFunctionByName(data.amsDatatableKeytableInitCallback, table, ktSettings) || ktSettings;
- table.data('ams-keytable', data.amsDatatableKeytableConstructor === undefined ?
- new KeyTable(ktSettings)
- : ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, ktSettings));
- break;
- case 'rowgrouping':
- var rgSettings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping);
- rgSettings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rgSettings) || rgSettings;
- table.data('ams-rowgrouping', data.amsDatatableRowgroupingConstructor === undefined ?
- table.rowGrouping(rgSettings)
- : ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rgSettings));
- break;
- case 'rowreordering':
- var rrSettings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering);
- rrSettings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rrSettings) || rrSettings;
- table.data('ams-rowreordering', data.amsDatatableRowreorderingConstructor === undefined ?
- table.rowReordering(rrSettings)
- : ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rrSettings));
- break;
- default:
- break;
- }
- }
- }
- if (data.amsDatatableFinalizeCallback) {
- var finalizers = data.amsDatatableFinalizeCallback.split(/\s+/);
- if (finalizers.length > 0) {
- for (index = 0; index < finalizers.length; index++) {
- ams.executeFunctionByName(finalizers[index], table, plugin, settings);
- }
- }
- }
- }
- catch (e) {
- }
- }
-
- callbacks.push(initTable);
- ams.ajax.check(checkers, sources, callbacks);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.dataTable,
+ ams.baseURL + 'ext/jquery-dataTables-1.9.4' + ams.devext + '.js',
+ function() {
+ ams.ajax.check($.fn.dataTableExt.oPagination.bootstrap_full,
+ ams.baseURL + 'myams-dataTables' + ams.devext + '.js',
+ function() {
+ $(tables).each(function() {
+ var table = $(this);
+ var data = table.data();
+ var extensions = (data.amsDatatableExtensions || '').split(/\s+/);
+ // Check DOM elements
+ var sDom = data.amsDatatableSdom ||
+ "W" +
+ ((extensions.indexOf('colreorder') >= 0 ||
+ extensions.indexOf('colreorderwithresize') >= 0) ? 'R' : '') +
+ "<'dt-top-row'" +
+ (extensions.indexOf('colvis') >= 0 ? 'C' : '') +
+ ((data.amsDatatablePagination === false ||
+ data.amsDatatablePaginationSize === false) ? '' : 'L') +
+ (data.amsDatatableGlobalFilter === false ? '' : 'F') +
+ ">r<'dt-wrapper't" +
+ (extensions.indexOf('scroller') >= 0 ? 'S' : '') +
+ "><'dt-row dt-bottom-row'<'row'<'col-sm-6'" +
+ (data.amsDatatableInformation === false ? '' : 'i') +
+ "><'col-sm-6 text-right'p>>";
+
+ var index;
+ // Check initial sorting
+ var sorting = data.amsDatatableSorting;
+ if (typeof (sorting) === 'string') {
+ var sortings = sorting.split(';');
+ sorting = [];
+ for (index = 0; index < sortings.length; index++) {
+ var colSorting = sortings[index].split(',');
+ colSorting[0] = parseInt(colSorting[0]);
+ sorting.push(colSorting);
+ }
+ }
+ // Check columns sortings
+ var columns = [];
+ var column;
+ var sortables = $('th', table).listattr('data-ams-datatable-sortable');
+ for (index = 0; index < sortables.length; index++) {
+ var sortable = sortables[index];
+ if (sortable !== undefined) {
+ column = columns[index] || {};
+ column.bSortable = typeof (sortable) === 'string' ? JSON.parse(sortable) : sortable;
+ columns[index] = column;
+ } else {
+ columns[index] = columns[index] || {};
+ }
+ }
+ // Check columns types
+ var sortTypes = $('th', table).listattr('data-ams-datatable-stype');
+ for (index = 0; index < sortTypes.length; index++) {
+ var sortType = sortTypes[index];
+ if (sortType) {
+ column = columns[index] || {};
+ column.sType = sortType;
+ columns[index] = column;
+ } else {
+ columns[index] = columns[index] || {};
+ }
+ }
+ // Set options
+ var dataOptions = {
+ bJQueryUI: false,
+ bServerSide: data.amsDatatableServerSide || false,
+ sAjaxSource: data.amsDatatableServerSide === true ? data.amsDatatableAjaxSource : undefined,
+ sServerMethod: data.amsDatatableServerSide === true ? 'POST' : undefined,
+ bFilter: data.amsDatatableGlobalFilter !== false || extensions.indexOf('columnfilter') >= 0,
+ bPaginate: data.amsDatatablePagination !== false,
+ bInfo: data.amsDatatableInfo !== false,
+ bSort: data.amsDatatableSort !== false,
+ aaSorting: sorting,
+ aoColumns: columns.length > 0 ? columns : undefined,
+ bDeferRender: true,
+ bAutoWidth: false,
+ iDisplayLength: data.amsDatatableDisplayLength || 25,
+ sPaginationType: data.amsDatatablePaginationType || 'bootstrap_full',
+ sDom: sDom,
+ oLanguage: ams.plugins && ams.plugins.i18n.datatables,
+ fnInitComplete: function(oSettings, json) {
+ $('.ColVis_Button').addClass('btn btn-default btn-sm')
+ .html(((ams.plugins && ams.plugins.i18n.datatables.sColumns) || "Columns") +
+ ' <i class="fa fa-fw fa-caret-down"></i>');
+ }
+ };
+ var settings = $.extend({}, dataOptions, data.amsDatatableOptions);
+ var checkers = [];
+ var sources = [];
+ var callbacks = [];
+ if (extensions.length > 0) {
+ for (index = 0; index < extensions.length; index++) {
+ switch (extensions[index]) {
+ case 'autofill':
+ checkers.push($.fn.dataTable.AutoFill);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-autoFill' + ams.devext + '.js');
+ break;
+ case 'columnfilter':
+ checkers.push($.fn.columnFilter);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-columnFilter' + ams.devext + '.js');
+ break;
+ case 'colreorder':
+ checkers.push($.fn.dataTable.ColReorder);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-colReorder' + ams.devext + '.js');
+ break;
+ case 'colreorderwithresize':
+ checkers.push(window.ColReorder);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-colReorderWithResize' + ams.devext + '.js');
+ break;
+ case 'colvis':
+ checkers.push($.fn.dataTable.ColVis);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-colVis' + ams.devext + '.js');
+ callbacks.push(function() {
+ var cvDefault = {
+ activate: 'click',
+ sAlign: 'right'
+ };
+ settings.oColVis = $.extend({}, cvDefault, data.amsDatatableColvisOptions);
+ });
+ break;
+ case 'editable':
+ checkers.push($.fn.editable);
+ sources.push(ams.baseURL + 'ext/jquery-jeditable' + ams.devext + '.js');
+ checkers.push($.fn.makeEditable);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-editable' + ams.devext + '.js');
+ break;
+ case 'fixedcolumns':
+ checkers.push($.fn.dataTable.FixedColumns);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-fixedColumns' + ams.devext + '.js');
+ break;
+ case 'fixedheader':
+ checkers.push($.fn.dataTable.Fixedheader);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-fixedHeader' + ams.devext + '.js');
+ break;
+ case 'keytable':
+ checkers.push(window.keyTable);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-keyTable' + ams.devext + '.js');
+ break;
+ case 'rowgrouping':
+ checkers.push($.fn.rowGrouping);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-rowGrouping' + ams.devext + '.js');
+ break;
+ case 'rowreordering':
+ checkers.push($.fn.rowReordering);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-rowReordering' + ams.devext + '.js');
+ break;
+ case 'scroller':
+ checkers.push($.fn.dataTable.Scroller);
+ sources.push(ams.baseURL + 'ext/jquery-dataTables-scroller' + ams.devext + '.js');
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ function initTable() {
+ settings = ams.executeFunctionByName(data.amsDatatableInitCallback, table, settings) || settings;
+ try { // Some settings can easily generate DataTables exceptions...
+ var plugin = table.dataTable(settings);
+ ams.executeFunctionByName(data.amsDatatableAfterInitCallback, table, plugin, settings);
+ if (extensions.length > 0) {
+ for (index = 0; index < extensions.length; index++) {
+ switch (extensions[index]) {
+ case 'autofill':
+ var afSettings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill);
+ afSettings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, afSettings) || afSettings;
+ table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined ?
+ new $.fn.dataTable.AutoFill(table, afSettings)
+ : ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, afSettings));
+ break;
+ case 'columnfilter':
+ var cfDefault = {
+ sPlaceHolder: 'head:after'
+ };
+ var cfSettings = $.extend({}, cfDefault, data.amsDatatableColumnfilterOptions, settings.columnfilter);
+ cfSettings = ams.executeFunctionByName(data.amsDatatableColumnfilterInitCallback, table, cfSettings) || cfSettings;
+ table.data('ams-columnfilter', data.amsDatatableColumnfilterConstructor === undefined ?
+ plugin.columnFilter(cfSettings)
+ : ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cfSettings));
+ break;
+ case 'editable':
+ var edSettings = $.extend({}, data.amsDatatableEditableOptions, settings.editable);
+ edSettings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, edSettings) || edSettings;
+ table.data('ams-editable', data.amsDatatableEditableConstructor === undefined ?
+ table.makeEditable(edSettings)
+ : ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, edSettings));
+ break;
+ case 'fixedcolumns':
+ var fcSettings = $.extend({}, data.amsDatatableFixedcolumnsOptions, settings.fixedcolumns);
+ fcSettings = ams.executeFunctionByName(data.amsDatatableFixedcolumnsInitCallback, table, fcSettings) || fcSettings;
+ table.data('ams-fixedcolumns', data.amsDatatableFixedcolumnsConstructor === undefined ?
+ new $.fn.dataTable.FixedColumns(table, fcSettings)
+ : ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fcSettings));
+ break;
+ case 'fixedheader':
+ var fhSettings = $.extend({}, data.amsDatatableFixedheaderOptions, settings.fixedheader);
+ fhSettings = ams.executeFunctionByName(data.amsDatatableFixedheadeInitCallback, table, fhSettings) || fhSettings;
+ table.data('ams-fixedheader', data.amsDatatableFixedheaderConstructor === undefined ?
+ new $.fn.dataTable.FixedHeader(table, fhSettings)
+ : ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fhSettings));
+ break;
+ case 'keytable':
+ var ktDefault = {
+ table: table.get(0),
+ datatable: plugin
+ };
+ var ktSettings = $.extend({}, ktDefault, data.amsDatatableKeytableOptions, settings.keytable);
+ ktSettings = ams.executeFunctionByName(data.amsDatatableKeytableInitCallback, table, ktSettings) || ktSettings;
+ table.data('ams-keytable', data.amsDatatableKeytableConstructor === undefined ?
+ new KeyTable(ktSettings)
+ : ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, ktSettings));
+ break;
+ case 'rowgrouping':
+ var rgSettings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping);
+ rgSettings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rgSettings) || rgSettings;
+ table.data('ams-rowgrouping', data.amsDatatableRowgroupingConstructor === undefined ?
+ table.rowGrouping(rgSettings)
+ : ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rgSettings));
+ break;
+ case 'rowreordering':
+ var rrSettings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering);
+ rrSettings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rrSettings) || rrSettings;
+ table.data('ams-rowreordering', data.amsDatatableRowreorderingConstructor === undefined ?
+ table.rowReordering(rrSettings)
+ : ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rrSettings));
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ if (data.amsDatatableFinalizeCallback) {
+ var finalizers = data.amsDatatableFinalizeCallback.split(/\s+/);
+ if (finalizers.length > 0) {
+ for (index = 0; index < finalizers.length; index++) {
+ ams.executeFunctionByName(finalizers[index], table, plugin, settings);
+ }
+ }
+ }
+ } catch (e) {
+ }
+ }
+
+ callbacks.push(initTable);
+ ams.ajax && ams.ajax.check(checkers, sources, callbacks);
+ });
+ });
+ });
}
},
@@ -4389,68 +4494,68 @@
tablednd: function(element) {
var tables = $('.table-dnd', element);
if (tables.length > 0) {
- ams.ajax.check($.fn.tableDnD,
- ams.baseURL + 'ext/jquery-tablednd' + ams.devext + '.js',
- function() {
- tables.each(function() {
- var table = $(this);
- var data = table.data();
- if (data.amsTabledndDragHandle) {
- $('tr', table).addClass('no-drag-handle');
- } else {
- $(table).on('mouseover', 'tr', function () {
- $(this.cells[0]).addClass('drag-handle');
- }).on('mouseout', 'tr', function () {
- $(this.cells[0]).removeClass('drag-handle');
- });
- }
- var dataOptions = {
- onDragClass: data.amsTabledndDragClass || 'dragging-row',
- onDragStart: ams.getFunctionByName(data.amsTabledndDragStart),
- dragHandle: data.amsTabledndDragHandle,
- scrollAmount: data.amsTabledndScrollAmount,
- onAllowDrop: data.amsTabledndAllowDrop,
- onDrop: ams.getFunctionByName(data.amsTabledndDrop) || function(dnd_table, row) {
- var target = data.amsTabledndDropTarget;
- if (target) {
- // Disable row click handler
- $(row).data('ams-disabled-handlers', 'click');
- try {
- var rows = [];
- $(dnd_table.rows).each(function() {
- var rowId = $(this).data('ams-element-name');
- if (rowId) {
- rows.push(rowId);
- }
- });
- var localTarget = ams.getFunctionByName(target);
- if (typeof(localTarget) === 'function') {
- localTarget.call(table, dnd_table, rows);
- } else {
- if (!target.startsWith(window.location.protocol)) {
- var location = data.amsLocation;
- if (location) {
- target = location + '/' + target;
- }
- }
- ams.ajax.post(target, {names: JSON.stringify(rows)});
- }
- } finally {
- // Restore row click handler
- setTimeout(function() {
- $(row).removeData('ams-disabled-handlers');
- }, 50);
- }
- }
- return false;
- }
- };
- var settings = $.extend({}, dataOptions, data.amsTabledndOptions);
- settings = ams.executeFunctionByName(data.amsTabledndInitCallback, table, settings) || settings;
- var plugin = table.tableDnD(settings);
- ams.executeFunctionByName(data.amsTabledndAfterInitCallback, table, plugin, settings);
- });
- });
+ ams.ajax && ams.ajax.check($.fn.tableDnD,
+ ams.baseURL + 'ext/jquery-tablednd' + ams.devext + '.js',
+ function() {
+ tables.each(function() {
+ var table = $(this);
+ var data = table.data();
+ if (data.amsTabledndDragHandle) {
+ $('tr', table).addClass('no-drag-handle');
+ } else {
+ $(table).on('mouseover', 'tr', function() {
+ $(this.cells[0]).addClass('drag-handle');
+ }).on('mouseout', 'tr', function() {
+ $(this.cells[0]).removeClass('drag-handle');
+ });
+ }
+ var dataOptions = {
+ onDragClass: data.amsTabledndDragClass || 'dragging-row',
+ onDragStart: ams.getFunctionByName(data.amsTabledndDragStart),
+ dragHandle: data.amsTabledndDragHandle,
+ scrollAmount: data.amsTabledndScrollAmount,
+ onAllowDrop: data.amsTabledndAllowDrop,
+ onDrop: ams.getFunctionByName(data.amsTabledndDrop) || function(dnd_table, row) {
+ var target = data.amsTabledndDropTarget;
+ if (target) {
+ // Disable row click handler
+ $(row).data('ams-disabled-handlers', 'click');
+ try {
+ var rows = [];
+ $(dnd_table.rows).each(function() {
+ var rowId = $(this).data('ams-element-name');
+ if (rowId) {
+ rows.push(rowId);
+ }
+ });
+ var localTarget = ams.getFunctionByName(target);
+ if (typeof (localTarget) === 'function') {
+ localTarget.call(table, dnd_table, rows);
+ } else {
+ if (!target.startsWith(window.location.protocol)) {
+ var location = data.amsLocation;
+ if (location) {
+ target = location + '/' + target;
+ }
+ }
+ ams.ajax && ams.ajax.post(target, {names: JSON.stringify(rows)});
+ }
+ } finally {
+ // Restore row click handler
+ setTimeout(function() {
+ $(row).removeData('ams-disabled-handlers');
+ }, 50);
+ }
+ }
+ return false;
+ }
+ };
+ var settings = $.extend({}, dataOptions, data.amsTabledndOptions);
+ settings = ams.executeFunctionByName(data.amsTabledndInitCallback, table, settings) || settings;
+ var plugin = table.tableDnD(settings);
+ ams.executeFunctionByName(data.amsTabledndAfterInitCallback, table, plugin, settings);
+ });
+ });
}
},
@@ -4460,39 +4565,39 @@
wizard: function(element) {
var wizards = $('.wizard', element);
if (wizards.length > 0) {
- ams.ajax.check($.fn.bootstrapWizard,
- ams.baseURL + 'ext/bootstrap-wizard-1.4.2' + ams.devext + '.js',
- function() {
- wizards.each(function() {
- var wizard = $(this);
- var data = wizard.data();
- var dataOptions = {
- withVisible: data.amsWizardWithVisible === undefined ? true : data.amsWizardWithVisible,
- tabClass: data.amsWizardTabClass,
- firstSelector: data.amsWizardFirstSelector,
- previousSelector: data.amsWizardPreviousSelector,
- nextSelector: data.amsWizardNextSelector,
- lastSelector: data.amsWizardLastSelector,
- finishSelector: data.amsWizardFinishSelector,
- backSelector: data.amsWizardBackSelector,
- onInit: ams.getFunctionByName(data.amsWizardInit),
- onShow: ams.getFunctionByName(data.amsWizardShow),
- onNext: ams.getFunctionByName(data.amsWizardNext),
- onPrevious: ams.getFunctionByName(data.amsWizardPrevious),
- onFirst: ams.getFunctionByName(data.amsWizardFirst),
- onLast: ams.getFunctionByName(data.amsWizardLast),
- onBack: ams.getFunctionByName(data.amsWizardBack),
- onFinish: ams.getFunctionByName(data.amsWizardFinish),
- onTabChange: ams.getFunctionByName(data.amsWizardTabChange),
- onTabClick: ams.getFunctionByName(data.amsWizardTabClick),
- onTabShow: ams.getFunctionByName(data.amsWizardTabShow)
- };
- var settings = $.extend({}, dataOptions, data.amsWizardOptions);
- settings = ams.executeFunctionByName(data.amsWizardInitCallback, wizard, settings) || settings;
- var plugin = wizard.bootstrapWizard(settings);
- ams.executeFunctionByName(data.amsWizardAfterInitCallback, wizard, plugin, settings);
- });
- });
+ ams.ajax && ams.ajax.check($.fn.bootstrapWizard,
+ ams.baseURL + 'ext/bootstrap-wizard-1.4.2' + ams.devext + '.js',
+ function() {
+ wizards.each(function() {
+ var wizard = $(this);
+ var data = wizard.data();
+ var dataOptions = {
+ withVisible: data.amsWizardWithVisible === undefined ? true : data.amsWizardWithVisible,
+ tabClass: data.amsWizardTabClass,
+ firstSelector: data.amsWizardFirstSelector,
+ previousSelector: data.amsWizardPreviousSelector,
+ nextSelector: data.amsWizardNextSelector,
+ lastSelector: data.amsWizardLastSelector,
+ finishSelector: data.amsWizardFinishSelector,
+ backSelector: data.amsWizardBackSelector,
+ onInit: ams.getFunctionByName(data.amsWizardInit),
+ onShow: ams.getFunctionByName(data.amsWizardShow),
+ onNext: ams.getFunctionByName(data.amsWizardNext),
+ onPrevious: ams.getFunctionByName(data.amsWizardPrevious),
+ onFirst: ams.getFunctionByName(data.amsWizardFirst),
+ onLast: ams.getFunctionByName(data.amsWizardLast),
+ onBack: ams.getFunctionByName(data.amsWizardBack),
+ onFinish: ams.getFunctionByName(data.amsWizardFinish),
+ onTabChange: ams.getFunctionByName(data.amsWizardTabChange),
+ onTabClick: ams.getFunctionByName(data.amsWizardTabClick),
+ onTabShow: ams.getFunctionByName(data.amsWizardTabShow)
+ };
+ var settings = $.extend({}, dataOptions, data.amsWizardOptions);
+ settings = ams.executeFunctionByName(data.amsWizardInitCallback, wizard, settings) || settings;
+ var plugin = wizard.bootstrapWizard(settings);
+ ams.executeFunctionByName(data.amsWizardAfterInitCallback, wizard, plugin, settings);
+ });
+ });
}
},
@@ -4513,82 +4618,82 @@
var editors = $('.tinymce', element);
if (editors.length > 0) {
var baseURL = ams.baseURL + 'ext/tinymce' + (ams.devmode ? '/dev' : '');
- ams.ajax.check(window.tinymce,
- baseURL + '/tinymce' + ams.devext + '.js',
- function(first_load) {
-
- function initEditors() {
- editors.each(function() {
- var editor = $(this);
- var data = editor.data();
- var dataOptions = {
- theme: data.amsTinymceTheme || "modern",
- language: ams.lang,
- menubar: data.amsTinymceMenubar !== false,
- statusbar: data.amsTinymceStatusbar !== false,
- plugins: data.amsTinymcePlugins || [
- "advlist autosave autolink lists link charmap print preview hr anchor pagebreak",
- "searchreplace wordcount visualblocks visualchars code fullscreen",
- "insertdatetime nonbreaking save table contextmenu directionality",
- "emoticons paste textcolor colorpicker textpattern autoresize"
- ],
- toolbar: data.amsTinymceToolbar,
- toolbar1: data.amsTinymceToolbar1 === false ? false : data.amsTinymceToolbar1 ||
- "undo redo | pastetext | styleselect | bold italic | alignleft " +
- "aligncenter alignright alignjustify | bullist numlist " +
- "outdent indent",
- toolbar2: data.amsTinymceToolbar2 === false ? false : data.amsTinymceToolbar2 ||
- "forecolor backcolor emoticons | charmap link image media | " +
- "fullscreen preview print | code",
- content_css: data.amsTinymceContentCss,
- formats: data.amsTinymceFormats,
- style_formats: data.amsTinymceStyleFormats,
- block_formats: data.amsTinymceBlockFormats,
- valid_classes: data.amsTinymceValidClasses,
- image_advtab: true,
- image_list: ams.getFunctionByName(data.amsTinymceImageList) || data.amsTinymceImageList,
- image_class_list: data.amsTinymceImageClassList,
- link_list: ams.getFunctionByName(data.amsTinymceLinkList) || data.amsTinymceLinkList,
- link_class_list: data.amsTinymceLinkClassList,
- paste_as_text: data.amsTinymcePasteAsText === undefined ? true : data.amsTinymcePasteAsText,
- paste_auto_cleanup_on_paste: data.amsTinymcePasteAutoCleanup === undefined ? true : data.amsTinymcePasteAutoCleanup,
- paste_strip_class_attributes: data.amsTinymcePasteStripClassAttributes || 'all',
- paste_remove_spans: data.amsTinymcePaseRemoveSpans === undefined ? true : data.amsTinymcePasteRemoveSpans,
- paste_remove_styles: data.amsTinymcePasteRemoveStyles === undefined ? true : data.amsTinymcePasteRemoveStyles,
- height: data.amsTinymceHeight || 50,
- min_height: 50,
- resize: true,
- autoresize_min_height: 50,
- autoresize_max_height: 500
- };
- if (data.amsTinymceExternalPlugins) {
- var names = data.amsTinymceExternalPlugins.split(/\s+/);
- for (var index in names) {
- if (!names.hasOwnProperty(index)) {
- continue;
- }
- var pluginSrc = editor.data('ams-tinymce-plugin-' + names[index]);
- tinymce.PluginManager.load(names[index], ams.getSource(pluginSrc));
- }
- }
- var settings = $.extend({}, dataOptions, data.amsTinymceOptions);
- settings = ams.executeFunctionByName(data.amsTinymceInitCallback, editor, settings) || settings;
- var plugin = editor.tinymce(settings);
- ams.executeFunctionByName(data.amsTinymceAfterInitCallback, editor, plugin, settings);
- });
- }
-
- if (first_load) {
- ams.getScript(baseURL + '/jquery.tinymce' + ams.devext + '.js', function() {
- tinymce.baseURL = baseURL;
- tinymce.suffix = ams.devext;
- ams.skin.registerCleanCallback(cleanEditors);
- initEditors();
- });
- } else {
- initEditors();
- }
- });
+ ams.ajax && ams.ajax.check(window.tinymce,
+ baseURL + '/tinymce' + ams.devext + '.js',
+ function(first_load) {
+
+ function initEditors() {
+ editors.each(function() {
+ var editor = $(this);
+ var data = editor.data();
+ var dataOptions = {
+ theme: data.amsTinymceTheme || "modern",
+ language: ams.lang,
+ menubar: data.amsTinymceMenubar !== false,
+ statusbar: data.amsTinymceStatusbar !== false,
+ plugins: data.amsTinymcePlugins || [
+ "advlist autosave autolink lists link charmap print preview hr anchor pagebreak",
+ "searchreplace wordcount visualblocks visualchars code fullscreen",
+ "insertdatetime nonbreaking save table contextmenu directionality",
+ "emoticons paste textcolor colorpicker textpattern autoresize"
+ ],
+ toolbar: data.amsTinymceToolbar,
+ toolbar1: data.amsTinymceToolbar1 === false ? false : data.amsTinymceToolbar1 ||
+ "undo redo | pastetext | styleselect | bold italic | alignleft " +
+ "aligncenter alignright alignjustify | bullist numlist " +
+ "outdent indent",
+ toolbar2: data.amsTinymceToolbar2 === false ? false : data.amsTinymceToolbar2 ||
+ "forecolor backcolor emoticons | charmap link image media | " +
+ "fullscreen preview print | code",
+ content_css: data.amsTinymceContentCss,
+ formats: data.amsTinymceFormats,
+ style_formats: data.amsTinymceStyleFormats,
+ block_formats: data.amsTinymceBlockFormats,
+ valid_classes: data.amsTinymceValidClasses,
+ image_advtab: true,
+ image_list: ams.getFunctionByName(data.amsTinymceImageList) || data.amsTinymceImageList,
+ image_class_list: data.amsTinymceImageClassList,
+ link_list: ams.getFunctionByName(data.amsTinymceLinkList) || data.amsTinymceLinkList,
+ link_class_list: data.amsTinymceLinkClassList,
+ paste_as_text: data.amsTinymcePasteAsText === undefined ? true : data.amsTinymcePasteAsText,
+ paste_auto_cleanup_on_paste: data.amsTinymcePasteAutoCleanup === undefined ? true : data.amsTinymcePasteAutoCleanup,
+ paste_strip_class_attributes: data.amsTinymcePasteStripClassAttributes || 'all',
+ paste_remove_spans: data.amsTinymcePaseRemoveSpans === undefined ? true : data.amsTinymcePasteRemoveSpans,
+ paste_remove_styles: data.amsTinymcePasteRemoveStyles === undefined ? true : data.amsTinymcePasteRemoveStyles,
+ height: data.amsTinymceHeight || 50,
+ min_height: 50,
+ resize: true,
+ autoresize_min_height: 50,
+ autoresize_max_height: 500
+ };
+ if (data.amsTinymceExternalPlugins) {
+ var names = data.amsTinymceExternalPlugins.split(/\s+/);
+ for (var index in names) {
+ if (!names.hasOwnProperty(index)) {
+ continue;
+ }
+ var pluginSrc = editor.data('ams-tinymce-plugin-' + names[index]);
+ tinymce.PluginManager.load(names[index], ams.getSource(pluginSrc));
+ }
+ }
+ var settings = $.extend({}, dataOptions, data.amsTinymceOptions);
+ settings = ams.executeFunctionByName(data.amsTinymceInitCallback, editor, settings) || settings;
+ var plugin = editor.tinymce(settings);
+ ams.executeFunctionByName(data.amsTinymceAfterInitCallback, editor, plugin, settings);
+ });
+ }
+
+ if (first_load) {
+ ams.getScript(baseURL + '/jquery.tinymce' + ams.devext + '.js', function() {
+ tinymce.baseURL = baseURL;
+ tinymce.suffix = ams.devext;
+ ams.skin && ams.skin.registerCleanCallback(cleanEditors);
+ initEditors();
+ });
+ } else {
+ initEditors();
+ }
+ });
}
},
@@ -4598,48 +4703,48 @@
imgareaselect: function(element) {
var images = $('.imgareaselect', element);
if (images.length > 0) {
- ams.ajax.check($.fn.imgAreaSelect,
- ams.baseURL + 'ext/jquery-imgareaselect-0.9.11-rc1' + ams.devext + '.js',
- function() {
- ams.getCSS(ams.baseURL + '../css/ext/jquery-imgareaselect' + ams.devext + '.css',
- 'jquery-imgareaselect',
- function() {
- images.each(function () {
- var image = $(this);
- var data = image.data();
- var parent = data.amsImgareaselectParent ? image.parents(data.amsImgareaselectParent) : 'body';
- var dataOptions = {
- instance: true,
- handles: true,
- parent: parent,
- x1: data.amsImgareaselectX1 || 0,
- y1: data.amsImgareaselectY1 || 0,
- x2: data.amsImgareaselectX2 || data.amsImgareaselectImageWidth,
- y2: data.amsImgareaselectY2 || data.amsImgareaselectImageHeight,
- imageWidth: data.amsImgareaselectImageWidth,
- imageHeight: data.amsImgareaselectImageHeight,
- minWidth: 128,
- minHeight: 128,
- aspectRatio: data.amsImgareaselectRatio,
- onSelectEnd: ams.getFunctionByName(data.amsImgareaselectSelectEnd) || function (img, selection) {
- var target = data.amsImgareaselectTargetField || 'image_';
- $('input[name="' + target + 'x1"]', parent).val(selection.x1);
- $('input[name="' + target + 'y1"]', parent).val(selection.y1);
- $('input[name="' + target + 'x2"]', parent).val(selection.x2);
- $('input[name="' + target + 'y2"]', parent).val(selection.y2);
- }
- };
- var settings = $.extend({}, dataOptions, data.amsImgareaselectOptions);
- settings = ams.executeFunctionByName(data.amsImgareaselectInitCallback, image, settings) || settings;
- var plugin = image.imgAreaSelect(settings);
- ams.executeFunctionByName(data.amsImgareaselectAfterInitCallback, image, plugin, settings);
- // Add update timeout when plug-in is displayed into a modal dialog
- setTimeout(function () {
- plugin.update();
- }, 250);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.imgAreaSelect,
+ ams.baseURL + 'ext/jquery-imgareaselect-0.9.11-rc1' + ams.devext + '.js',
+ function() {
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-imgareaselect' + ams.devext + '.css',
+ 'jquery-imgareaselect',
+ function() {
+ images.each(function() {
+ var image = $(this);
+ var data = image.data();
+ var parent = data.amsImgareaselectParent ? image.parents(data.amsImgareaselectParent) : 'body';
+ var dataOptions = {
+ instance: true,
+ handles: true,
+ parent: parent,
+ x1: data.amsImgareaselectX1 || 0,
+ y1: data.amsImgareaselectY1 || 0,
+ x2: data.amsImgareaselectX2 || data.amsImgareaselectImageWidth,
+ y2: data.amsImgareaselectY2 || data.amsImgareaselectImageHeight,
+ imageWidth: data.amsImgareaselectImageWidth,
+ imageHeight: data.amsImgareaselectImageHeight,
+ minWidth: 128,
+ minHeight: 128,
+ aspectRatio: data.amsImgareaselectRatio,
+ onSelectEnd: ams.getFunctionByName(data.amsImgareaselectSelectEnd) || function(img, selection) {
+ var target = data.amsImgareaselectTargetField || 'image_';
+ $('input[name="' + target + 'x1"]', parent).val(selection.x1);
+ $('input[name="' + target + 'y1"]', parent).val(selection.y1);
+ $('input[name="' + target + 'x2"]', parent).val(selection.x2);
+ $('input[name="' + target + 'y2"]', parent).val(selection.y2);
+ }
+ };
+ var settings = $.extend({}, dataOptions, data.amsImgareaselectOptions);
+ settings = ams.executeFunctionByName(data.amsImgareaselectInitCallback, image, settings) || settings;
+ var plugin = image.imgAreaSelect(settings);
+ ams.executeFunctionByName(data.amsImgareaselectAfterInitCallback, image, plugin, settings);
+ // Add update timeout when plug-in is displayed into a modal dialog
+ setTimeout(function() {
+ plugin.update();
+ }, 250);
+ });
+ });
+ });
}
},
@@ -4649,97 +4754,97 @@
fancybox: function(element) {
var fancyboxes = $('.fancybox', element);
if (fancyboxes.length > 0) {
- ams.ajax.check($.fn.fancybox,
- ams.baseURL + 'ext/jquery-fancybox-2.1.5' + ams.devext + '.js',
- function() {
- ams.getCSS(ams.baseURL + '../css/ext/jquery-fancybox-2.1.5' + ams.devext + '.css',
- 'jquery-fancybox',
- function() {
- fancyboxes.each(function () {
- var fancybox = $(this);
- var data = fancybox.data();
- var elements = fancybox;
- var index,
- helper;
- if (data.amsFancyboxElements) {
- elements = $(data.amsFancyboxElements, fancybox);
- }
- var helpers = (data.amsFancyboxHelpers || '').split(/\s+/);
- if (helpers.length > 0) {
- for (index = 0; index < helpers.length; index++) {
- helper = helpers[index];
- switch (helper) {
- case 'buttons':
- ams.ajax.check($.fancybox.helpers.buttons,
- ams.baseURL + 'ext/fancybox-helpers/fancybox-buttons' + ams.devext + '.js');
- break;
- case 'thumbs':
- ams.ajax.check($.fancybox.helpers.thumbs,
- ams.baseURL + 'ext/fancybox-helpers/fancybox-thumbs' + ams.devext + '.js');
- break;
- case 'media':
- ams.ajax.check($.fancybox.helpers.media,
- ams.baseURL + 'ext/fancybox-helpers/fancybox-media' + ams.devext + '.js');
- break;
- default:
- break;
- }
- }
- }
- var dataOptions = {
- type: data.amsFancyboxType,
- padding: data.amsFancyboxPadding || 10,
- margin: data.amsFancyboxMargin || 10,
- loop: data.amsFancyboxLoop,
- beforeLoad: ams.getFunctionByName(data.amsFancyboxBeforeLoad) || function () {
- var title;
- if (data.amsFancyboxTitleGetter) {
- title = ams.executeFunctionByName(data.amsFancyboxTitleGetter, this);
- }
- if (!title) {
- var content = $('*:first', this.element);
- title = content.attr('original-title') || content.attr('title');
- if (!title) {
- title = $(this.element).attr('original-title') || $(this.element).attr('title');
- }
- }
- this.title = title;
- },
- afterLoad: ams.getFunctionByName(data.amsFancyboxAfterLoad),
- helpers: {
- title: {
- type: 'inside'
- }
- }
- };
- if (helpers.length > 0) {
- for (index = 0; index < helpers.length; index++) {
- helper = helpers[index];
- switch (helper) {
- case 'buttons':
- dataOptions.helpers.buttons = {
- position: data.amsFancyboxButtonsPosition || 'top'
- };
- break;
- case 'thumbs':
- dataOptions.helpers.thumbs = {
- width: data.amsFancyboxThumbsWidth || 50,
- height: data.amsFancyboxThumbsHeight || 50
- };
- break;
- case 'media':
- dataOptions.helpers.media = true;
- break;
- }
- }
- }
- var settings = $.extend({}, dataOptions, data.amsFancyboxOptions);
- settings = ams.executeFunctionByName(data.amsFancyboxInitCallback, fancybox, settings) || settings;
- var plugin = elements.fancybox(settings);
- ams.executeFunctionByName(data.amsFancyboxAfterInitCallback, fancybox, plugin, settings);
- });
- });
- });
+ ams.ajax && ams.ajax.check($.fn.fancybox,
+ ams.baseURL + 'ext/jquery-fancybox-2.1.5' + ams.devext + '.js',
+ function() {
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-fancybox-2.1.5' + ams.devext + '.css',
+ 'jquery-fancybox',
+ function() {
+ fancyboxes.each(function() {
+ var fancybox = $(this);
+ var data = fancybox.data();
+ var elements = fancybox;
+ var index,
+ helper;
+ if (data.amsFancyboxElements) {
+ elements = $(data.amsFancyboxElements, fancybox);
+ }
+ var helpers = (data.amsFancyboxHelpers || '').split(/\s+/);
+ if (helpers.length > 0) {
+ for (index = 0; index < helpers.length; index++) {
+ helper = helpers[index];
+ switch (helper) {
+ case 'buttons':
+ ams.ajax && ams.ajax.check($.fancybox.helpers.buttons,
+ ams.baseURL + 'ext/fancybox-helpers/fancybox-buttons' + ams.devext + '.js');
+ break;
+ case 'thumbs':
+ ams.ajax && ams.ajax.check($.fancybox.helpers.thumbs,
+ ams.baseURL + 'ext/fancybox-helpers/fancybox-thumbs' + ams.devext + '.js');
+ break;
+ case 'media':
+ ams.ajax && ams.ajax.check($.fancybox.helpers.media,
+ ams.baseURL + 'ext/fancybox-helpers/fancybox-media' + ams.devext + '.js');
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ var dataOptions = {
+ type: data.amsFancyboxType,
+ padding: data.amsFancyboxPadding || 10,
+ margin: data.amsFancyboxMargin || 10,
+ loop: data.amsFancyboxLoop,
+ beforeLoad: ams.getFunctionByName(data.amsFancyboxBeforeLoad) || function() {
+ var title;
+ if (data.amsFancyboxTitleGetter) {
+ title = ams.executeFunctionByName(data.amsFancyboxTitleGetter, this);
+ }
+ if (!title) {
+ var content = $('*:first', this.element);
+ title = content.attr('original-title') || content.attr('title');
+ if (!title) {
+ title = $(this.element).attr('original-title') || $(this.element).attr('title');
+ }
+ }
+ this.title = title;
+ },
+ afterLoad: ams.getFunctionByName(data.amsFancyboxAfterLoad),
+ helpers: {
+ title: {
+ type: 'inside'
+ }
+ }
+ };
+ if (helpers.length > 0) {
+ for (index = 0; index < helpers.length; index++) {
+ helper = helpers[index];
+ switch (helper) {
+ case 'buttons':
+ dataOptions.helpers.buttons = {
+ position: data.amsFancyboxButtonsPosition || 'top'
+ };
+ break;
+ case 'thumbs':
+ dataOptions.helpers.thumbs = {
+ width: data.amsFancyboxThumbsWidth || 50,
+ height: data.amsFancyboxThumbsHeight || 50
+ };
+ break;
+ case 'media':
+ dataOptions.helpers.media = true;
+ break;
+ }
+ }
+ }
+ var settings = $.extend({}, dataOptions, data.amsFancyboxOptions);
+ settings = ams.executeFunctionByName(data.amsFancyboxInitCallback, fancybox, settings) || settings;
+ var plugin = elements.fancybox(settings);
+ ams.executeFunctionByName(data.amsFancyboxAfterInitCallback, fancybox, plugin, settings);
+ });
+ });
+ });
}
},
@@ -4749,45 +4854,45 @@
chart: function(element) {
var charts = $('.chart', element);
if (charts.length > 0) {
- ams.ajax.check($.fn.plot,
- ams.baseURL + 'flot/jquery.flot' + ams.devext + '.js',
- function() {
- charts.each(function() {
-
- function checkPlugin(plugin) {
- for (var index in $.plot.plugins) {
- if ($.plot.plugins.hasOwnProperty(index)) {
- var pluginInfo = $.plot.plugins[index];
- if (pluginInfo.name === plugin) {
- return pluginInfo;
- }
- }
- }
- return null;
- }
-
- var chart = $(this);
- var data = chart.data();
- var dataOptions = {};
- var plugins = (data.amsChartPlugins || '').split(/\s+/);
- if (plugins.length > 0) {
- for (var index in plugins) {
- if (plugins.hasOwnProperty(index)) {
- var pluginName = plugins[index];
- if (!checkPlugin(pluginName)) {
- ams.getScript(ams.baseURL + 'flot/jquery.flot.' + pluginName + ams.devext + '.js');
- }
- }
- }
- }
- var settings = $.extend({}, dataOptions, data.amsChartOptions);
- settings = ams.executeFunctionByName(data.amsChartInitCallback, chart, settings) || settings;
- var chartData = data.amsChartData;
- chartData = ams.executeFunctionByName(data.amsChartInitData, chart, chartData) || chartData;
- var plugin = chart.plot(chartData, settings);
- ams.executeFunctionByName(data.amsChartAfterInitCallback, chart, plugin, settings);
- });
- });
+ ams.ajax && ams.ajax.check($.fn.plot,
+ ams.baseURL + 'flot/jquery.flot' + ams.devext + '.js',
+ function() {
+ charts.each(function() {
+
+ function checkPlugin(plugin) {
+ for (var index in $.plot.plugins) {
+ if ($.plot.plugins.hasOwnProperty(index)) {
+ var pluginInfo = $.plot.plugins[index];
+ if (pluginInfo.name === plugin) {
+ return pluginInfo;
+ }
+ }
+ }
+ return null;
+ }
+
+ var chart = $(this);
+ var data = chart.data();
+ var dataOptions = {};
+ var plugins = (data.amsChartPlugins || '').split(/\s+/);
+ if (plugins.length > 0) {
+ for (var index in plugins) {
+ if (plugins.hasOwnProperty(index)) {
+ var pluginName = plugins[index];
+ if (!checkPlugin(pluginName)) {
+ ams.getScript(ams.baseURL + 'flot/jquery.flot.' + pluginName + ams.devext + '.js');
+ }
+ }
+ }
+ }
+ var settings = $.extend({}, dataOptions, data.amsChartOptions);
+ settings = ams.executeFunctionByName(data.amsChartInitCallback, chart, settings) || settings;
+ var chartData = data.amsChartData;
+ chartData = ams.executeFunctionByName(data.amsChartInitData, chart, chartData) || chartData;
+ var plugin = chart.plot(chartData, settings);
+ ams.executeFunctionByName(data.amsChartAfterInitCallback, chart, plugin, settings);
+ });
+ });
}
},
@@ -4797,11 +4902,11 @@
graphs: function(element) {
var graphs = $('.sparkline', element);
if (graphs.length > 0) {
- ams.ajax.check(ams.graphs,
- ams.baseURL + 'myams-graphs' + ams.devext + '.js',
- function() {
- ams.graphs.init(graphs);
- });
+ ams.ajax && ams.ajax.check(ams.graphs,
+ ams.baseURL + 'myams-graphs' + ams.devext + '.js',
+ function() {
+ ams.graphs.init(graphs);
+ });
}
},
@@ -4811,29 +4916,29 @@
scrollbars: function(element) {
var scrollbars = $('.scrollbar', element);
if (scrollbars.length > 0) {
- ams.ajax.check($.event.special.mousewheel,
- ams.baseURL + 'ext/jquery-mousewheel.min.js',
- function() {
- ams.ajax.check($.fn.mCustomScrollbar,
- ams.baseURL + 'ext/jquery-mCustomScrollbar' + ams.devext + '.js',
- function() {
- ams.getCSS(ams.baseURL + '../css/ext/jquery-mCustomScrollbar.css',
- 'jquery-mCustomScrollbar',
- function () {
- scrollbars.each(function () {
- var scrollbar = $(this);
- var data = scrollbar.data();
- var dataOptions = {
- theme: data.amsScrollbarTheme || 'light'
- };
- var settings = $.extend({}, dataOptions, data.amsScrollbarOptions);
- settings = ams.executeFunctionByName(data.amsScrollbarInitCallback, scrollbar, settings) || settings;
- var plugin = scrollbar.mCustomScrollbar(settings);
- ams.executeFunctionByName(data.amsScrollbarAfterInitCallback, scrollbar, plugin, settings);
- });
- });
- });
- });
+ ams.ajax && ams.ajax.check($.event.special.mousewheel,
+ ams.baseURL + 'ext/jquery-mousewheel.min.js',
+ function() {
+ ams.ajax.check($.fn.mCustomScrollbar,
+ ams.baseURL + 'ext/jquery-mCustomScrollbar' + ams.devext + '.js',
+ function() {
+ ams.getCSS(ams.baseURL + '../css/ext/jquery-mCustomScrollbar.css',
+ 'jquery-mCustomScrollbar',
+ function() {
+ scrollbars.each(function() {
+ var scrollbar = $(this);
+ var data = scrollbar.data();
+ var dataOptions = {
+ theme: data.amsScrollbarTheme || 'light'
+ };
+ var settings = $.extend({}, dataOptions, data.amsScrollbarOptions);
+ settings = ams.executeFunctionByName(data.amsScrollbarInitCallback, scrollbar, settings) || settings;
+ var plugin = scrollbar.mCustomScrollbar(settings);
+ ams.executeFunctionByName(data.amsScrollbarAfterInitCallback, scrollbar, plugin, settings);
+ });
+ });
+ });
+ });
}
}
});
@@ -4941,7 +5046,7 @@
var message = data.amsAlertMessage || settings.message;
var subtitle = data.amsAlertSubtitle || settings.subtitle;
var margin = data.amsAlertMargin === undefined ? (settings.margin === undefined ? false : settings.margin) : data.amsAlertMargin;
- ams.skin.alert(parent, status, header, message, subtitle, margin);
+ ams.skin && ams.skin.alert(parent, status, header, message, subtitle, margin);
},
/**
@@ -4970,7 +5075,7 @@
});
var status = data.amsMessageboxStatus || dataOptions.status || 'info';
var callback = ams.getFunctionByName(data.amsMessageboxCallback || dataOptions.callback);
- ams.skin.messageBox(status, settings, callback);
+ ams.skin && ams.skin.messageBox(status, settings, callback);
},
/**
@@ -4999,7 +5104,7 @@
});
var status = data.amsSmallboxStatus || dataOptions.status || 'info';
var callback = ams.getFunctionByName(data.amsSmallboxCallback || dataOptions.callback);
- ams.skin.smallBox(status, settings, callback);
+ ams.skin && ams.skin.smallBox(status, settings, callback);
}
};
@@ -5069,7 +5174,7 @@
deleteElement: function() {
return function() {
var link = $(this);
- ams.skin.bigBox({
+ ams.skin && ams.skin.bigBox({
title: ams.i18n.WARNING,
content: '<i class="text-danger fa fa-fw fa-bell"></i> ' + ams.i18n.DELETE_WARNING,
status: 'info',
@@ -5084,7 +5189,7 @@
}
var deleteTarget = tr.data('ams-delete-target') || table.data('ams-delete-target') || 'delete-element.json';
var objectName = tr.data('ams-element-name');
- ams.ajax.post(location + deleteTarget, {'object_name': objectName}, function(result, status) {
+ ams.ajax && ams.ajax.post(location + deleteTarget, {'object_name': objectName}, function(result, status) {
if (result.status === 'success') {
if (table.hasClass('datatable')) {
table.dataTable().fnDeleteRow(tr[0]);
@@ -5092,10 +5197,10 @@
tr.remove();
}
if (result.handle_json) {
- ams.ajax.handleJSON(result);
+ ams.ajax && ams.ajax.handleJSON(result);
}
} else {
- ams.ajax.handleJSON(result);
+ ams.ajax && ams.ajax.handleJSON(result);
}
});
}
@@ -5113,8 +5218,8 @@
var row = source.parents('tr').first();
var table = row.parents('table');
$('i', source).attr('class', 'fa fa-fw fa-spinner fa-pulse');
- ams.ajax.post(table.data('ams-location') + '/' +
- (cell.data('ams-attribute-switcher') || table.data('ams-attribute-switcher')),
+ ams.ajax && ams.ajax.post(table.data('ams-location') + '/' +
+ (cell.data('ams-attribute-switcher') || table.data('ams-attribute-switcher')),
{object_name: row.data('ams-element-name')},
function(result, status) {
if (result.visible) {
@@ -5137,8 +5242,8 @@
var row = source.parents('tr').first();
var table = row.parents('table');
$('i', source).attr('class', 'fa fa-fw fa-spinner fa-pulse');
- ams.ajax.post(table.data('ams-location') + '/' +
- (cell.data('ams-attribute-switcher') || table.data('ams-attribute-switcher')),
+ ams.ajax && ams.ajax.post(table.data('ams-location') + '/' +
+ (cell.data('ams-attribute-switcher') || table.data('ams-attribute-switcher')),
{object_name: row.data('ams-element-name')},
function(result, status) {
if (result[attribute] || result['on']) {
@@ -5189,7 +5294,7 @@
var sourceName = tr.data('ams-element-name');
switcher.removeClass('fa-plus-square-o')
.addClass('fa-cog fa-spin');
- ams.ajax.post(location + '/' + sourceName + '/' + treeNodesTarget, {
+ ams.ajax && ams.ajax.post(location + '/' + sourceName + '/' + treeNodesTarget, {
can_sort: !$('td.sorter', tr).is(':empty')
}, function(result, status) {
if (result.length > 0) {
@@ -5197,8 +5302,8 @@
for (var index = 0; index < result.length; index++) {
var new_row = $(result[index]);
new_row.insertAfter(old_row)
- .addClass('no-drag-handle');
- ams.initContent(new_row);
+ .addClass('no-drag-handle');
+ ams.initContent && ams.initContent(new_row);
old_row = new_row;
}
if (table.hasClass('table-dnd')) {
@@ -5206,7 +5311,7 @@
}
}
switcher.removeClass('fa-cog fa-spin')
- .addClass('fa-minus-square-o');
+ .addClass('fa-minus-square-o');
});
}
},
@@ -5222,14 +5327,14 @@
if (switcher.hasClass('fa-minus-square-o')) {
$('tr[data-ams-tree-node-parent-id]').filter('tr[data-ams-tree-node-parent-id!="' + tableID + '"]').remove();
$('i.switch', table).removeClass('fa-minus-square-o')
- .addClass('fa-plus-square-o');
+ .addClass('fa-plus-square-o');
} else {
var tr = $('tbody tr', table).first();
var location = table.data('ams-location') || '';
var target = table.data('ams-tree-nodes-target') || 'get-tree.json';
switcher.removeClass('fa-plus-square-o')
- .addClass('fa-cog fa-spin');
- ams.ajax.post(location + '/' + target, {
+ .addClass('fa-cog fa-spin');
+ ams.ajax && ams.ajax.post(location + '/' + target, {
can_sort: !$('td.sorter', tr).is(':empty')
}, function(result, status) {
$('tr[data-ams-tree-node-id]', table).remove();
@@ -5242,16 +5347,16 @@
new_row.insertAfter(old_row);
}
new_row.addClass('no-drag-handle');
- ams.initContent(new_row);
+ ams.initContent && ams.initContent(new_row);
old_row = new_row;
}
if (table.hasClass('table-dnd')) {
table.tableDnDUpdate();
}
$('i.switch', table).removeClass('fa-plus-square-o')
- .addClass('fa-minus-square-o');
+ .addClass('fa-minus-square-o');
switcher.removeClass('fa-cog fa-spin')
- .addClass('fa-minus-square-o');
+ .addClass('fa-minus-square-o');
});
}
},
@@ -5313,7 +5418,7 @@
}
// Call ordering target
var localTarget = ams.getFunctionByName(target);
- if (typeof(localTarget) === 'function') {
+ if (typeof (localTarget) === 'function') {
localTarget.call(table, dnd_table, post_data);
} else {
if (!target.startsWith(window.location.protocol)) {
@@ -5329,7 +5434,7 @@
order: JSON.stringify($('tr[data-ams-tree-node-id]').listattr('data-ams-tree-node-id')),
can_sort: !$('td.sorter', row).is(':empty')
};
- ams.ajax.post(target, post_data, function(result) {
+ ams.ajax && ams.ajax.post(target, post_data, function(result) {
function removeChildRows(rowID) {
var childs = $('tr[data-ams-tree-node-parent-id="' + rowID + '"]');
@@ -5361,7 +5466,7 @@
new_row.prependTo(body)
.addClass('no-drag-handle');
}
- ams.initContent(new_row);
+ ams.initContent && ams.initContent(new_row);
old_row = new_row;
}
}
@@ -5396,7 +5501,6 @@
*/
_setPageHeight: function() {
var mainHeight = $('#main').height();
- var menuHeight = ams.leftPanel.height();
var windowHeight = $(window).height() - ams.navbarHeight;
if (mainHeight > windowHeight) {
ams.root.css('min-height', mainHeight + ams.navbarHeight);
@@ -5422,16 +5526,16 @@
* Show/hide shortcut buttons
*/
_showShortcutButtons: function() {
- ams.shortcuts.animate({
- height: 'show'
- }, 200, 'easeOutCirc');
+ ams.shortcuts && ams.shortcuts.animate({
+ height: 'show'
+ }, 200, 'easeOutCirc');
ams.root.addClass('shortcut-on');
},
_hideShortcutButtons: function() {
- ams.shortcuts.animate({
- height: 'hide'
- }, 300, 'easeOutCirc');
+ ams.shortcuts && ams.shortcuts.animate({
+ height: 'hide'
+ }, 300, 'easeOutCirc');
ams.root.removeClass('shortcut-on');
},
@@ -5442,10 +5546,10 @@
var badge = $('.badge', '#user-activity >span');
if (parseInt(badge.text()) > 0) {
badge.removeClass("hidden")
- .addClass("bg-color-red bounceIn animated");
+ .addClass("bg-color-red bounceIn animated");
} else {
badge.addClass("hidden")
- .removeClass("bg-color-red bounceIn animated");
+ .removeClass("bg-color-red bounceIn animated");
}
},
@@ -5465,7 +5569,7 @@
var target = $('[id="' + options.object_id + '"]');
target.replaceWith($(options.content));
target = $('[id="' + options.object_id + '"]');
- ams.initContent(target);
+ ams.initContent && ams.initContent(target);
return target;
},
@@ -5487,7 +5591,7 @@
}
var label = widget.parents('.input').last();
label.html(options.content);
- ams.initContent(label);
+ ams.initContent && ams.initContent(label);
return label;
},
@@ -5498,7 +5602,7 @@
var widget = $('[id="' + options.object_id + '"]').parents('.ams-widget:first');
widget.replaceWith($(options.table));
widget = $('[id="' + options.object_id + '"]').parents('.ams-widget:first');
- ams.initContent(widget);
+ ams.initContent && ams.initContent(widget);
return widget;
},
@@ -5508,9 +5612,11 @@
*/
refreshSwitchedTable: function(options) {
var widget = ams.skin.refreshTable(options);
- var legend = widget.siblings('legend');
- if (legend.parents('fieldset:first').hasClass('switched')) {
- legend.click();
+ if (widget) {
+ var legend = widget.siblings('legend');
+ if (legend.parents('fieldset:first').hasClass('switched')) {
+ legend.click();
+ }
}
},
@@ -5522,7 +5628,7 @@
var table = tr.parents('table').first();
var new_tr = $(options.row);
tr.replaceWith(new_tr);
- ams.initContent(new_tr);
+ ams.initContent && ams.initContent(new_tr);
if (table.hasClass('table-dnd')) {
new_tr.addClass('no-drag-handle');
table.tableDnDUpdate();
@@ -5542,7 +5648,7 @@
if (index > -1) {
var cell = $($('td', tr).get(index));
cell.html(options.cell);
- ams.initContent(cell);
+ ams.initContent && ams.initContent(cell);
}
},
@@ -5555,21 +5661,21 @@
if (switcher.hasClass('fa-plus-square-o')) {
var container = datatype.parents('table');
innerdiv.html('<h1 class="loading"><i class="fa fa-gear fa-spin"></i></h1>');
- ams.ajax.post(container.data('ams-location') + '/' + source.data('ams-switch-handler'),
- {object_name: datatype.data('ams-element-name')},
- function (result) {
- innerdiv.html(result);
- if (result) {
- ams.initContent(innerdiv);
- switcher.removeClass('fa-plus-square-o')
- .addClass('fa-minus-square-o');
- }
- });
+ ams.ajax && ams.ajax.post(container.data('ams-location') + '/' + source.data('ams-switch-handler'),
+ {object_name: datatype.data('ams-element-name')},
+ function(result) {
+ innerdiv.html(result);
+ if (result) {
+ ams.initContent && ams.initContent(innerdiv);
+ switcher.removeClass('fa-plus-square-o')
+ .addClass('fa-minus-square-o');
+ }
+ });
} else {
ams.skin.cleanContainer(innerdiv);
innerdiv.empty();
switcher.removeClass('fa-minus-square-o')
- .addClass('fa-plus-square-o');
+ .addClass('fa-plus-square-o');
}
},
@@ -5580,22 +5686,22 @@
if (ams.enableWidgets) {
var widgets = $('.ams-widget', element);
if (widgets.length > 0) {
- ams.ajax.check($.fn.MyAMSWidget,
- ams.baseURL + 'myams-widgets' + ams.devext + '.js',
- function () {
- widgets.each(function () {
- var widget = $(this);
- var data = widget.data();
- var dataOptions = {
- deleteSettingsKey: '#deletesettingskey-options',
- deletePositionKey: '#deletepositionkey-options'
- };
- var settings = $.extend({}, dataOptions, data.amsWidgetOptions);
- settings = ams.executeFunctionByName(data.amsWidgetInitcallback, widget, settings) || settings;
- widget.MyAMSWidget(settings);
- });
- globals.MyAMSWidget.initWidgetsGrid($('.ams-widget-grid', element));
- });
+ ams.ajax && ams.ajax.check($.fn.MyAMSWidget,
+ ams.baseURL + 'myams-widgets' + ams.devext + '.js',
+ function() {
+ widgets.each(function() {
+ var widget = $(this);
+ var data = widget.data();
+ var dataOptions = {
+ deleteSettingsKey: '#deletesettingskey-options',
+ deletePositionKey: '#deletepositionkey-options'
+ };
+ var settings = $.extend({}, dataOptions, data.amsWidgetOptions);
+ settings = ams.executeFunctionByName(data.amsWidgetInitcallback, widget, settings) || settings;
+ widget.MyAMSWidget(settings);
+ });
+ globals.MyAMSWidget.initWidgetsGrid($('.ams-widget-grid', element));
+ });
}
}
},
@@ -5627,7 +5733,7 @@
'<i class="fa fa-fw fa-warning"></i> ' + header +
'</h4>' +
(subtitle ? ('<p>' + subtitle + '</p>') : '');
- if (typeof(message) === 'string') {
+ if (typeof (message) === 'string') {
content += '<ul><li>' + message + '</li></ul>';
} else if (message) {
content += '<ul>';
@@ -5650,73 +5756,73 @@
* Big message box
*/
bigBox: function(options, callback) {
- ams.ajax.check(ams.notify,
- ams.baseURL + 'myams-notify' + ams.devext + '.js',
- function() {
- ams.notify.messageBox(options, callback);
- });
+ ams.ajax && ams.ajax.check(ams.notify,
+ ams.baseURL + 'myams-notify' + ams.devext + '.js',
+ function() {
+ ams.notify.messageBox(options, callback);
+ });
},
/**
* Medium notification message box, displayed on page's bottom right
*/
messageBox: function(status, options, callback) {
- if (typeof(status) === 'object') {
+ if (typeof (status) === 'object') {
callback = options;
options = status || {};
status = 'info';
}
- ams.ajax.check(ams.notify,
- ams.baseURL + 'myams-notify' + ams.devext + '.js',
- function() {
- switch (status) {
- case 'error':
- case 'danger':
- options.color = '#C46A69';
- break;
- case 'warning':
- options.color = '#C79121';
- break;
- case 'success':
- options.color = '#739E73';
- break;
- default:
- options.color = options.color || '#3276B1';
- }
- options.sound = false;
- ams.notify.bigBox(options, callback);
- });
+ ams.ajax && ams.ajax.check(ams.notify,
+ ams.baseURL + 'myams-notify' + ams.devext + '.js',
+ function() {
+ switch (status) {
+ case 'error':
+ case 'danger':
+ options.color = '#C46A69';
+ break;
+ case 'warning':
+ options.color = '#C79121';
+ break;
+ case 'success':
+ options.color = '#739E73';
+ break;
+ default:
+ options.color = options.color || '#3276B1';
+ }
+ options.sound = false;
+ ams.notify.bigBox(options, callback);
+ });
},
/**
* Small notification message box, displayed on page's top right
*/
smallBox: function(status, options, callback) {
- if (typeof(status) === 'object') {
+ if (typeof (status) === 'object') {
callback = options;
options = status || {};
status = 'info';
}
- ams.ajax.check(ams.notify,
- ams.baseURL + 'myams-notify' + ams.devext + '.js',
- function () {
- switch (status) {
- case 'error':
- case 'danger':
- options.color = '#C46A69';
- break;
- case 'warning':
- options.color = '#C79121';
- break;
- case 'success':
- options.color = '#739E73';
- break;
- default:
- options.color = options.color || '#3276B1';
- }
- options.sound = false;
- ams.notify.smallBox(options, callback);
- });
+ ams.ajax && ams.ajax.check(ams.notify,
+ ams.baseURL + 'myams-notify' + ams.devext + '.js',
+ function() {
+ switch (status) {
+ case 'error':
+ case 'danger':
+ options.color = '#C46A69';
+ break;
+ case 'warning':
+ options.color = '#C79121';
+ break;
+ case 'success':
+ options.color = '#739E73';
+ break;
+ default:
+ options.color = options.color || '#3276B1';
+ }
+ options.sound = false;
+ ams.notify.smallBox(options, callback);
+ });
},
/**
@@ -5726,20 +5832,20 @@
* @param options: scroll options
*/
scrollTo: function(element, options) {
- ams.ajax.check($.scrollTo,
- ams.baseURL + 'ext/jquery-scrollto-2.1.2' + ams.devext + '.js',
- function() {
- var body = $('body');
- var offset = options.offset || 0;
- if (body.hasClass('fixed-header')) {
- offset -= $('#header').height();
- }
- if (body.hasClass('fixed-ribbon')) {
- offset -= $('#ribbon').height();
- }
- options = $.extend({}, options, {offset: offset});
- $.scrollTo(element, options);
- });
+ ams.ajax && ams.ajax.check($.scrollTo,
+ ams.baseURL + 'ext/jquery-scrollto-2.1.2' + ams.devext + '.js',
+ function() {
+ var body = $('body');
+ var offset = options.offset || 0;
+ if (body.hasClass('fixed-header')) {
+ offset -= $('#header').height();
+ }
+ if (body.hasClass('fixed-ribbon')) {
+ offset -= $('#ribbon').height();
+ }
+ options = $.extend({}, options, {offset: offset});
+ $.scrollTo(element, options);
+ });
},
/**
@@ -5750,8 +5856,8 @@
$('li', crumb).not('.parent').remove();
if (!$('li', crumb).exists()) {
crumb.append($('<li></li>').append($('<a></a>').text(ams.i18n.HOME)
- .addClass('padding-right-5')
- .attr('href', $('nav a[href!="#"]:first').attr('href'))));
+ .addClass('padding-right-5')
+ .attr('href', $('nav a[href!="#"]:first').attr('href'))));
}
$('LI.active >A', 'nav').each(function() {
var menu = $(this);
@@ -5761,8 +5867,8 @@
.end()
.text());
var item = $("<li></li>").append(menu.attr('href').replace(/^#/, '') ?
- $("<a></a>").html(body).attr('href', menu.attr('href'))
- : body);
+ $("<a></a>").html(body).attr('href', menu.attr('href'))
+ : body);
crumb.append(item);
});
},
@@ -5797,13 +5903,15 @@
if (menu.exists()) {
updateActiveMenus(menu);
}
- ams.skin.loadURL(url, container, {afterLoadCallback: function() {
- var prefix = $('html head title').data('ams-title-prefix');
- document.title = (prefix ? prefix + ' > ' : '') +
- ($('[data-ams-page-title]:first', container).data('ams-page-title') ||
- menu.attr('title') ||
- document.title);
- }});
+ ams.skin.loadURL(url, container, {
+ afterLoadCallback: function() {
+ var prefix = $('html head title').data('ams-title-prefix');
+ document.title = (prefix ? prefix + ' > ' : '') +
+ ($('[data-ams-page-title]:first', container).data('ams-page-title') ||
+ menu.attr('title') ||
+ document.title);
+ }
+ });
} else {
var activeUrl = $('[data-ams-active-menu]').data('ams-active-menu');
if (activeUrl) {
@@ -5855,7 +5963,7 @@
*/
cleanContainer: function(container) {
var callbacks = ams.skin._clean_callbacks;
- for (var index=0; index < callbacks.length; index++) {
+ for (var index = 0; index < callbacks.length; index++) {
callbacks[index].call(container);
}
},
@@ -5867,7 +5975,7 @@
if (url.startsWith('#')) {
url = url.substr(1);
}
- if (typeof(options) === 'function') {
+ if (typeof (options) === 'function') {
callback = options;
options = {};
} else if (options === undefined) {
@@ -5898,44 +6006,46 @@
if (callback) {
ams.executeFunctionByName(callback, this, data, status, request, options);
} else {
- var response = ams.ajax.getResponse(request);
- var dataType = response.contentType;
- var result = response.data;
- $('.loading', container).remove();
- switch (dataType) {
- case 'json':
- ams.ajax.handleJSON(result, container);
- break;
- case 'script':
- break;
- case 'xml':
- break;
- case 'html':
+ var response = ams.ajax && ams.ajax.getResponse(request);
+ if (response) {
+ var dataType = response.contentType;
+ var result = response.data;
+ $('.loading', container).remove();
+ switch (dataType) {
+ case 'json':
+ ams.ajax.handleJSON(result, container);
+ break;
+ case 'script':
+ break;
+ case 'xml':
+ break;
+ case 'html':
/* falls through */
- case 'text':
+ case 'text':
/* falls through */
- default:
- // Show and init container
- container.parents('.hidden').removeClass('hidden');
- $('.alert', container.parents('.alerts-container')).remove();
- container.css({opacity: '0.0'})
- .html(data)
- .removeClass('hidden')
- .delay(50)
- .animate({opacity: '1.0'}, 300);
- ams.initContent(container);
- ams.form.setFocus(container);
+ default:
+ // Show and init container
+ container.parents('.hidden').removeClass('hidden');
+ $('.alert', container.parents('.alerts-container')).remove();
+ container.css({opacity: '0.0'})
+ .html(data)
+ .removeClass('hidden')
+ .delay(50)
+ .animate({opacity: '1.0'}, 300);
+ ams.initContent && ams.initContent(container);
+ ams.form && ams.form.setFocus(container);
+ }
+ if (options && options.afterLoadCallback) {
+ ams.executeFunctionByName(options.afterLoadCallback, this, options.afterLoadCallbackOptions);
+ }
+ ams.stats && ams.stats.logPageview();
}
- if (options && options.afterLoadCallback) {
- ams.executeFunctionByName(options.afterLoadCallback, this, options.afterLoadCallbackOptions);
- }
- ams.stats.logPageview();
}
},
error: function(request, errorOptions, error) {
container.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> ' +
- ams.i18n.ERROR + error + '</h3>' +
- request.responseText);
+ ams.i18n.ERROR + error + '</h3>' +
+ request.responseText);
if (options && options.afterErrorCallback) {
ams.executeFunctionByName(options.afterErrorCallback, this);
}
@@ -5955,13 +6065,13 @@
switch (handlerType) {
case 'json':
var method = options.method || 'setUserLanguage';
- ams.jsonrpc.post(method, {lang: lang}, function() {
+ ams.jsonrpc && ams.jsonrpc.post(method, {lang: lang}, function() {
window.location.reload(true);
});
break;
case 'ajax':
var href = options.href || 'setUserLanguage';
- ams.ajax.post(href, {lang: lang}, function() {
+ ams.ajax && ams.ajax.post(href, {lang: lang}, function() {
window.location.reload(true);
});
break;
@@ -6052,8 +6162,8 @@
}
}
},
- progress: ams.ajax.progress,
- progressUpload: ams.ajax.progress,
+ progress: ams.ajax && ams.ajax.progress,
+ progressUpload: ams.ajax && ams.ajax.progress,
xhr: function() {
var request = xhr();
if (request && (typeof(request.addEventListener) === "function")) {
@@ -6067,9 +6177,9 @@
return request;
}
});
- $(document).ajaxStart(ams.ajax.start);
- $(document).ajaxStop(ams.ajax.stop);
- $(document).ajaxError(ams.error.ajax);
+ $(document).ajaxStart(ams.ajax && ams.ajax.start);
+ $(document).ajaxStop(ams.ajax && ams.ajax.stop);
+ $(document).ajaxError(ams.error && ams.error.ajax);
// Check for minified state in local storage
var state = globals.localStorage && globals.localStorage.getItem('window-state');
@@ -6085,32 +6195,32 @@
ams.root.addClass('mobile-detected');
ams.device = 'mobile';
if (ams.enableFastclick) {
- ams.ajax.check($.fn.noClickDelay,
- ams.baseURL + '/ext/jquery-smartclick' + ams.devext + '.js',
- function() {
- $('NAV UL A').noClickDelay();
- $('A', '#hide-menu').noClickDelay();
- });
+ ams.ajax && ams.ajax.check($.fn.noClickDelay,
+ ams.baseURL + '/ext/jquery-smartclick' + ams.devext + '.js',
+ function() {
+ $('NAV UL A').noClickDelay();
+ $('A', '#hide-menu').noClickDelay();
+ });
}
}
// Switch shortcuts
$('#show-shortcuts').click(function(e) {
if (ams.shortcuts.is(":visible")) {
- ams.skin._hideShortcutButtons();
+ ams.skin && ams.skin._hideShortcutButtons();
} else {
- ams.skin._showShortcutButtons();
+ ams.skin && ams.skin._showShortcutButtons();
}
e.preventDefault();
});
ams.shortcuts.click(function(e) {
- ams.skin._hideShortcutButtons();
+ ams.skin && ams.skin._hideShortcutButtons();
});
$(document).mouseup(function(e) {
if (!ams.shortcuts.is(e.target) &&
ams.shortcuts.has(e.target).length === 0) {
- ams.skin._hideShortcutButtons();
+ ams.skin && ams.skin._hideShortcutButtons();
}
});
@@ -6137,7 +6247,7 @@
}
e.preventDefault();
});
- ams.skin.checkNotification();
+ ams.skin && ams.skin.checkNotification();
$(document).mouseup(function(e) {
var dropdown = $('.ajax-dropdown');
@@ -6162,7 +6272,7 @@
href.call(this);
} else {
var container = $('.ajax-notifications');
- ams.skin.loadURL(href, container);
+ ams.skin && ams.skin.loadURL(href, container);
}
}
});
@@ -6174,7 +6284,7 @@
//get the link
ams.loginURL = $(this).attr('href');
// ask verification
- ams.skin.bigBox({
+ ams.skin && ams.skin.bigBox({
title : "<i class='fa fa-sign-out txt-color-orangeDark'></i> " + ams.i18n.LOGOUT +
" <span class='txt-color-orangeDark'><strong>" + $('#show-shortcut').text() + "</strong></span> ?",
content : ams.i18n.LOGOUT_COMMENT,
@@ -6223,7 +6333,7 @@
// Reset widgets
$('#refresh').click(function(e) {
- ams.skin.bigBox({
+ ams.skin && ams.skin.bigBox({
title: "<i class='fa fa-refresh' style='color: green'></i> " + ams.i18n.CLEAR_STORAGE_TITLE,
content: ams.i18n.CLEAR_STORAGE_CONTENT,
buttons: '['+ams.i18n.BTN_CANCEL+']['+ams.i18n.BTN_OK+']'
@@ -6247,17 +6357,17 @@
});
// Resize events
- ams.ajax.check($.resize,
- ams.baseURL + 'ext/jquery-resize' + ams.devext + '.js',
- function() {
- $('#main').resize(function() {
- ams.skin._setPageHeight();
- ams.skin._checkMobileWidth();
- });
- nav.resize(function() {
- ams.skin._setPageHeight();
- });
- });
+ ams.ajax && ams.ajax.check($.resize,
+ ams.baseURL + 'ext/jquery-resize' + ams.devext + '.js',
+ function() {
+ $('#main').resize(function() {
+ ams.skin._setPageHeight();
+ ams.skin._checkMobileWidth();
+ });
+ nav.resize(function() {
+ ams.skin._setPageHeight();
+ });
+ });
// Init AJAX navigation
if (ams.ajaxNav) {
@@ -6304,16 +6414,16 @@
} else {
var target = link.data('ams-target');
if (target) {
- ams.form.confirmChangedForm(target, function () {
- ams.skin.loadURL(href, target, link.data('ams-link-options'), link.data('ams-link-callback'));
+ ams.form && ams.form.confirmChangedForm(target, function () {
+ ams.skin && ams.skin.loadURL(href, target, link.data('ams-link-options'), link.data('ams-link-callback'));
});
} else {
- ams.form.confirmChangedForm(function () {
+ ams.form && ams.form.confirmChangedForm(function() {
if (href.startsWith('#')) {
if (href !== location.hash) {
if (ams.root.hasClass('mobile-view-activated')) {
ams.root.removeClass('hidden-menu');
- window.setTimeout(function () {
+ window.setTimeout(function() {
window.location.hash = href;
}, 50);
} else {
@@ -6332,19 +6442,19 @@
e.preventDefault();
var target = $(e.currentTarget);
window.open(target.attr('href'));
- ams.stats.logEvent(target.data('ams-stats-category') || 'Navigation',
- target.data('ams-stats-action') || 'External',
- target.data('ams-stats-label') || target.attr('href'));
+ ams.stats && ams.stats.logEvent(target.data('ams-stats-category') || 'Navigation',
+ target.data('ams-stats-action') || 'External',
+ target.data('ams-stats-label') || target.attr('href'));
});
$(document).on('click', 'a[target="_top"]', function(e) {
e.preventDefault();
- ams.form.confirmChangedForm(function() {
+ ams.form && ams.form.confirmChangedForm(function() {
window.location = $(e.currentTarget).attr('href');
});
});
// Check URL when hash changed
- $(window).on('hashchange', ams.skin.checkURL);
+ $(window).on('hashchange', ams.skin && ams.skin.checkURL);
}
// Initialize modal dialogs links
@@ -6362,7 +6472,7 @@
e.stopPropagation();
}
e.preventDefault();
- ams.dialog.open(source);
+ ams.dialog && ams.dialog.open(source);
if (source.parents('#shortcut').exists()) {
setTimeout(ams.skin._hideShortcutButtons, 300);
}
@@ -6465,7 +6575,7 @@
}
});
}, 10);
- ams.form.setFocus(form);
+ ams.form && ams.form.setFocus(form);
});
// Initialize custom reset handlers
@@ -6547,7 +6657,7 @@
return;
}
link.append('<i class="fa fa-spin fa-cog margin-left-5"></i>');
- ams.skin.loadURL(data.amsUrl, link.attr('href'), {
+ ams.skin && ams.skin.loadURL(data.amsUrl, link.attr('href'), {
afterLoadCallback: function() {
if (data.amsTabLoadOnce) {
link.data('ams-tab-loaded', true);
@@ -6564,7 +6674,7 @@
// Check modal form dialogs on close
$(document).on('hide.bs.modal', function(e) {
var modal = $(e.target);
- ams.form.confirmChangedForm(modal, function() {
+ ams.form && ams.form.confirmChangedForm(modal, function() {
// Confirm closing if OK
var bsModal = modal.data('modal') || modal.data('bs.modal');
if (bsModal) {
@@ -6580,18 +6690,18 @@
// Enable custom MyAMS refresh events
$(document).on('myams.refresh', function(event, options) {
- ams.executeFunctionByName(options.handler || ams.skin.refreshContent, event.target, options);
+ ams.executeFunctionByName(options.handler || (ams.skin && ams.skin.refreshContent), event.target, options);
});
// Init page content
ams.initContent(document);
if (ams.ajaxNav && nav.exists()) {
- ams.skin.checkURL();
+ ams.skin && ams.skin.checkURL();
}
- ams.form.setFocus(document);
+ ams.form && ams.form.setFocus(document);
// Add unload event listener to check for modified forms
- $(window).on('beforeunload', ams.form.checkBeforeUnload);
+ $(window).on('beforeunload', ams.form && ams.form.checkBeforeUnload);
};
@@ -6616,108 +6726,19 @@
});
// Init registered plug-ins and callbacks
- ams.plugins.init(element);
- ams.callbacks.init(element);
- ams.events.init(element);
- ams.form.init(element);
+ ams.plugins && ams.plugins.init(element);
+ ams.callbacks && ams.callbacks.init(element);
+ ams.events && ams.events.init(element);
+ ams.form && ams.form.init(element);
// Initialize widgets
if (ams.device === 'desktop') {
- ams.skin._initDesktopWidgets(element);
+ ams.skin && ams.skin._initDesktopWidgets(element);
} else {
- ams.skin._initMobileWidgets(element);
+ ams.skin && ams.skin._initMobileWidgets(element);
}
- ams.skin._setPageHeight();
-
- };
-
-
- /**
- * MyAMS locale strings
- */
- ams.i18n = {
-
- INFO: "Information",
- WARNING: "!! WARNING !!",
- ERROR: "ERROR: ",
-
- LOADING: "Loading...",
- PROGRESS: "Processing",
-
- 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",
- CLIPBOARD_CHARACTER_COPY_OK: "Character copied to clipboard",
- CLIPBOARD_TEXT_COPY_OK: "Text copied to clipboard",
-
- 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"
- }
-
- ams.plugins.i18n = {
- widgets: {},
- validate: {},
- datatables: {},
- fancybox: {
- ERROR: "Can't load requested content.",
- RETRY: "Please check URL or try again later.",
- CLOSE: "Close",
- NEXT: "Next",
- PREVIOUS: "Previous"
- },
- dndupload: {
- FILES_SELECTED: '{count} files selected',
- CHOOSE_FILE: 'Select file(s)',
- ADD_INFO: 'to add them to current folder,',
- DRAG_FILE: 'or drag and drop them here!',
- UPLOAD: 'Upload',
- UPLOADING: 'Uploading…',
- DONE: 'Done!',
- UPLOAD_MORE: 'Upload more?',
- ERROR: 'Error!',
- TRY_AGAIN: 'Try again?'
- }
+ ams.skin && ams.skin._setPageHeight();
+
};
--- a/src/pyams_skin/resources/js/myams.min.js Wed Dec 12 21:16:29 2018 +0100
+++ b/src/pyams_skin/resources/js/myams.min.js Thu Dec 13 14:28:29 2018 +0100
@@ -1,1 +1,1 @@
-"use strict";!function(o,a){var e=a.console;String.prototype.startsWith=function(e){var a=this.length,t=e.length;return!(a<t)&&this.substr(0,t)===e},String.prototype.endsWith=function(e){var a=this.length,t=e.length;return!(a<t)&&this.substr(a-t)===e},String.prototype.unserialize=function(e){for(var a=decodeURIComponent(this).split("&"),t={},n=0;n<a.length;n++){var s=a[n].split("=",2);t[s[0]]=s[1]}return t},Array.prototype.indexOf||(Array.prototype.indexOf=function(e,a){var t=this.length;for((a=(a=Number(a)||0)<0?Math.ceil(a):Math.floor(a))<0&&(a+=t);a<t;a++)if(a in this&&this[a]===e)return a;return-1}),o.expr[":"].hasvalue=function(e,a,t){return""!==o(e).val()},o.expr[":"].econtains=function(e,a,t){return(e.textContent||e.innerText||o(e).text()||"").toLowerCase()===t[3].toLowerCase()},o.expr[":"].withtext=function(e,a,t){return(e.textContent||e.innerText||o(e).text()||"")===t[3]},o.expr[":"].parents=function(e,a,t){return 0<o(e).parents(t[3]).length},void 0===o.scrollbarWidth&&(o.scrollbarWidth=function(){var e=o('<div style="width: 50px; height: 50px; overflow: auto"><div/></div>').appendTo("body"),a=e.children(),t=a.innerWidth()-a.height(99).innerWidth();return e.remove(),t}),o.fn.extend({exists:function(){return 0<o(this).length},objectOrParentWithClass:function(e){return this.hasClass(e)?this:this.parents("."+e)},listattr:function(e){var a=[];return this.each(function(){a.push(o(this).attr(e))}),a},style:function(e,a,t){if(void 0!==this.get(0)){var n=this.get(0).style;return void 0!==e?void 0!==a?(t=void 0!==t?t:"",n.setProperty(e,a,t),this):n.getPropertyValue(e):n}},removeClassPrefix:function(n){return this.each(function(e,a){var t=a.className.split(" ").map(function(e){return e.startsWith(n)?"":e});a.className=o.trim(t.join(" "))}),this}}),void 0===a.MyAMS&&(a.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var t,n=a.MyAMS,c=n;n.baseURL=(t=o('script[src*="/myams.js"], script[src*="/myams.min.js"], script[src*="/myams-core.js"], script[src*="/myams-core.min.js"], script[src*="/myams-require.js"], script[src*="/myams-require.min.js"]').attr("src"),c.devmode=t.indexOf(".min.js")<0,c.devext=c.devmode?"":".min",t.substring(0,t.lastIndexOf("/")+1)),n.log=function(){e&&e.debug&&e.debug(this,arguments)},n.getQueryVar=function(e,a){if(e.indexOf("?")<0)return!1;e.endsWith("&")||(e+="&");var t=new RegExp(".*?[&\\?]"+a+"=(.*?)&.*"),n=e.replace(t,"$1");return n!==e&&n},n.rgb2hex=function(e){return"#"+o.map(e.match(/\b(\d+)\b/g),function(e){return("0"+parseInt(e).toString(16)).slice(-2)}).join("")},n.generateId=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()+e()},n.generateUUID=function(){var t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var a=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?a:3&a|8).toString(16)})},n.getObject=function(e,a){if(e){if("string"!=typeof e)return e;var t=e.split(".");a=null==a?window:a;for(var n=0;n<t.length;n++)try{a=a[t[n]]}catch(e){return}return a}},n.getFunctionByName=function(e,a){if(void 0!==e){if("function"==typeof e)return e;var t=e.split("."),n=t.pop();a=null==a?window:a;for(var s=0;s<t.length;s++)try{a=a[t[s]]}catch(e){return}try{return a[n]}catch(e){return}}},n.executeFunctionByName=function(e,a){var t=c.getFunctionByName(e,window);if("function"==typeof t){var n=Array.prototype.slice.call(arguments,2);return t.apply(a,n)}},n.isInDOM=function(e){return!!(e=o(e)).exists()&&a.document.body.contains(e[0])},n.getSource=function(e){return e.replace(/{[^{}]*}/g,function(e){return c.getFunctionByName(e.substr(1,e.length-2))})},n.getScript=function(e,a,t,n){"object"==typeof a&&(n=t,t=a,a=null),void 0===t&&(t={});var s={dataType:"script",url:c.getSource(e),success:a,error:n||c.error.show,cache:!c.devmode,async:void 0===t.async?"function"==typeof a:t.async},i=o.extend({},s,t);return o.ajax(i)},n.getCSS=function(e,a,t,n){t&&(t=c.getFunctionByName(t));var s=o("HEAD"),i=o('style[data-ams-id="'+a+'"]',s);if(0===i.length){if(i=o("<style>").attr("data-ams-id",a).text('@import "'+c.getSource(e)+'";'),t)var r=setInterval(function(){try{i[0].sheet.cssRules;t.call(window,!0,n),clearInterval(r)}catch(e){}},10);i.appendTo(s)}else t&&t.call(window,!1,n)}}(jQuery,this),jQuery.UTF8={encode:function(e){e=e.replace(/\r\n/g,"\n");for(var a="",t=0;t<e.length;t++){var n=e.charCodeAt(t);n<128?a+=String.fromCharCode(n):(127<n&&n<2048?a+=String.fromCharCode(n>>6|192):(a+=String.fromCharCode(n>>12|224),a+=String.fromCharCode(n>>6&63|128)),a+=String.fromCharCode(63&n|128))}return a},decode:function(e){for(var a="",t=0,n=0,s=0,i=0;t<e.length;)(n=e.charCodeAt(t))<128?(a+=String.fromCharCode(n),t++):191<n&&n<224?(s=e.charCodeAt(t+1),a+=String.fromCharCode((31&n)<<6|63&s),t+=2):(s=e.charCodeAt(t+1),i=e.charCodeAt(t+2),a+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),t+=3);return a}},function(c,e){var n=e.MyAMS;c.fn.extend({contextMenu:function(r){function a(e,a,t){var n=c(window)[a](),s=c(r.menuSelector)[a](),i=e;return n<e+s&&s<e&&(i-=s),i}return this.each(function(){c("a",c(r.menuSelector)).each(function(){c(this).data("ams-context-menu",!0)}),c(this).on("contextmenu",function(e){if(!e.ctrlKey)return c(r.menuSelector).data("invokedOn",c(e.target)).show().css({position:"fixed",left:a(e.clientX,"width")-10,top:a(e.clientY,"height")-10}).off("click").on("click",function(e){c(this).hide();var a=c(this).data("invokedOn"),t=c(e.target);r.menuSelected.call(this,a,t),n.event.stop(e)}),!1}),c(document).click(function(){c(r.menuSelector).hide()})})},myams_menu:function(e){var o=c.extend({},{accordion:!0,speed:200,closedSign:'<em class="fa fa-angle-down"></em>',openedSign:'<em class="fa fa-angle-up"></em>'},e),t=c(this);t.find("LI").each(function(){var e=c(this);if(0<e.find("UL").size()){e.find("A:first").append("<b class='collapse-sign'>"+o.closedSign+"</b>");var a=e.find("A:first");"#"===a.attr("href")&&a.click(function(){return!1})}}),t.find("LI.active").each(function(){var e=c(this).parents("UL"),a=e.parent("LI");e.slideDown(o.speed),a.find("b:first").html(o.openedSign),a.addClass("open")}),t.find("LI A").on("click",function(){var e=c(this);if(!e.hasClass("active")){var n=e.attr("href").replace(/^#/,""),s=e.parent().find("UL");if(o.accordion){var i=e.parent().parents("UL"),r=t.find("UL:visible");r.each(function(a){var t=!0;if(i.each(function(e){if(i[e]===r[a])return t=!1}),t&&s!==r[a]){var e=c(r[a]);!n&&e.hasClass("active")||e.slideUp(o.speed,function(){c(this).parent("LI").removeClass("open").find("B:first").delay(o.speed).html(o.closedSign)})}})}var a=e.parent().find("UL:first");n||!a.is(":visible")||a.hasClass("active")?a.slideDown(o.speed,function(){e.parent("LI").addClass("open").find("B:first").delay(o.speed).html(o.openedSign)}):a.slideUp(o.speed,function(){e.parent("LI").removeClass("open").find("B:first").delay(o.speed).html(o.closedSign)})}})}})}(jQuery,this),function(e,a){a.MyAMS.event={stop:function(e){e||(e=window.event),e&&"string"!=typeof e&&(e.stopPropagation?(e.stopPropagation(),e.preventDefault()):(e.cancelBubble=!0,e.returnValue=!1))}}}(jQuery,this),function(n,s){var i=s.MyAMS;i.browser={getInternetExplorerVersion:function(){var e=-1;if("Microsoft Internet Explorer"===navigator.appName){var a=navigator.userAgent;null!==new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(a)&&(e=parseFloat(RegExp.$1))}return e},checkVersion:function(){var e="You're not using Windows Internet Explorer.",a=this.getInternetExplorerVersion();-1<a&&(e=8<=a?"You're using a recent copy of Windows Internet Explorer.":"You should upgrade your copy of Windows Internet Explorer."),s.alert&&s.alert(e)},isIE8orlower:function(){var e="0",a=this.getInternetExplorerVersion();return-1<a&&(e=9<=a?0:1),e},copyToClipboard:function(e){function t(e){var a=!1;if(window.clipboardData&&window.clipboardData.setData)a=clipboardData.setData("Text",e);else if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var t=n("<textarea>");t.val(e),t.css("position","fixed"),t.appendTo(n("body")),t.get(0).select();try{document.execCommand("copy"),a=!0}catch(e){console&&console.warn&&console.warn("Copy to clipboard failed.",e)}finally{t.remove()}}a?i.skin.smallBox("success",{title:1<e.length?i.i18n.CLIPBOARD_TEXT_COPY_OK:i.i18n.CLIPBOARD_CHARACTER_COPY_OK,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):s.prompt&&s.prompt(i.i18n.CLIPBOARD_COPY,e)}if(void 0===e)return function(){var e=n(this),a=e.text();e.parents(".btn-group").removeClass("open"),t(a)};t(e)}}}(jQuery,this),function(e,a){var r=a.MyAMS;r.error={ajax:function(e,a,t,n){if(!("abort"===n||a&&a.statusText&&"OK"===a.statusText.toUpperCase())){if("json"===(a=r.ajax.getResponse(a)).contentType)r.ajax.handleJSON(a.data);else{var s=n||e.statusText||e.type,i=a.responseText;r.skin.messageBox("error",{title:r.i18n.ERROR_OCCURED,content:"<h4>"+s+"</h4><p>"+(i||"")+"</p>",icon:"fa fa-warning animated shake",timeout:1e4})}console&&(console.error&&console.error(e),console.debug&&console.debug(a))}},show:function(e,a,t){if(t){var n=r.ajax.getResponse(e);"json"===n.contentType?r.ajax.handleJSON(n.data):r.skin.messageBox("error",{title:r.i18n.ERRORS_OCCURED,content:"<h4>"+a+"</h4><p>"+t+"</p>",icon:"fa fa-warning animated shake",timeout:1e4}),console&&(console.error&&console.error(t),console.debug&&console.debug(e))}}}}(jQuery,this),function(h,p){var g=p.MyAMS;g.ajax={check:function(e,a,s,t){function n(e,a){if(void 0!==s){s instanceof Array||(s=[s]);for(var t=0;t<s.length;t++){var n=g.getFunctionByName(s[t]);"function"==typeof n&&n(e,a)}}}s instanceof Array||"object"==typeof s&&(t=s,s=void 0);var i={async:"function"==typeof s},r=h.extend({},i,t);if(e instanceof Array){for(var o=[],c=0;c<e.length;c++)void 0===e[c]&&o.push(g.getScript(a[c],{async:!0}));0<o.length?h.when.apply(h,o).then(function(){n(!0,t)}):n(!1,t)}else void 0===e?"string"==typeof a&&g.getScript(a,function(){n(!0,t)},r):n(!1,t)},getAddr:function(e){var a=e||h("HTML HEAD BASE").attr("href")||window.location.href;return a.substr(0,a.lastIndexOf("/")+1)},start:function(){h("#ajax-gear").show()},stop:function(){h("#ajax-gear").hide()},progress:function(e){e.lengthComputable&&(e.loaded>=e.total||console&&console.log&&console.log(parseInt(e.loaded/e.total*100,10)+"%"))},getJSON:function(){return function(e){var a=e.url;delete e.url,g.ajax.post(a,e,function(e,a,t){g.ajax.handleJSON(e)})}},post:function(e,a,t,n){var s,i;s=e.startsWith(window.location.protocol)?e:this.getAddr()+e,"function"==typeof t?(n=t,t={}):t||(t={}),void 0===n&&(n=t.callback),"string"==typeof n&&(n=g.getFunctionByName(n)),delete t.callback;var r={url:s,type:"post",cache:!1,async:"function"==typeof n,data:h.param(a),dataType:"json",beforeSend:function(e,a){if(void 0!==p.Cookies){var t=Cookies.get(g.csrfCookieName);t&&e.setRequestHeader(g.csrfHeaderName,t)}},success:n||function(e){i=e.result}},o=h.extend({},r,t);return h.ajax(o),i},getResponse:function(a){var t,n,e=a.getResponseHeader("content-type");if(e)if(e.startsWith("application/javascript"))t="script",n=a.responseText;else if(e.startsWith("text/html"))t="html",n=a.responseText;else if(e.startsWith("text/xml"))t="xml",n=a.responseText;else if(n=a.responseJSON)t="json";else try{n=JSON.parse(a.responseText),t="json"}catch(e){n=a.responseText,t="text"}else t="json",n={status:"alert",alert:{title:g.i18n.ERROR_OCCURED,content:g.i18n.NO_SERVER_RESPONSE}};return{contentType:t,data:n}},handleJSON:function(e,a,t){var n,s,i,r,o,c,l,d=e.status;switch(d){case"alert":p.alert&&p.alert(e.alert.title+"\n\n"+e.alert.content);break;case"error":g.form.showErrors(a,e);break;case"info":case"success":void 0!==a&&(g.form.resetChanged(a),!1!==e.close_form&&g.dialog.close(a));break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":void 0!==a&&(g.form.resetChanged(a),!1!==e.close_form&&g.dialog.close(a));break;case"modal":g.dialog.open(e.location);break;case"reload":void 0!==a&&(g.form.resetChanged(a),!1!==e.close_form&&g.dialog.close(a)),(n=e.location||window.location.hash).startsWith("#")&&(n=n.substr(1));var m=h(e.target||t||"#content");g.skin.loadURL(n,m,{preLoadCallback:g.getFunctionByName(e.pre_reload)||function(){h("[data-ams-pre-reload]",m).each(function(){g.executeFunctionByName(h(this).data("ams-pre-reload"))})},preLoadCallbackOptions:e.pre_reload_options,afterLoadCallback:g.getFunctionByName(e.post_reload)||function(){h("[data-ams-post-reload]",m).each(function(){g.executeFunctionByName(h(this).data("ams-post-reload"))})},afterLoadCallbackOptions:e.post_reload_options});break;case"redirect":void 0!==a&&(g.form.resetChanged(a),!0===e.close_form&&g.dialog.close(a)),(n=e.location||window.location.href).endsWith("##")&&(n=n.replace(/##/,window.location.hash)),e.window?window.open(n,e.window,e.options):window.location.href===n?window.location.reload(!0):window.location.href=n;break;default:console&&console.log&&console.log("Unhandled status: "+d)}if(e.content&&(i=e.content,r=h(i.target||t||a||"#content"),!0===i.raw?r.text(i.text):(r.html(i.html),g.initContent(r)),i.keep_hidden||r.removeClass("hidden")),e.contents){var u=e.contents;for(s=0;s<u.length;s++)i=u[s],r=h(i.target),!0===i.raw?r.text(i.text):(r.html(i.html),g.initContent(r)),i.keep_hidden||r.removeClass("hidden")}if(e.message&&("string"==typeof(o=e.message)?"info"===d||"success"===d?g.skin.smallBox(d,{title:o,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):g.skin.alert(h(a||"#content"),d,o):g.skin.alert(h(o.target||t||a||"#content"),o.status||"success",o.header,o.body,o.subtitle)),e.smallbox&&("string"==typeof(o=e.smallbox)?g.skin.smallBox(e.smallbox_status||d,{title:e.smallbox,icon:e.smallbox_icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:e.smallbox_timeout||3e3}):g.skin.smallBox(o.status||d,{title:o.message,icon:o.icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:o.timeout||3e3})),e.messagebox)if("string"==typeof(o=e.messagebox))g.skin.messageBox("info",{title:g.i18n.ERROR_OCCURED,content:o,timeout:1e4});else{var f=o.status||"info";"error"===f&&a&&t&&g.executeFunctionByName(a.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",a,t),g.skin.messageBox(f,{title:o.title||g.i18n.ERROR_OCCURED,content:o.content,icon:o.icon,number:o.number,timeout:null===o.timeout?void 0:o.timeout||1e4})}if(e.event&&a.trigger(e.event,e.event_options),e.events)for(void 0===a&&(a=h(document)),s=0;s<e.events.length;s++)null!==(c=e.events[s])&&("string"==typeof c?a.trigger(c,e.events_options):a.trigger(c.event,c.options));if(e.callback&&g.executeFunctionByName(e.callback,a,e.options),e.callbacks)for(s=0;s<e.callbacks.length;s++)"function"==typeof(l=e.callbacks[s])?g.executeFunctionByName(l,a,l.options):g.executeFunctionByName(l.callback,a,l.options)}}}(jQuery,this),function(c,e){var l=e.MyAMS;l.jsonrpc={getAddr:function(e){var a=(e||c("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return a.substr(0,a.lastIndexOf("/")+1)},query:function(s,i,r,o){l.ajax.check(c.jsonRPC,l.baseURL+"ext/jquery-jsonrpc"+l.devext+".js",function(){"function"==typeof r?(o=r,r={}):r||(r={}),"undefined"===o&&(o=r.callback),"string"==typeof o&&(o=l.getFunctionByName(o)),delete r.callback;var a,e={};"string"==typeof s?e.query=s:"object"==typeof s&&c.extend(e,s),c.extend(e,r);var t={id:(new Date).getTime(),params:e,success:o||function(e){a=e},error:l.error.show},n=c.extend({},t,r);return c.jsonRPC.withOptions({endPoint:l.jsonrpc.getAddr(r.url),namespace:r.namespace,cache:!1},function(){c.jsonRPC.request(i,n)}),a})},post:function(n,s,i,r){l.ajax.check(c.jsonRPC,l.baseURL+"ext/jquery-jsonrpc"+l.devext+".js",function(){var a;"function"==typeof i?(r=i,i={}):i||(i={}),void 0===r&&(r=i.callback),"string"==typeof r&&(r=l.getFunctionByName(r)),delete i.callback;var e={id:(new Date).getTime(),params:s,success:r||function(e){a=e},error:l.error.show},t=c.extend({},e,i);return c.jsonRPC.withOptions({endPoint:l.jsonrpc.getAddr(i.url),namespace:i.namespace,cache:!1},function(){c.jsonRPC.request(n,t)}),a})}}}(jQuery,this),function(c,e){var l=e.MyAMS;l.xmlrpc={getAddr:function(e){var a=(e||c("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return a.substr(0,a.lastIndexOf("/")+1)},post:function(n,s,i,r,o){l.ajax.check(c.xmlrpc,l.baseURL+"ext/jquery-xmlrpc"+l.devext+".js",function(){var a;"function"==typeof r?(o=r,r={}):r||(r={}),void 0===o&&(o=r.callback),"string"==typeof o&&(o=l.getFunctionByName(o)),delete r.callback;var e={url:l.xmlrpc.getAddr(n),methodName:s,params:i,success:o||function(e){a=e},error:l.error.show},t=c.extend({},e,r);return c.xmlrpc(t),a})}}}(jQuery,this),function(F,j){var R=j.MyAMS;R.form={init:function(e){F("FORM",e).each(function(){var e=F(this);F('INPUT.select2[type="hidden"]',e).each(function(){var e=F(this);e.data("ams-select2-input-value",e.val())})}),(R.warnOnFormChange?F('FORM[data-ams-warn-on-change!="false"]',e):F('FORM[data-ams-warn-on-change="true"]',e)).each(function(){var e=F(this);F('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',e).each(function(){var e=F(this);if(!0!==e.data("ams-ignore-change")){var a=e.data("ams-changed-event")||"change";e.on(a,function(){R.form.setChanged(F(this).parents("FORM"))})}}),e.on("reset",function(){R.form.resetChanged(F(this))})})},setFocus:function(e){var a=F("[data-ams-focus-target]",e).first();a.exists()||(a=F("input, select",e).first()),a.exists()&&(a.hasClass("select2-input")&&(a=a.parents(".select2")),a.hasClass("select2")?setTimeout(function(){a.select2("focus"),!0===a.data("ams-focus-open")&&a.select2("open")},100):a.focus())},checkBeforeUnload:function(){if(F('FORM[data-ams-form-changed="true"]').exists())return R.i18n.FORM_CHANGED_WARNING},confirmChangedForm:function(a,t,e){"function"==typeof a&&(t=a,a=void 0),F('FORM[data-ams-form-changed="true"]',a).exists()?e?j.confirm(R.i18n.FORM_CHANGED_WARNING,R.i18n.WARNING)?t.call(a):e.call(a):R.skin.bigBox({title:R.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+R.i18n.FORM_CHANGED_WARNING,buttons:R.i18n.BTN_OK_CANCEL},function(e){e===R.i18n.BTN_OK&&t.call(a)}):t.call(a)},setChanged:function(e){e.attr("data-ams-form-changed",!0)},resetChanged:function(e){void 0!==e&&F(e).removeAttr("data-ams-form-changed")},submit:function(t,T,N){if(!(t=F(t)).exists())return!1;if("object"==typeof T&&(N=T,T=void 0),t.data("submitted"))return t.data("ams-form-hide-submitted")||R.skin.messageBox("warning",{title:R.i18n.WAIT,content:R.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:t.data("ams-form-alert-timeout")||5e3}),!1;if(!R.form._checkSubmitValidators(t))return!1;F(".alert-danger, SPAN.state-error",t).not(".persistent").remove(),F(".state-error",t).removeClassPrefix("state-");var e=F(t.data("ams-submit-button"));return e&&!e.data("ams-form-hide-loading")&&(e.data("ams-progress-content",e.html()),e.button("loading")),R.ajax.check(F.fn.ajaxSubmit,R.baseURL+"ext/jquery-form-3.49"+R.devext+".js",function(){function e(s,e){var i,a,t,n,r,o,c,l,d,m,u=s.data(),f=u.amsFormOptions;if(N&&(r=N.formDataInitCallback),r?delete N.formDataInitCallback:r=u.amsFormDataInitCallback,r){var h={};if(n=R.executeFunctionByName(r,s,h),h.veto)return(i=s.data("ams-submit-button"))&&i.button("reset"),R.form.finalizeSubmitFooter.call(s),!1}else n=u.amsFormData||{};(i=F(s.data("ams-submit-button")))&&i.exists()?t=(a=i.data()).amsFormSubmitTarget:a={};var p=T||a.amsFormHandler||u.amsFormHandler||"";if(p.startsWith(window.location.protocol))m=p;else{var g=a.amsFormAction||s.attr("action").replace(/#/,"");m=g.startsWith(window.location.protocol)?g:R.ajax.getAddr()+g,m+=p}o=a.amsProgressHandler||u.amsProgressHandler||"",c=a.amsProgressInterval||u.amsProgressInterval||1e3,l=a.amsProgressCallback||u.amsProgressCallback,d=a.amsProgressEndCallback||u.amsProgressEndCallback;var b,v=null;N&&N.initSubmitTarget?R.executeFunctionByName(N.initSubmitTarget,s):u.amsFormInitSubmitTarget?(v=F(t||u.amsFormSubmitTarget||"#content"),R.executeFunctionByName(u.amsFormInitSubmit||"MyAMS.form.initSubmit",s,v)):u.amsFormHideSubmitFooter||R.executeFunctionByName(u.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",s),N&&(n=F.extend({},n,N.form_data)),o?n.progress_id=R.generateUUID():(b=void 0!==e.uuid)&&(m.indexOf("X-Progress-ID")<0&&(m+="?X-Progress-ID="+e.uuid),delete e.uuid);var y={url:m,type:"post",cache:!1,data:n,dataType:u.amsFormDatatype,beforeSerialize:function(){void 0!==j.tinyMCE&&j.tinyMCE.triggerSave()},beforeSubmit:function(e,a){a.data("submitted",!0)},error:function(e,a,t,n){v&&R.executeFunctionByName(u.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",n,v),R.form.resetAfterSubmit(n)},iframe:b},x=N&&N.downloadTarget||u.amsFormDownloadTarget;if(x){var C=F('iframe[name="'+x+'"]');C.exists()||(C=F("<iframe></iframe>").hide().attr("name",x).appendTo(F("body"))),y=F.extend({},y,{iframe:!0,iframeTarget:C,success:function(e,a,t,n){if(F(n).parents(".modal-dialog").exists())R.dialog.close(n);else{var s,i=n.data("ams-submit-button");i&&(s=i.data("ams-form-submit-callback")),s||(s=R.getFunctionByName(u.amsFormSubmitCallback)||R.form._submitCallback);try{s.call(n,e,a,t,n)}finally{R.form.resetAfterSubmit(n),R.form.resetChanged(n)}}}})}else y=F.extend({},y,{error:function(e,a,t,n){v&&R.executeFunctionByName(u.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",n,v),R.form.resetAfterSubmit(n)},success:function(e,a,t,n){var s,i=n.data("ams-submit-button");i&&(s=i.data("ams-form-submit-callback")),s||(s=R.getFunctionByName(u.amsFormSubmitCallback)||R.form._submitCallback);try{s.call(n,e,a,t,n)}finally{R.form.resetAfterSubmit(n),R.form.resetChanged(n)}},iframe:b});var k=F.extend({},y,e,f,N);if(o&&function(e,a){var t;function n(){clearInterval(t),R.form.resetAfterSubmit(s,i),i.html(i.data("ams-progress-content")),R.executeFunctionByName(d,s,i),R.form.resetChanged(s)}i.button("loading"),t=setInterval(function(){R.ajax.post(e,{progress_id:a},{error:n},R.getFunctionByName(l)||function(e,a){if("success"===a)if("running"===e.status)if(e.message)i.text(e.message);else{var t=i.data("ams-progress-text")||R.i18n.PROGRESS;e.current?t+=": "+e.current+"/ "+(e.length||100):t+="...",i.text(t)}else"finished"===e.status&&n();else n()})},c)}(o,n.progress_id),F(s).ajaxSubmit(k),x){var S=F(s).parents(".modal-dialog"),w=S.exists()&&i.exists()&&i.data("ams-keep-modal");S.exists()&&!0!==w?R.dialog.close(s):o||setTimeout(function(){R.form.resetAfterSubmit(s,i),R.form.resetChanged(s)},i.data("ams-form-reset-timeout")||2e3)}}if(!0!==t.data("ams-form-ignore-uploads")&&0<F('INPUT[type="file"]',t).length){R.ajax.check(F.progressBar,R.baseURL+"ext/jquery-progressbar"+R.devext+".js");var a=F.extend({},{uuid:F.progressBar.submit(t)});e(t,a)}else e(t,{})}),!1},initSubmit:function(e,a){var t=F(this),n='<i class="fa fa-3x fa-gear fa-spin"></i>';a||(a=t.data("ams-form-submit-message")),a&&(n+="<strong>"+a+"</strong>"),F(e).html('<div class="row margin-20"><div class="text-center">'+n+"</div></div>"),F(e).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(e){if(e.is(":visible")){var a=e.data("ams-submit-button");a&&a.button("reset"),R.form.finalizeSubmitFooter.call(e)}e.data("submitted",!1),e.removeData("ams-submit-button")},finalizeSubmitOnError:function(e){F("i",e).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(e){var a=F(this),t='<i class="fa fa-3x fa-gear fa-spin"></i>';e||(e=F(this).data("ams-form-submit-message")),e&&(t+='<strong class="submit-message align-top padding-left-10 margin-top-10">'+e+"</strong>");var n=F("footer",a);F("button",n).hide(),n.append('<div class="row"><div class="text-center">'+t+"</div></div>")},finalizeSubmitFooter:function(){var e=F(this),a=F("footer",e);a&&(F(".row",a).remove(),F("button",a).show())},_submitCallback:function(e,a,t,n){var s;n.is(":visible")&&(R.form.finalizeSubmitFooter.call(n),(s=n.data("ams-submit-button"))&&s.button("reset"));var i,r,o=n.data();if(o.amsFormDatatype)i=o.amsFormDatatype;else{var c=R.ajax.getResponse(t);i=c.contentType,e=c.data}switch(r=F(s?s.data("ams-form-submit-target")||o.amsFormSubmitTarget||"#content":o.amsFormSubmitTarget||"#content"),i){case"json":R.ajax.handleJSON(e,n,r);break;case"script":case"xml":break;case"html":case"text":default:R.form.resetChanged(n),s&&!0!==s.data("ams-keep-modal")&&R.dialog.close(n),r.exists()||(r=F("body")),r.parents(".hidden").removeClass("hidden"),F(".alert",r.parents(".alerts-container")).remove(),r.css({opacity:"0.0"}).html(e).delay(50).animate({opacity:"1.0"},300),R.initContent(r),R.form.setFocus(r)}var l=t.getResponseHeader("X-AMS-Callback");if(l){var d=t.getResponseHeader("X-AMS-Callback-Options");R.executeFunctionByName(l,n,void 0===d?{}:JSON.parse(d),t)}},_getSubmitValidators:function(e){var a=[],t=e.data("ams-form-validator");return t&&a.push([e,t]),F("[data-ams-form-validator]",e).each(function(){var e=F(this);a.push([e,e.data("ams-form-validator")])}),a},_checkSubmitValidators:function(e){var a=R.form._getSubmitValidators(e);if(!a.length)return!0;for(var t=[],n=!0,s=0;s<a.length;s++){var i=a[s],r=i[0],o=i[1],c=R.executeFunctionByName(o,e,r);!1===c?n=!1:"string"==typeof c?t.push(c):n.length&&0<n.length&&(t=t.concat(n))}if(0<t.length){var l=1===t.length?R.i18n.ERROR_OCCURED:R.i18n.ERRORS_OCCURED;return R.skin.alert(e,"danger",l,t),!1}return n},showErrors:function(e,a){var t;if("string"==typeof a)R.skin.alert(e,"error",R.i18n.ERROR_OCCURED,a);else if(a instanceof Array)t=1===a.length?R.i18n.ERROR_OCCURED:R.i18n.ERRORS_OCCURED,R.skin.alert(e,"error",t,a);else{F(".state-error",e).removeClass("state-error"),t=a.error_header||(a.widgets&&1<a.widgets.length?R.i18n.ERRORS_OCCURED:R.i18n.ERROR_OCCURED);var n,s=[];if(a.messages)for(n=0;n<a.messages.length;n++){var i=a.messages[n];i.header?s.push("<strong>"+i.header+"</strong><br />"+i.message):s.push(i.message||i)}if(a.widgets)for(n=0;n<a.widgets.length;n++){var r=a.widgets[n],o=F('[name="'+r.name+'"]',e);o.exists()||(o=F('[name="'+r.name+':list"]',e)),o.exists()?o.parents("label:first").removeClassPrefix("state-").addClass("state-error").after('<span for="name" class="state-error">'+r.message+"</span>"):r.label&&s.push(r.label+" : "+r.message);var c=o.parents(".tab-pane").index()+1;if(0<c){var l=F(".nav-tabs",F(o).parents(".tabforms"));F("li:nth-child("+c+")",l).removeClassPrefix("state-").addClass("state-error"),F("li.state-error:first a",e).click()}}R.skin.alert(F(".form-group:first",e),a.error_level||"error",t,s,a.error_message)}}}}(jQuery,this),function(p,e){var g=e.MyAMS;g.dialog={_shown_callbacks:[],registerShownCallback:function(e,a){var t,n;a&&(t=a.objectOrParentWithClass("modal-dialog")),t&&t.exists()?void 0===(n=t.data("shown-callbacks"))&&(n=[],t.data("shown-callbacks",n)):n=g.dialog._shown_callbacks,n.indexOf(e)<0&&n.push(e)},_hide_callbacks:[],registerHideCallback:function(e,a){var t,n;a&&(t=a.objectOrParentWithClass("modal-dialog")),t&&t.exists()?void 0===(n=t.data("hide-callbacks"))&&(n=[],t.data("hide-callbacks",n)):n=g.dialog._hide_callbacks,n.indexOf(e)<0&&n.push(e)},open:function(f,t,h){g.ajax.check(p.fn.modalmanager,g.baseURL+"ext/bootstrap-modalmanager"+g.devext+".js",function(){g.ajax.check(p.fn.modal.defaults,g.baseURL+"ext/bootstrap-modal"+g.devext+".js",function(e){var m,u;if(e&&(p(document).off("click.modal"),p.fn.modal.defaults.spinner=p.fn.modalmanager.defaults.spinner='<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="progress-bar" style="width: 100%;"></div></div></div>'),"string"==typeof f)m={},u=f;else{m=f.data(),u=f.attr("href")||m.amsUrl;var a=g.getFunctionByName(u);"function"==typeof a&&(u=a.call(f))}u&&(p("body").modalmanager("loading"),0===u.indexOf("#")?p(u).modal("show"):p.ajax({url:u,type:"get",cache:void 0!==m.amsAllowCache&&m.amsAllowCache,data:t,success:function(e,a,t){p("body").modalmanager("removeLoading");var n=g.ajax.getResponse(t),s=n.contentType,i=n.data;switch(s){case"json":g.ajax.handleJSON(i,p(p(f).data("ams-json-target")||"#content"));break;case"script":case"xml":break;case"html":case"text":default:var r=p(i),o=p(".modal-dialog",r.wrap("<div></div>").parent()),c=o.data()||{},l={backdrop:"static",overflow:c.amsModalOverflow||".modal-viewport",maxHeight:void 0===c.amsModalMaxHeight?function(){return p(window).height()-p(".modal-header",r).outerHeight(!0)-p("footer",r).outerHeight(!0)-85}:g.getFunctionByName(c.amsModalMaxHeight)},d=p.extend({},l,c.amsModalOptions);d=g.executeFunctionByName(c.amsModalInitCallback,o,d)||d,h&&(h.shown&&g.dialog.registerShownCallback(h.shown,r),h.hide&&g.dialog.registerHideCallback(h.hide,r)),p("<div>").addClass("modal fade").append(r).modal(d).on("shown",g.dialog.shown).on("hidden",g.dialog.hidden),g.initContent(r),!1!==m.amsLogEvent&&g.stats.logPageview(u)}}}))})})},shown:function(e){function a(e){var a=p(".scrollmarker.top",s),t=s.scrollTop();0<t?a.show():a.hide();var n=p(".scrollmarker.bottom",s);i+t>=s.get(0).scrollHeight?n.hide():n.show()}var t,n=e.target,s=p(".modal-viewport",n);if(s.exists()){var i=parseInt(s.css("max-height")),r=p.scrollbarWidth();"hidden"!==s.css("overflow")&&s.height()===i?(p("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",s.width()-r).hide().appendTo(s),p("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",i-20).css("width",s.width()-r).appendTo(s),s.scroll(a),s.off("resize").on("resize",a)):p(".scrollmarker",s).remove()}p("[data-ams-shown-callback]",n).each(function(){var e=g.getFunctionByName(p(this).data("ams-shown-callback"));e&&e.call(n,this)});var o=p(".modal-dialog",n).data("shown-callbacks");if(o)for(t=0;t<o.length;t++)o[t].call(n);if(o=g.dialog._shown_callbacks)for(t=0;t<o.length;t++)o[t].call(n);g.form.setFocus(n)},close:function(e){"string"==typeof e&&(e=p(e));var a=e.parents(".modal").data("modal");if(a){var t=p("body").data("modalmanager");t&&0<=t.getOpenModals().indexOf(a)&&a.hide()}},hidden:function(e){var a,t=e.target;g.skin.cleanContainer(t),p("[data-ams-hidden-callback]",t).each(function(){var e=g.getFunctionByName(p(this).data("ams-hidden-callback"));e&&e.call(t,this)});var n=p(".modal-dialog",t).data("hide-callbacks");if(n)for(a=0;a<n.length;a++)n[a].call(t);if(n=g.dialog._hide_callbacks)for(a=0;a<n.length;a++)n[a].call(t)}}}(jQuery,this),function(i,e){var r=e.MyAMS;r.helpers={sort:function(e,t){t||(t="weight"),e.children().sort(function(e,a){return+i(e).data(t)-+i(a).data(t)}).each(function(){e.append(this)})},select2ClearSelection:function(){var e=i(this),a=e.parents("label").first(),t=e.data("ams-select2-target");i('[name="'+t+'"]',a).data("select2").val("")},select2FormatSelection:function(e,a){e instanceof Array||(e=[e]),i(e).each(function(){"object"==typeof this?a.append(this.text):a.append(this)})},select2SelectAllHelper:function(){var e=i(this),a=e.parents("label").first(),t=e.data("ams-select2-target"),n=i('[name="'+t+'"]',a);"SELECT"===n.get(0).tagName?n.select2("val",i("option",n).listattr("value")):n.select2("data",n.data("ams-select2-data"))},select2QueryUrlResultsCallback:function(e,a,t){switch(e.status){case"error":r.skin.messageBox("error",{title:r.i18n.ERROR_OCCURED,content:"<h4>"+e.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":i(this).data("select2").dropdown.hide(),r.dialog.open(e.location);break;default:return{results:e.results||e,more:e.has_more||!1,context:e.context}}},select2QueryMethodSuccessCallback:function(e,a,t){var n=e.result;if("string"==typeof n)try{n=JSON.parse(n)}catch(e){}switch(n.status){case"error":r.skin.messageBox("error",{title:r.i18n.ERROR_OCCURED,content:"<h4>"+n.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":i(this).data("select2").dropdown.hide(),r.dialog.open(n.location);break;default:t.callback({results:n.results||n,more:n.has_more||!1,context:n.context})}},select2ChangeHelper:function(){var e=i(this),a=e.data(),t=i(a.amsSelect2HelperTarget);switch(a.amsSelect2HelperType){case"html":t.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>');var n={};n[a.amsSelect2HelperArgument||"value"]=e.val(),i.get(a.amsSelect2HelperUrl,n,r.getFunctionByName(a.amsSelect2HelperCallback)||function(e){e?(t.html(e),r.initContent(t)):t.empty()}).fail(function(){t.empty()});break;case"json-rpc":t.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>'),r.jsonrpc.post(a.amsSelect2HelperMethod,{value:e.val()},{url:a.amsSelect2HelperUrl},r.getFunctionByName(a.amsSelect2HelperCallback)||function(e){e.result?(t.html(e.result),r.initContent(t)):t.empty()});break;default:var s=a.amsSelect2HelperCallback;s&&r.executeFunctionByName(s,e,a)}},contextMenuHandler:function(e,a){"A"!==a.get(0).tagName&&(a=a.parents("a").first());var t=a.data();if("modal"===t.toggle)r.dialog.open(a);else{var n=a.attr("href")||t.amsUrl;if(!n||n.startsWith("javascript")||a.attr("target"))return;r.event.stop();var s=r.getFunctionByName(n);"function"==typeof s&&(n=s.call(a,e)),"function"==typeof n?n.call(a,e):(n=n.replace(/\%23/,"#"),(e=a.data("ams-target"))?r.form.confirmChangedForm(e,function(){r.skin.loadURL(n,e,a.data("ams-link-options"),a.data("ams-link-callback"))}):r.form.confirmChangedForm(function(){n.startsWith("#")?n!==location.hash&&(r.root.hasClass("mobile-view-activated")?(r.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=n},150)):window.location.hash=n):window.location=n}))}},datetimepickerDialogHiddenCallback:function(){i(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")},clearSearchTarget:function(){var e=i(this);if(!e.val()){var a=i(e).parents("form").first();i(a.data("ams-form-submit-target")).empty()}},setSEOStatus:function(){var e=i(this),a=e.siblings(".progress").children(".progress-bar"),t=Math.min(e.val().length,100),n="success";t<20||80<t?n="danger":(t<40||66<t)&&(n="warning"),a.removeClassPrefix("progress-bar").addClass("progress-bar").addClass("progress-bar-"+n).css("width",t+"%")}}}(jQuery,this),function(u,e){var f=e.MyAMS;f.plugins={enabled:{},init:function(i){f.plugins.initData(i);var t=[];u("[data-ams-plugins-disabled]",i).each(function(){for(var e=u(this).data("ams-plugins-disabled").split(/\s+/),a=0;a<e.length;a++)t.push(e[a])});var r,o,n={};function c(e,a){if(n.hasOwnProperty(e)){var t=n[e];t.css=t.css||a.css,t.callbacks.push({callback:a.callback,context:a.context}),a.register&&(t.register=!0),!1===a.async&&(t.async=!1)}else n[e]={src:a.src,css:a.css,callbacks:[{callback:a.callback,context:a.context}],register:a.register,async:a.async};a.css&&f.getCSS(a.css,e+"_css")}function e(e){var a,t,n=o.callbacks;if(n&&n.length){for(a=0;a<n.length;a++)if((t=n[a]).callback=f.getFunctionByName(t.callback),!1!==o.register){var s=f.plugins.enabled;s.hasOwnProperty(r)?s[r].push(t):s[r]=[t]}}else!1!==o.register&&(f.plugins.enabled[r]=null);if(!0!==e&&n&&n.length&&!1!==o.async)for(a=0;a<n.length;a++)t=n[a],f.executeFunctionByName(t.callback,i,t.context)}function a(){var e=f.plugins.enabled[r];for(s=0;s<e.length;s++){var a=e[s];a&&a.context&&!f.isInDOM(a.context)&&(e[s]=null)}}for(r in u("[data-ams-plugins]",i).each(function(){var e=u(this),a=e.data("ams-plugins");if("string"==typeof a)for(var t=e.data("ams-plugins").split(/\s+/),n=0;n<t.length;n++){r=t[n];var s={src:e.data("ams-plugin-"+r+"-src"),css:e.data("ams-plugin-"+r+"-css"),callback:e.data("ams-plugin-"+r+"-callback"),context:e,register:e.data("ams-plugin-"+r+"-register"),async:e.data("ams-plugin-"+r+"-async")};c(r,s)}else for(r in a)a.hasOwnProperty(r)&&c(r,a[r])}),n)n.hasOwnProperty(r)&&(o=n[r],void 0===f.plugins.enabled[r]?f.getScript(o.src,e,{async:void 0===o.async||o.async}):(a(),e(!0)));for(var s in f.plugins.enabled)if(f.plugins.enabled.hasOwnProperty(s)&&!(0<=t.indexOf(s))){var l=f.plugins.enabled[s];if(l)switch(typeof l){case"function":l(i);break;default:for(var d=0;d<l.length;d++){var m=l[d];switch(typeof m){case"function":m(i);break;default:m&&m.callback&&m.callback(m.context)}}}}},initData:function(e){u("[data-ams-data]",e).each(function(){var e=u(this),a=e.data("ams-data");if(a)for(var t in a)if(a.hasOwnProperty(t)){var n=a[t];"string"!=typeof n&&(n=JSON.stringify(n)),e.attr("data-"+t,n)}})},register:function(a,t,n){if("function"==typeof t&&(n=t,t=null),t=t||a.name,0<=f.plugins.enabled.indexOf(t))console&&console.warn&&console.warn("Plugin "+t+" is already registered!");else if("object"==typeof a){var e=a.src;e?f.ajax.check(a.callback,e,function(e){e&&(f.plugins.enabled[t]=f.getFunctionByName(a.callback),a.css&&f.getCSS(a.css,t+"_css"),n&&f.executeFunctionByName(n))}):(f.plugins.enabled[t]=f.getFunctionByName(a.callback),a.css&&f.getCSS(a.css,t+"_css"),n&&f.executeFunctionByName(n))}else"function"==typeof a&&(f.plugins.enabled[t]=a,n&&f.executeFunctionByName(n))}}}(jQuery,this),function(y,e){var x=e.MyAMS;y.extend(x.plugins.enabled,{svg:function(e){var a=y(".svg-container",e);0<a.length&&a.each(function(){var e=y(this),a=y("svg",e),t=a.attr("width"),n=a.attr("height");t&&n&&a.get(0).setAttribute("viewBox","0 0 "+Math.round(parseFloat(t))+" "+Math.round(parseFloat(n))),a.attr("width","100%").attr("height","auto")})},hint:function(e){var a=y(".hint:not(:parents(.nohints))",e);0<a.length&&x.ajax.check(y.fn.tipsy,x.baseURL+"ext/jquery-tipsy"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-tipsy"+x.devext+".css","jquery-tipsy",function(){a.each(function(){var e=y(this),t=e.data(),a={html:void 0===t.amsHintHtml?(e.attr("title")||"").startsWith("<"):t.amsHintHtml,title:x.getFunctionByName(t.amsHintTitleGetter)||function(){var e=y(this),a=e.attr("original-title")||e.attr(t.amsHintTitleAttr||"title")||(t.amsHintHtml?e.html():e.text());return a=a.replace(/\?_="/,"?_="+(new Date).getTime()+'"')},opacity:t.amsHintOpacity||.95,gravity:t.amsHintGravity||"sw",offset:t.amsHintOffset||0},n=y.extend({},a,t.amsHintOptions);n=x.executeFunctionByName(t.amsHintInitCallback,e,n)||n;var s=e.tipsy(n);x.executeFunctionByName(t.amsHintAfterInitCallback,e,s,n)})})})},contextMenu:function(e){var a=y(".context-menu",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={menuSelector:a.amsContextmenuSelector,menuSelected:x.helpers.contextMenuHandler},n=y.extend({},t,a.amsContextmenuOptions);n=x.executeFunctionByName(a.amsContextmenuInitCallback,e,n)||n;var s=e.contextMenu(n);x.executeFunctionByName(a.amsContextmenuAfterInitCallback,e,s,n)})},switcher:function(e){y("LEGEND.switcher",e).each(function(){var n=y(this),s=n.parent("fieldset"),i=n.data();i.amsSwitcher||(y('<i class="fa fa-fw"></i>').prependTo(y(this)).addClass("open"===i.amsSwitcherState?i.amsSwitcherMinusClass||"fa-minus":i.amsSwitcherPlusClass||"fa-plus"),n.on("click",function(e){e.preventDefault();var a={};if(n.trigger("ams.switcher.before-switch",[n,a]),!a.veto)if(s.hasClass("switched")){s.removeClass("switched"),y(".fa",n).removeClass(i.amsSwitcherPlusClass||"fa-plus").addClass(i.amsSwitcherMinusClass||"fa-minus"),n.trigger("ams.switcher.opened",[n]);var t=n.attr("id");t&&y('legend.switcher[data-ams-switcher-sync="'+t+'"]',s).each(function(){var e=y(this);e.parents("fieldset").hasClass("switched")&&e.click()})}else s.addClass("switched"),y(".fa",n).removeClass(i.amsSwitcherMinusClass||"fa-minus").addClass(i.amsSwitcherPlusClass||"fa-plus"),n.trigger("ams.switcher.closed",[n])}),"open"!==i.amsSwitcherState&&s.addClass("switched"),n.data("ams-switcher","on"))})},checker:function(e){y("LEGEND.checker",e).each(function(){var s=y(this),i=s.parent("fieldset"),r=s.data();if(!r.amsChecker){var e=y('<label class="checkbox"></label>'),a=r.amsCheckerFieldname||"checker_"+x.generateId(),t=a.replace(/\./,"_"),n=r.amsCheckerHiddenPrefix,o=null,c=r.amsCheckerHiddenValueOn||"true",l=r.amsCheckerHiddenValueOff||"false",d=r.amsCheckerMarker||!1;n?o=y('<input type="hidden">').attr("name",n+a).val("on"===r.amsCheckerState?c:l).prependTo(s):d&&y('<input type="hidden">').attr("name",d).attr("value",1).prependTo(s);var m=y('<input type="checkbox">').attr("name",a).attr("id",t).data("ams-checker-hidden-input",o).data("ams-checker-init",!0).val(r.amsCheckerValue||!0).attr("checked","on"===r.amsCheckerState?"checked":null);r.amsCheckerReadonly?m.attr("disabled","disabled"):m.on("change",function(e){e.preventDefault();var a={},t=y(this).is(":checked");if(s.trigger("ams.checker.before-switch",[s,a]),a.veto)y(this).prop("checked",!t);else if(x.executeFunctionByName(r.amsCheckerChangeHandler,s,t),!r.amsCheckerCancelDefault){var n=m.data("ams-checker-hidden-input");t?("disable"===r.amsCheckerMode?(i.removeAttr("disabled"),y(".select2",i).removeAttr("disabled")):i.removeClass("switched"),n&&n.val(c),y("[data-required]",i).attr("required","required"),s.trigger("ams.checker.opened",[s])):("disable"===r.amsCheckerMode?(i.prop("disabled","disabled"),y(".select2",i).attr("disabled","disabled")):i.addClass("switched"),n&&n.val(l),y("[data-required]",i).removeAttr("required"),s.trigger("ams.checker.closed",[s]))}}),m.appendTo(e),y(">label",s).attr("for",m.attr("id")),e.append("<i></i>").prependTo(s);var u=y("[required]",i);u.attr("data-required",!0),"on"===r.amsCheckerState?m.attr("checked",!0):("disable"===r.amsCheckerMode?(i.attr("disabled","disabled"),y(".select2",i).attr("disabled","disabled")):i.addClass("switched"),u.removeAttr("required")),s.data("ams-checker","on")}})},slider:function(e){var a=y(".slider",e);0<a.length&&x.ajax.check(y.fn.slider,x.baseURL+"ext/bootstrap-slider-2.0.0"+x.devext+".js",function(){a.each(function(){var e=y(this),a=e.data(),t=y.extend({},{},e.data.amsSliderOptions);t=x.executeFunctionByName(a.amsSliderInitCallback,e,t)||t;var n=e.slider(t);x.executeFunctionByName(a.amsSliderAfterInitCallback,e,n,t)})})},draggable:function(e){var a=y(".draggable",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={cursor:a.amsDraggableCursor||"move",containment:a.amsDraggableContainment,handle:a.amsDraggableHandle,connectToSortable:a.amsDraggableConnectSortable,helper:x.getFunctionByName(a.amsDraggableHelper)||a.amsDraggableHelper,start:x.getFunctionByName(a.amsDraggableStart),stop:x.getFunctionByName(a.amsDraggableStop)},n=y.extend({},t,a.amsDraggableOptions);n=x.executeFunctionByName(a.amsDraggableInitCallback,e,n)||n;var s=e.draggable(n);e.disableSelection(),x.executeFunctionByName(a.amsDraggableAfterInitCallback,e,s,n)})},droppable:function(e){var a=y(".droppable",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={accept:a.amsdroppableAccept,drop:x.getFunctionByName(a.amsDroppableDrop)},n=y.extend({},t,a.amsDroppableOptions);n=x.executeFunctionByName(a.amsDroppableInitCallback,e,n)||n;var s=e.droppable(n);x.executeFunctionByName(a.amsDroppableAfterInitCallback,e,s,n)})},sortable:function(e){var a=y(".sortable",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={items:a.amsSortableItems,handle:a.amsSortableHandle,helper:a.amsSortableHelper,connectWith:a.amsSortableConnectwith,start:x.getFunctionByName(a.amsSortableStart),over:x.getFunctionByName(a.amsSortableOver),containment:a.amsSortableContainment,placeholder:a.amsSortablePlaceholder,stop:x.getFunctionByName(a.amsSortableStop)},n=y.extend({},t,a.amsSortableOptions);n=x.executeFunctionByName(a.amsSortableInitCallback,e,n)||n;var s=e.sortable(n);e.disableSelection(),x.executeFunctionByName(a.amsSortableAfterInitCallback,e,s,n)})},resizable:function(e){var a=y(".resizable",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={autoHide:!1===a.amsResizableAutohide||a.amsResizableAutohide,containment:a.amsResizableContainment,grid:a.amsResizableGrid,handles:a.amsResizableHandles,start:x.getFunctionByName(a.amsResizableStart),stop:x.getFunctionByName(a.amsResizableStop)},n=y.extend({},t,a.amsResizableOptions);n=x.executeFunctionByName(a.amsResizableInitCallback,e,n)||n;var s=e.resizable(n);e.disableSelection(),x.executeFunctionByName(a.amsResizableAfterInitCallback,e,s,n)})},typeahead:function(e){var a=y(".typeahead",e);0<a.length&&x.ajax.check(y.fn.typeahead,x.baseURL+"ext/jquery-typeahead"+x.devext+".js",function(){a.each(function(){var e=y(this),a=e.data(),t=y.extend({},{},a.amsTypeaheadOptions);t=x.executeFunctionByName(a.amsTypeaheadInitCallback,e,t)||t;var n=e.typeahead(t);x.executeFunctionByName(a.amsTypeaheadAfterInitCallback,e,n,t)})})},treeview:function(e){var a=y(".treeview",e);0<a.length&&x.ajax.check(y.fn.treview,x.baseURL+"ext/bootstrap-treeview"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/bootstrap-treeview"+x.devext+".css","bootstrap-treeview",function(){a.each(function(){var e=y(this),a=e.data(),t={data:a.amsTreeviewData,levels:a.amsTreeviewLevels,injectStyle:a.amsTreeviewInjectStyle,expandIcon:a.amsTreeviewExpandIcon||"fa fa-fw fa-plus-square-o",collapseIcon:a.amsTreeviewCollaspeIcon||"fa fa-fw fa-minus-square-o",emptyIcon:a.amsTreeviewEmptyIcon||"fa fa-fw",nodeIcon:a.amsTreeviewNodeIcon,selectedIcon:a.amsTreeviewSelectedIcon,checkedIcon:a.amsTreeviewCheckedIcon||"fa fa-fw fa-check-square-o",uncheckedIcon:a.amsTreeviewUncheckedIcon||"fa fa-fw fa-square-o",color:a.amsTreeviewColor,backColor:a.amsTreeviewBackColor,borderColor:a.amsTreeviewBorderColor,onHoverColor:a.amsTreeviewHoverColor,selectedColor:a.amsTreeviewSelectedColor,selectedBackColor:a.amsTreeviewSelectedBackColor,unselectableColor:a.amsTreeviewUnselectableColor||"rgba(1,1,1,0.25)",unselectableBackColor:a.amsTreeviewUnselectableBackColor||"rgba(1,1,1,0.25)",enableLinks:a.amsTreeviewEnableLinks,highlightSelected:a.amsTreeviewHighlightSelected,highlightSearchResults:a.amsTreeviewhighlightSearchResults,showBorder:a.amsTreeviewShowBorder,showIcon:a.amsTreeviewShowIcon,showCheckbox:a.amsTreeviewShowCheckbox,showTags:a.amsTreeviewShowTags,toggleUnselectable:a.amsTreeviewToggleUnselectable,multiSelect:a.amsTreeviewMultiSelect,onNodeChecked:x.getFunctionByName(a.amsTreeviewNodeChecked),onNodeCollapsed:x.getFunctionByName(a.amsTreeviewNodeCollapsed),onNodeDisabled:x.getFunctionByName(a.amsTreeviewNodeDisabled),onNodeEnabled:x.getFunctionByName(a.amsTreeviewNodeEnabled),onNodeExpanded:x.getFunctionByName(a.amsTreeviewNodeExpanded),onNodeSelected:x.getFunctionByName(a.amsTreeviewNodeSelected),onNodeUnchecked:x.getFunctionByName(a.amsTreeviewNodeUnchecked),onNodeUnselected:x.getFunctionByName(a.amsTreeviewNodeUnselected),onSearchComplete:x.getFunctionByName(a.amsTreeviewSearchComplete),onSearchCleared:x.getFunctionByName(a.amsTreeviewSearchCleared)},n=y.extend({},t,a.amsTreeviewOptions);n=x.executeFunctionByName(a.amsTreeviewInitcallback,e,n)||n;var s=e.treeview(n);x.executeFunctionByName(a.amsTreeviewAfterInitCallback,e,s,n)})})})},select2:function(e){var a=y(".select2",e);0<a.length&&x.ajax.check(y.fn.select2,x.baseURL+"ext/jquery-select2-3.5.4"+x.devext+".js",function(){a.each(function(){var t=y(this),s=t.data();if(!s.select2){var n={placeholder:s.amsSelect2Placeholder,multiple:s.amsSelect2Multiple,minimumInputLength:s.amsSelect2MinimumInputLength||0,maximumSelectionSize:s.amsSelect2MaximumSelectionSize,openOnEnter:void 0===s.amsSelect2EnterOpen||s.amsSelect2EnterOpen,allowClear:void 0===s.amsSelect2AllowClear||s.amsSelect2AllowClear,width:s.amsSelect2Width||"100%",initSelection:x.getFunctionByName(s.amsSelect2InitSelection),formatSelection:void 0===s.amsSelect2FormatSelection?x.helpers.select2FormatSelection:x.getFunctionByName(s.amsSelect2FormatSelection),formatResult:x.getFunctionByName(s.amsSelect2FormatResult),formatMatches:void 0===s.amsSelect2FormatMatches?function(e){return 1===e?x.i18n.SELECT2_MATCH:e+x.i18n.SELECT2_MATCHES}:x.getFunctionByName(s.amsSelect2FormatMatches),formatNoMatches:void 0===s.amsSelect2FormatResult?function(e){return x.i18n.SELECT2_NOMATCHES}:x.getFunctionByName(s.amsSelect2FormatResult),formatInputTooShort:void 0===s.amsSelect2FormatInputTooShort?function(e,a){var t=a-e.length;return x.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,t).replace(/\{1\}/,1===t?"":x.i18n.SELECT2_PLURAL)}:x.getFunctionByName(s.amsSelect2FormatInputTooShort),formatInputTooLong:void 0===s.amsSelect2FormatInputTooLong?function(e,a){var t=e.length-a;return x.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,t).replace(/\{1\}/,1===t?"":x.i18n.SELECT2_PLURAL)}:x.getFunctionByName(s.amsSelect2FormatInputTooLong),formatSelectionTooBig:void 0===s.amsSelect2FormatSelectionTooBig?function(e){return x.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,e).replace(/\{1\}/,1===e?"":x.i18n.SELECT2_PLURAL)}:x.getFunctionByName(s.amsSelect2FormatSelectionTooBig),formatLoadMore:void 0===s.amsSelect2FormatLoadMore?function(e){return x.i18n.SELECT2_LOADMORE}:x.getFunctionByName(s.amsSelect2FormatLoadMore),formatSearching:void 0===s.amsSelect2FormatSearching?function(){return x.i18n.SELECT2_SEARCHING}:x.getFunctionByName(s.amsSelect2FormatSearching),separator:s.amsSelect2Separator||",",tokenSeparators:s.amsSelect2TokensSeparators||[","],tokenizer:x.getFunctionByName(s.amsSelect2Tokenizer)};switch(t.context.type){case"text":case"hidden":if(!n.initSelection){var i=t.data("ams-select2-values");i&&(n.initSelection=function(e,a){var t=[];y(e.val().split(n.separator)).each(function(){t.push({id:this,text:i[this]||this})}),a(t)})}}t.attr("readonly")?"hidden"===t.attr("type")&&(n.query=function(){return[]}):s.amsSelect2Query?(n.query=x.getFunctionByName(s.amsSelect2Query),n.minimumInputLength=s.amsSelect2MinimumInputLength||1):s.amsSelect2QueryUrl?(n.ajax={url:s.amsSelect2QueryUrl,quietMillis:s.amsSelect2QuietMillis||200,type:s.amsSelect2QueryType||"POST",dataType:s.amsSelect2QueryDatatype||"json",data:function(e,a,t){var n={};return n[s.amsSelect2QueryParamName||"query"]=e,n[s.amsSelect2PageParamName||"page"]=a,n[s.amsSelect2ContextParamName||"context"]=t,y.extend({},n,s.amsSelect2QueryOptions)},results:x.helpers.select2QueryUrlResultsCallback},n.minimumInputLength=s.amsSelect2MinimumInputLength||1):s.amsSelect2QueryMethod?(n.query=function(a){var e={id:(new Date).getTime(),params:s.amsSelect2QueryParams||{},success:function(e){return x.helpers.select2QueryMethodSuccessCallback.call(t,e,"success",a)},error:x.error.show};e.params[s.amsSelect2QueryParamName||"query"]=a.term,e.params[s.amsSelect2PageParamName||"page"]=a.page,e.params[s.amsSelect2ContextParamName||"context"]=a.context,e=y.extend({},e,s.amsSelect2QueryOptions),e=x.executeFunctionByName(s.amsSelect2QueryInitCallback,t,e)||e,x.ajax.check(y.jsonRPC,x.baseURL+"ext/jquery-jsonrpc"+x.devext+".js",function(){y.jsonRPC.withOptions({endPoint:s.amsSelect2MethodTarget||x.jsonrpc.getAddr(),namespace:s.amsSelect2MethodNamespace,cache:!1},function(){y.jsonRPC.request(s.amsSelect2QueryMethod,e)})})},n.minimumInputLength=s.amsSelect2MinimumInputLength||1):s.amsSelect2Tags?n.tags=s.amsSelect2Tags:s.amsSelect2Data&&(n.data=s.amsSelect2Data),s.amsSelect2EnableFreeTags&&(n.createSearchChoice=function(e){return{id:e,text:(s.amsSelect2FreeTagsPrefix||x.i18n.SELECT2_FREETAG_PREFIX)+e}});var e=y.extend({},n,s.amsSelect2Options);e=x.executeFunctionByName(s.amsSelect2InitCallback,t,e)||e;var a=t.select2(e);x.executeFunctionByName(s.amsSelect2AfterInitCallback,t,a,e),t.hasClass("ordered")&&x.ajax.check(y.fn.select2Sortable,x.baseURL+"ext/jquery-select2-sortable"+x.devext+".js",function(){t.select2Sortable({bindOrder:"sortableStop"})}),t.on("change",function(){void 0!==y(t.get(0).form).data("validator")&&y(t).valid()})}})})},maskedit:function(e){var a=y("[data-mask]",e);0<a.length&&x.ajax.check(y.fn.mask,x.baseURL+"ext/jquery-maskedinput-1.4.1"+x.devext+".js",function(){a.each(function(){var e=y(this),a=e.data(),t={placeholder:void 0===a.amsMaskeditPlaceholder?"X":a.amsMaskeditPlaceholder,complete:x.getFunctionByName(a.amsMaskeditComplete)},n=y.extend({},t,a.amsMaskeditOptions);n=x.executeFunctionByName(a.amsMaskeditInitCallback,e,n)||n;var s=e.mask(e.attr("data-mask"),n);x.executeFunctionByName(a.amsMaskeditAfterInitCallback,e,s,n)})})},inputmask:function(e){var a=y("input[data-input-mask]",e);0<a.length&&x.ajax.check(y.fn.inputmask,x.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+x.devext+".js",function(){a.each(function(){var e,a=y(this),t=a.data();e="object"==typeof t.inputMask?t.inputMask:{mask:t.inputMask.toString()};var n=y.extend({},e,t.amsInputmaskOptions);n=x.executeFunctionByName(t.amsInputmaskInitCallback,a,n)||n;var s=a.inputmask(n);x.executeFunctionByName(t.amsInputmaskAfterInitCallback,a,s,n)})})},datepicker:function(e){var a=y(".datepicker",e);0<a.length&&x.ajax.check(y.fn.datetimepicker,x.baseURL+"ext/jquery-datetimepicker"+x.devext+".js",function(e){e&&x.dialog.registerHideCallback(x.helpers.datetimepickerDialogHiddenCallback),x.getCSS(x.baseURL+"../css/ext/jquery-datetimepicker"+x.devext+".css","jquery-datetimepicker",function(){a.each(function(){var e=y(this),a=e.data(),t={lang:a.amsDatetimepickerLang||x.lang,format:a.amsDatetimepickerFormat||"d/m/y",datepicker:!0,dayOfWeekStart:1,timepicker:!1,closeOnDateSelect:void 0===a.amsDatetimepickerCloseOnSelect||a.amsDatetimepickerCloseOnSelect,weeks:a.amsDatetimepickerWeeks},n=y.extend({},t,a.amsDatetimepickerOptions);n=x.executeFunctionByName(a.amsDatetimepickerInitCallback,e,n)||n;var s=e.datetimepicker(n);x.executeFunctionByName(a.amsDatetimepickerAfterInitCallback,e,s,n)})})})},datetimepicker:function(e){var a=y(".datetimepicker",e);0<a.length&&x.ajax.check(y.fn.datetimepicker,x.baseURL+"ext/jquery-datetimepicker"+x.devext+".js",function(e){e&&x.dialog.registerHideCallback(x.helpers.datetimepickerDialogHiddenCallback),x.getCSS(x.baseURL+"../css/ext/jquery-datetimepicker"+x.devext+".css","jquery-datetimepicker",function(){a.each(function(){var e=y(this),a=e.data(),t={lang:a.amsDatetimepickerLang||x.lang,format:a.amsDatetimepickerFormat||"d/m/y H:i",datepicker:!0,dayOfWeekStart:1,timepicker:!0,closeOnDateSelect:void 0===a.amsDatetimepickerCloseOnSelect||a.amsDatetimepickerCloseOnSelect,closeOnTimeSelect:void 0===a.amsDatetimepickerCloseOnSelect||a.amsDatetimepickerCloseOnSelect,weeks:a.amsDatetimepickerWeeks},n=y.extend({},t,a.amsDatetimepickerOptions);n=x.executeFunctionByName(a.amsDatetimepickerInitCallback,e,n)||n;var s=e.datetimepicker(n);x.executeFunctionByName(a.amsDatetimepickerAfterInitCallback,e,s,n)})})})},timepicker:function(e){var a=y(".timepicker",e);0<a.length&&x.ajax.check(y.fn.datetimepicker,x.baseURL+"ext/jquery-datetimepicker"+x.devext+".js",function(e){e&&x.dialog.registerHideCallback(x.helpers.datetimepickerDialogHiddenCallback),x.getCSS(x.baseURL+"../css/ext/jquery-datetimepicker"+x.devext+".css","jquery-datetimepicker",function(){a.each(function(){var e=y(this),a=e.data(),t={lang:a.amsDatetimepickerLang||x.lang,format:a.amsDatetimepickerFormat||"H:i",datepicker:!1,timepicker:!0,closeOnTimeSelect:void 0===a.amsDatetimepickerCloseOnSelect||a.amsDatetimepickerCloseOnSelect},n=y.extend({},t,a.amsDatetimepickerOptions);n=x.executeFunctionByName(a.amsDatetimepickerInitCallback,e,n)||n;var s=e.datetimepicker(n);x.executeFunctionByName(a.amsDatetimepickerAfterInitCallback,e,s,n)})})})},colorpicker:function(e){var a=y(".colorpicker",e);0<a.length&&x.ajax.check(y.fn.minicolors,x.baseURL+"ext/jquery-minicolors"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-minicolors"+x.devext+".css","jquery-minicolors",function(){a.each(function(){var e=y(this),a=e.data(),t={position:a.amsColorpickerPosition||e.closest(".input").data("ams-colorpicker-position")||"bottom left"},n=y.extend({},t,a.amsColorpickerOptions);n=x.executeFunctionByName(a.amsColorpickerInitCallback,e,n)||n;var s=e.minicolors(n);x.executeFunctionByName(a.amsDatetimepickerAfterInitCallback,e,s,n)})})})},dndupload:function(e){var a=y(".dndupload",e);0<a.length&&x.ajax.check(y.fn.dndupload,x.baseURL+"ext/jquery-dndupload"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-dndupload"+x.devext+".css","jquery-dndupload",function(){a.each(function(){var e=y(this),a=e.data(),t={action:a.amsDnduploadAction||e.attr("action")||"upload-files",fieldname:a.amsDnduploadFieldname||"files",autosubmit:a.amsDnduploadAutosubmit},n=y.extend({},t,a.amsDnduploadOptions);n=x.executeFunctionByName(a.amsDnduploadInitCallback,e,n)||n;var s=e.dndupload(n);x.executeFunctionByName(a.amsDnduploadAfterInitcallback,e,s,n)})})})},validate:function(e){var n=y("FORM:not([novalidate])",e);0<n.length&&x.ajax.check(y.fn.validate,x.baseURL+"ext/jquery-validate-1.17.0"+x.devext+".js",function(e){if(e&&(y.validator.setDefaults({highlight:function(e){y(e).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(e){y(e).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(e,a){var t=a.parents("label:first");t.length?e.insertAfter(t):e.insertAfter(a)}}),x.plugins.i18n)){for(var a in x.plugins.i18n.validate)if(x.plugins.i18n.validate.hasOwnProperty(a)){var t=x.plugins.i18n.validate[a];"string"==typeof t&&-1<t.indexOf("{0}")&&(x.plugins.i18n.validate[a]=y.validator.format(t))}y.extend(y.validator.messages,x.plugins.i18n.validate)}n.each(function(){var r=y(this),e=r.data(),a={ignore:null,submitHandler:void 0!==r.attr("data-async")?void 0===e.amsFormSubmitHandler?function(){return y(".state-error",r).removeClass("state-error"),x.ajax.check(y.fn.ajaxSubmit,x.baseURL+"ext/jquery-form-3.49"+x.devext+".js"),x.form.submit(r)}:x.getFunctionByName(e.amsFormSubmitHandler):void 0,invalidHandler:void 0!==r.attr("data-async")?void 0===e.amsFormInvalidHandler?function(e,a){y(".state-error",r).removeClass("state-error");for(var t=0;t<a.errorList.length;t++){var n=a.errorList[t],s=y(n.element).parents(".tab-pane").index()+1;if(0<s){var i=y(".nav-tabs",y(n.element).parents(".tabforms"));y("li:nth-child("+s+")",i).removeClassPrefix("state-").addClass("state-error"),y("li.state-error:first a",i).click()}}}:x.getFunctionByName(e.amsFormInvalidHandler):void 0};y("[data-ams-validate-rules]",r).each(function(e){0===e&&(a.rules={}),a.rules[y(this).attr("name")]=y(this).data("ams-validate-rules")});var t=y.extend({},a,e.amsValidateOptions);t=x.executeFunctionByName(e.amsValidateInitCallback,r,t)||t;var n=r.validate(t);x.executeFunctionByName(e.amsValidateAfterInitCallback,r,n,t)})})},datatable:function(e){var a=y(".datatable",e);0<a.length&&x.ajax.check(y.fn.dataTable,x.baseURL+"ext/jquery-dataTables-1.9.4"+x.devext+".js",function(){x.ajax.check(y.fn.dataTableExt.oPagination.bootstrap_full,x.baseURL+"myams-dataTables"+x.devext+".js",function(){y(a).each(function(){var m,u=y(this),f=u.data(),h=(f.amsDatatableExtensions||"").split(/\s+/),e=f.amsDatatableSdom||"W"+(0<=h.indexOf("colreorder")||0<=h.indexOf("colreorderwithresize")?"R":"")+"<'dt-top-row'"+(0<=h.indexOf("colvis")?"C":"")+(!1===f.amsDatatablePagination||!1===f.amsDatatablePaginationSize?"":"L")+(!1===f.amsDatatableGlobalFilter?"":"F")+">r<'dt-wrapper't"+(0<=h.indexOf("scroller")?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(!1===f.amsDatatableInformation?"":"i")+"><'col-sm-6 text-right'p>>",a=f.amsDatatableSorting;if("string"==typeof a){var t=a.split(";");for(a=[],m=0;m<t.length;m++){var n=t[m].split(",");n[0]=parseInt(n[0]),a.push(n)}}var s,i=[],r=y("th",u).listattr("data-ams-datatable-sortable");for(m=0;m<r.length;m++){var o=r[m];void 0!==o?((s=i[m]||{}).bSortable="string"==typeof o?JSON.parse(o):o,i[m]=s):i[m]=i[m]||{}}var c=y("th",u).listattr("data-ams-datatable-stype");for(m=0;m<c.length;m++){var l=c[m];l?((s=i[m]||{}).sType=l,i[m]=s):i[m]=i[m]||{}}var d={bJQueryUI:!1,bServerSide:f.amsDatatableServerSide||!1,sAjaxSource:!0===f.amsDatatableServerSide?f.amsDatatableAjaxSource:void 0,sServerMethod:!0===f.amsDatatableServerSide?"POST":void 0,bFilter:!1!==f.amsDatatableGlobalFilter||0<=h.indexOf("columnfilter"),bPaginate:!1!==f.amsDatatablePagination,bInfo:!1!==f.amsDatatableInfo,bSort:!1!==f.amsDatatableSort,aaSorting:a,aoColumns:0<i.length?i:void 0,bDeferRender:!0,bAutoWidth:!1,iDisplayLength:f.amsDatatableDisplayLength||25,sPaginationType:f.amsDatatablePaginationType||"bootstrap_full",sDom:e,oLanguage:x.plugins.i18n.datatables,fnInitComplete:function(e,a){y(".ColVis_Button").addClass("btn btn-default btn-sm").html((x.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}},p=y.extend({},d,f.amsDatatableOptions),g=[],b=[],v=[];if(0<h.length)for(m=0;m<h.length;m++)switch(h[m]){case"autofill":g.push(y.fn.dataTable.AutoFill),b.push(x.baseURL+"ext/jquery-dataTables-autoFill"+x.devext+".js");break;case"columnfilter":g.push(y.fn.columnFilter),b.push(x.baseURL+"ext/jquery-dataTables-columnFilter"+x.devext+".js");break;case"colreorder":g.push(y.fn.dataTable.ColReorder),b.push(x.baseURL+"ext/jquery-dataTables-colReorder"+x.devext+".js");break;case"colreorderwithresize":g.push(window.ColReorder),b.push(x.baseURL+"ext/jquery-dataTables-colReorderWithResize"+x.devext+".js");break;case"colvis":g.push(y.fn.dataTable.ColVis),b.push(x.baseURL+"ext/jquery-dataTables-colVis"+x.devext+".js"),v.push(function(){p.oColVis=y.extend({},{activate:"click",sAlign:"right"},f.amsDatatableColvisOptions)});break;case"editable":g.push(y.fn.editable),b.push(x.baseURL+"ext/jquery-jeditable"+x.devext+".js"),g.push(y.fn.makeEditable),b.push(x.baseURL+"ext/jquery-dataTables-editable"+x.devext+".js");break;case"fixedcolumns":g.push(y.fn.dataTable.FixedColumns),b.push(x.baseURL+"ext/jquery-dataTables-fixedColumns"+x.devext+".js");break;case"fixedheader":g.push(y.fn.dataTable.Fixedheader),b.push(x.baseURL+"ext/jquery-dataTables-fixedHeader"+x.devext+".js");break;case"keytable":g.push(window.keyTable),b.push(x.baseURL+"ext/jquery-dataTables-keyTable"+x.devext+".js");break;case"rowgrouping":g.push(y.fn.rowGrouping),b.push(x.baseURL+"ext/jquery-dataTables-rowGrouping"+x.devext+".js");break;case"rowreordering":g.push(y.fn.rowReordering),b.push(x.baseURL+"ext/jquery-dataTables-rowReordering"+x.devext+".js");break;case"scroller":g.push(y.fn.dataTable.Scroller),b.push(x.baseURL+"ext/jquery-dataTables-scroller"+x.devext+".js")}v.push(function(){p=x.executeFunctionByName(f.amsDatatableInitCallback,u,p)||p;try{var e=u.dataTable(p);if(x.executeFunctionByName(f.amsDatatableAfterInitCallback,u,e,p),0<h.length)for(m=0;m<h.length;m++)switch(h[m]){case"autofill":var a=y.extend({},f.amsDatatableAutofillOptions,p.autofill);a=x.executeFunctionByName(f.amsDatatableAutofillInitCallback,u,a)||a,u.data("ams-autofill",void 0===f.amsDatatableAutofillConstructor?new y.fn.dataTable.AutoFill(u,a):x.executeFunctionByName(f.amsDatatableAutofillConstructor,u,e,a));break;case"columnfilter":var t=y.extend({},{sPlaceHolder:"head:after"},f.amsDatatableColumnfilterOptions,p.columnfilter);t=x.executeFunctionByName(f.amsDatatableColumnfilterInitCallback,u,t)||t,u.data("ams-columnfilter",void 0===f.amsDatatableColumnfilterConstructor?e.columnFilter(t):x.executeFunctionByName(f.amsDatatableColumnfilterConstructor,u,e,t));break;case"editable":var n=y.extend({},f.amsDatatableEditableOptions,p.editable);n=x.executeFunctionByName(f.amsDatatableEditableInitCallback,u,n)||n,u.data("ams-editable",void 0===f.amsDatatableEditableConstructor?u.makeEditable(n):x.executeFunctionByName(f.amsDatatableEditableConstructor,u,e,n));break;case"fixedcolumns":var s=y.extend({},f.amsDatatableFixedcolumnsOptions,p.fixedcolumns);s=x.executeFunctionByName(f.amsDatatableFixedcolumnsInitCallback,u,s)||s,u.data("ams-fixedcolumns",void 0===f.amsDatatableFixedcolumnsConstructor?new y.fn.dataTable.FixedColumns(u,s):x.executeFunctionByName(f.amsDatatableFixedcolumnsConstructor,u,e,s));break;case"fixedheader":var i=y.extend({},f.amsDatatableFixedheaderOptions,p.fixedheader);i=x.executeFunctionByName(f.amsDatatableFixedheadeInitCallback,u,i)||i,u.data("ams-fixedheader",void 0===f.amsDatatableFixedheaderConstructor?new y.fn.dataTable.FixedHeader(u,i):x.executeFunctionByName(f.amsDatatableFixedheaderConstructor,u,e,i));break;case"keytable":var r={table:u.get(0),datatable:e},o=y.extend({},r,f.amsDatatableKeytableOptions,p.keytable);o=x.executeFunctionByName(f.amsDatatableKeytableInitCallback,u,o)||o,u.data("ams-keytable",void 0===f.amsDatatableKeytableConstructor?new KeyTable(o):x.executeFunctionByName(f.amsDatatableKeytableConstructor,u,e,o));break;case"rowgrouping":var c=y.extend({},f.amsDatatableRowgroupingOptions,p.rowgrouping);c=x.executeFunctionByName(f.amsDatatableRowgroupingInitCallback,u,c)||c,u.data("ams-rowgrouping",void 0===f.amsDatatableRowgroupingConstructor?u.rowGrouping(c):x.executeFunctionByName(f.amsDatatableRowgroupingConstructor,u,e,c));break;case"rowreordering":var l=y.extend({},f.amsDatatableRowreorderingOptions,p.rowreordering);l=x.executeFunctionByName(f.amsDatatableRowreorderingInitCallback,u,l)||l,u.data("ams-rowreordering",void 0===f.amsDatatableRowreorderingConstructor?u.rowReordering(l):x.executeFunctionByName(f.amsDatatableRowreorderingConstructor,u,e,l))}if(f.amsDatatableFinalizeCallback){var d=f.amsDatatableFinalizeCallback.split(/\s+/);if(0<d.length)for(m=0;m<d.length;m++)x.executeFunctionByName(d[m],u,e,p)}}catch(e){}}),x.ajax.check(g,b,v)})})})},tablednd:function(e){var a=y(".table-dnd",e);0<a.length&&x.ajax.check(y.fn.tableDnD,x.baseURL+"ext/jquery-tablednd"+x.devext+".js",function(){a.each(function(){var r=y(this),o=r.data();o.amsTabledndDragHandle?y("tr",r).addClass("no-drag-handle"):y(r).on("mouseover","tr",function(){y(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){y(this.cells[0]).removeClass("drag-handle")});var e={onDragClass:o.amsTabledndDragClass||"dragging-row",onDragStart:x.getFunctionByName(o.amsTabledndDragStart),dragHandle:o.amsTabledndDragHandle,scrollAmount:o.amsTabledndScrollAmount,onAllowDrop:o.amsTabledndAllowDrop,onDrop:x.getFunctionByName(o.amsTabledndDrop)||function(e,a){var t=o.amsTabledndDropTarget;if(t){y(a).data("ams-disabled-handlers","click");try{var n=[];y(e.rows).each(function(){var e=y(this).data("ams-element-name");e&&n.push(e)});var s=x.getFunctionByName(t);if("function"==typeof s)s.call(r,e,n);else{if(!t.startsWith(window.location.protocol)){var i=o.amsLocation;i&&(t=i+"/"+t)}x.ajax.post(t,{names:JSON.stringify(n)})}}finally{setTimeout(function(){y(a).removeData("ams-disabled-handlers")},50)}}return!1}},a=y.extend({},e,o.amsTabledndOptions);a=x.executeFunctionByName(o.amsTabledndInitCallback,r,a)||a;var t=r.tableDnD(a);x.executeFunctionByName(o.amsTabledndAfterInitCallback,r,t,a)})})},wizard:function(e){var a=y(".wizard",e);0<a.length&&x.ajax.check(y.fn.bootstrapWizard,x.baseURL+"ext/bootstrap-wizard-1.4.2"+x.devext+".js",function(){a.each(function(){var e=y(this),a=e.data(),t={withVisible:void 0===a.amsWizardWithVisible||a.amsWizardWithVisible,tabClass:a.amsWizardTabClass,firstSelector:a.amsWizardFirstSelector,previousSelector:a.amsWizardPreviousSelector,nextSelector:a.amsWizardNextSelector,lastSelector:a.amsWizardLastSelector,finishSelector:a.amsWizardFinishSelector,backSelector:a.amsWizardBackSelector,onInit:x.getFunctionByName(a.amsWizardInit),onShow:x.getFunctionByName(a.amsWizardShow),onNext:x.getFunctionByName(a.amsWizardNext),onPrevious:x.getFunctionByName(a.amsWizardPrevious),onFirst:x.getFunctionByName(a.amsWizardFirst),onLast:x.getFunctionByName(a.amsWizardLast),onBack:x.getFunctionByName(a.amsWizardBack),onFinish:x.getFunctionByName(a.amsWizardFinish),onTabChange:x.getFunctionByName(a.amsWizardTabChange),onTabClick:x.getFunctionByName(a.amsWizardTabClick),onTabShow:x.getFunctionByName(a.amsWizardTabShow)},n=y.extend({},t,a.amsWizardOptions);n=x.executeFunctionByName(a.amsWizardInitCallback,e,n)||n;var s=e.bootstrapWizard(n);x.executeFunctionByName(a.amsWizardAfterInitCallback,e,s,n)})})},tinymce:function(e){function t(){y(".tinymce",y(this)).each(function(){var e=tinymce.get(y(this).attr("id"));e&&e.remove()})}var n=y(".tinymce",e);if(0<n.length){var s=x.baseURL+"ext/tinymce"+(x.devmode?"/dev":"");x.ajax.check(window.tinymce,s+"/tinymce"+x.devext+".js",function(e){function a(){n.each(function(){var e=y(this),a=e.data(),t={theme:a.amsTinymceTheme||"modern",language:x.lang,menubar:!1!==a.amsTinymceMenubar,statusbar:!1!==a.amsTinymceStatusbar,plugins:a.amsTinymcePlugins||["advlist autosave autolink lists link charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code fullscreen","insertdatetime nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern autoresize"],toolbar:a.amsTinymceToolbar,toolbar1:!1!==a.amsTinymceToolbar1&&(a.amsTinymceToolbar1||"undo redo | pastetext | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),toolbar2:!1!==a.amsTinymceToolbar2&&(a.amsTinymceToolbar2||"forecolor backcolor emoticons | charmap link image media | fullscreen preview print | code"),content_css:a.amsTinymceContentCss,formats:a.amsTinymceFormats,style_formats:a.amsTinymceStyleFormats,block_formats:a.amsTinymceBlockFormats,valid_classes:a.amsTinymceValidClasses,image_advtab:!0,image_list:x.getFunctionByName(a.amsTinymceImageList)||a.amsTinymceImageList,image_class_list:a.amsTinymceImageClassList,link_list:x.getFunctionByName(a.amsTinymceLinkList)||a.amsTinymceLinkList,link_class_list:a.amsTinymceLinkClassList,paste_as_text:void 0===a.amsTinymcePasteAsText||a.amsTinymcePasteAsText,paste_auto_cleanup_on_paste:void 0===a.amsTinymcePasteAutoCleanup||a.amsTinymcePasteAutoCleanup,paste_strip_class_attributes:a.amsTinymcePasteStripClassAttributes||"all",paste_remove_spans:void 0===a.amsTinymcePaseRemoveSpans||a.amsTinymcePasteRemoveSpans,paste_remove_styles:void 0===a.amsTinymcePasteRemoveStyles||a.amsTinymcePasteRemoveStyles,height:a.amsTinymceHeight||50,min_height:50,resize:!0,autoresize_min_height:50,autoresize_max_height:500};if(a.amsTinymceExternalPlugins){var n=a.amsTinymceExternalPlugins.split(/\s+/);for(var s in n)if(n.hasOwnProperty(s)){var i=e.data("ams-tinymce-plugin-"+n[s]);tinymce.PluginManager.load(n[s],x.getSource(i))}}var r=y.extend({},t,a.amsTinymceOptions);r=x.executeFunctionByName(a.amsTinymceInitCallback,e,r)||r;var o=e.tinymce(r);x.executeFunctionByName(a.amsTinymceAfterInitCallback,e,o,r)})}e?x.getScript(s+"/jquery.tinymce"+x.devext+".js",function(){tinymce.baseURL=s,tinymce.suffix=x.devext,x.skin.registerCleanCallback(t),a()}):a()})}},imgareaselect:function(e){var a=y(".imgareaselect",e);0<a.length&&x.ajax.check(y.fn.imgAreaSelect,x.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-imgareaselect"+x.devext+".css","jquery-imgareaselect",function(){a.each(function(){var e=y(this),n=e.data(),s=n.amsImgareaselectParent?e.parents(n.amsImgareaselectParent):"body",a={instance:!0,handles:!0,parent:s,x1:n.amsImgareaselectX1||0,y1:n.amsImgareaselectY1||0,x2:n.amsImgareaselectX2||n.amsImgareaselectImageWidth,y2:n.amsImgareaselectY2||n.amsImgareaselectImageHeight,imageWidth:n.amsImgareaselectImageWidth,imageHeight:n.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:n.amsImgareaselectRatio,onSelectEnd:x.getFunctionByName(n.amsImgareaselectSelectEnd)||function(e,a){var t=n.amsImgareaselectTargetField||"image_";y('input[name="'+t+'x1"]',s).val(a.x1),y('input[name="'+t+'y1"]',s).val(a.y1),y('input[name="'+t+'x2"]',s).val(a.x2),y('input[name="'+t+'y2"]',s).val(a.y2)}},t=y.extend({},a,n.amsImgareaselectOptions);t=x.executeFunctionByName(n.amsImgareaselectInitCallback,e,t)||t;var i=e.imgAreaSelect(t);x.executeFunctionByName(n.amsImgareaselectAfterInitCallback,e,i,t),setTimeout(function(){i.update()},250)})})})},fancybox:function(e){var a=y(".fancybox",e);0<a.length&&x.ajax.check(y.fn.fancybox,x.baseURL+"ext/jquery-fancybox-2.1.5"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-fancybox-2.1.5"+x.devext+".css","jquery-fancybox",function(){a.each(function(){var e,a=y(this),t=a.data(),n=a;t.amsFancyboxElements&&(n=y(t.amsFancyboxElements,a));var s=(t.amsFancyboxHelpers||"").split(/\s+/);if(0<s.length)for(e=0;e<s.length;e++)switch(s[e]){case"buttons":x.ajax.check(y.fancybox.helpers.buttons,x.baseURL+"ext/fancybox-helpers/fancybox-buttons"+x.devext+".js");break;case"thumbs":x.ajax.check(y.fancybox.helpers.thumbs,x.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+x.devext+".js");break;case"media":x.ajax.check(y.fancybox.helpers.media,x.baseURL+"ext/fancybox-helpers/fancybox-media"+x.devext+".js")}var i={type:t.amsFancyboxType,padding:t.amsFancyboxPadding||10,margin:t.amsFancyboxMargin||10,loop:t.amsFancyboxLoop,beforeLoad:x.getFunctionByName(t.amsFancyboxBeforeLoad)||function(){var e;if(t.amsFancyboxTitleGetter&&(e=x.executeFunctionByName(t.amsFancyboxTitleGetter,this)),!e){var a=y("*:first",this.element);(e=a.attr("original-title")||a.attr("title"))||(e=y(this.element).attr("original-title")||y(this.element).attr("title"))}this.title=e},afterLoad:x.getFunctionByName(t.amsFancyboxAfterLoad),helpers:{title:{type:"inside"}}};if(0<s.length)for(e=0;e<s.length;e++)switch(s[e]){case"buttons":i.helpers.buttons={position:t.amsFancyboxButtonsPosition||"top"};break;case"thumbs":i.helpers.thumbs={width:t.amsFancyboxThumbsWidth||50,height:t.amsFancyboxThumbsHeight||50};break;case"media":i.helpers.media=!0}var r=y.extend({},i,t.amsFancyboxOptions);r=x.executeFunctionByName(t.amsFancyboxInitCallback,a,r)||r;var o=n.fancybox(r);x.executeFunctionByName(t.amsFancyboxAfterInitCallback,a,o,r)})})})},chart:function(e){var a=y(".chart",e);0<a.length&&x.ajax.check(y.fn.plot,x.baseURL+"flot/jquery.flot"+x.devext+".js",function(){a.each(function(){function e(e){for(var a in y.plot.plugins)if(y.plot.plugins.hasOwnProperty(a)){var t=y.plot.plugins[a];if(t.name===e)return t}return null}var a=y(this),t=a.data(),n=(t.amsChartPlugins||"").split(/\s+/);if(0<n.length)for(var s in n)if(n.hasOwnProperty(s)){var i=n[s];e(i)||x.getScript(x.baseURL+"flot/jquery.flot."+i+x.devext+".js")}var r=y.extend({},{},t.amsChartOptions);r=x.executeFunctionByName(t.amsChartInitCallback,a,r)||r;var o=t.amsChartData;o=x.executeFunctionByName(t.amsChartInitData,a,o)||o;var c=a.plot(o,r);x.executeFunctionByName(t.amsChartAfterInitCallback,a,c,r)})})},graphs:function(e){var a=y(".sparkline",e);0<a.length&&x.ajax.check(x.graphs,x.baseURL+"myams-graphs"+x.devext+".js",function(){x.graphs.init(a)})},scrollbars:function(e){var a=y(".scrollbar",e);0<a.length&&x.ajax.check(y.event.special.mousewheel,x.baseURL+"ext/jquery-mousewheel.min.js",function(){x.ajax.check(y.fn.mCustomScrollbar,x.baseURL+"ext/jquery-mCustomScrollbar"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar",function(){a.each(function(){var e=y(this),a=e.data(),t={theme:a.amsScrollbarTheme||"light"},n=y.extend({},t,a.amsScrollbarOptions);n=x.executeFunctionByName(a.amsScrollbarInitCallback,e,n)||n;var s=e.mCustomScrollbar(n);x.executeFunctionByName(a.amsScrollbarAfterInitCallback,e,s,n)})})})})}})}(jQuery,this),function(l,e){var d=e.MyAMS;d.callbacks={init:function(e){l("[data-ams-callback]",e).each(function(){var e,a,t=this,n=l(t).data();try{var s=JSON.parse(n.amsCallback);Array.isArray(s)||(s=[s])}catch(e){s=n.amsCallback.split(/\s+/)}for(var i=0;i<s.length;i++){var r=s[i];if("string"==typeof r){var o=d.getFunctionByName(r),c=n.amsCallbackOptions;"string"==typeof c&&(c=c.unserialize()),void 0===o?n.amsCallbackSource?d.getScript(n.amsCallbackSource,(a=r,void d.executeFunctionByName(a,t,c)),{async:void 0===n.amsCallbackAsync||n.amsCallbackAsync}):console&&console.warn&&console.warn("Undefined callback: "+n.amsCallback):o.call(t,c)}else o=d.getFunctionByName(r.callback),"string"==typeof(c=r.options)&&(c=c.unserialize()),void 0===o?r.source?d.getScript(r.source,(e=r,void d.executeFunctionByName(e.callback,t,e.options)),{async:void 0===r.async||r.async}):console&&console.warn&&console.warn("Undefined callback: "+r.callback):o.call(t,r.options)}})},alert:function(e){var a=l(this).data(),t=l.extend({},e,a.amsAlertOptions),n=l(a.amsAlertParent||t.parent||this),s=a.amsAlertStatus||t.status||"info",i=a.amsAlertHeader||t.header,r=a.amsAlertMessage||t.message,o=a.amsAlertSubtitle||t.subtitle,c=void 0===a.amsAlertMargin?void 0!==t.margin&&t.margin:a.amsAlertMargin;d.skin.alert(n,s,i,r,o,c)},messageBox:function(e){var a=l(this).data(),t=l.extend({},e,a.amsMessageboxOptions),n=l.extend({},t,{title:a.amsMessageboxTitle||t.title||"",content:a.amsMessageboxContent||t.content||"",icon:a.amsMessageboxIcon||t.icon,number:a.amsMessageboxNumber||t.number,timeout:a.amsMessageboxTimeout||t.timeout}),s=a.amsMessageboxStatus||t.status||"info",i=d.getFunctionByName(a.amsMessageboxCallback||t.callback);d.skin.messageBox(s,n,i)},smallBox:function(e){var a=l(this).data(),t=l.extend({},e,a.amsSmallboxOptions),n=l.extend({},t,{title:a.amsSmallboxTitle||t.title||"",content:a.amsSmallboxContent||t.content||"",icon:a.amsSmallboxIcon||t.icon,iconSmall:a.amsSmallboxIconSmall||t.iconSmall,timeout:a.amsSmallboxTimeout||t.timeout}),s=a.amsSmallboxStatus||t.status||"info",i=d.getFunctionByName(a.amsSmallboxCallback||t.callback);d.skin.smallBox(s,n,i)}}}(jQuery,this),function(n,e){var s=e.MyAMS;s.events={init:function(e){n("[data-ams-events-handlers]",e).each(function(){var e=n(this),a=e.data("ams-events-handlers");if(a)for(var t in a)a.hasOwnProperty(t)&&e.on(t,s.getFunctionByName(a[t]))})}}}(jQuery,this),function(i,e){var o=e.MyAMS;o.container={changeOrder:function(e,a){i('input[name="'+i(this).data("ams-input-name")+'"]',i(this)).val(a.join(";"))},deleteElement:function(){return function(){var r=i(this);o.skin.bigBox({title:o.i18n.WARNING,content:'<i class="text-danger fa fa-fw fa-bell"></i> '+o.i18n.DELETE_WARNING,status:"info",buttons:o.i18n.BTN_OK_CANCEL},function(e){if(e===o.i18n.BTN_OK){var t=r.parents("tr").first(),n=t.parents("table").first(),a=t.data("ams-location")||n.data("ams-location")||"";a&&(a+="/");var s=t.data("ams-delete-target")||n.data("ams-delete-target")||"delete-element.json",i=t.data("ams-element-name");o.ajax.post(a+s,{object_name:i},function(e,a){"success"===e.status?(n.hasClass("datatable")?n.dataTable().fnDeleteRow(t[0]):t.remove(),e.handle_json&&o.ajax.handleJSON(e)):o.ajax.handleJSON(e)})}})}},switchElementVisibility:function(){return function(){var t=i(this),e=t.parents("td").first(),a=t.parents("tr").first(),n=a.parents("table");i("i",t).attr("class","fa fa-fw fa-spinner fa-pulse"),o.ajax.post(n.data("ams-location")+"/"+(e.data("ams-attribute-switcher")||n.data("ams-attribute-switcher")),{object_name:a.data("ams-element-name")},function(e,a){e.visible?i("i",t).attr("class","fa fa-fw fa-eye"):i("i",t).attr("class","fa fa-fw fa-eye-slash text-danger")})}},switchElementAttribute:function(){return function(){var t=i(this),e=t.parents("td").first(),n=e.data("ams-switcher-attribute-name"),a=t.parents("tr").first(),s=a.parents("table");i("i",t).attr("class","fa fa-fw fa-spinner fa-pulse"),o.ajax.post(s.data("ams-location")+"/"+(e.data("ams-attribute-switcher")||s.data("ams-attribute-switcher")),{object_name:a.data("ams-element-name")},function(e,a){e[n]||e.on?i("i",t).attr("class",s.data("ams-"+n+"-icon-on")||"fa fa-fw fa-check-square-o"):i("i",t).attr("class",s.data("ams-"+n+"-icon-off")||"fa fa-fw fa-check-square txt-color-silver opacity-75")})}}}}(jQuery,this),function(h,e){var p=e.MyAMS;p.tree={switchTableNode:function(){var e=h(this),i=h("i.switch",e),r=e.parents("tr").first(),o=r.parents("table").first();if(i.hasClass("fa-minus-square-o"))!function a(e){h('tr[data-ams-tree-node-parent-id="'+e+'"]').each(function(){var e=h(this);a(e.data("ams-tree-node-id")),e.remove()})}(r.data("ams-tree-node-id")),i.removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var a=r.data("ams-location")||o.data("ams-location")||"",t=r.data("ams-tree-nodes-target")||o.data("ams-tree-nodes-target")||"get-tree-nodes.json",n=r.data("ams-element-name");i.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),p.ajax.post(a+"/"+n+"/"+t,{can_sort:!h("td.sorter",r).is(":empty")},function(e,a){if(0<e.length){for(var t=r,n=0;n<e.length;n++){var s=h(e[n]);s.insertAfter(t).addClass("no-drag-handle"),p.initContent(s),t=s}o.hasClass("table-dnd")&&o.tableDnDUpdate()}i.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},switchTree:function(){var e=h(this),i=h("i.switch",e),r=h(this).parents("table").first(),a=r.data("ams-tree-node-id");if(i.hasClass("fa-minus-square-o"))h("tr[data-ams-tree-node-parent-id]").filter('tr[data-ams-tree-node-parent-id!="'+a+'"]').remove(),h("i.switch",r).removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var t=h("tbody tr",r).first(),n=r.data("ams-location")||"",s=r.data("ams-tree-nodes-target")||"get-tree.json";i.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),p.ajax.post(n+"/"+s,{can_sort:!h("td.sorter",t).is(":empty")},function(e,a){h("tr[data-ams-tree-node-id]",r).remove();for(var t=null,n=0;n<e.length;n++){var s=h(e[n]);null===t?s.appendTo(h("tbody",r)):s.insertAfter(t),s.addClass("no-drag-handle"),p.initContent(s),t=s}r.hasClass("table-dnd")&&r.tableDnDUpdate(),h("i.switch",r).removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),i.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},sortTree:function(e,r){var a=h(e).data(),t=a.amsTabledndDropTarget;if(t){(r=h(r)).data("ams-disabled-handlers","click");try{var n=r.parents("table").first().data("ams-tree-node-id"),o=r.data("ams-tree-node-id"),s=r.data("ams-tree-node-parent-id"),i=r.prev("tr");if(i.exists()){var c=i.data("ams-tree-node-id"),l=h(".switch",i);if(l.hasClass("fa-minus-square-o"))if(s===c)var d="reorder";else d="reparent";else d=s===(c=i.data("ams-tree-node-parent-id"))?"reorder":"reparent"}else l=null,d=s===(c=n)?"reorder":"reparent";var m=p.getFunctionByName(t);if("function"==typeof m)m.call(table,e,f);else{if(!t.startsWith(window.location.protocol)){var u=a.amsLocation;u&&(t=u+"/"+t)}var f={action:d,child:o,parent:c,order:JSON.stringify(h("tr[data-ams-tree-node-id]").listattr("data-ams-tree-node-id")),can_sort:!h("td.sorter",r).is(":empty")};p.ajax.post(t,f,function(e){function a(e){h('tr[data-ams-tree-node-parent-id="'+e+'"]').each(function(){var e=h(this);a(e.attr("data-ams-tree-node-id")),e.remove()})}if(e.status)p.ajax.handleJSON(e);else{var t=h(r).parents("tbody").first();if(a(o),"reparent"===f.action){a(c),r.remove();for(var n=h('tr[data-ams-tree-node-id="'+c+'"]'),s=0;s<e.length;s++){var i=h(e[s]);n.exists()?i.insertAfter(n).addClass("no-drag-handle"):i.prependTo(t).addClass("no-drag-handle"),p.initContent(i),n=i}}h("tr").parents("table").tableDnDUpdate()}})}}finally{setTimeout(function(){h(r).removeData("ams-disabled-handlers")},50)}}return!1}}}(jQuery,this),function(l,t){var d=t.MyAMS;d.skin={_setPageHeight:function(){var e=l("#main").height(),a=(d.leftPanel.height(),l(window).height()-d.navbarHeight);a<e?d.root.css("min-height",e+d.navbarHeight):d.root.css("min-height",a),d.leftPanel.css("min-height",a),d.leftPanel.css("max-height",a)},_checkMobileWidth:function(){l(window).width()<979?d.root.addClass("mobile-view-activated"):d.root.hasClass("mobile-view-activated")&&d.root.removeClass("mobile-view-activated")},_showShortcutButtons:function(){d.shortcuts.animate({height:"show"},200,"easeOutCirc"),d.root.addClass("shortcut-on")},_hideShortcutButtons:function(){d.shortcuts.animate({height:"hide"},300,"easeOutCirc"),d.root.removeClass("shortcut-on")},checkNotification:function(){var e=l(".badge","#user-activity >span");0<parseInt(e.text())?e.removeClass("hidden").addClass("bg-color-red bounceIn animated"):e.addClass("hidden").removeClass("bg-color-red bounceIn animated")},refreshNotificationsPanel:function(e){var a=l(this);a.addClass("disabled"),l("i",a).addClass("fa-spin"),l('input[name="activity"]:checked',"#user-activity").change(),l("i",a).removeClass("fa-spin"),a.removeClass("disabled")},refreshContent:function(e){var a=l('[id="'+e.object_id+'"]');return a.replaceWith(l(e.content)),a=l('[id="'+e.object_id+'"]'),d.initContent(a),a},refreshImage:function(e){l('img[src^="'+e.src+'"]').attr("src",e.target)},refreshWidget:function(e){var a=l('[id="'+e.parent_id+'"]'),t=l('[name="'+e.widget_name+'"]',a);t.exists()||(t=l('[name="'+e.widget_name+':list"]',a));var n=t.parents(".input").last();return n.html(e.content),d.initContent(n),n},refreshTable:function(e){var a=l('[id="'+e.object_id+'"]').parents(".ams-widget:first");return a.replaceWith(l(e.table)),a=l('[id="'+e.object_id+'"]').parents(".ams-widget:first"),d.initContent(a),a},refreshSwitchedTable:function(e){var a=d.skin.refreshTable(e).siblings("legend");a.parents("fieldset:first").hasClass("switched")&&a.click()},refreshRow:function(e){var a=l('tr[id="'+e.object_id+'"]'),t=a.parents("table").first(),n=l(e.row);return a.replaceWith(n),d.initContent(n),t.hasClass("table-dnd")&&(n.addClass("no-drag-handle"),t.tableDnDUpdate()),n},refreshRowCell:function(e){var a=l('tr[id="'+e.object_id+'"]'),t=a.parents("table").first(),n=l("tr",l("thead",t)),s=l('th[data-ams-column-name="'+e.col_name+'"]',n),i=l("th",n).index(s);if(-1<i){var r=l(l("td",a).get(i));r.html(e.cell),d.initContent(r)}},switchCellContent:function(e){var a=l(this),t=l("i.switch",a),n=a.parents("td"),s=l(a.data("ams-switch-target")||".inner-table-form",n),i=a.parents("tr");if(t.hasClass("fa-plus-square-o")){var r=i.parents("table");s.html('<h1 class="loading"><i class="fa fa-gear fa-spin"></i></h1>'),d.ajax.post(r.data("ams-location")+"/"+a.data("ams-switch-handler"),{object_name:i.data("ams-element-name")},function(e){s.html(e),e&&(d.initContent(s),t.removeClass("fa-plus-square-o").addClass("fa-minus-square-o"))})}else d.skin.cleanContainer(s),s.empty(),t.removeClass("fa-minus-square-o").addClass("fa-plus-square-o")},_initDesktopWidgets:function(e){if(d.enableWidgets){var a=l(".ams-widget",e);0<a.length&&d.ajax.check(l.fn.MyAMSWidget,d.baseURL+"myams-widgets"+d.devext+".js",function(){a.each(function(){var e=l(this),a=e.data(),t=l.extend({},{deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"},a.amsWidgetOptions);t=d.executeFunctionByName(a.amsWidgetInitcallback,e,t)||t,e.MyAMSWidget(t)}),t.MyAMSWidget.initWidgetsGrid(l(".ams-widget-grid",e))})}},_initMobileWidgets:function(e){d.enableMobile&&d.enableWidgets&&d.skin._initDesktopWidgets(e)},alert:function(e,a,t,n,s,i){"error"===a&&(a="danger"),l(".alert-"+a,e).not(".persistent").remove();var r='<div class="'+(i?"margin-10":"")+" alert alert-block alert-"+a+' padding-5 fade in"><a class="close" data-dismiss="alert"><i class="fa fa-check"></i></a><h4 class="alert-heading"><i class="fa fa-fw fa-warning"></i> '+t+"</h4>"+(s?"<p>"+s+"</p>":"");if("string"==typeof n)r+="<ul><li>"+n+"</li></ul>";else if(n){for(var o in r+="<ul>",n)l.isNumeric(o)&&(r+="<li>"+n[o]+"</li>");r+="</ul>"}l(r+="</div>").insertBefore(e),e.exists&&d.skin.scrollTo(e,{offset:{top:-50}})},bigBox:function(e,a){d.ajax.check(d.notify,d.baseURL+"myams-notify"+d.devext+".js",function(){d.notify.messageBox(e,a)})},messageBox:function(e,a,t){"object"==typeof e&&(t=a,a=e||{},e="info"),d.ajax.check(d.notify,d.baseURL+"myams-notify"+d.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,d.notify.bigBox(a,t)})},smallBox:function(e,a,t){"object"==typeof e&&(t=a,a=e||{},e="info"),d.ajax.check(d.notify,d.baseURL+"myams-notify"+d.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,d.notify.smallBox(a,t)})},scrollTo:function(t,n){d.ajax.check(l.scrollTo,d.baseURL+"ext/jquery-scrollto-2.1.2"+d.devext+".js",function(){var e=l("body"),a=n.offset||0;e.hasClass("fixed-header")&&(a-=l("#header").height()),e.hasClass("fixed-ribbon")&&(a-=l("#ribbon").height()),n=l.extend({},n,{offset:a}),l.scrollTo(t,n)})},_drawBreadCrumb:function(){var n=l("OL.breadcrumb","#ribbon");l("li",n).not(".parent").remove(),l("li",n).exists()||n.append(l("<li></li>").append(l("<a></a>").text(d.i18n.HOME).addClass("padding-right-5").attr("href",l('nav a[href!="#"]:first').attr("href")))),l("LI.active >A","nav").each(function(){var e=l(this),a=l.trim(e.clone().children(".badge").remove().end().text()),t=l("<li></li>").append(e.attr("href").replace(/^#/,"")?l("<a></a>").html(a).attr("href",e.attr("href")):a);n.append(t)})},checkURL:function(){function e(e){l(".active",t).removeClass("active"),e.addClass("open").addClass("active"),e.parents("li").addClass("open active").children("ul").addClass("active").show(),e.parents("li:first").removeClass("open"),e.parents("ul").addClass(e.attr("href").replace(/^#/,"")?"active":"").show()}var a,t=l("nav"),n=location.hash,s=n.replace(/^#/,"");if(s){var i=l("#content");i.exists()||(i=l("body")),(a=l('A[href="'+n+'"]',t)).exists()&&e(a),d.skin.loadURL(s,i,{afterLoadCallback:function(){var e=l("html head title").data("ams-title-prefix");document.title=(e?e+" > ":"")+(l("[data-ams-page-title]:first",i).data("ams-page-title")||a.attr("title")||document.title)}})}else{var r=l("[data-ams-active-menu]").data("ams-active-menu");(a=r?l('A[href="'+r+'"]',t):l('>UL >LI >A[href!="#"]',t).first()).exists()&&(e(a),r?d.skin._drawBreadCrumb():window.location.hash=a.attr("href"))}},_clean_callbacks:[],registerCleanCallback:function(e){var a=d.skin._clean_callbacks;a.indexOf(e)<0&&a.push(e)},unregisterCleanCallback:function(e){var a=d.skin._clean_callbacks,t=a.indexOf(e);0<=t&&a.splice(t,1)},cleanContainer:function(e){for(var a=d.skin._clean_callbacks,t=0;t<a.length;t++)a[t].call(e)},loadURL:function(e,r,o,c){e.startsWith("#")&&(e=e.substr(1)),"function"==typeof o?(c=o,o={}):void 0===o&&(o={}),r=l(r);var a={type:"GET",url:e,dataType:"html",cache:!1,beforeSend:function(){if(o&&o.preLoadCallback&&d.executeFunctionByName(o.preLoadCallback,this,o.preLoadCallbackOptions),d.skin.cleanContainer(r),r.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> '+d.i18n.LOADING+" </h1>"),r[0]===l("#content")[0]){d.skin._drawBreadCrumb();var e=l("html head title").data("ams-title-prefix");document.title=(e?e+" > ":"")+l(".breadcrumb LI:last-child").text(),l("html, body").animate({scrollTop:0},"fast")}else r.animate({scrollTop:0},"fast")},success:function(e,a,t){if(c)d.executeFunctionByName(c,this,e,a,t,o);else{var n=d.ajax.getResponse(t),s=n.contentType,i=n.data;switch(l(".loading",r).remove(),s){case"json":d.ajax.handleJSON(i,r);break;case"script":case"xml":break;case"html":case"text":default:r.parents(".hidden").removeClass("hidden"),l(".alert",r.parents(".alerts-container")).remove(),r.css({opacity:"0.0"}).html(e).removeClass("hidden").delay(50).animate({opacity:"1.0"},300),d.initContent(r),d.form.setFocus(r)}o&&o.afterLoadCallback&&d.executeFunctionByName(o.afterLoadCallback,this,o.afterLoadCallbackOptions),d.stats.logPageview()}},error:function(e,a,t){r.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> '+d.i18n.ERROR+t+"</h3>"+e.responseText),o&&o.afterErrorCallback&&d.executeFunctionByName(o.afterErrorCallback,this)},async:void 0===o.async||o.async},t=l.extend({},a,o);l.ajax(t)},setLanguage:function(e,a){var t=a.lang;switch(a.handler_type||"json"){case"json":var n=a.method||"setUserLanguage";d.jsonrpc.post(n,{lang:t},function(){window.location.reload(!0)});break;case"ajax":var s=a.href||"setUserLanguage";d.ajax.post(s,{lang:t},function(){window.location.reload(!0)})}},logout:function(){window.location=d.loginURL}}}(jQuery,this),function(e,n){n.MyAMS.stats={logPageview:function(e){if(void 0!==n._gaq){var a=n.window.location;n._gaq.push(["_trackPageview",e||a.pathname+a.hash])}},logEvent:function(e,a,t){void 0!==n._gaq&&("object"==typeof e&&(a=e.action,t=e.label,e=e.category),n._gaq.push(["_trackEvent",e,a,t]))}}}(jQuery,this),function(c,s){var l=s.MyAMS;l.initPage=function(){var a=c("body");l.root=a,l.leftPanel=c("#left-panel"),l.shortcuts=c("#shortcuts"),l.plugins.initData(a);var t=c.ajaxSettings.xhr;c.ajaxSetup({beforeSend:function(e,a){if(l.safeMethods.indexOf(a.type)<0&&void 0!==s.Cookies){var t=Cookies.get(l.csrfCookieName);t&&e.setRequestHeader(l.csrfHeaderName,t)}},progress:l.ajax.progress,progressUpload:l.ajax.progress,xhr:function(){var e=t();if(e&&"function"==typeof e.addEventListener){var a=this;a&&a.progress&&e.addEventListener("progress",function(e){a.progress(e)},!1)}return e}}),c(document).ajaxStart(l.ajax.start),c(document).ajaxStop(l.ajax.stop),c(document).ajaxError(l.error.ajax);var e=s.localStorage&&s.localStorage.getItem("window-state");e&&a.addClass(e),l.isMobile?(l.root.addClass("mobile-detected"),l.device="mobile",l.enableFastclick&&l.ajax.check(c.fn.noClickDelay,l.baseURL+"/ext/jquery-smartclick"+l.devext+".js",function(){c("NAV UL A").noClickDelay(),c("A","#hide-menu").noClickDelay()})):(l.root.addClass("desktop-detected"),l.device="desktop"),c("#show-shortcuts").click(function(e){l.shortcuts.is(":visible")?l.skin._hideShortcutButtons():l.skin._showShortcutButtons(),e.preventDefault()}),l.shortcuts.click(function(e){l.skin._hideShortcutButtons()}),c(document).mouseup(function(e){l.shortcuts.is(e.target)||0!==l.shortcuts.has(e.target).length||l.skin._hideShortcutButtons()}),c("#search-mobile").click(function(){l.root.addClass("search-mobile")}),c("#cancel-search-js").click(function(){l.root.removeClass("search-mobile")}),c(".activity-button","#user-activity").click(function(e){var a=c("#user-activity"),t=c(".ajax-dropdown",a);t.is(":visible")?(t.fadeOut(150),a.removeClass("active")):(t.css("left",-t.innerWidth()+a.innerWidth()).fadeIn(150),a.addClass("active")),e.preventDefault()}),l.skin.checkNotification(),c(document).mouseup(function(e){var a=c(".ajax-dropdown");a.is(e.target)||0!==a.has(e.target).length||a.fadeOut(150).prev().removeClass("active")}),c('input[name="activity"]').change(function(e){var a=c(this).data("ams-url");if(a){e.preventDefault(),e.stopPropagation();var t=l.getFunctionByName(a);if("function"==typeof t&&(a=t.call(this)),"function"==typeof a)a.call(this);else{var n=c(".ajax-notifications");l.skin.loadURL(a,n)}}}),c("a","#user-menu LI.logout").click(function(e){e.preventDefault(),e.stopPropagation(),l.loginURL=c(this).attr("href"),l.skin.bigBox({title:"<i class='fa fa-sign-out txt-color-orangeDark'></i> "+l.i18n.LOGOUT+" <span class='txt-color-orangeDark'><strong>"+c("#show-shortcut").text()+"</strong></span> ?",content:l.i18n.LOGOUT_COMMENT,buttons:l.i18n.BTN_YES_NO},function(e){e===l.i18n.BTN_YES&&(l.root.addClass("animated fadeOutUp"),setTimeout(l.skin.logout,1e3))})});var n=c("nav");c("UL",n).myams_menu({accordion:!1!==n.data("ams-menu-accordion"),speed:l.menuSpeed}),c("#hide-menu").find(">:first-child >A").click(function(e){a.toggleClass("hidden-menu"),s.localStorage&&(a.hasClass("hidden-menu")?s.localStorage.setItem("window-state","hidden-menu"):s.localStorage.setItem("window-state","")),e.preventDefault()}),c(".minifyme").click(function(e){a.toggleClass("minified"),s.localStorage&&(a.hasClass("minified")?s.localStorage.setItem("window-state","minified"):s.localStorage.setItem("window-state","")),c(this).effect("highlight",{},500),e.preventDefault()}),c("#refresh").click(function(e){l.skin.bigBox({title:"<i class='fa fa-refresh' style='color: green'></i> "+l.i18n.CLEAR_STORAGE_TITLE,content:l.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+l.i18n.BTN_CANCEL+"]["+l.i18n.BTN_OK+"]"},function(e){e===l.i18n.BTN_OK&&localStorage&&(localStorage.clear(),location.reload())}),e.preventDefault()}),a.on("click",function(e){var a=c(this);a.is(e.target)||0!==a.has(e.target).length||0!==c(".popover").has(e.target).length||a.popover("hide")}),l.ajax.check(c.resize,l.baseURL+"ext/jquery-resize"+l.devext+".js",function(){c("#main").resize(function(){l.skin._setPageHeight(),l.skin._checkMobileWidth()}),n.resize(function(){l.skin._setPageHeight()})}),l.ajaxNav&&(c(document).on("click",'a[href="#"]',function(e){e.preventDefault()}),c(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(e){var a=c(e.currentTarget),t=a.data("ams-disabled-handlers");if(!0!==t&&"click"!==t&&"all"!==t){var n=a.attr("href")||a.data("ams-url");if(n&&!n.startsWith("javascript")&&!a.attr("target")&&!0!==a.data("ams-context-menu")){var s,i;e.preventDefault(),e.stopPropagation(),0<=n.indexOf("?")?(s=n.split("?"),r=s[0],i=s[1].unserialize()):(r=n,i=void 0);var r,o=l.getFunctionByName(r);if("function"==typeof o&&(n=o.call(a,i)),"function"==typeof n)n.call(a,i);else if(n=n.replace(/\%23/,"#"),e.ctrlKey)window.open(n);else(r=a.data("ams-target"))?l.form.confirmChangedForm(r,function(){l.skin.loadURL(n,r,a.data("ams-link-options"),a.data("ams-link-callback"))}):l.form.confirmChangedForm(function(){n.startsWith("#")?n!==location.hash&&(l.root.hasClass("mobile-view-activated")?(l.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=n},50)):window.location.hash=n):window.location=n})}}}),c(document).on("click",'a[target="_blank"]',function(e){e.preventDefault();var a=c(e.currentTarget);window.open(a.attr("href")),l.stats.logEvent(a.data("ams-stats-category")||"Navigation",a.data("ams-stats-action")||"External",a.data("ams-stats-label")||a.attr("href"))}),c(document).on("click",'a[target="_top"]',function(e){e.preventDefault(),l.form.confirmChangedForm(function(){window.location=c(e.currentTarget).attr("href")})}),c(window).on("hashchange",l.skin.checkURL)),c(document).off("click.modal").on("click",'[data-toggle="modal"]',function(e){var a=c(this),t=a.data("ams-disabled-handlers");!0!==t&&"click"!==t&&"all"!==t&&!0!==a.data("ams-context-menu")&&(!0===a.data("ams-stop-propagation")&&e.stopPropagation(),e.preventDefault(),l.dialog.open(a),a.parents("#shortcut").exists()&&setTimeout(l.skin._hideShortcutButtons,300))}),c(document).on("click",'button[type="submit"], button.submit',function(){var e=c(this);c(e.get(0).form).data("ams-submit-button",e)}),c(document).on("click",'input[type="checkbox"][readonly]',function(){return!1}),c(document).on("click","[data-ams-click-handler]",function(e){var a=c(this),t=a.data("ams-disabled-handlers");if(!0!==t&&"click"!==t&&"all"!==t){var n=a.data();if(n.amsClickHandler){!0!==n.amsStopPropagation&&!0!==n.amsClickStopPropagation||e.stopPropagation(),!0!==n.amsClickKeepDefault&&e.preventDefault();for(var s=n.amsClickHandler.split(/\s+/),i=0;i<s.length;i++){var r=l.getFunctionByName(s[i]);void 0!==r&&r.call(a,e,n.amsClickHandlerOptions)}}}}),c(document).on("change","[data-ams-change-handler]",function(e){var a=c(this);if(!a.prop("readonly")){var t=a.data("ams-disabled-handlers");if(!0!==t&&"change"!==t&&"all"!==t){var n=a.data();if(n.amsChangeHandler){!0!==n.amsStopPropagation&&!0!==n.amsChangeStopPropagation||e.stopPropagation(),!0!==n.amsChangeKeepDefault&&e.preventDefault();for(var s=n.amsChangeHandler.split(/\s+/),i=0;i<s.length;i++){var r=l.getFunctionByName(s[i]);void 0!==r&&r.call(a,e,n.amsChangeHandlerOptions)}}}}}),c(document).on("keydown","textarea",function(e){10!==e.keyCode&&13!==e.keyCode||!e.ctrlKey&&!e.metaKey||c(this).closest("form").submit()}),c(document).on("reset","form",function(e){var n=c(this);setTimeout(function(){c(".alert-danger, SPAN.state-error",n).not(".persistent").remove(),c("LABEL.state-error",n).removeClass("state-error"),c('INPUT.select2[type="hidden"]',n).each(function(){var e=c(this),a=e.data("select2"),t=e.data("ams-select2-input-value");t&&e.select2("val",t.split(a.opts.separator))}),n.find(".select2").trigger("change"),c("[data-ams-reset-callback]",n).each(function(){var e=c(this),a=e.data(),t=l.getFunctionByName(a.amsResetCallback);void 0!==t&&t.call(n,e,a.amsResetCallbackOptions)})},10),l.form.setFocus(n)}),c(document).on("reset","[data-ams-reset-handler]",function(e){var a=c(this),t=a.data();if(t.amsResetHandler){!0!==t.amsResetKeepDefault&&e.preventDefault();var n=l.getFunctionByName(t.amsResetHandler);void 0!==n&&n.call(a,t.amsResetHandlerOptions)}}),c(document).on("click","[data-ams-click-event]",function(e){var a=c(this);c(e.target).trigger(a.data("ams-click-event"),a.data("ams-click-event-options"))}),c(document).on("change",'input[type="file"]',function(e){e.preventDefault();var a=c(this),t=a.parent(".button");t.exists()&&t.parent().hasClass("input-file")&&t.next('input[type="text"]').val(a.val())}),c(document).on("focus",'input[readonly="readonly"]',function(){c(this).blur()}),c(document).on("focusin",function(e){c(e.target).closest(".mce-window").length&&e.stopImmediatePropagation()}),c(document).on("click",".nav-tabs a[data-toggle=tab]",function(e){if(c(this).parent("li").hasClass("disabled"))return e.preventDefault(),!1}),c(document).on("show.bs.dropdown",".btn-group",function(){var e=c(this),a=e.children(".dropdown-menu"),t=e.get(0).getBoundingClientRect(),n=t.top,s=t.height,i=a.outerHeight();i<n&&c(window).height()-n<s+i&&e.addClass("dropup")}).on("hidden.bs.dropdown",".btn-group",function(){c(this).removeClass("dropup")}),c(document).on("show.bs.tab",function(e){var a=c(e.target);a.exists()&&"A"!==a.get(0).tagName&&(a=c("a[href]",a));var t=a.data();if(t&&t.amsUrl){if(t.amsTabLoaded)return;a.append('<i class="fa fa-spin fa-cog margin-left-5"></i>'),l.skin.loadURL(t.amsUrl,a.attr("href"),{afterLoadCallback:function(){t.amsTabLoadOnce&&a.data("ams-tab-loaded",!0),c("i",a).remove()},afterErrorCallback:function(){c("i",a).remove()}})}}),c(document).on("hide.bs.modal",function(e){var a=c(e.target);l.form.confirmChangedForm(a,function(){var e=a.data("modal")||a.data("bs.modal");return e&&(e.isShown=!0),!0},function(){return e.preventDefault(),!1})}),c(document).on("myams.refresh",function(e,a){l.executeFunctionByName(a.handler||l.skin.refreshContent,e.target,a)}),l.initContent(document),l.ajaxNav&&n.exists()&&l.skin.checkURL(),l.form.setFocus(document),c(window).on("beforeunload",l.form.checkBeforeUnload)},l.initContent=function(e){c(".tipsy").remove(),c("[rel=tooltip]",e).tooltip(),c("[rel=popover]",e).popover(),c("[rel=popover-hover]",e).popover({trigger:"hover"}),l.plugins.init(e),l.callbacks.init(e),l.events.init(e),l.form.init(e),"desktop"===l.device?l.skin._initDesktopWidgets(e):l.skin._initMobileWidgets(e),l.skin._setPageHeight()},l.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",LOADING:"Loading...",PROGRESS:"Processing",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",CLIPBOARD_CHARACTER_COPY_OK:"Character copied to clipboard",CLIPBOARD_TEXT_COPY_OK:"Text copied to clipboard",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"},l.plugins.i18n={widgets:{},validate:{},datatables:{},fancybox:{ERROR:"Can't load requested content.",RETRY:"Please check URL or try again later.",CLOSE:"Close",NEXT:"Next",PREVIOUS:"Previous"},dndupload:{FILES_SELECTED:"{count} files selected",CHOOSE_FILE:"Select file(s)",ADD_INFO:"to add them to current folder,",DRAG_FILE:"or drag and drop them here!",UPLOAD:"Upload",UPLOADING:"Uploading…",DONE:"Done!",UPLOAD_MORE:"Upload more?",ERROR:"Error!",TRY_AGAIN:"Try again?"}},c(document).ready(function(){var e=(c=jQuery.noConflict())("HTML");e.removeClass("no-js").addClass("js");var a=e.attr("lang")||e.attr("xml:lang");a&&!a.startsWith("en")?(l.lang=a,l.getScript(l.baseURL+"i18n/myams_"+a.substr(0,2)+l.devext+".js",function(){l.initPage()})):l.initPage()})}(jQuery,this);
+"use strict";!function(e,a){var t=a.console;String.prototype.startsWith=function(e){var a=this.length,t=e.length;return!(a<t)&&this.substr(0,t)===e},String.prototype.endsWith=function(e){var a=this.length,t=e.length;return!(a<t)&&this.substr(a-t)===e},String.prototype.unserialize=function(e){for(var a=decodeURIComponent(this).split("&"),t={},n=0;n<a.length;n++){var s=a[n].split("=",2);t[s[0]]=s[1]}return t},Array.prototype.indexOf||(Array.prototype.indexOf=function(e,a){var t=this.length;for((a=(a=Number(a)||0)<0?Math.ceil(a):Math.floor(a))<0&&(a+=t);a<t;a++)if(a in this&&this[a]===e)return a;return-1}),e.expr[":"].hasvalue=function(a,t,n){return""!==e(a).val()},e.expr[":"].econtains=function(a,t,n){return(a.textContent||a.innerText||e(a).text()||"").toLowerCase()===n[3].toLowerCase()},e.expr[":"].withtext=function(a,t,n){return(a.textContent||a.innerText||e(a).text()||"")===n[3]},e.expr[":"].parents=function(a,t,n){return e(a).parents(n[3]).length>0},void 0===e.scrollbarWidth&&(e.scrollbarWidth=function(){var a=e('<div style="width: 50px; height: 50px; overflow: auto"><div/></div>').appendTo("body"),t=a.children(),n=t.innerWidth()-t.height(99).innerWidth();return a.remove(),n}),e.fn.extend({exists:function(){return e(this).length>0},objectOrParentWithClass:function(e){return this.hasClass(e)?this:this.parents("."+e)},listattr:function(a){var t=[];return this.each(function(){t.push(e(this).attr(a))}),t},style:function(e,a,t){if(void 0!==this.get(0)){var n=this.get(0).style;return void 0!==e?void 0!==a?(t=void 0!==t?t:"",n.setProperty(e,a,t),this):n.getPropertyValue(e):n}},removeClassPrefix:function(a){return this.each(function(t,n){var s=n.className.split(" ").map(function(e){return e.startsWith(a)?"":e});n.className=e.trim(s.join(" "))}),this}}),void 0===a.MyAMS&&(a.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var n=a.MyAMS,s=n;n.baseURL=function(){var a=e('script[src*="/myams.js"], script[src*="/myams.min.js"], script[src*="/myams-core.js"], script[src*="/myams-core.min.js"], script[src*="/myams-require.js"], script[src*="/myams-require.min.js"]').attr("src");return s.devmode=a.indexOf(".min.js")<0,s.devext=s.devmode?"":".min",a.substring(0,a.lastIndexOf("/")+1)}(),n.log=function(){t&&t.debug&&t.debug(this,arguments)},n.getQueryVar=function(e,a){if(e.indexOf("?")<0)return!1;e.endsWith("&")||(e+="&");var t=new RegExp(".*?[&\\?]"+a+"=(.*?)&.*"),n=e.replace(t,"$1");return n!==e&&n},n.rgb2hex=function(a){return"#"+e.map(a.match(/\b(\d+)\b/g),function(e){return("0"+parseInt(e).toString(16)).slice(-2)}).join("")},n.generateId=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()+e()},n.generateUUID=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var t=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===a?t:3&t|8).toString(16)})},n.getObject=function(e,a){if(e){if("string"!=typeof e)return e;var t=e.split(".");a=void 0===a||null===a?window:a;for(var n=0;n<t.length;n++)try{a=a[t[n]]}catch(e){return}return a}},n.getFunctionByName=function(e,a){if(void 0!==e){if("function"==typeof e)return e;var t=e.split("."),n=t.pop();a=void 0===a||null===a?window:a;for(var s=0;s<t.length;s++)try{a=a[t[s]]}catch(e){return}try{return a[n]}catch(e){return}}},n.executeFunctionByName=function(e,a){var t=s.getFunctionByName(e,window);if("function"==typeof t){var n=Array.prototype.slice.call(arguments,2);return t.apply(a,n)}},n.isInDOM=function(t){return!!(t=e(t)).exists()&&a.document.body.contains(t[0])},n.getSource=function(e){return e.replace(/{[^{}]*}/g,function(e){return s.getFunctionByName(e.substr(1,e.length-2))})},n.getScript=function(a,t,n,i){"object"==typeof t&&(i=n,n=t,t=null),void 0===n&&(n={});var r={dataType:"script",url:s.getSource(a),success:t,error:i||s.error.show,cache:!s.devmode,async:void 0===n.async?"function"==typeof t:n.async},o=e.extend({},r,n);return e.ajax(o)},n.getCSS=function(a,t,n,i){n&&(n=s.getFunctionByName(n));var r=e("HEAD"),o=e('style[data-ams-id="'+t+'"]',r);if(0===o.length){if(o=e("<style>").attr("data-ams-id",t).text('@import "'+s.getSource(a)+'";'),n)var c=setInterval(function(){try{o[0].sheet.cssRules;n.call(window,!0,i),clearInterval(c)}catch(e){}},10);o.appendTo(r)}else n&&n.call(window,!1,i)}}(jQuery,this),function(e,a){a.MyAMS.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",LOADING:"Loading...",PROGRESS:"Processing",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",CLIPBOARD_CHARACTER_COPY_OK:"Character copied to clipboard",CLIPBOARD_TEXT_COPY_OK:"Text copied to clipboard",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"}}(jQuery,this),jQuery.UTF8={encode:function(e){e=e.replace(/\r\n/g,"\n");for(var a="",t=0;t<e.length;t++){var n=e.charCodeAt(t);n<128?a+=String.fromCharCode(n):n>127&&n<2048?(a+=String.fromCharCode(n>>6|192),a+=String.fromCharCode(63&n|128)):(a+=String.fromCharCode(n>>12|224),a+=String.fromCharCode(n>>6&63|128),a+=String.fromCharCode(63&n|128))}return a},decode:function(e){for(var a="",t=0,n=0,s=0,i=0;t<e.length;)(n=e.charCodeAt(t))<128?(a+=String.fromCharCode(n),t++):n>191&&n<224?(s=e.charCodeAt(t+1),a+=String.fromCharCode((31&n)<<6|63&s),t+=2):(s=e.charCodeAt(t+1),i=e.charCodeAt(t+2),a+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),t+=3);return a}},function(e,a){var t=a.MyAMS;e.fn.extend({contextMenu:function(a){function n(t,n,s){var i=e(window)[n](),r=e(a.menuSelector)[n](),o=t;return t+r>i&&r<t&&(o-=r),o}return this.each(function(){e("a",e(a.menuSelector)).each(function(){e(this).data("ams-context-menu",!0)}),e(this).on("contextmenu",function(s){if(!s.ctrlKey)return e(a.menuSelector).data("invokedOn",e(s.target)).show().css({position:"fixed",left:n(s.clientX,"width")-10,top:n(s.clientY,"height")-10}).off("click").on("click",function(n){e(this).hide();var s=e(this).data("invokedOn"),i=e(n.target);a.menuSelected.call(this,s,i),t.event&&t.event.stop(n)}),!1}),e(document).click(function(){e(a.menuSelector).hide()})})},myams_menu:function(a){var t=e.extend({},{accordion:!0,speed:200,closedSign:'<em class="fa fa-angle-down"></em>',openedSign:'<em class="fa fa-angle-up"></em>'},a),n=e(this);n.find("LI").each(function(){var a=e(this);if(a.find("UL").size()>0){a.find("A:first").append("<b class='collapse-sign'>"+t.closedSign+"</b>");var n=a.find("A:first");"#"===n.attr("href")&&n.click(function(){return!1})}}),n.find("LI.active").each(function(){var a=e(this).parents("UL"),n=a.parent("LI");a.slideDown(t.speed),n.find("b:first").html(t.openedSign),n.addClass("open")}),n.find("LI A").on("click",function(){var a=e(this);if(!a.hasClass("active")){var s=a.attr("href").replace(/^#/,""),i=a.parent().find("UL");if(t.accordion){var r=a.parent().parents("UL"),o=n.find("UL:visible");o.each(function(a){var n=!0;if(r.each(function(e){if(r[e]===o[a])return n=!1,!1}),n&&i!==o[a]){var c=e(o[a]);!s&&c.hasClass("active")||c.slideUp(t.speed,function(){e(this).parent("LI").removeClass("open").find("B:first").delay(t.speed).html(t.closedSign)})}})}var c=a.parent().find("UL:first");s||!c.is(":visible")||c.hasClass("active")?c.slideDown(t.speed,function(){a.parent("LI").addClass("open").find("B:first").delay(t.speed).html(t.openedSign)}):c.slideUp(t.speed,function(){a.parent("LI").removeClass("open").find("B:first").delay(t.speed).html(t.closedSign)})}})}})}(jQuery,this),function(e,a){a.MyAMS.event={stop:function(e){e||(e=window.event),e&&"string"!=typeof e&&(e.stopPropagation?(e.stopPropagation(),e.preventDefault()):(e.cancelBubble=!0,e.returnValue=!1))}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.browser={getInternetExplorerVersion:function(){var e=-1;if("Microsoft Internet Explorer"===navigator.appName){var a=navigator.userAgent;null!==new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(a)&&(e=parseFloat(RegExp.$1))}return e},checkVersion:function(){var e="You're not using Windows Internet Explorer.",t=this.getInternetExplorerVersion();t>-1&&(e=t>=8?"You're using a recent copy of Windows Internet Explorer.":"You should upgrade your copy of Windows Internet Explorer."),a.alert&&a.alert(e)},isIE8orlower:function(){var e="0",a=this.getInternetExplorerVersion();return a>-1&&(e=a>=9?0:1),e},copyToClipboard:function(n){function s(n){var s=!1;if(window.clipboardData&&window.clipboardData.setData)s=clipboardData.setData("Text",n);else if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var i=e("<textarea>");i.val(n),i.css("position","fixed"),i.appendTo(e("body")),i.get(0).select();try{document.execCommand("copy"),s=!0}catch(e){console&&console.warn&&console.warn("Copy to clipboard failed.",e)}finally{i.remove()}}s?t.skin&&t.skin.smallBox("success",{title:n.length>1?t.i18n.CLIPBOARD_TEXT_COPY_OK:t.i18n.CLIPBOARD_CHARACTER_COPY_OK,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):a.prompt&&a.prompt(t.i18n.CLIPBOARD_COPY,n)}if(void 0===n)return function(){var a=e(this),t=a.text();a.parents(".btn-group").removeClass("open"),s(t)};s(n)}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.error={ajax:function(e,a,n,s){if(!("abort"===s||a&&a.statusText&&"OK"===a.statusText.toUpperCase()))if(a=t.ajax&&t.ajax.getResponse(a)){if("json"===a.contentType)t.ajax.handleJSON(a.data);else{var i=s||e.statusText||e.type,r=a.responseText;t.skin&&t.skin.messageBox("error",{title:t.i18n.ERROR_OCCURED,content:"<h4>"+i+"</h4><p>"+(r||"")+"</p>",icon:"fa fa-warning animated shake",timeout:1e4})}console&&(console.error&&console.error(e),console.debug&&console.debug(a))}else console.error&&console.error("Missing MyAMS AJAX module!")},show:function(e,a,n){if(n){var s=t.ajax&&t.ajax.getResponse(e);s?("json"===s.contentType?t.ajax.handleJSON(s.data):t.skin.messageBox("error",{title:t.i18n.ERRORS_OCCURED,content:"<h4>"+a+"</h4><p>"+n+"</p>",icon:"fa fa-warning animated shake",timeout:1e4}),console&&(console.error&&console.error(n),console.debug&&console.debug(e))):console.error&&console.error("Missing MyAMS AJAX module!")}}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.ajax={check:function(a,n,s,i){function r(e,a){if(void 0!==s){s instanceof Array||(s=[s]);for(var n=0;n<s.length;n++){var i=t.getFunctionByName(s[n]);"function"==typeof i&&i(e,a)}}}s instanceof Array||"object"==typeof s&&(i=s,s=void 0);var o={async:"function"==typeof s},c=e.extend({},o,i);if(a instanceof Array){for(var l=[],d=0;d<a.length;d++)void 0===a[d]&&l.push(t.getScript(n[d],{async:!0}));l.length>0?e.when.apply(e,l).then(function(){r(!0,i)}):r(!1,i)}else void 0===a?"string"==typeof n&&t.getScript(n,function(){r(!0,i)},c):r(!1,i)},getAddr:function(a){var t=a||e("HTML HEAD BASE").attr("href")||window.location.href;return t.substr(0,t.lastIndexOf("/")+1)},start:function(){e("#ajax-gear").show()},stop:function(){e("#ajax-gear").hide()},progress:function(e){e.lengthComputable&&(e.loaded>=e.total||console&&console.log&&console.log(parseInt(e.loaded/e.total*100,10)+"%"))},getJSON:function(){return function(e){var a=e.url;delete e.url,t.ajax.post(a,e,function(e,a,n){t.ajax.handleJSON(e)})}},post:function(n,s,i,r){var o;o=n.startsWith(window.location.protocol)?n:this.getAddr()+n,"function"==typeof i?(r=i,i={}):i||(i={}),void 0===r&&(r=i.callback),"string"==typeof r&&(r=t.getFunctionByName(r)),delete i.callback;var c,l={url:o,type:"post",cache:!1,async:"function"==typeof r,data:e.param(s),dataType:"json",beforeSend:function(e,n){if(void 0!==a.Cookies){var s=Cookies.get(t.csrfCookieName);s&&e.setRequestHeader(t.csrfHeaderName,s)}},success:r||function(e){c=e.result}},d=e.extend({},l,i);return e.ajax(d),c},getResponse:function(e){var a,n,s=e.getResponseHeader("content-type");if(s)if(s.startsWith("application/javascript"))a="script",n=e.responseText;else if(s.startsWith("text/html"))a="html",n=e.responseText;else if(s.startsWith("text/xml"))a="xml",n=e.responseText;else if(n=e.responseJSON)a="json";else try{n=JSON.parse(e.responseText),a="json"}catch(t){n=e.responseText,a="text"}else a="json",n={status:"alert",alert:{title:t.i18n.ERROR_OCCURED,content:t.i18n.NO_SERVER_RESPONSE}};return{contentType:a,data:n}},handleJSON:function(n,s,i){var r,o=n.status;switch(o){case"alert":a.alert&&a.alert(n.alert.title+"\n\n"+n.alert.content);break;case"error":t.form&&t.form.showErrors(s,n);break;case"info":case"success":void 0!==s&&(t.form&&t.form.resetChanged(s),!1!==n.close_form&&t.dialog&&t.dialog.close(s));break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":void 0!==s&&(t.form&&t.form.resetChanged(s),!1!==n.close_form&&t.dialog&&t.dialog.close(s));break;case"modal":t.dialog&&t.dialog.open(n.location);break;case"reload":void 0!==s&&(t.form&&t.form.resetChanged(s),!1!==n.close_form&&t.dialog&&t.dialog.close(s)),(r=n.location||window.location.hash).startsWith("#")&&(r=r.substr(1));var c=e(n.target||i||"#content");t.skin&&t.skin.loadURL(r,c,{preLoadCallback:t.getFunctionByName(n.pre_reload)||function(){e("[data-ams-pre-reload]",c).each(function(){t.executeFunctionByName(e(this).data("ams-pre-reload"))})},preLoadCallbackOptions:n.pre_reload_options,afterLoadCallback:t.getFunctionByName(n.post_reload)||function(){e("[data-ams-post-reload]",c).each(function(){t.executeFunctionByName(e(this).data("ams-post-reload"))})},afterLoadCallbackOptions:n.post_reload_options});break;case"redirect":void 0!==s&&(t.form&&t.form.resetChanged(s),!0===n.close_form&&t.dialog&&t.dialog.close(s)),(r=n.location||window.location.href).endsWith("##")&&(r=r.replace(/##/,window.location.hash)),n.window?window.open(r,n.window,n.options):window.location.href===r?window.location.reload(!0):window.location.href=r;break;default:console&&console.log&&console.log("Unhandled status: "+o)}var l,d,m;if(n.content&&(d=n.content,m=e(d.target||i||s||"#content"),!0===d.raw?m.text(d.text):(m.html(d.html),t.initContent&&t.initContent(m)),d.keep_hidden||m.removeClass("hidden")),n.contents){var u=n.contents;for(l=0;l<u.length;l++)d=u[l],m=e(d.target),!0===d.raw?m.text(d.text):(m.html(d.html),t.initContent&&t.initContent(m)),d.keep_hidden||m.removeClass("hidden")}var f;if(n.message&&("string"==typeof(f=n.message)?"info"===o||"success"===o?t.skin&&t.skin.smallBox(o,{title:f,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):t.skin&&t.skin.alert(e(s||"#content"),o,f):t.skin&&t.skin.alert(e(f.target||i||s||"#content"),f.status||"success",f.header,f.body,f.subtitle)),n.smallbox&&("string"==typeof(f=n.smallbox)?t.skin&&t.skin.smallBox(n.smallbox_status||o,{title:n.smallbox,icon:n.smallbox_icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:n.smallbox_timeout||3e3}):t.skin&&t.skin.smallBox(f.status||o,{title:f.message,icon:f.icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:f.timeout||3e3})),n.messagebox)if("string"==typeof(f=n.messagebox))t.skin&&t.skin.messageBox("info",{title:t.i18n.ERROR_OCCURED,content:f,timeout:1e4});else{var h=f.status||"info";"error"===h&&s&&i&&t.executeFunctionByName(s.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",s,i),t.skin&&t.skin.messageBox(h,{title:f.title||t.i18n.ERROR_OCCURED,content:f.content,icon:f.icon,number:f.number,timeout:null===f.timeout?void 0:f.timeout||1e4})}if(n.event&&s.trigger(n.event,n.event_options),n.events){var p;for(void 0===s&&(s=e(document)),l=0;l<n.events.length;l++)null!==(p=n.events[l])&&("string"==typeof p?s.trigger(p,n.events_options):s.trigger(p.event,p.options))}if(n.callback&&t.executeFunctionByName(n.callback,s,n.options),n.callbacks){var g;for(l=0;l<n.callbacks.length;l++)"function"==typeof(g=n.callbacks[l])?t.executeFunctionByName(g,s,g.options):t.executeFunctionByName(g.callback,s,g.options)}}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.jsonrpc={getAddr:function(a){var t=(a||e("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return t.substr(0,t.lastIndexOf("/")+1)},query:function(a,n,s,i){t.ajax&&t.ajax.check(e.jsonRPC,t.baseURL+"ext/jquery-jsonrpc"+t.devext+".js",function(){"function"==typeof s?(i=s,s={}):s||(s={}),"undefined"===i&&(i=s.callback),"string"==typeof i&&(i=t.getFunctionByName(i)),delete s.callback;var r={};"string"==typeof a?r.query=a:"object"==typeof a&&e.extend(r,a),e.extend(r,s);var o,c={id:(new Date).getTime(),params:r,success:i||function(e){o=e},error:t.error&&t.error.show},l=e.extend({},c,s);return e.jsonRPC.withOptions({endPoint:t.jsonrpc.getAddr(s.url),namespace:s.namespace,cache:!1},function(){e.jsonRPC.request(n,l)}),o})},post:function(a,n,s,i){t.ajax&&t.ajax.check(e.jsonRPC,t.baseURL+"ext/jquery-jsonrpc"+t.devext+".js",function(){"function"==typeof s?(i=s,s={}):s||(s={}),void 0===i&&(i=s.callback),"string"==typeof i&&(i=t.getFunctionByName(i)),delete s.callback;var r,o={id:(new Date).getTime(),params:n,success:i||function(e){r=e},error:t.error&&t.error.show},c=e.extend({},o,s);return e.jsonRPC.withOptions({endPoint:t.jsonrpc.getAddr(s.url),namespace:s.namespace,cache:!1},function(){e.jsonRPC.request(a,c)}),r})}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.xmlrpc={getAddr:function(a){var t=(a||e("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return t.substr(0,t.lastIndexOf("/")+1)},post:function(a,n,s,i,r){t.ajax&&t.ajax.check(e.xmlrpc,t.baseURL+"ext/jquery-xmlrpc"+t.devext+".js",function(){"function"==typeof i?(r=i,i={}):i||(i={}),void 0===r&&(r=i.callback),"string"==typeof r&&(r=t.getFunctionByName(r)),delete i.callback;var o,c={url:t.xmlrpc.getAddr(a),methodName:n,params:s,success:r||function(e){o=e},error:t.error&&t.error.show},l=e.extend({},c,i);return e.xmlrpc(l),o})}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.form={init:function(a){e("FORM",a).each(function(){var a=e(this);e('INPUT.select2[type="hidden"]',a).each(function(){var a=e(this);a.data("ams-select2-input-value",a.val())})});(t.warnOnFormChange?e('FORM[data-ams-warn-on-change!="false"]',a):e('FORM[data-ams-warn-on-change="true"]',a)).each(function(){var a=e(this);e('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',a).each(function(){var a=e(this);if(!0!==a.data("ams-ignore-change")){var n=a.data("ams-changed-event")||"change";a.on(n,function(){t.form.setChanged(e(this).parents("FORM"))})}}),a.on("reset",function(){t.form.resetChanged(e(this))})})},setFocus:function(a){var t=e("[data-ams-focus-target]",a).first();t.exists()||(t=e("input, select",a).first()),t.exists()&&(t.hasClass("select2-input")&&(t=t.parents(".select2")),t.hasClass("select2")?setTimeout(function(){t.select2("focus"),!0===t.data("ams-focus-open")&&t.select2("open")},100):t.focus())},checkBeforeUnload:function(){if(e('FORM[data-ams-form-changed="true"]').exists())return t.i18n.FORM_CHANGED_WARNING},confirmChangedForm:function(n,s,i){"function"==typeof n&&(s=n,n=void 0),e('FORM[data-ams-form-changed="true"]',n).exists()?i?a.confirm(t.i18n.FORM_CHANGED_WARNING,t.i18n.WARNING)?s.call(n):i.call(n):t.skin&&t.skin.bigBox({title:t.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+t.i18n.FORM_CHANGED_WARNING,buttons:t.i18n.BTN_OK_CANCEL},function(e){e===t.i18n.BTN_OK&&s.call(n)}):s.call(n)},setChanged:function(e){e.attr("data-ams-form-changed",!0)},resetChanged:function(a){void 0!==a&&e(a).removeAttr("data-ams-form-changed")},submit:function(n,s,i){if(!(n=e(n)).exists())return!1;if("object"==typeof s&&(i=s,s=void 0),n.data("submitted"))return n.data("ams-form-hide-submitted")||t.skin&&t.skin.messageBox("warning",{title:t.i18n.WAIT,content:t.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:n.data("ams-form-alert-timeout")||5e3}),!1;if(t.form&&!t.form._checkSubmitValidators(n))return!1;e(".alert-danger, SPAN.state-error",n).not(".persistent").remove(),e(".state-error",n).removeClassPrefix("state-");var r=e(n.data("ams-submit-button"));return r&&!r.data("ams-form-hide-loading")&&(r.data("ams-progress-content",r.html()),r.button("loading")),t.ajax&&t.ajax.check(e.fn.ajaxSubmit,t.baseURL+"ext/jquery-form-3.49"+t.devext+".js",function(){function r(n,r){var o,c,l,d,m,u,f,h,p,g=n.data(),b=g.amsFormOptions;if(i&&(m=i.formDataInitCallback),m?delete i.formDataInitCallback:m=g.amsFormDataInitCallback,m){var v={};if(d=t.executeFunctionByName(m,n,v),v.veto)return(o=n.data("ams-submit-button"))&&o.button("reset"),t.form.finalizeSubmitFooter.call(n),!1}else d=g.amsFormData||{};(o=e(n.data("ams-submit-button")))&&o.exists()?l=(c=o.data()).amsFormSubmitTarget:c={};var x,y=s||c.amsFormHandler||g.amsFormHandler||"";if(y.startsWith(window.location.protocol))x=y;else{var k=c.amsFormAction||n.attr("action").replace(/#/,"");x=k.startsWith(window.location.protocol)?k:t.ajax&&t.ajax.getAddr()+k,x+=y}u=c.amsProgressHandler||g.amsProgressHandler||"",f=c.amsProgressInterval||g.amsProgressInterval||1e3,h=c.amsProgressCallback||g.amsProgressCallback,p=c.amsProgressEndCallback||g.amsProgressEndCallback;var C=null;i&&i.initSubmitTarget?t.executeFunctionByName(i.initSubmitTarget,n):g.amsFormInitSubmitTarget?(C=e(l||g.amsFormSubmitTarget||"#content"),t.executeFunctionByName(g.amsFormInitSubmit||"MyAMS.form.initSubmit",n,C)):g.amsFormHideSubmitFooter||t.executeFunctionByName(g.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",n),i&&(d=e.extend({},d,i.form_data));var S;u?d.progress_id=t.generateUUID():(S=void 0!==r.uuid)&&(x.indexOf("X-Progress-ID")<0&&(x+="?X-Progress-ID="+r.uuid),delete r.uuid);var w={url:x,type:"post",cache:!1,data:d,dataType:g.amsFormDatatype,beforeSerialize:function(){void 0!==a.tinyMCE&&a.tinyMCE.triggerSave()},beforeSubmit:function(e,a){a.data("submitted",!0)},error:function(e,a,n,s){C&&t.executeFunctionByName(g.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",s,C),t.form.resetAfterSubmit(s)},iframe:S},j=i&&i.downloadTarget||g.amsFormDownloadTarget;if(j){var T=e('iframe[name="'+j+'"]');T.exists()||(T=e("<iframe></iframe>").hide().attr("name",j).appendTo(e("body"))),w=e.extend({},w,{iframe:!0,iframeTarget:T,success:function(a,n,s,i){if(e(i).parents(".modal-dialog").exists())t.dialog&&t.dialog.close(i);else{var r,o=i.data("ams-submit-button");o&&(r=o.data("ams-form-submit-callback")),r||(r=t.getFunctionByName(g.amsFormSubmitCallback)||t.form._submitCallback);try{r.call(i,a,n,s,i)}finally{t.form.resetAfterSubmit(i),t.form.resetChanged(i)}}}})}else w=e.extend({},w,{error:function(e,a,n,s){C&&t.executeFunctionByName(g.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",s,C),t.form.resetAfterSubmit(s)},success:function(e,a,n,s){var i,r=s.data("ams-submit-button");r&&(i=r.data("ams-form-submit-callback")),i||(i=t.getFunctionByName(g.amsFormSubmitCallback)||t.form._submitCallback);try{i.call(s,e,a,n,s)}finally{t.form.resetAfterSubmit(s),t.form.resetChanged(s)}},iframe:S});var N=e.extend({},w,r,b,i);if(u&&function(e,a){function s(){clearInterval(i),t.form.resetAfterSubmit(n,o),o.html(o.data("ams-progress-content")),t.executeFunctionByName(p,n,o),t.form.resetChanged(n)}var i;o.button("loading"),i=setInterval(function(){t.ajax&&t.ajax.post(e,{progress_id:a},{error:s},t.getFunctionByName(h)||function(e,a){if("success"===a)if("running"===e.status)if(e.message)o.text(e.message);else{var n=o.data("ams-progress-text")||t.i18n.PROGRESS;e.current?n+=": "+e.current+"/ "+(e.length||100):n+="...",o.text(n)}else"finished"===e.status&&s();else s()})},f)}(u,d.progress_id),e(n).ajaxSubmit(N),j){var F=e(n).parents(".modal-dialog"),R=F.exists()&&o.exists()&&o.data("ams-keep-modal");F.exists()&&!0!==R?t.dialog&&t.dialog.close(n):u||setTimeout(function(){t.form.resetAfterSubmit(n,o),t.form.resetChanged(n)},o.data("ams-form-reset-timeout")||2e3)}}if(!0!==n.data("ams-form-ignore-uploads")&&e('INPUT[type="file"]',n).length>0){t.ajax&&t.ajax.check(e.progressBar,t.baseURL+"ext/jquery-progressbar"+t.devext+".js");var o=e.extend({},{uuid:e.progressBar.submit(n)});r(n,o)}else r(n,{})}),!1},initSubmit:function(a,t){var n=e(this),s='<i class="fa fa-3x fa-gear fa-spin"></i>';t||(t=n.data("ams-form-submit-message")),t&&(s+="<strong>"+t+"</strong>"),e(a).html('<div class="row margin-20"><div class="text-center">'+s+"</div></div>"),e(a).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(e){if(e.is(":visible")){var a=e.data("ams-submit-button");a&&a.button("reset"),t.form.finalizeSubmitFooter.call(e)}e.data("submitted",!1),e.removeData("ams-submit-button")},finalizeSubmitOnError:function(a){e("i",a).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(a){var t=e(this),n='<i class="fa fa-3x fa-gear fa-spin"></i>';a||(a=e(this).data("ams-form-submit-message")),a&&(n+='<strong class="submit-message align-top padding-left-10 margin-top-10">'+a+"</strong>");var s=e("footer",t);e("button",s).hide(),s.append('<div class="row"><div class="text-center">'+n+"</div></div>")},finalizeSubmitFooter:function(){var a=e(this),t=e("footer",a);t&&(e(".row",t).remove(),e("button",t).show())},_submitCallback:function(a,n,s,i){var r;i.is(":visible")&&(t.form.finalizeSubmitFooter.call(i),(r=i.data("ams-submit-button"))&&r.button("reset"));var o,c=i.data();if(c.amsFormDatatype)o=c.amsFormDatatype;else{var l=t.ajax&&t.ajax.getResponse(s);l&&(o=l.contentType,a=l.data)}var d;switch(d=e(r?r.data("ams-form-submit-target")||c.amsFormSubmitTarget||"#content":c.amsFormSubmitTarget||"#content"),o){case"json":t.ajax&&t.ajax.handleJSON(a,i,d);break;case"script":case"xml":break;case"html":case"text":default:t.form.resetChanged(i),r&&!0!==r.data("ams-keep-modal")&&t.dialog&&t.dialog.close(i),d.exists()||(d=e("body")),d.parents(".hidden").removeClass("hidden"),e(".alert",d.parents(".alerts-container")).remove(),d.css({opacity:"0.0"}).html(a).delay(50).animate({opacity:"1.0"},300),t.initContent&&t.initContent(d),t.form.setFocus(d)}var m=s.getResponseHeader("X-AMS-Callback");if(m){var u=s.getResponseHeader("X-AMS-Callback-Options");t.executeFunctionByName(m,i,void 0===u?{}:JSON.parse(u),s)}},_getSubmitValidators:function(a){var t=[],n=a.data("ams-form-validator");return n&&t.push([a,n]),e("[data-ams-form-validator]",a).each(function(){var a=e(this);t.push([a,a.data("ams-form-validator")])}),t},_checkSubmitValidators:function(e){var a=t.form._getSubmitValidators(e);if(!a.length)return!0;for(var n=[],s=!0,i=0;i<a.length;i++){var r=a[i],o=r[0],c=r[1],l=t.executeFunctionByName(c,e,o);!1===l?s=!1:"string"==typeof l?n.push(l):s.length&&s.length>0&&(n=n.concat(s))}if(n.length>0){var d=1===n.length?t.i18n.ERROR_OCCURED:t.i18n.ERRORS_OCCURED;return t.skin&&t.skin.alert(e,"danger",d,n),!1}return s},showErrors:function(a,n){var s;if("string"==typeof n)t.skin&&t.skin.alert(a,"error",t.i18n.ERROR_OCCURED,n);else if(n instanceof Array)s=1===n.length?t.i18n.ERROR_OCCURED:t.i18n.ERRORS_OCCURED,t.skin&&t.skin.alert(a,"error",s,n);else{e(".state-error",a).removeClass("state-error"),s=n.error_header||(n.widgets&&n.widgets.length>1?t.i18n.ERRORS_OCCURED:t.i18n.ERROR_OCCURED);var i,r=[];if(n.messages)for(i=0;i<n.messages.length;i++){var o=n.messages[i];o.header?r.push("<strong>"+o.header+"</strong><br />"+o.message):r.push(o.message||o)}if(n.widgets)for(i=0;i<n.widgets.length;i++){var c=n.widgets[i],l=e('[name="'+c.name+'"]',a);l.exists()||(l=e('[name="'+c.name+':list"]',a)),l.exists()?l.parents("label:first").removeClassPrefix("state-").addClass("state-error").after('<span for="name" class="state-error">'+c.message+"</span>"):c.label&&r.push(c.label+" : "+c.message);var d=l.parents(".tab-pane").index()+1;if(d>0){var m=e(".nav-tabs",e(l).parents(".tabforms"));e("li:nth-child("+d+")",m).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",a).click()}}t.skin&&t.skin.alert(e(".form-group:first",a),n.error_level||"error",s,r,n.error_message)}}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.dialog={_shown_callbacks:[],registerShownCallback:function(e,a){var n;a&&(n=a.objectOrParentWithClass("modal-dialog"));var s;n&&n.exists()?void 0===(s=n.data("shown-callbacks"))&&(s=[],n.data("shown-callbacks",s)):s=t.dialog._shown_callbacks,s.indexOf(e)<0&&s.push(e)},_hide_callbacks:[],registerHideCallback:function(e,a){var n;a&&(n=a.objectOrParentWithClass("modal-dialog"));var s;n&&n.exists()?void 0===(s=n.data("hide-callbacks"))&&(s=[],n.data("hide-callbacks",s)):s=t.dialog._hide_callbacks,s.indexOf(e)<0&&s.push(e)},open:function(a,n,s){t.ajax&&t.ajax.check(e.fn.modalmanager,t.baseURL+"ext/bootstrap-modalmanager"+t.devext+".js",function(){t.ajax.check(e.fn.modal.defaults,t.baseURL+"ext/bootstrap-modal"+t.devext+".js",function(i){i&&(e(document).off("click.modal"),e.fn.modal.defaults.spinner=e.fn.modalmanager.defaults.spinner='<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="progress-bar" style="width: 100%;"></div></div></div>');var r,o;if("string"==typeof a)r={},o=a;else{r=a.data(),o=a.attr("href")||r.amsUrl;var c=t.getFunctionByName(o);"function"==typeof c&&(o=c.call(a))}o&&(e("body").modalmanager("loading"),0===o.indexOf("#")?e(o).modal("show"):e.ajax({url:o,type:"get",cache:void 0!==r.amsAllowCache&&r.amsAllowCache,data:n,success:function(n,i,c){e("body").modalmanager("removeLoading");var l=t.ajax.getResponse(c),d=l.contentType,m=l.data;switch(d){case"json":t.ajax.handleJSON(m,e(e(a).data("ams-json-target")||"#content"));break;case"script":case"xml":break;case"html":case"text":default:var u=e(m),f=e(".modal-dialog",u.wrap("<div></div>").parent()),h=f.data()||{},p={backdrop:"static",overflow:h.amsModalOverflow||".modal-viewport",maxHeight:void 0===h.amsModalMaxHeight?function(){return e(window).height()-e(".modal-header",u).outerHeight(!0)-e("footer",u).outerHeight(!0)-85}:t.getFunctionByName(h.amsModalMaxHeight)},g=e.extend({},p,h.amsModalOptions);g=t.executeFunctionByName(h.amsModalInitCallback,f,g)||g,s&&(s.shown&&t.dialog.registerShownCallback(s.shown,u),s.hide&&t.dialog.registerHideCallback(s.hide,u)),e("<div>").addClass("modal fade").append(u).modal(g).on("shown",t.dialog.shown).on("hidden",t.dialog.hidden),t.initContent&&t.initContent(u),!1!==r.amsLogEvent&&t.stats&&t.stats.logPageview(o)}}}))})})},shown:function(a){function n(a){var t=e(".scrollmarker.top",i),n=i.scrollTop();n>0?t.show():t.hide();var s=e(".scrollmarker.bottom",i);r+n>=i.get(0).scrollHeight?s.hide():s.show()}var s=a.target,i=e(".modal-viewport",s);if(i.exists()){var r=parseInt(i.css("max-height")),o=e.scrollbarWidth();"hidden"!==i.css("overflow")&&i.height()===r?(e("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",i.width()-o).hide().appendTo(i),e("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",r-20).css("width",i.width()-o).appendTo(i),i.scroll(n),i.off("resize").on("resize",n)):e(".scrollmarker",i).remove()}e("[data-ams-shown-callback]",s).each(function(){var a=t.getFunctionByName(e(this).data("ams-shown-callback"));a&&a.call(s,this)});var c,l=e(".modal-dialog",s).data("shown-callbacks");if(l)for(c=0;c<l.length;c++)l[c].call(s);if(l=t.dialog._shown_callbacks)for(c=0;c<l.length;c++)l[c].call(s);t.form&&t.form.setFocus(s)},close:function(a){"string"==typeof a&&(a=e(a));var t=a.parents(".modal").data("modal");if(t){var n=e("body").data("modalmanager");n&&n.getOpenModals().indexOf(t)>=0&&t.hide()}},hidden:function(a){var n=a.target;t.skin&&t.skin.cleanContainer(n),e("[data-ams-hidden-callback]",n).each(function(){var a=t.getFunctionByName(e(this).data("ams-hidden-callback"));a&&a.call(n,this)});var s,i=e(".modal-dialog",n).data("hide-callbacks");if(i)for(s=0;s<i.length;s++)i[s].call(n);if(i=t.dialog._hide_callbacks)for(s=0;s<i.length;s++)i[s].call(n)}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.helpers={sort:function(a,t){t||(t="weight"),a.children().sort(function(a,n){return+e(a).data(t)-+e(n).data(t)}).each(function(){a.append(this)})},select2ClearSelection:function(){var a=e(this),t=a.parents("label").first(),n=a.data("ams-select2-target");e('[name="'+n+'"]',t).data("select2").val("")},select2FormatSelection:function(a,t){a instanceof Array||(a=[a]),e(a).each(function(){"object"==typeof this?t.append(this.text):t.append(this)})},select2SelectAllHelper:function(){var a=e(this),t=a.parents("label").first(),n=a.data("ams-select2-target"),s=e('[name="'+n+'"]',t);"SELECT"===s.get(0).tagName?s.select2("val",e("option",s).listattr("value")):s.select2("data",s.data("ams-select2-data"))},select2QueryUrlResultsCallback:function(a,n,s){switch(a.status){case"error":t.skin&&t.skin.messageBox("error",{title:t.i18n.ERROR_OCCURED,content:"<h4>"+a.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":e(this).data("select2").dropdown.hide(),t.dialog&&t.dialog.open(a.location);break;default:return{results:a.results||a,more:a.has_more||!1,context:a.context}}},select2QueryMethodSuccessCallback:function(a,n,s){var i=a.result;if("string"==typeof i)try{i=JSON.parse(i)}catch(e){}switch(i.status){case"error":t.skin&&t.skin.messageBox("error",{title:t.i18n.ERROR_OCCURED,content:"<h4>"+i.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":e(this).data("select2").dropdown.hide(),t.dialog&&t.dialog.open(i.location);break;default:s.callback({results:i.results||i,more:i.has_more||!1,context:i.context})}},select2ChangeHelper:function(){var a=e(this),n=a.data(),s=e(n.amsSelect2HelperTarget);switch(n.amsSelect2HelperType){case"html":s.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>');var i={};i[n.amsSelect2HelperArgument||"value"]=a.val(),e.get(n.amsSelect2HelperUrl,i,t.getFunctionByName(n.amsSelect2HelperCallback)||function(e){e?(s.html(e),t.initContent&&t.initContent(s)):s.empty()}).fail(function(){s.empty()});break;case"json-rpc":s.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>'),t.jsonrpc&&t.jsonrpc.post(n.amsSelect2HelperMethod,{value:a.val()},{url:n.amsSelect2HelperUrl},t.getFunctionByName(n.amsSelect2HelperCallback)||function(e){e.result?(s.html(e.result),t.initContent&&t.initContent(s)):s.empty()});break;default:var r=n.amsSelect2HelperCallback;r&&t.executeFunctionByName(r,a,n)}},contextMenuHandler:function(e,a){"A"!==a.get(0).tagName&&(a=a.parents("a").first());var n=a.data();if("modal"===n.toggle)t.dialog&&t.dialog.open(a);else{var s=a.attr("href")||n.amsUrl;if(!s||s.startsWith("javascript")||a.attr("target"))return;t.event&&t.event.stop();var i=t.getFunctionByName(s);"function"==typeof i&&(s=i.call(a,e)),"function"==typeof s?s.call(a,e):(s=s.replace(/\%23/,"#"),(e=a.data("ams-target"))?t.form&&t.form.confirmChangedForm(e,function(){t.skin&&t.skin.loadURL(s,e,a.data("ams-link-options"),a.data("ams-link-callback"))}):t.form&&t.form.confirmChangedForm(function(){s.startsWith("#")?s!==location.hash&&(t.root.hasClass("mobile-view-activated")?(t.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=s},150)):window.location.hash=s):window.location=s}))}},datetimepickerDialogHiddenCallback:function(){e(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")},clearSearchTarget:function(){var a=e(this);if(!a.val()){var t=e(a).parents("form").first();e(t.data("ams-form-submit-target")).empty()}},setSEOStatus:function(){var a=e(this),t=a.siblings(".progress").children(".progress-bar"),n=Math.min(a.val().length,100),s="success";n<20||n>80?s="danger":(n<40||n>66)&&(s="warning"),t.removeClassPrefix("progress-bar").addClass("progress-bar").addClass("progress-bar-"+s).css("width",n+"%")}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.plugins={enabled:{},init:function(a){function n(e,a){if(o.hasOwnProperty(e)){var n=o[e];n.css=n.css||a.css,n.callbacks.push({callback:a.callback,context:a.context}),a.register&&(n.register=!0),!1===a.async&&(n.async=!1)}else o[e]={src:a.src,css:a.css,callbacks:[{callback:a.callback,context:a.context}],register:a.register,async:a.async};a.css&&t.getCSS(a.css,e+"_css")}function s(e){var n,s,i=c.callbacks;if(i&&i.length){for(n=0;n<i.length;n++)if(s=i[n],s.callback=t.getFunctionByName(s.callback),!1!==c.register){var o=t.plugins.enabled;o.hasOwnProperty(r)?o[r].push(s):o[r]=[s]}}else!1!==c.register&&(t.plugins.enabled[r]=null);if(!0!==e&&i&&i.length&&!1!==c.async)for(n=0;n<i.length;n++)s=i[n],t.executeFunctionByName(s.callback,a,s.context)}t.plugins.initData(a);var i=[];e("[data-ams-plugins-disabled]",a).each(function(){for(var a=e(this).data("ams-plugins-disabled").split(/\s+/),t=0;t<a.length;t++)i.push(a[t])});var r,o={};e("[data-ams-plugins]",a).each(function(){var a=e(this),t=a.data("ams-plugins");if("string"==typeof t)for(var s=a.data("ams-plugins").split(/\s+/),i=0;i<s.length;i++){r=s[i];var o={src:a.data("ams-plugin-"+r+"-src"),css:a.data("ams-plugin-"+r+"-css"),callback:a.data("ams-plugin-"+r+"-callback"),context:a,register:a.data("ams-plugin-"+r+"-register"),async:a.data("ams-plugin-"+r+"-async")};n(r,o)}else for(r in t)t.hasOwnProperty(r)&&n(r,t[r])});var c;for(r in o)o.hasOwnProperty(r)&&(c=o[r],void 0===t.plugins.enabled[r]?t.getScript(c.src,s,{async:void 0===c.async||c.async}):(!function(){var e=t.plugins.enabled[r];for(l=0;l<e.length;l++){var a=e[l];a&&a.context&&!t.isInDOM(a.context)&&(e[l]=null)}}(),s(!0)));for(var l in t.plugins.enabled)if(t.plugins.enabled.hasOwnProperty(l)&&!(i.indexOf(l)>=0)){var d=t.plugins.enabled[l];if(d)switch(typeof d){case"function":d(a);break;default:for(var m=0;m<d.length;m++){var u=d[m];switch(typeof u){case"function":u(a);break;default:u&&u.callback&&u.callback(u.context)}}}}},initData:function(a){e("[data-ams-data]",a).each(function(){var a=e(this),t=a.data("ams-data");if(t)for(var n in t)if(t.hasOwnProperty(n)){var s=t[n];"string"!=typeof s&&(s=JSON.stringify(s)),a.attr("data-"+n,s)}})},register:function(e,a,n){if("function"==typeof a&&(n=a,a=null),a=a||e.name,t.plugins.enabled.indexOf(a)>=0)console&&console.warn&&console.warn("Plugin "+a+" is already registered!");else if("object"==typeof e){var s=e.src;s?t.ajax&&t.ajax.check(e.callback,s,function(s){s&&(t.plugins.enabled[a]=t.getFunctionByName(e.callback),e.css&&t.getCSS(e.css,a+"_css"),n&&t.executeFunctionByName(n))}):(t.plugins.enabled[a]=t.getFunctionByName(e.callback),e.css&&t.getCSS(e.css,a+"_css"),n&&t.executeFunctionByName(n))}else"function"==typeof e&&(t.plugins.enabled[a]=e,n&&t.executeFunctionByName(n))}},t.plugins.i18n={widgets:{},validate:{},datatables:{},fancybox:{ERROR:"Can't load requested content.",RETRY:"Please check URL or try again later.",CLOSE:"Close",NEXT:"Next",PREVIOUS:"Previous"},dndupload:{FILES_SELECTED:"{count} files selected",CHOOSE_FILE:"Select file(s)",ADD_INFO:"to add them to current folder,",DRAG_FILE:"or drag and drop them here!",UPLOAD:"Upload",UPLOADING:"Uploading…",DONE:"Done!",UPLOAD_MORE:"Upload more?",ERROR:"Error!",TRY_AGAIN:"Try again?"}}}(jQuery,this),function(e,a){var t=a.MyAMS;e.extend(t.plugins.enabled,{svg:function(a){var t=e(".svg-container",a);t.length>0&&t.each(function(){var a=e(this),t=e("svg",a),n=t.attr("width"),s=t.attr("height");n&&s&&t.get(0).setAttribute("viewBox","0 0 "+Math.round(parseFloat(n))+" "+Math.round(parseFloat(s))),t.attr("width","100%").attr("height","auto")})},hint:function(a){var n=e(".hint:not(:parents(.nohints))",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.tipsy,t.baseURL+"ext/jquery-tipsy"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-tipsy"+t.devext+".css","jquery-tipsy",function(){n.each(function(){var a=e(this),n=a.data(),s={html:void 0===n.amsHintHtml?(a.attr("title")||"").startsWith("<"):n.amsHintHtml,title:t.getFunctionByName(n.amsHintTitleGetter)||function(){var a=e(this),t=a.attr("original-title")||a.attr(n.amsHintTitleAttr||"title")||(n.amsHintHtml?a.html():a.text());return t=t.replace(/\?_="/,"?_="+(new Date).getTime()+'"')},opacity:n.amsHintOpacity||.95,gravity:n.amsHintGravity||"sw",offset:n.amsHintOffset||0},i=e.extend({},s,n.amsHintOptions);i=t.executeFunctionByName(n.amsHintInitCallback,a,i)||i;var r=a.tipsy(i);t.executeFunctionByName(n.amsHintAfterInitCallback,a,r,i)})})})},contextMenu:function(a){var n=e(".context-menu",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),s={menuSelector:n.amsContextmenuSelector,menuSelected:t.helpers&&t.helpers.contextMenuHandler},i=e.extend({},s,n.amsContextmenuOptions);i=t.executeFunctionByName(n.amsContextmenuInitCallback,a,i)||i;var r=a.contextMenu(i);t.executeFunctionByName(n.amsContextmenuAfterInitCallback,a,r,i)})},switcher:function(a){e("LEGEND.switcher",a).each(function(){var a=e(this),t=a.parent("fieldset"),n=a.data();n.amsSwitcher||(e('<i class="fa fa-fw"></i>').prependTo(e(this)).addClass("open"===n.amsSwitcherState?n.amsSwitcherMinusClass||"fa-minus":n.amsSwitcherPlusClass||"fa-plus"),a.on("click",function(s){s.preventDefault();var i={};if(a.trigger("ams.switcher.before-switch",[a,i]),!i.veto)if(t.hasClass("switched")){t.removeClass("switched"),e(".fa",a).removeClass(n.amsSwitcherPlusClass||"fa-plus").addClass(n.amsSwitcherMinusClass||"fa-minus"),a.trigger("ams.switcher.opened",[a]);var r=a.attr("id");r&&e('legend.switcher[data-ams-switcher-sync="'+r+'"]',t).each(function(){var a=e(this);a.parents("fieldset").hasClass("switched")&&a.click()})}else t.addClass("switched"),e(".fa",a).removeClass(n.amsSwitcherMinusClass||"fa-minus").addClass(n.amsSwitcherPlusClass||"fa-plus"),a.trigger("ams.switcher.closed",[a])}),"open"!==n.amsSwitcherState&&t.addClass("switched"),a.data("ams-switcher","on"))})},checker:function(a){e("LEGEND.checker",a).each(function(){var a=e(this),n=a.parent("fieldset"),s=a.data();if(!s.amsChecker){var i=e('<label class="checkbox"></label>'),r=s.amsCheckerFieldname||"checker_"+t.generateId(),o=r.replace(/\./,"_"),c=s.amsCheckerHiddenPrefix,l=null,d=s.amsCheckerHiddenValueOn||"true",m=s.amsCheckerHiddenValueOff||"false",u=s.amsCheckerMarker||!1;c?l=e('<input type="hidden">').attr("name",c+r).val("on"===s.amsCheckerState?d:m).prependTo(a):u&&e('<input type="hidden">').attr("name",u).attr("value",1).prependTo(a);var f=e('<input type="checkbox">').attr("name",r).attr("id",o).data("ams-checker-hidden-input",l).data("ams-checker-init",!0).val(s.amsCheckerValue||!0).attr("checked","on"===s.amsCheckerState?"checked":null);s.amsCheckerReadonly?f.attr("disabled","disabled"):f.on("change",function(i){i.preventDefault();var r={},o=e(this).is(":checked");if(a.trigger("ams.checker.before-switch",[a,r]),r.veto)e(this).prop("checked",!o);else if(t.executeFunctionByName(s.amsCheckerChangeHandler,a,o),!s.amsCheckerCancelDefault){var c=f.data("ams-checker-hidden-input");o?("disable"===s.amsCheckerMode?(n.removeAttr("disabled"),e(".select2",n).removeAttr("disabled")):n.removeClass("switched"),c&&c.val(d),e("[data-required]",n).attr("required","required"),a.trigger("ams.checker.opened",[a])):("disable"===s.amsCheckerMode?(n.prop("disabled","disabled"),e(".select2",n).attr("disabled","disabled")):n.addClass("switched"),c&&c.val(m),e("[data-required]",n).removeAttr("required"),a.trigger("ams.checker.closed",[a]))}}),f.appendTo(i),e(">label",a).attr("for",f.attr("id")),i.append("<i></i>").prependTo(a);var h=e("[required]",n);h.attr("data-required",!0),"on"===s.amsCheckerState?f.attr("checked",!0):("disable"===s.amsCheckerMode?(n.attr("disabled","disabled"),e(".select2",n).attr("disabled","disabled")):n.addClass("switched"),h.removeAttr("required")),a.data("ams-checker","on")}})},slider:function(a){var n=e(".slider",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.slider,t.baseURL+"ext/bootstrap-slider-2.0.0"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),s=e.extend({},{},a.data.amsSliderOptions);s=t.executeFunctionByName(n.amsSliderInitCallback,a,s)||s;var i=a.slider(s);t.executeFunctionByName(n.amsSliderAfterInitCallback,a,i,s)})})},draggable:function(a){var n=e(".draggable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),s={cursor:n.amsDraggableCursor||"move",containment:n.amsDraggableContainment,handle:n.amsDraggableHandle,connectToSortable:n.amsDraggableConnectSortable,helper:t.getFunctionByName(n.amsDraggableHelper)||n.amsDraggableHelper,start:t.getFunctionByName(n.amsDraggableStart),stop:t.getFunctionByName(n.amsDraggableStop)},i=e.extend({},s,n.amsDraggableOptions);i=t.executeFunctionByName(n.amsDraggableInitCallback,a,i)||i;var r=a.draggable(i);a.disableSelection(),t.executeFunctionByName(n.amsDraggableAfterInitCallback,a,r,i)})},droppable:function(a){var n=e(".droppable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),s={accept:n.amsdroppableAccept,drop:t.getFunctionByName(n.amsDroppableDrop)},i=e.extend({},s,n.amsDroppableOptions);i=t.executeFunctionByName(n.amsDroppableInitCallback,a,i)||i;var r=a.droppable(i);t.executeFunctionByName(n.amsDroppableAfterInitCallback,a,r,i)})},sortable:function(a){var n=e(".sortable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),s={items:n.amsSortableItems,handle:n.amsSortableHandle,helper:n.amsSortableHelper,connectWith:n.amsSortableConnectwith,start:t.getFunctionByName(n.amsSortableStart),over:t.getFunctionByName(n.amsSortableOver),containment:n.amsSortableContainment,placeholder:n.amsSortablePlaceholder,stop:t.getFunctionByName(n.amsSortableStop)},i=e.extend({},s,n.amsSortableOptions);i=t.executeFunctionByName(n.amsSortableInitCallback,a,i)||i;var r=a.sortable(i);a.disableSelection(),t.executeFunctionByName(n.amsSortableAfterInitCallback,a,r,i)})},resizable:function(a){var n=e(".resizable",a);n.length>0&&n.each(function(){var a=e(this),n=a.data(),s={autoHide:!1===n.amsResizableAutohide||n.amsResizableAutohide,containment:n.amsResizableContainment,grid:n.amsResizableGrid,handles:n.amsResizableHandles,start:t.getFunctionByName(n.amsResizableStart),stop:t.getFunctionByName(n.amsResizableStop)},i=e.extend({},s,n.amsResizableOptions);i=t.executeFunctionByName(n.amsResizableInitCallback,a,i)||i;var r=a.resizable(i);a.disableSelection(),t.executeFunctionByName(n.amsResizableAfterInitCallback,a,r,i)})},typeahead:function(a){var n=e(".typeahead",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.typeahead,t.baseURL+"ext/jquery-typeahead"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),s=e.extend({},{},n.amsTypeaheadOptions);s=t.executeFunctionByName(n.amsTypeaheadInitCallback,a,s)||s;var i=a.typeahead(s);t.executeFunctionByName(n.amsTypeaheadAfterInitCallback,a,i,s)})})},treeview:function(a){var n=e(".treeview",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.treview,t.baseURL+"ext/bootstrap-treeview"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/bootstrap-treeview"+t.devext+".css","bootstrap-treeview",function(){n.each(function(){var a=e(this),n=a.data(),s={data:n.amsTreeviewData,levels:n.amsTreeviewLevels,injectStyle:n.amsTreeviewInjectStyle,expandIcon:n.amsTreeviewExpandIcon||"fa fa-fw fa-plus-square-o",collapseIcon:n.amsTreeviewCollaspeIcon||"fa fa-fw fa-minus-square-o",emptyIcon:n.amsTreeviewEmptyIcon||"fa fa-fw",nodeIcon:n.amsTreeviewNodeIcon,selectedIcon:n.amsTreeviewSelectedIcon,checkedIcon:n.amsTreeviewCheckedIcon||"fa fa-fw fa-check-square-o",uncheckedIcon:n.amsTreeviewUncheckedIcon||"fa fa-fw fa-square-o",color:n.amsTreeviewColor,backColor:n.amsTreeviewBackColor,borderColor:n.amsTreeviewBorderColor,onHoverColor:n.amsTreeviewHoverColor,selectedColor:n.amsTreeviewSelectedColor,selectedBackColor:n.amsTreeviewSelectedBackColor,unselectableColor:n.amsTreeviewUnselectableColor||"rgba(1,1,1,0.25)",unselectableBackColor:n.amsTreeviewUnselectableBackColor||"rgba(1,1,1,0.25)",enableLinks:n.amsTreeviewEnableLinks,highlightSelected:n.amsTreeviewHighlightSelected,highlightSearchResults:n.amsTreeviewhighlightSearchResults,showBorder:n.amsTreeviewShowBorder,showIcon:n.amsTreeviewShowIcon,showCheckbox:n.amsTreeviewShowCheckbox,showTags:n.amsTreeviewShowTags,toggleUnselectable:n.amsTreeviewToggleUnselectable,multiSelect:n.amsTreeviewMultiSelect,onNodeChecked:t.getFunctionByName(n.amsTreeviewNodeChecked),onNodeCollapsed:t.getFunctionByName(n.amsTreeviewNodeCollapsed),onNodeDisabled:t.getFunctionByName(n.amsTreeviewNodeDisabled),onNodeEnabled:t.getFunctionByName(n.amsTreeviewNodeEnabled),onNodeExpanded:t.getFunctionByName(n.amsTreeviewNodeExpanded),onNodeSelected:t.getFunctionByName(n.amsTreeviewNodeSelected),onNodeUnchecked:t.getFunctionByName(n.amsTreeviewNodeUnchecked),onNodeUnselected:t.getFunctionByName(n.amsTreeviewNodeUnselected),onSearchComplete:t.getFunctionByName(n.amsTreeviewSearchComplete),onSearchCleared:t.getFunctionByName(n.amsTreeviewSearchCleared)},i=e.extend({},s,n.amsTreeviewOptions);i=t.executeFunctionByName(n.amsTreeviewInitcallback,a,i)||i;var r=a.treeview(i);t.executeFunctionByName(n.amsTreeviewAfterInitCallback,a,r,i)})})})},select2:function(a){var n=e(".select2",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.select2,t.baseURL+"ext/jquery-select2-3.5.4"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data();if(!n.select2){var s={placeholder:n.amsSelect2Placeholder,multiple:n.amsSelect2Multiple,minimumInputLength:n.amsSelect2MinimumInputLength||0,maximumSelectionSize:n.amsSelect2MaximumSelectionSize,openOnEnter:void 0===n.amsSelect2EnterOpen||n.amsSelect2EnterOpen,allowClear:void 0===n.amsSelect2AllowClear||n.amsSelect2AllowClear,width:n.amsSelect2Width||"100%",initSelection:t.getFunctionByName(n.amsSelect2InitSelection),formatSelection:void 0===n.amsSelect2FormatSelection?t.helpers&&t.helpers.select2FormatSelection:t.getFunctionByName(n.amsSelect2FormatSelection),formatResult:t.getFunctionByName(n.amsSelect2FormatResult),formatMatches:void 0===n.amsSelect2FormatMatches?function(e){return 1===e?t.i18n.SELECT2_MATCH:e+t.i18n.SELECT2_MATCHES}:t.getFunctionByName(n.amsSelect2FormatMatches),formatNoMatches:void 0===n.amsSelect2FormatResult?function(e){return t.i18n.SELECT2_NOMATCHES}:t.getFunctionByName(n.amsSelect2FormatResult),formatInputTooShort:void 0===n.amsSelect2FormatInputTooShort?function(e,a){var n=a-e.length;return t.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,n).replace(/\{1\}/,1===n?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatInputTooShort),formatInputTooLong:void 0===n.amsSelect2FormatInputTooLong?function(e,a){var n=e.length-a;return t.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,n).replace(/\{1\}/,1===n?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatInputTooLong),formatSelectionTooBig:void 0===n.amsSelect2FormatSelectionTooBig?function(e){return t.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,e).replace(/\{1\}/,1===e?"":t.i18n.SELECT2_PLURAL)}:t.getFunctionByName(n.amsSelect2FormatSelectionTooBig),formatLoadMore:void 0===n.amsSelect2FormatLoadMore?function(e){return t.i18n.SELECT2_LOADMORE}:t.getFunctionByName(n.amsSelect2FormatLoadMore),formatSearching:void 0===n.amsSelect2FormatSearching?function(){return t.i18n.SELECT2_SEARCHING}:t.getFunctionByName(n.amsSelect2FormatSearching),separator:n.amsSelect2Separator||",",tokenSeparators:n.amsSelect2TokensSeparators||[","],tokenizer:t.getFunctionByName(n.amsSelect2Tokenizer)};switch(a.context.type){case"text":case"hidden":if(!s.initSelection){var i=a.data("ams-select2-values");i&&(s.initSelection=function(a,t){var n=[];e(a.val().split(s.separator)).each(function(){n.push({id:this,text:i[this]||this})}),t(n)})}}a.attr("readonly")?"hidden"===a.attr("type")&&(s.query=function(){return[]}):n.amsSelect2Query?(s.query=t.getFunctionByName(n.amsSelect2Query),s.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2QueryUrl?(s.ajax={url:n.amsSelect2QueryUrl,quietMillis:n.amsSelect2QuietMillis||200,type:n.amsSelect2QueryType||"POST",dataType:n.amsSelect2QueryDatatype||"json",data:function(a,t,s){var i={};return i[n.amsSelect2QueryParamName||"query"]=a,i[n.amsSelect2PageParamName||"page"]=t,i[n.amsSelect2ContextParamName||"context"]=s,e.extend({},i,n.amsSelect2QueryOptions)},results:t.helpers&&t.helpers.select2QueryUrlResultsCallback},s.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2QueryMethod?(s.query=function(s){var i={id:(new Date).getTime(),params:n.amsSelect2QueryParams||{},success:function(e){return t.helpers&&t.helpers.select2QueryMethodSuccessCallback.call(a,e,"success",s)},error:t.error&&t.error.show};i.params[n.amsSelect2QueryParamName||"query"]=s.term,i.params[n.amsSelect2PageParamName||"page"]=s.page,i.params[n.amsSelect2ContextParamName||"context"]=s.context,i=e.extend({},i,n.amsSelect2QueryOptions),i=t.executeFunctionByName(n.amsSelect2QueryInitCallback,a,i)||i,t.ajax&&t.ajax.check(e.jsonRPC,t.baseURL+"ext/jquery-jsonrpc"+t.devext+".js",function(){e.jsonRPC.withOptions({endPoint:n.amsSelect2MethodTarget||t.jsonrpc&&t.jsonrpc.getAddr(),namespace:n.amsSelect2MethodNamespace,cache:!1},function(){e.jsonRPC.request(n.amsSelect2QueryMethod,i)})})},s.minimumInputLength=n.amsSelect2MinimumInputLength||1):n.amsSelect2Tags?s.tags=n.amsSelect2Tags:n.amsSelect2Data&&(s.data=n.amsSelect2Data),n.amsSelect2EnableFreeTags&&(s.createSearchChoice=function(e){return{id:e,text:(n.amsSelect2FreeTagsPrefix||t.i18n.SELECT2_FREETAG_PREFIX)+e}});var r=e.extend({},s,n.amsSelect2Options);r=t.executeFunctionByName(n.amsSelect2InitCallback,a,r)||r;var o=a.select2(r);t.executeFunctionByName(n.amsSelect2AfterInitCallback,a,o,r),a.hasClass("ordered")&&t.ajax&&t.ajax.check(e.fn.select2Sortable,t.baseURL+"ext/jquery-select2-sortable"+t.devext+".js",function(){a.select2Sortable({bindOrder:"sortableStop"})}),a.on("change",function(){void 0!==e(a.get(0).form).data("validator")&&e(a).valid()})}})})},maskedit:function(a){var n=e("[data-mask]",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.mask,t.baseURL+"ext/jquery-maskedinput-1.4.1"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),s={placeholder:void 0===n.amsMaskeditPlaceholder?"X":n.amsMaskeditPlaceholder,complete:t.getFunctionByName(n.amsMaskeditComplete)},i=e.extend({},s,n.amsMaskeditOptions);i=t.executeFunctionByName(n.amsMaskeditInitCallback,a,i)||i;var r=a.mask(a.attr("data-mask"),i);t.executeFunctionByName(n.amsMaskeditAfterInitCallback,a,r,i)})})},inputmask:function(a){var n=e("input[data-input-mask]",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.inputmask,t.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+t.devext+".js",function(){n.each(function(){var a,n=e(this),s=n.data();a="object"==typeof s.inputMask?s.inputMask:{mask:s.inputMask.toString()};var i=e.extend({},a,s.amsInputmaskOptions);i=t.executeFunctionByName(s.amsInputmaskInitCallback,n,i)||i;var r=n.inputmask(i);t.executeFunctionByName(s.amsInputmaskAfterInitCallback,n,r,i)})})},datepicker:function(a){var n=e(".datepicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog&&t.dialog.registerHideCallback(t.helpers&&t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),s={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"d/m/y",datepicker:!0,dayOfWeekStart:1,timepicker:!1,closeOnDateSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,weeks:n.amsDatetimepickerWeeks},i=e.extend({},s,n.amsDatetimepickerOptions);i=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,i)})})})},datetimepicker:function(a){var n=e(".datetimepicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog&&t.dialog.registerHideCallback(t.helpers&&t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),s={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"d/m/y H:i",datepicker:!0,dayOfWeekStart:1,timepicker:!0,closeOnDateSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,closeOnTimeSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect,weeks:n.amsDatetimepickerWeeks},i=e.extend({},s,n.amsDatetimepickerOptions);i=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,i)})})})},timepicker:function(a){var n=e(".timepicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.datetimepicker,t.baseURL+"ext/jquery-datetimepicker"+t.devext+".js",function(a){a&&t.dialog&&t.dialog.registerHideCallback(t.helpers&&t.helpers.datetimepickerDialogHiddenCallback),t.getCSS(t.baseURL+"../css/ext/jquery-datetimepicker"+t.devext+".css","jquery-datetimepicker",function(){n.each(function(){var a=e(this),n=a.data(),s={lang:n.amsDatetimepickerLang||t.lang,format:n.amsDatetimepickerFormat||"H:i",datepicker:!1,timepicker:!0,closeOnTimeSelect:void 0===n.amsDatetimepickerCloseOnSelect||n.amsDatetimepickerCloseOnSelect},i=e.extend({},s,n.amsDatetimepickerOptions);i=t.executeFunctionByName(n.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,i)})})})},colorpicker:function(a){var n=e(".colorpicker",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.minicolors,t.baseURL+"ext/jquery-minicolors"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-minicolors"+t.devext+".css","jquery-minicolors",function(){n.each(function(){var a=e(this),n=a.data(),s={position:n.amsColorpickerPosition||a.closest(".input").data("ams-colorpicker-position")||"bottom left"},i=e.extend({},s,n.amsColorpickerOptions);i=t.executeFunctionByName(n.amsColorpickerInitCallback,a,i)||i;var r=a.minicolors(i);t.executeFunctionByName(n.amsDatetimepickerAfterInitCallback,a,r,i)})})})},dndupload:function(a){var n=e(".dndupload",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.dndupload,t.baseURL+"ext/jquery-dndupload"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-dndupload"+t.devext+".css","jquery-dndupload",function(){n.each(function(){var a=e(this),n=a.data(),s={action:n.amsDnduploadAction||a.attr("action")||"upload-files",fieldname:n.amsDnduploadFieldname||"files",autosubmit:n.amsDnduploadAutosubmit},i=e.extend({},s,n.amsDnduploadOptions);i=t.executeFunctionByName(n.amsDnduploadInitCallback,a,i)||i;var r=a.dndupload(i);t.executeFunctionByName(n.amsDnduploadAfterInitcallback,a,r,i)})})})},validate:function(a){var n=e("FORM:not([novalidate])",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.validate,t.baseURL+"ext/jquery-validate-1.17.0"+t.devext+".js",function(a){if(a&&(e.validator.setDefaults({highlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(e,a){var t=a.parents("label:first");t.length?e.insertAfter(t):e.insertAfter(a)}}),t.plugins&&t.plugins.i18n)){for(var s in t.plugins.i18n.validate)if(t.plugins.i18n.validate.hasOwnProperty(s)){var i=t.plugins.i18n.validate[s];"string"==typeof i&&i.indexOf("{0}")>-1&&(t.plugins.i18n.validate[s]=e.validator.format(i))}e.extend(e.validator.messages,t.plugins.i18n.validate)}n.each(function(){var a=e(this),n=a.data(),s={ignore:null,submitHandler:void 0!==a.attr("data-async")?void 0===n.amsFormSubmitHandler?function(){return e(".state-error",a).removeClass("state-error"),t.ajax&&t.ajax.check(e.fn.ajaxSubmit,t.baseURL+"ext/jquery-form-3.49"+t.devext+".js"),t.form&&t.form.submit(a)}:t.getFunctionByName(n.amsFormSubmitHandler):void 0,invalidHandler:void 0!==a.attr("data-async")?void 0===n.amsFormInvalidHandler?function(t,n){e(".state-error",a).removeClass("state-error");for(var s=0;s<n.errorList.length;s++){var i=n.errorList[s],r=e(i.element).parents(".tab-pane").index()+1;if(r>0){var o=e(".nav-tabs",e(i.element).parents(".tabforms"));e("li:nth-child("+r+")",o).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",o).click()}}}:t.getFunctionByName(n.amsFormInvalidHandler):void 0};e("[data-ams-validate-rules]",a).each(function(a){0===a&&(s.rules={}),s.rules[e(this).attr("name")]=e(this).data("ams-validate-rules")});var i=e.extend({},s,n.amsValidateOptions);i=t.executeFunctionByName(n.amsValidateInitCallback,a,i)||i;var r=a.validate(i);t.executeFunctionByName(n.amsValidateAfterInitCallback,a,r,i)})})},datatable:function(a){var n=e(".datatable",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.dataTable,t.baseURL+"ext/jquery-dataTables-1.9.4"+t.devext+".js",function(){t.ajax.check(e.fn.dataTableExt.oPagination.bootstrap_full,t.baseURL+"myams-dataTables"+t.devext+".js",function(){e(n).each(function(){var a,n=e(this),s=n.data(),i=(s.amsDatatableExtensions||"").split(/\s+/),r=s.amsDatatableSdom||"W"+(i.indexOf("colreorder")>=0||i.indexOf("colreorderwithresize")>=0?"R":"")+"<'dt-top-row'"+(i.indexOf("colvis")>=0?"C":"")+(!1===s.amsDatatablePagination||!1===s.amsDatatablePaginationSize?"":"L")+(!1===s.amsDatatableGlobalFilter?"":"F")+">r<'dt-wrapper't"+(i.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(!1===s.amsDatatableInformation?"":"i")+"><'col-sm-6 text-right'p>>",o=s.amsDatatableSorting;if("string"==typeof o){var c=o.split(";");for(o=[],a=0;a<c.length;a++){var l=c[a].split(",");l[0]=parseInt(l[0]),o.push(l)}}var d,m=[],u=e("th",n).listattr("data-ams-datatable-sortable");for(a=0;a<u.length;a++){var f=u[a];void 0!==f?((d=m[a]||{}).bSortable="string"==typeof f?JSON.parse(f):f,m[a]=d):m[a]=m[a]||{}}var h=e("th",n).listattr("data-ams-datatable-stype");for(a=0;a<h.length;a++){var p=h[a];p?((d=m[a]||{}).sType=p,m[a]=d):m[a]=m[a]||{}}var g={bJQueryUI:!1,bServerSide:s.amsDatatableServerSide||!1,sAjaxSource:!0===s.amsDatatableServerSide?s.amsDatatableAjaxSource:void 0,sServerMethod:!0===s.amsDatatableServerSide?"POST":void 0,bFilter:!1!==s.amsDatatableGlobalFilter||i.indexOf("columnfilter")>=0,bPaginate:!1!==s.amsDatatablePagination,bInfo:!1!==s.amsDatatableInfo,bSort:!1!==s.amsDatatableSort,aaSorting:o,aoColumns:m.length>0?m:void 0,bDeferRender:!0,bAutoWidth:!1,iDisplayLength:s.amsDatatableDisplayLength||25,sPaginationType:s.amsDatatablePaginationType||"bootstrap_full",sDom:r,oLanguage:t.plugins&&t.plugins.i18n.datatables,fnInitComplete:function(a,n){e(".ColVis_Button").addClass("btn btn-default btn-sm").html((t.plugins&&t.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}},b=e.extend({},g,s.amsDatatableOptions),v=[],x=[],y=[];if(i.length>0)for(a=0;a<i.length;a++)switch(i[a]){case"autofill":v.push(e.fn.dataTable.AutoFill),x.push(t.baseURL+"ext/jquery-dataTables-autoFill"+t.devext+".js");break;case"columnfilter":v.push(e.fn.columnFilter),x.push(t.baseURL+"ext/jquery-dataTables-columnFilter"+t.devext+".js");break;case"colreorder":v.push(e.fn.dataTable.ColReorder),x.push(t.baseURL+"ext/jquery-dataTables-colReorder"+t.devext+".js");break;case"colreorderwithresize":v.push(window.ColReorder),x.push(t.baseURL+"ext/jquery-dataTables-colReorderWithResize"+t.devext+".js");break;case"colvis":v.push(e.fn.dataTable.ColVis),x.push(t.baseURL+"ext/jquery-dataTables-colVis"+t.devext+".js"),y.push(function(){b.oColVis=e.extend({},{activate:"click",sAlign:"right"},s.amsDatatableColvisOptions)});break;case"editable":v.push(e.fn.editable),x.push(t.baseURL+"ext/jquery-jeditable"+t.devext+".js"),v.push(e.fn.makeEditable),x.push(t.baseURL+"ext/jquery-dataTables-editable"+t.devext+".js");break;case"fixedcolumns":v.push(e.fn.dataTable.FixedColumns),x.push(t.baseURL+"ext/jquery-dataTables-fixedColumns"+t.devext+".js");break;case"fixedheader":v.push(e.fn.dataTable.Fixedheader),x.push(t.baseURL+"ext/jquery-dataTables-fixedHeader"+t.devext+".js");break;case"keytable":v.push(window.keyTable),x.push(t.baseURL+"ext/jquery-dataTables-keyTable"+t.devext+".js");break;case"rowgrouping":v.push(e.fn.rowGrouping),x.push(t.baseURL+"ext/jquery-dataTables-rowGrouping"+t.devext+".js");break;case"rowreordering":v.push(e.fn.rowReordering),x.push(t.baseURL+"ext/jquery-dataTables-rowReordering"+t.devext+".js");break;case"scroller":v.push(e.fn.dataTable.Scroller),x.push(t.baseURL+"ext/jquery-dataTables-scroller"+t.devext+".js")}y.push(function(){b=t.executeFunctionByName(s.amsDatatableInitCallback,n,b)||b;try{var r=n.dataTable(b);if(t.executeFunctionByName(s.amsDatatableAfterInitCallback,n,r,b),i.length>0)for(a=0;a<i.length;a++)switch(i[a]){case"autofill":var o=e.extend({},s.amsDatatableAutofillOptions,b.autofill);o=t.executeFunctionByName(s.amsDatatableAutofillInitCallback,n,o)||o,n.data("ams-autofill",void 0===s.amsDatatableAutofillConstructor?new e.fn.dataTable.AutoFill(n,o):t.executeFunctionByName(s.amsDatatableAutofillConstructor,n,r,o));break;case"columnfilter":var c=e.extend({},{sPlaceHolder:"head:after"},s.amsDatatableColumnfilterOptions,b.columnfilter);c=t.executeFunctionByName(s.amsDatatableColumnfilterInitCallback,n,c)||c,n.data("ams-columnfilter",void 0===s.amsDatatableColumnfilterConstructor?r.columnFilter(c):t.executeFunctionByName(s.amsDatatableColumnfilterConstructor,n,r,c));break;case"editable":var l=e.extend({},s.amsDatatableEditableOptions,b.editable);l=t.executeFunctionByName(s.amsDatatableEditableInitCallback,n,l)||l,n.data("ams-editable",void 0===s.amsDatatableEditableConstructor?n.makeEditable(l):t.executeFunctionByName(s.amsDatatableEditableConstructor,n,r,l));break;case"fixedcolumns":var d=e.extend({},s.amsDatatableFixedcolumnsOptions,b.fixedcolumns);d=t.executeFunctionByName(s.amsDatatableFixedcolumnsInitCallback,n,d)||d,n.data("ams-fixedcolumns",void 0===s.amsDatatableFixedcolumnsConstructor?new e.fn.dataTable.FixedColumns(n,d):t.executeFunctionByName(s.amsDatatableFixedcolumnsConstructor,n,r,d));break;case"fixedheader":var m=e.extend({},s.amsDatatableFixedheaderOptions,b.fixedheader);m=t.executeFunctionByName(s.amsDatatableFixedheadeInitCallback,n,m)||m,n.data("ams-fixedheader",void 0===s.amsDatatableFixedheaderConstructor?new e.fn.dataTable.FixedHeader(n,m):t.executeFunctionByName(s.amsDatatableFixedheaderConstructor,n,r,m));break;case"keytable":var u={table:n.get(0),datatable:r},f=e.extend({},u,s.amsDatatableKeytableOptions,b.keytable);f=t.executeFunctionByName(s.amsDatatableKeytableInitCallback,n,f)||f,n.data("ams-keytable",void 0===s.amsDatatableKeytableConstructor?new KeyTable(f):t.executeFunctionByName(s.amsDatatableKeytableConstructor,n,r,f));break;case"rowgrouping":var h=e.extend({},s.amsDatatableRowgroupingOptions,b.rowgrouping);h=t.executeFunctionByName(s.amsDatatableRowgroupingInitCallback,n,h)||h,n.data("ams-rowgrouping",void 0===s.amsDatatableRowgroupingConstructor?n.rowGrouping(h):t.executeFunctionByName(s.amsDatatableRowgroupingConstructor,n,r,h));break;case"rowreordering":var p=e.extend({},s.amsDatatableRowreorderingOptions,b.rowreordering);p=t.executeFunctionByName(s.amsDatatableRowreorderingInitCallback,n,p)||p,n.data("ams-rowreordering",void 0===s.amsDatatableRowreorderingConstructor?n.rowReordering(p):t.executeFunctionByName(s.amsDatatableRowreorderingConstructor,n,r,p))}if(s.amsDatatableFinalizeCallback){var g=s.amsDatatableFinalizeCallback.split(/\s+/);if(g.length>0)for(a=0;a<g.length;a++)t.executeFunctionByName(g[a],n,r,b)}}catch(e){}}),t.ajax&&t.ajax.check(v,x,y)})})})},tablednd:function(a){var n=e(".table-dnd",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.tableDnD,t.baseURL+"ext/jquery-tablednd"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data();n.amsTabledndDragHandle?e("tr",a).addClass("no-drag-handle"):e(a).on("mouseover","tr",function(){e(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){e(this.cells[0]).removeClass("drag-handle")});var s={onDragClass:n.amsTabledndDragClass||"dragging-row",onDragStart:t.getFunctionByName(n.amsTabledndDragStart),dragHandle:n.amsTabledndDragHandle,scrollAmount:n.amsTabledndScrollAmount,onAllowDrop:n.amsTabledndAllowDrop,onDrop:t.getFunctionByName(n.amsTabledndDrop)||function(s,i){var r=n.amsTabledndDropTarget;if(r){e(i).data("ams-disabled-handlers","click");try{var o=[];e(s.rows).each(function(){var a=e(this).data("ams-element-name");a&&o.push(a)});var c=t.getFunctionByName(r);if("function"==typeof c)c.call(a,s,o);else{if(!r.startsWith(window.location.protocol)){var l=n.amsLocation;l&&(r=l+"/"+r)}t.ajax&&t.ajax.post(r,{names:JSON.stringify(o)})}}finally{setTimeout(function(){e(i).removeData("ams-disabled-handlers")},50)}}return!1}},i=e.extend({},s,n.amsTabledndOptions);i=t.executeFunctionByName(n.amsTabledndInitCallback,a,i)||i;var r=a.tableDnD(i);t.executeFunctionByName(n.amsTabledndAfterInitCallback,a,r,i)})})},wizard:function(a){var n=e(".wizard",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.bootstrapWizard,t.baseURL+"ext/bootstrap-wizard-1.4.2"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),s={withVisible:void 0===n.amsWizardWithVisible||n.amsWizardWithVisible,tabClass:n.amsWizardTabClass,firstSelector:n.amsWizardFirstSelector,previousSelector:n.amsWizardPreviousSelector,nextSelector:n.amsWizardNextSelector,lastSelector:n.amsWizardLastSelector,finishSelector:n.amsWizardFinishSelector,backSelector:n.amsWizardBackSelector,onInit:t.getFunctionByName(n.amsWizardInit),onShow:t.getFunctionByName(n.amsWizardShow),onNext:t.getFunctionByName(n.amsWizardNext),onPrevious:t.getFunctionByName(n.amsWizardPrevious),onFirst:t.getFunctionByName(n.amsWizardFirst),onLast:t.getFunctionByName(n.amsWizardLast),onBack:t.getFunctionByName(n.amsWizardBack),onFinish:t.getFunctionByName(n.amsWizardFinish),onTabChange:t.getFunctionByName(n.amsWizardTabChange),onTabClick:t.getFunctionByName(n.amsWizardTabClick),onTabShow:t.getFunctionByName(n.amsWizardTabShow)},i=e.extend({},s,n.amsWizardOptions);i=t.executeFunctionByName(n.amsWizardInitCallback,a,i)||i;var r=a.bootstrapWizard(i);t.executeFunctionByName(n.amsWizardAfterInitCallback,a,r,i)})})},tinymce:function(a){function n(){e(".tinymce",e(this)).each(function(){var a=tinymce.get(e(this).attr("id"));a&&a.remove()})}var s=e(".tinymce",a);if(s.length>0){var i=t.baseURL+"ext/tinymce"+(t.devmode?"/dev":"");t.ajax&&t.ajax.check(window.tinymce,i+"/tinymce"+t.devext+".js",function(a){function r(){s.each(function(){var a=e(this),n=a.data(),s={theme:n.amsTinymceTheme||"modern",language:t.lang,menubar:!1!==n.amsTinymceMenubar,statusbar:!1!==n.amsTinymceStatusbar,plugins:n.amsTinymcePlugins||["advlist autosave autolink lists link charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code fullscreen","insertdatetime nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern autoresize"],toolbar:n.amsTinymceToolbar,toolbar1:!1!==n.amsTinymceToolbar1&&(n.amsTinymceToolbar1||"undo redo | pastetext | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),toolbar2:!1!==n.amsTinymceToolbar2&&(n.amsTinymceToolbar2||"forecolor backcolor emoticons | charmap link image media | fullscreen preview print | code"),content_css:n.amsTinymceContentCss,formats:n.amsTinymceFormats,style_formats:n.amsTinymceStyleFormats,block_formats:n.amsTinymceBlockFormats,valid_classes:n.amsTinymceValidClasses,image_advtab:!0,image_list:t.getFunctionByName(n.amsTinymceImageList)||n.amsTinymceImageList,image_class_list:n.amsTinymceImageClassList,link_list:t.getFunctionByName(n.amsTinymceLinkList)||n.amsTinymceLinkList,link_class_list:n.amsTinymceLinkClassList,paste_as_text:void 0===n.amsTinymcePasteAsText||n.amsTinymcePasteAsText,paste_auto_cleanup_on_paste:void 0===n.amsTinymcePasteAutoCleanup||n.amsTinymcePasteAutoCleanup,paste_strip_class_attributes:n.amsTinymcePasteStripClassAttributes||"all",paste_remove_spans:void 0===n.amsTinymcePaseRemoveSpans||n.amsTinymcePasteRemoveSpans,paste_remove_styles:void 0===n.amsTinymcePasteRemoveStyles||n.amsTinymcePasteRemoveStyles,height:n.amsTinymceHeight||50,min_height:50,resize:!0,autoresize_min_height:50,autoresize_max_height:500};if(n.amsTinymceExternalPlugins){var i=n.amsTinymceExternalPlugins.split(/\s+/);for(var r in i)if(i.hasOwnProperty(r)){var o=a.data("ams-tinymce-plugin-"+i[r]);tinymce.PluginManager.load(i[r],t.getSource(o))}}var c=e.extend({},s,n.amsTinymceOptions);c=t.executeFunctionByName(n.amsTinymceInitCallback,a,c)||c;var l=a.tinymce(c);t.executeFunctionByName(n.amsTinymceAfterInitCallback,a,l,c)})}a?t.getScript(i+"/jquery.tinymce"+t.devext+".js",function(){tinymce.baseURL=i,tinymce.suffix=t.devext,t.skin&&t.skin.registerCleanCallback(n),r()}):r()})}},imgareaselect:function(a){var n=e(".imgareaselect",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.imgAreaSelect,t.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-imgareaselect"+t.devext+".css","jquery-imgareaselect",function(){n.each(function(){var a=e(this),n=a.data(),s=n.amsImgareaselectParent?a.parents(n.amsImgareaselectParent):"body",i={instance:!0,handles:!0,parent:s,x1:n.amsImgareaselectX1||0,y1:n.amsImgareaselectY1||0,x2:n.amsImgareaselectX2||n.amsImgareaselectImageWidth,y2:n.amsImgareaselectY2||n.amsImgareaselectImageHeight,imageWidth:n.amsImgareaselectImageWidth,imageHeight:n.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:n.amsImgareaselectRatio,onSelectEnd:t.getFunctionByName(n.amsImgareaselectSelectEnd)||function(a,t){var i=n.amsImgareaselectTargetField||"image_";e('input[name="'+i+'x1"]',s).val(t.x1),e('input[name="'+i+'y1"]',s).val(t.y1),e('input[name="'+i+'x2"]',s).val(t.x2),e('input[name="'+i+'y2"]',s).val(t.y2)}},r=e.extend({},i,n.amsImgareaselectOptions);r=t.executeFunctionByName(n.amsImgareaselectInitCallback,a,r)||r;var o=a.imgAreaSelect(r);t.executeFunctionByName(n.amsImgareaselectAfterInitCallback,a,o,r),setTimeout(function(){o.update()},250)})})})},fancybox:function(a){var n=e(".fancybox",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.fancybox,t.baseURL+"ext/jquery-fancybox-2.1.5"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-fancybox-2.1.5"+t.devext+".css","jquery-fancybox",function(){n.each(function(){var a,n=e(this),s=n.data(),i=n;s.amsFancyboxElements&&(i=e(s.amsFancyboxElements,n));var r=(s.amsFancyboxHelpers||"").split(/\s+/);if(r.length>0)for(a=0;a<r.length;a++)switch(r[a]){case"buttons":t.ajax&&t.ajax.check(e.fancybox.helpers.buttons,t.baseURL+"ext/fancybox-helpers/fancybox-buttons"+t.devext+".js");break;case"thumbs":t.ajax&&t.ajax.check(e.fancybox.helpers.thumbs,t.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+t.devext+".js");break;case"media":t.ajax&&t.ajax.check(e.fancybox.helpers.media,t.baseURL+"ext/fancybox-helpers/fancybox-media"+t.devext+".js")}var o={type:s.amsFancyboxType,padding:s.amsFancyboxPadding||10,margin:s.amsFancyboxMargin||10,loop:s.amsFancyboxLoop,beforeLoad:t.getFunctionByName(s.amsFancyboxBeforeLoad)||function(){var a;if(s.amsFancyboxTitleGetter&&(a=t.executeFunctionByName(s.amsFancyboxTitleGetter,this)),!a){var n=e("*:first",this.element);(a=n.attr("original-title")||n.attr("title"))||(a=e(this.element).attr("original-title")||e(this.element).attr("title"))}this.title=a},afterLoad:t.getFunctionByName(s.amsFancyboxAfterLoad),helpers:{title:{type:"inside"}}};if(r.length>0)for(a=0;a<r.length;a++)switch(r[a]){case"buttons":o.helpers.buttons={position:s.amsFancyboxButtonsPosition||"top"};break;case"thumbs":o.helpers.thumbs={width:s.amsFancyboxThumbsWidth||50,height:s.amsFancyboxThumbsHeight||50};break;case"media":o.helpers.media=!0}var c=e.extend({},o,s.amsFancyboxOptions);c=t.executeFunctionByName(s.amsFancyboxInitCallback,n,c)||c;var l=i.fancybox(c);t.executeFunctionByName(s.amsFancyboxAfterInitCallback,n,l,c)})})})},chart:function(a){var n=e(".chart",a);n.length>0&&t.ajax&&t.ajax.check(e.fn.plot,t.baseURL+"flot/jquery.flot"+t.devext+".js",function(){n.each(function(){var a=e(this),n=a.data(),s=(n.amsChartPlugins||"").split(/\s+/);if(s.length>0)for(var i in s)if(s.hasOwnProperty(i)){var r=s[i];(function(a){for(var t in e.plot.plugins)if(e.plot.plugins.hasOwnProperty(t)){var n=e.plot.plugins[t];if(n.name===a)return n}return null})(r)||t.getScript(t.baseURL+"flot/jquery.flot."+r+t.devext+".js")}var o=e.extend({},{},n.amsChartOptions);o=t.executeFunctionByName(n.amsChartInitCallback,a,o)||o;var c=n.amsChartData;c=t.executeFunctionByName(n.amsChartInitData,a,c)||c;var l=a.plot(c,o);t.executeFunctionByName(n.amsChartAfterInitCallback,a,l,o)})})},graphs:function(a){var n=e(".sparkline",a);n.length>0&&t.ajax&&t.ajax.check(t.graphs,t.baseURL+"myams-graphs"+t.devext+".js",function(){t.graphs.init(n)})},scrollbars:function(a){var n=e(".scrollbar",a);n.length>0&&t.ajax&&t.ajax.check(e.event.special.mousewheel,t.baseURL+"ext/jquery-mousewheel.min.js",function(){t.ajax.check(e.fn.mCustomScrollbar,t.baseURL+"ext/jquery-mCustomScrollbar"+t.devext+".js",function(){t.getCSS(t.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar",function(){n.each(function(){var a=e(this),n=a.data(),s={theme:n.amsScrollbarTheme||"light"},i=e.extend({},s,n.amsScrollbarOptions);i=t.executeFunctionByName(n.amsScrollbarInitCallback,a,i)||i;var r=a.mCustomScrollbar(i);t.executeFunctionByName(n.amsScrollbarAfterInitCallback,a,r,i)})})})})}})}(jQuery,this),function(e,a){var t=a.MyAMS;t.callbacks={init:function(a){e("[data-ams-callback]",a).each(function(){var a=this,n=e(a).data();try{var s=JSON.parse(n.amsCallback);Array.isArray(s)||(s=[s])}catch(e){s=n.amsCallback.split(/\s+/)}for(var i=0;i<s.length;i++){var r=s[i];if("string"==typeof r){var o=t.getFunctionByName(r),c=n.amsCallbackOptions;"string"==typeof c&&(c=c.unserialize()),void 0===o?n.amsCallbackSource?t.getScript(n.amsCallbackSource,function(e){t.executeFunctionByName(e,a,c)}(r),{async:void 0===n.amsCallbackAsync||n.amsCallbackAsync}):console&&console.warn&&console.warn("Undefined callback: "+n.amsCallback):o.call(a,c)}else o=t.getFunctionByName(r.callback),"string"==typeof(c=r.options)&&(c=c.unserialize()),void 0===o?r.source?t.getScript(r.source,function(e){t.executeFunctionByName(e.callback,a,e.options)}(r),{async:void 0===r.async||r.async}):console&&console.warn&&console.warn("Undefined callback: "+r.callback):o.call(a,r.options)}})},alert:function(a){var n=e(this).data(),s=e.extend({},a,n.amsAlertOptions),i=e(n.amsAlertParent||s.parent||this),r=n.amsAlertStatus||s.status||"info",o=n.amsAlertHeader||s.header,c=n.amsAlertMessage||s.message,l=n.amsAlertSubtitle||s.subtitle,d=void 0===n.amsAlertMargin?void 0!==s.margin&&s.margin:n.amsAlertMargin;t.skin&&t.skin.alert(i,r,o,c,l,d)},messageBox:function(a){var n=e(this).data(),s=e.extend({},a,n.amsMessageboxOptions),i=e.extend({},s,{title:n.amsMessageboxTitle||s.title||"",content:n.amsMessageboxContent||s.content||"",icon:n.amsMessageboxIcon||s.icon,number:n.amsMessageboxNumber||s.number,timeout:n.amsMessageboxTimeout||s.timeout}),r=n.amsMessageboxStatus||s.status||"info",o=t.getFunctionByName(n.amsMessageboxCallback||s.callback);t.skin&&t.skin.messageBox(r,i,o)},smallBox:function(a){var n=e(this).data(),s=e.extend({},a,n.amsSmallboxOptions),i=e.extend({},s,{title:n.amsSmallboxTitle||s.title||"",content:n.amsSmallboxContent||s.content||"",icon:n.amsSmallboxIcon||s.icon,iconSmall:n.amsSmallboxIconSmall||s.iconSmall,timeout:n.amsSmallboxTimeout||s.timeout}),r=n.amsSmallboxStatus||s.status||"info",o=t.getFunctionByName(n.amsSmallboxCallback||s.callback);t.skin&&t.skin.smallBox(r,i,o)}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.events={init:function(a){e("[data-ams-events-handlers]",a).each(function(){var a=e(this),n=a.data("ams-events-handlers");if(n)for(var s in n)n.hasOwnProperty(s)&&a.on(s,t.getFunctionByName(n[s]))})}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.container={changeOrder:function(a,t){e('input[name="'+e(this).data("ams-input-name")+'"]',e(this)).val(t.join(";"))},deleteElement:function(){return function(){var a=e(this);t.skin&&t.skin.bigBox({title:t.i18n.WARNING,content:'<i class="text-danger fa fa-fw fa-bell"></i> '+t.i18n.DELETE_WARNING,status:"info",buttons:t.i18n.BTN_OK_CANCEL},function(e){if(e===t.i18n.BTN_OK){var n=a.parents("tr").first(),s=n.parents("table").first(),i=n.data("ams-location")||s.data("ams-location")||"";i&&(i+="/");var r=n.data("ams-delete-target")||s.data("ams-delete-target")||"delete-element.json",o=n.data("ams-element-name");t.ajax&&t.ajax.post(i+r,{object_name:o},function(e,a){"success"===e.status?(s.hasClass("datatable")?s.dataTable().fnDeleteRow(n[0]):n.remove(),e.handle_json&&t.ajax&&t.ajax.handleJSON(e)):t.ajax&&t.ajax.handleJSON(e)})}})}},switchElementVisibility:function(){return function(){var a=e(this),n=a.parents("td").first(),s=a.parents("tr").first(),i=s.parents("table");e("i",a).attr("class","fa fa-fw fa-spinner fa-pulse"),t.ajax&&t.ajax.post(i.data("ams-location")+"/"+(n.data("ams-attribute-switcher")||i.data("ams-attribute-switcher")),{object_name:s.data("ams-element-name")},function(t,n){t.visible?e("i",a).attr("class","fa fa-fw fa-eye"):e("i",a).attr("class","fa fa-fw fa-eye-slash text-danger")})}},switchElementAttribute:function(){return function(){var a=e(this),n=a.parents("td").first(),s=n.data("ams-switcher-attribute-name"),i=a.parents("tr").first(),r=i.parents("table");e("i",a).attr("class","fa fa-fw fa-spinner fa-pulse"),t.ajax&&t.ajax.post(r.data("ams-location")+"/"+(n.data("ams-attribute-switcher")||r.data("ams-attribute-switcher")),{object_name:i.data("ams-element-name")},function(t,n){t[s]||t.on?e("i",a).attr("class",r.data("ams-"+s+"-icon-on")||"fa fa-fw fa-check-square-o"):e("i",a).attr("class",r.data("ams-"+s+"-icon-off")||"fa fa-fw fa-check-square txt-color-silver opacity-75")})}}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.tree={switchTableNode:function(){function a(t){e('tr[data-ams-tree-node-parent-id="'+t+'"]').each(function(){var t=e(this);a(t.data("ams-tree-node-id")),t.remove()})}var n=e(this),s=e("i.switch",n),i=n.parents("tr").first(),r=i.parents("table").first();if(s.hasClass("fa-minus-square-o"))a(i.data("ams-tree-node-id")),s.removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var o=i.data("ams-location")||r.data("ams-location")||"",c=i.data("ams-tree-nodes-target")||r.data("ams-tree-nodes-target")||"get-tree-nodes.json",l=i.data("ams-element-name");s.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),t.ajax&&t.ajax.post(o+"/"+l+"/"+c,{can_sort:!e("td.sorter",i).is(":empty")},function(a,n){if(a.length>0){for(var o=i,c=0;c<a.length;c++){var l=e(a[c]);l.insertAfter(o).addClass("no-drag-handle"),t.initContent&&t.initContent(l),o=l}r.hasClass("table-dnd")&&r.tableDnDUpdate()}s.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},switchTree:function(){var a=e(this),n=e("i.switch",a),s=e(this).parents("table").first(),i=s.data("ams-tree-node-id");if(n.hasClass("fa-minus-square-o"))e("tr[data-ams-tree-node-parent-id]").filter('tr[data-ams-tree-node-parent-id!="'+i+'"]').remove(),e("i.switch",s).removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var r=e("tbody tr",s).first(),o=s.data("ams-location")||"",c=s.data("ams-tree-nodes-target")||"get-tree.json";n.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),t.ajax&&t.ajax.post(o+"/"+c,{can_sort:!e("td.sorter",r).is(":empty")},function(a,i){e("tr[data-ams-tree-node-id]",s).remove();for(var r=null,o=0;o<a.length;o++){var c=e(a[o]);null===r?c.appendTo(e("tbody",s)):c.insertAfter(r),c.addClass("no-drag-handle"),t.initContent&&t.initContent(c),r=c}s.hasClass("table-dnd")&&s.tableDnDUpdate(),e("i.switch",s).removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),n.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},sortTree:function(a,n){var s=e(a).data(),i=s.amsTabledndDropTarget;if(i){(n=e(n)).data("ams-disabled-handlers","click");try{var r=n.parents("table").first().data("ams-tree-node-id"),o=n.data("ams-tree-node-id"),c=n.data("ams-tree-node-parent-id"),l=n.prev("tr");if(l.exists()){var d=l.data("ams-tree-node-id"),m=e(".switch",l);if(m.hasClass("fa-minus-square-o"))if(c===d)var u="reorder";else u="reparent";else u=c===(d=l.data("ams-tree-node-parent-id"))?"reorder":"reparent"}else m=null,u=c===(d=r)?"reorder":"reparent";var f=t.getFunctionByName(i);if("function"==typeof f)f.call(table,a,p);else{if(!i.startsWith(window.location.protocol)){var h=s.amsLocation;h&&(i=h+"/"+i)}var p={action:u,child:o,parent:d,order:JSON.stringify(e("tr[data-ams-tree-node-id]").listattr("data-ams-tree-node-id")),can_sort:!e("td.sorter",n).is(":empty")};t.ajax&&t.ajax.post(i,p,function(a){function s(a){e('tr[data-ams-tree-node-parent-id="'+a+'"]').each(function(){var a=e(this);s(a.attr("data-ams-tree-node-id")),a.remove()})}if(a.status)t.ajax.handleJSON(a);else{var i=e(n).parents("tbody").first();if(s(o),"reparent"===p.action){s(d),n.remove();for(var r=e('tr[data-ams-tree-node-id="'+d+'"]'),c=0;c<a.length;c++){var l=e(a[c]);r.exists()?l.insertAfter(r).addClass("no-drag-handle"):l.prependTo(i).addClass("no-drag-handle"),t.initContent&&t.initContent(l),r=l}}e("tr").parents("table").tableDnDUpdate()}})}}finally{setTimeout(function(){e(n).removeData("ams-disabled-handlers")},50)}}return!1}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.skin={_setPageHeight:function(){var a=e("#main").height(),n=e(window).height()-t.navbarHeight;a>n?t.root.css("min-height",a+t.navbarHeight):t.root.css("min-height",n),t.leftPanel.css("min-height",n),t.leftPanel.css("max-height",n)},_checkMobileWidth:function(){e(window).width()<979?t.root.addClass("mobile-view-activated"):t.root.hasClass("mobile-view-activated")&&t.root.removeClass("mobile-view-activated")},_showShortcutButtons:function(){t.shortcuts&&t.shortcuts.animate({height:"show"},200,"easeOutCirc"),t.root.addClass("shortcut-on")},_hideShortcutButtons:function(){t.shortcuts&&t.shortcuts.animate({height:"hide"},300,"easeOutCirc"),t.root.removeClass("shortcut-on")},checkNotification:function(){var a=e(".badge","#user-activity >span");parseInt(a.text())>0?a.removeClass("hidden").addClass("bg-color-red bounceIn animated"):a.addClass("hidden").removeClass("bg-color-red bounceIn animated")},refreshNotificationsPanel:function(a){var t=e(this);t.addClass("disabled"),e("i",t).addClass("fa-spin"),e('input[name="activity"]:checked',"#user-activity").change(),e("i",t).removeClass("fa-spin"),t.removeClass("disabled")},refreshContent:function(a){var n=e('[id="'+a.object_id+'"]');return n.replaceWith(e(a.content)),n=e('[id="'+a.object_id+'"]'),t.initContent&&t.initContent(n),n},refreshImage:function(a){e('img[src^="'+a.src+'"]').attr("src",a.target)},refreshWidget:function(a){var n=e('[id="'+a.parent_id+'"]'),s=e('[name="'+a.widget_name+'"]',n);s.exists()||(s=e('[name="'+a.widget_name+':list"]',n));var i=s.parents(".input").last();return i.html(a.content),t.initContent&&t.initContent(i),i},refreshTable:function(a){var n=e('[id="'+a.object_id+'"]').parents(".ams-widget:first");return n.replaceWith(e(a.table)),n=e('[id="'+a.object_id+'"]').parents(".ams-widget:first"),t.initContent&&t.initContent(n),n},refreshSwitchedTable:function(e){var a=t.skin.refreshTable(e);if(a){var n=a.siblings("legend");n.parents("fieldset:first").hasClass("switched")&&n.click()}},refreshRow:function(a){var n=e('tr[id="'+a.object_id+'"]'),s=n.parents("table").first(),i=e(a.row);return n.replaceWith(i),t.initContent&&t.initContent(i),s.hasClass("table-dnd")&&(i.addClass("no-drag-handle"),s.tableDnDUpdate()),i},refreshRowCell:function(a){var n=e('tr[id="'+a.object_id+'"]'),s=n.parents("table").first(),i=e("tr",e("thead",s)),r=e('th[data-ams-column-name="'+a.col_name+'"]',i),o=e("th",i).index(r);if(o>-1){var c=e(e("td",n).get(o));c.html(a.cell),t.initContent&&t.initContent(c)}},switchCellContent:function(a){var n=e(this),s=e("i.switch",n),i=n.parents("td"),r=e(n.data("ams-switch-target")||".inner-table-form",i),o=n.parents("tr");if(s.hasClass("fa-plus-square-o")){var c=o.parents("table");r.html('<h1 class="loading"><i class="fa fa-gear fa-spin"></i></h1>'),t.ajax&&t.ajax.post(c.data("ams-location")+"/"+n.data("ams-switch-handler"),{object_name:o.data("ams-element-name")},function(e){r.html(e),e&&(t.initContent&&t.initContent(r),s.removeClass("fa-plus-square-o").addClass("fa-minus-square-o"))})}else t.skin.cleanContainer(r),r.empty(),s.removeClass("fa-minus-square-o").addClass("fa-plus-square-o")},_initDesktopWidgets:function(n){if(t.enableWidgets){var s=e(".ams-widget",n);s.length>0&&t.ajax&&t.ajax.check(e.fn.MyAMSWidget,t.baseURL+"myams-widgets"+t.devext+".js",function(){s.each(function(){var a=e(this),n=a.data(),s=e.extend({},{deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"},n.amsWidgetOptions);s=t.executeFunctionByName(n.amsWidgetInitcallback,a,s)||s,a.MyAMSWidget(s)}),a.MyAMSWidget.initWidgetsGrid(e(".ams-widget-grid",n))})}},_initMobileWidgets:function(e){t.enableMobile&&t.enableWidgets&&t.skin._initDesktopWidgets(e)},alert:function(a,n,s,i,r,o){"error"===n&&(n="danger"),e(".alert-"+n,a).not(".persistent").remove();var c='<div class="'+(o?"margin-10":"")+" alert alert-block alert-"+n+' padding-5 fade in"><a class="close" data-dismiss="alert"><i class="fa fa-check"></i></a><h4 class="alert-heading"><i class="fa fa-fw fa-warning"></i> '+s+"</h4>"+(r?"<p>"+r+"</p>":"");if("string"==typeof i)c+="<ul><li>"+i+"</li></ul>";else if(i){c+="<ul>";for(var l in i)e.isNumeric(l)&&(c+="<li>"+i[l]+"</li>");c+="</ul>"}e(c+="</div>").insertBefore(a),a.exists&&t.skin.scrollTo(a,{offset:{top:-50}})},bigBox:function(e,a){t.ajax&&t.ajax.check(t.notify,t.baseURL+"myams-notify"+t.devext+".js",function(){t.notify.messageBox(e,a)})},messageBox:function(e,a,n){"object"==typeof e&&(n=a,a=e||{},e="info"),t.ajax&&t.ajax.check(t.notify,t.baseURL+"myams-notify"+t.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,t.notify.bigBox(a,n)})},smallBox:function(e,a,n){"object"==typeof e&&(n=a,a=e||{},e="info"),t.ajax&&t.ajax.check(t.notify,t.baseURL+"myams-notify"+t.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,t.notify.smallBox(a,n)})},scrollTo:function(a,n){t.ajax&&t.ajax.check(e.scrollTo,t.baseURL+"ext/jquery-scrollto-2.1.2"+t.devext+".js",function(){var t=e("body"),s=n.offset||0;t.hasClass("fixed-header")&&(s-=e("#header").height()),t.hasClass("fixed-ribbon")&&(s-=e("#ribbon").height()),n=e.extend({},n,{offset:s}),e.scrollTo(a,n)})},_drawBreadCrumb:function(){var a=e("OL.breadcrumb","#ribbon");e("li",a).not(".parent").remove(),e("li",a).exists()||a.append(e("<li></li>").append(e("<a></a>").text(t.i18n.HOME).addClass("padding-right-5").attr("href",e('nav a[href!="#"]:first').attr("href")))),e("LI.active >A","nav").each(function(){var t=e(this),n=e.trim(t.clone().children(".badge").remove().end().text()),s=e("<li></li>").append(t.attr("href").replace(/^#/,"")?e("<a></a>").html(n).attr("href",t.attr("href")):n);a.append(s)})},checkURL:function(){function a(a){e(".active",s).removeClass("active"),a.addClass("open").addClass("active"),a.parents("li").addClass("open active").children("ul").addClass("active").show(),a.parents("li:first").removeClass("open"),a.parents("ul").addClass(a.attr("href").replace(/^#/,"")?"active":"").show()}var n,s=e("nav"),i=location.hash,r=i.replace(/^#/,"");if(r){var o=e("#content");o.exists()||(o=e("body")),(n=e('A[href="'+i+'"]',s)).exists()&&a(n),t.skin.loadURL(r,o,{afterLoadCallback:function(){var a=e("html head title").data("ams-title-prefix");document.title=(a?a+" > ":"")+(e("[data-ams-page-title]:first",o).data("ams-page-title")||n.attr("title")||document.title)}})}else{var c=e("[data-ams-active-menu]").data("ams-active-menu");(n=c?e('A[href="'+c+'"]',s):e('>UL >LI >A[href!="#"]',s).first()).exists()&&(a(n),c?t.skin._drawBreadCrumb():window.location.hash=n.attr("href"))}},_clean_callbacks:[],registerCleanCallback:function(e){var a=t.skin._clean_callbacks;a.indexOf(e)<0&&a.push(e)},unregisterCleanCallback:function(e){var a=t.skin._clean_callbacks,n=a.indexOf(e);n>=0&&a.splice(n,1)},cleanContainer:function(e){for(var a=t.skin._clean_callbacks,n=0;n<a.length;n++)a[n].call(e)},loadURL:function(a,n,s,i){a.startsWith("#")&&(a=a.substr(1)),"function"==typeof s?(i=s,s={}):void 0===s&&(s={}),n=e(n);var r={type:"GET",url:a,dataType:"html",cache:!1,beforeSend:function(){if(s&&s.preLoadCallback&&t.executeFunctionByName(s.preLoadCallback,this,s.preLoadCallbackOptions),t.skin.cleanContainer(n),n.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> '+t.i18n.LOADING+" </h1>"),n[0]===e("#content")[0]){t.skin._drawBreadCrumb();var a=e("html head title").data("ams-title-prefix");document.title=(a?a+" > ":"")+e(".breadcrumb LI:last-child").text(),e("html, body").animate({scrollTop:0},"fast")}else n.animate({scrollTop:0},"fast")},success:function(a,r,o){if(i)t.executeFunctionByName(i,this,a,r,o,s);else{var c=t.ajax&&t.ajax.getResponse(o);if(c){var l=c.contentType,d=c.data;switch(e(".loading",n).remove(),l){case"json":t.ajax.handleJSON(d,n);break;case"script":case"xml":break;case"html":case"text":default:n.parents(".hidden").removeClass("hidden"),e(".alert",n.parents(".alerts-container")).remove(),n.css({opacity:"0.0"}).html(a).removeClass("hidden").delay(50).animate({opacity:"1.0"},300),t.initContent&&t.initContent(n),t.form&&t.form.setFocus(n)}s&&s.afterLoadCallback&&t.executeFunctionByName(s.afterLoadCallback,this,s.afterLoadCallbackOptions),t.stats&&t.stats.logPageview()}}},error:function(e,a,i){n.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> '+t.i18n.ERROR+i+"</h3>"+e.responseText),s&&s.afterErrorCallback&&t.executeFunctionByName(s.afterErrorCallback,this)},async:void 0===s.async||s.async},o=e.extend({},r,s);e.ajax(o)},setLanguage:function(e,a){var n=a.lang;switch(a.handler_type||"json"){case"json":var s=a.method||"setUserLanguage";t.jsonrpc&&t.jsonrpc.post(s,{lang:n},function(){window.location.reload(!0)});break;case"ajax":var i=a.href||"setUserLanguage";t.ajax&&t.ajax.post(i,{lang:n},function(){window.location.reload(!0)})}},logout:function(){window.location=t.loginURL}}}(jQuery,this),function(e,a){a.MyAMS.stats={logPageview:function(e){if(void 0!==a._gaq){var t=a.window.location;a._gaq.push(["_trackPageview",e||t.pathname+t.hash])}},logEvent:function(e,t,n){void 0!==a._gaq&&("object"==typeof e&&(t=e.action,n=e.label,e=e.category),a._gaq.push(["_trackEvent",e,t,n]))}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.initPage=function(){var n=e("body");t.root=n,t.leftPanel=e("#left-panel"),t.shortcuts=e("#shortcuts"),t.plugins.initData(n);var s=e.ajaxSettings.xhr;e.ajaxSetup({beforeSend:function(e,n){if(t.safeMethods.indexOf(n.type)<0&&void 0!==a.Cookies){var s=Cookies.get(t.csrfCookieName);s&&e.setRequestHeader(t.csrfHeaderName,s)}},progress:t.ajax&&t.ajax.progress,progressUpload:t.ajax&&t.ajax.progress,xhr:function(){var e=s();if(e&&"function"==typeof e.addEventListener){var a=this;a&&a.progress&&e.addEventListener("progress",function(e){a.progress(e)},!1)}return e}}),e(document).ajaxStart(t.ajax&&t.ajax.start),e(document).ajaxStop(t.ajax&&t.ajax.stop),e(document).ajaxError(t.error&&t.error.ajax);var i=a.localStorage&&a.localStorage.getItem("window-state");i&&n.addClass(i),t.isMobile?(t.root.addClass("mobile-detected"),t.device="mobile",t.enableFastclick&&t.ajax&&t.ajax.check(e.fn.noClickDelay,t.baseURL+"/ext/jquery-smartclick"+t.devext+".js",function(){e("NAV UL A").noClickDelay(),e("A","#hide-menu").noClickDelay()})):(t.root.addClass("desktop-detected"),t.device="desktop"),e("#show-shortcuts").click(function(e){t.shortcuts.is(":visible")?t.skin&&t.skin._hideShortcutButtons():t.skin&&t.skin._showShortcutButtons(),e.preventDefault()}),t.shortcuts.click(function(e){t.skin&&t.skin._hideShortcutButtons()}),e(document).mouseup(function(e){t.shortcuts.is(e.target)||0!==t.shortcuts.has(e.target).length||t.skin&&t.skin._hideShortcutButtons()}),e("#search-mobile").click(function(){t.root.addClass("search-mobile")}),e("#cancel-search-js").click(function(){t.root.removeClass("search-mobile")}),e(".activity-button","#user-activity").click(function(a){var t=e("#user-activity"),n=e(".ajax-dropdown",t);n.is(":visible")?(n.fadeOut(150),t.removeClass("active")):(n.css("left",-n.innerWidth()+t.innerWidth()).fadeIn(150),t.addClass("active")),a.preventDefault()}),t.skin&&t.skin.checkNotification(),e(document).mouseup(function(a){var t=e(".ajax-dropdown");t.is(a.target)||0!==t.has(a.target).length||t.fadeOut(150).prev().removeClass("active")}),e('input[name="activity"]').change(function(a){var n=e(this).data("ams-url");if(n){a.preventDefault(),a.stopPropagation();var s=t.getFunctionByName(n);if("function"==typeof s&&(n=s.call(this)),"function"==typeof n)n.call(this);else{var i=e(".ajax-notifications");t.skin&&t.skin.loadURL(n,i)}}}),e("a","#user-menu LI.logout").click(function(a){a.preventDefault(),a.stopPropagation(),t.loginURL=e(this).attr("href"),t.skin&&t.skin.bigBox({title:"<i class='fa fa-sign-out txt-color-orangeDark'></i> "+t.i18n.LOGOUT+" <span class='txt-color-orangeDark'><strong>"+e("#show-shortcut").text()+"</strong></span> ?",content:t.i18n.LOGOUT_COMMENT,buttons:t.i18n.BTN_YES_NO},function(e){e===t.i18n.BTN_YES&&(t.root.addClass("animated fadeOutUp"),setTimeout(t.skin.logout,1e3))})});var r=e("nav");e("UL",r).myams_menu({accordion:!1!==r.data("ams-menu-accordion"),speed:t.menuSpeed}),e("#hide-menu").find(">:first-child >A").click(function(e){n.toggleClass("hidden-menu"),a.localStorage&&(n.hasClass("hidden-menu")?a.localStorage.setItem("window-state","hidden-menu"):a.localStorage.setItem("window-state","")),e.preventDefault()}),e(".minifyme").click(function(t){n.toggleClass("minified"),a.localStorage&&(n.hasClass("minified")?a.localStorage.setItem("window-state","minified"):a.localStorage.setItem("window-state","")),e(this).effect("highlight",{},500),t.preventDefault()}),e("#refresh").click(function(e){t.skin&&t.skin.bigBox({title:"<i class='fa fa-refresh' style='color: green'></i> "+t.i18n.CLEAR_STORAGE_TITLE,content:t.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+t.i18n.BTN_CANCEL+"]["+t.i18n.BTN_OK+"]"},function(e){e===t.i18n.BTN_OK&&localStorage&&(localStorage.clear(),location.reload())}),e.preventDefault()}),n.on("click",function(a){var t=e(this);t.is(a.target)||0!==t.has(a.target).length||0!==e(".popover").has(a.target).length||t.popover("hide")}),t.ajax&&t.ajax.check(e.resize,t.baseURL+"ext/jquery-resize"+t.devext+".js",function(){e("#main").resize(function(){t.skin._setPageHeight(),t.skin._checkMobileWidth()}),r.resize(function(){t.skin._setPageHeight()})}),t.ajaxNav&&(e(document).on("click",'a[href="#"]',function(e){e.preventDefault()}),e(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(a){var n=e(a.currentTarget),s=n.data("ams-disabled-handlers");if(!0!==s&&"click"!==s&&"all"!==s){var i=n.attr("href")||n.data("ams-url");if(i&&!i.startsWith("javascript")&&!n.attr("target")&&!0!==n.data("ams-context-menu")){a.preventDefault(),a.stopPropagation();var r,o,c;i.indexOf("?")>=0?(r=i.split("?"),o=r[0],c=r[1].unserialize()):(o=i,c=void 0);var l=t.getFunctionByName(o);"function"==typeof l&&(i=l.call(n,c)),"function"==typeof i?i.call(n,c):(i=i.replace(/\%23/,"#"),a.ctrlKey?window.open(i):(o=n.data("ams-target"))?t.form&&t.form.confirmChangedForm(o,function(){t.skin&&t.skin.loadURL(i,o,n.data("ams-link-options"),n.data("ams-link-callback"))}):t.form&&t.form.confirmChangedForm(function(){i.startsWith("#")?i!==location.hash&&(t.root.hasClass("mobile-view-activated")?(t.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=i},50)):window.location.hash=i):window.location=i}))}}}),e(document).on("click",'a[target="_blank"]',function(a){a.preventDefault();var n=e(a.currentTarget);window.open(n.attr("href")),t.stats&&t.stats.logEvent(n.data("ams-stats-category")||"Navigation",n.data("ams-stats-action")||"External",n.data("ams-stats-label")||n.attr("href"))}),e(document).on("click",'a[target="_top"]',function(a){a.preventDefault(),t.form&&t.form.confirmChangedForm(function(){window.location=e(a.currentTarget).attr("href")})}),e(window).on("hashchange",t.skin&&t.skin.checkURL)),e(document).off("click.modal").on("click",'[data-toggle="modal"]',function(a){var n=e(this),s=n.data("ams-disabled-handlers");!0!==s&&"click"!==s&&"all"!==s&&!0!==n.data("ams-context-menu")&&(!0===n.data("ams-stop-propagation")&&a.stopPropagation(),a.preventDefault(),t.dialog&&t.dialog.open(n),n.parents("#shortcut").exists()&&setTimeout(t.skin._hideShortcutButtons,300))}),e(document).on("click",'button[type="submit"], button.submit',function(){var a=e(this);e(a.get(0).form).data("ams-submit-button",a)}),e(document).on("click",'input[type="checkbox"][readonly]',function(){return!1}),e(document).on("click","[data-ams-click-handler]",function(a){var n=e(this),s=n.data("ams-disabled-handlers");if(!0!==s&&"click"!==s&&"all"!==s){var i=n.data();if(i.amsClickHandler){!0!==i.amsStopPropagation&&!0!==i.amsClickStopPropagation||a.stopPropagation(),!0!==i.amsClickKeepDefault&&a.preventDefault();for(var r=i.amsClickHandler.split(/\s+/),o=0;o<r.length;o++){var c=t.getFunctionByName(r[o]);void 0!==c&&c.call(n,a,i.amsClickHandlerOptions)}}}}),e(document).on("change","[data-ams-change-handler]",function(a){var n=e(this);if(!n.prop("readonly")){var s=n.data("ams-disabled-handlers");if(!0!==s&&"change"!==s&&"all"!==s){var i=n.data();if(i.amsChangeHandler){!0!==i.amsStopPropagation&&!0!==i.amsChangeStopPropagation||a.stopPropagation(),!0!==i.amsChangeKeepDefault&&a.preventDefault();for(var r=i.amsChangeHandler.split(/\s+/),o=0;o<r.length;o++){var c=t.getFunctionByName(r[o]);void 0!==c&&c.call(n,a,i.amsChangeHandlerOptions)}}}}}),e(document).on("keydown","textarea",function(a){10!==a.keyCode&&13!==a.keyCode||!a.ctrlKey&&!a.metaKey||e(this).closest("form").submit()}),e(document).on("reset","form",function(a){var n=e(this);setTimeout(function(){e(".alert-danger, SPAN.state-error",n).not(".persistent").remove(),e("LABEL.state-error",n).removeClass("state-error"),e('INPUT.select2[type="hidden"]',n).each(function(){var a=e(this),t=a.data("select2"),n=a.data("ams-select2-input-value");n&&a.select2("val",n.split(t.opts.separator))}),n.find(".select2").trigger("change"),e("[data-ams-reset-callback]",n).each(function(){var a=e(this),s=a.data(),i=t.getFunctionByName(s.amsResetCallback);void 0!==i&&i.call(n,a,s.amsResetCallbackOptions)})},10),t.form&&t.form.setFocus(n)}),e(document).on("reset","[data-ams-reset-handler]",function(a){var n=e(this),s=n.data();if(s.amsResetHandler){!0!==s.amsResetKeepDefault&&a.preventDefault();var i=t.getFunctionByName(s.amsResetHandler);void 0!==i&&i.call(n,s.amsResetHandlerOptions)}}),e(document).on("click","[data-ams-click-event]",function(a){var t=e(this);e(a.target).trigger(t.data("ams-click-event"),t.data("ams-click-event-options"))}),e(document).on("change",'input[type="file"]',function(a){a.preventDefault();var t=e(this),n=t.parent(".button");n.exists()&&n.parent().hasClass("input-file")&&n.next('input[type="text"]').val(t.val())}),e(document).on("focus",'input[readonly="readonly"]',function(){e(this).blur()}),e(document).on("focusin",function(a){e(a.target).closest(".mce-window").length&&a.stopImmediatePropagation()}),e(document).on("click",".nav-tabs a[data-toggle=tab]",function(a){if(e(this).parent("li").hasClass("disabled"))return a.preventDefault(),!1}),e(document).on("show.bs.dropdown",".btn-group",function(){var a=e(this),t=a.children(".dropdown-menu"),n=a.get(0).getBoundingClientRect(),s=n.top,i=n.height,r=t.outerHeight();s>r&&e(window).height()-s<i+r&&a.addClass("dropup")}).on("hidden.bs.dropdown",".btn-group",function(){e(this).removeClass("dropup")}),e(document).on("show.bs.tab",function(a){var n=e(a.target);n.exists()&&"A"!==n.get(0).tagName&&(n=e("a[href]",n));var s=n.data();if(s&&s.amsUrl){if(s.amsTabLoaded)return;n.append('<i class="fa fa-spin fa-cog margin-left-5"></i>'),t.skin&&t.skin.loadURL(s.amsUrl,n.attr("href"),{afterLoadCallback:function(){s.amsTabLoadOnce&&n.data("ams-tab-loaded",!0),e("i",n).remove()},afterErrorCallback:function(){e("i",n).remove()}})}}),e(document).on("hide.bs.modal",function(a){var n=e(a.target);t.form&&t.form.confirmChangedForm(n,function(){var e=n.data("modal")||n.data("bs.modal");return e&&(e.isShown=!0),!0},function(){return a.preventDefault(),!1})}),e(document).on("myams.refresh",function(e,a){t.executeFunctionByName(a.handler||t.skin&&t.skin.refreshContent,e.target,a)}),t.initContent(document),t.ajaxNav&&r.exists()&&t.skin&&t.skin.checkURL(),t.form&&t.form.setFocus(document),e(window).on("beforeunload",t.form&&t.form.checkBeforeUnload)},t.initContent=function(a){e(".tipsy").remove(),e("[rel=tooltip]",a).tooltip(),e("[rel=popover]",a).popover(),e("[rel=popover-hover]",a).popover({trigger:"hover"}),t.plugins&&t.plugins.init(a),t.callbacks&&t.callbacks.init(a),t.events&&t.events.init(a),t.form&&t.form.init(a),"desktop"===t.device?t.skin&&t.skin._initDesktopWidgets(a):t.skin&&t.skin._initMobileWidgets(a),t.skin&&t.skin._setPageHeight()},e(document).ready(function(){var a=(e=jQuery.noConflict())("HTML");a.removeClass("no-js").addClass("js");var n=a.attr("lang")||a.attr("xml:lang");n&&!n.startsWith("en")?(t.lang=n,t.getScript(t.baseURL+"i18n/myams_"+n.substr(0,2)+t.devext+".js",function(){t.initPage()})):t.initPage()})}(jQuery,this);