# HG changeset patch # User Thierry Florac # Date 1445515168 -7200 # Node ID 3ea42c4b993849137ea47566c92cf1fb337aea5d # Parent f7b7e3f21da648c08318b0310493888bfe5d8ed9 Version 0.1.16 diff -r f7b7e3f21da6 -r 3ea42c4b9938 .installed.cfg --- a/.installed.cfg Tue Oct 13 17:39:09 2015 +0200 +++ b/.installed.cfg Thu Oct 22 13:59:28 2015 +0200 @@ -93,3 +93,39 @@ [buildout] parts = package i18n pyflakes pyflakesrun test + +[buildout] +installed_develop_eggs = /home/tflorac/Dropbox/src/ztfy.myams/develop-eggs/ztfy.mail.egg-link + +[buildout] +parts = i18n pyflakes pyflakesrun test package + +[buildout] +parts = pyflakes pyflakesrun test package i18n + +[buildout] +parts = pyflakesrun test package i18n pyflakes + +[buildout] +parts = test package i18n pyflakes pyflakesrun + +[buildout] +parts = package i18n pyflakes pyflakesrun test + +[buildout] +installed_develop_eggs = /home/tflorac/Dropbox/src/ztfy.myams/develop-eggs/ztfy.mail.egg-link + +[buildout] +parts = i18n pyflakes pyflakesrun test package + +[buildout] +parts = pyflakes pyflakesrun test package i18n + +[buildout] +parts = pyflakesrun test package i18n pyflakes + +[buildout] +parts = test package i18n pyflakes pyflakesrun + +[buildout] +parts = package i18n pyflakes pyflakesrun test diff -r f7b7e3f21da6 -r 3ea42c4b9938 buildout.cfg --- a/buildout.cfg Tue Oct 13 17:39:09 2015 +0200 +++ b/buildout.cfg Thu Oct 22 13:59:28 2015 +0200 @@ -49,4 +49,4 @@ eggs = ztfy.myams [test] [versions] -ztfy.myams = 0.1.15 +ztfy.myams = 0.1.16 diff -r f7b7e3f21da6 -r 3ea42c4b9938 docs/HISTORY.txt --- a/docs/HISTORY.txt Tue Oct 13 17:39:09 2015 +0200 +++ b/docs/HISTORY.txt Thu Oct 22 13:59:28 2015 +0200 @@ -1,6 +1,20 @@ History ======= +0.1.16 +------ + - small updates in MyAMS.js + - small CSS updates + - new backport from pyams_skin development package + +0.1.15.2 +-------- + - changed default layout language + +0.1.15.1 +-------- + - replace minified javascript resource + 0.1.15 ------ - new backport from pyams_skin development package including a few CSS and javascript updates diff -r f7b7e3f21da6 -r 3ea42c4b9938 setup.py --- a/setup.py Tue Oct 13 17:39:09 2015 +0200 +++ b/setup.py Thu Oct 22 13:59:28 2015 +0200 @@ -8,7 +8,7 @@ HISTORY = os.path.join(DOCS, 'HISTORY.txt') CONTRIBS = os.path.join(DOCS, 'CONTRIBUTORS.txt') -version = '0.1.15' +version = '0.1.16' long_description = open(README).read() + '\n\n' + \ open(CONTRIBS).read() + '\n\n' + \ open(HISTORY).read() diff -r f7b7e3f21da6 -r 3ea42c4b9938 src/ztfy.myams.egg-info/PKG-INFO --- a/src/ztfy.myams.egg-info/PKG-INFO Tue Oct 13 17:39:09 2015 +0200 +++ b/src/ztfy.myams.egg-info/PKG-INFO Thu Oct 22 13:59:28 2015 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: ztfy.myams -Version: 0.1.15 +Version: 0.1.16 Summary: ZTFY new admin/application skin Home-page: http://hg.ztfy.org/ztfy.myams Author: Thierry Florac @@ -36,6 +36,20 @@ History ======= + 0.1.16 + ------ + - small updates in MyAMS.js + - small CSS updates + - new backport from pyams_skin development package + + 0.1.15.2 + -------- + - changed default layout language + + 0.1.15.1 + -------- + - replace minified javascript resource + 0.1.15 ------ - new backport from pyams_skin development package including a few CSS and javascript updates diff -r f7b7e3f21da6 -r 3ea42c4b9938 src/ztfy/myams/resources/js/i18n/myams_fr.js --- a/src/ztfy/myams/resources/js/i18n/myams_fr.js Tue Oct 13 17:39:09 2015 +0200 +++ b/src/ztfy/myams/resources/js/i18n/myams_fr.js Thu Oct 22 13:59:28 2015 +0200 @@ -55,6 +55,8 @@ BTN_NO: "Non", BTN_YES_NO: "[Oui][Non]", + CLIPBOARD_COPY: "Copier dans le presse-papier avec Ctrl+C, puis Entrée", + FORM_CHANGED_WARNING: "Certaines modifications n'ont pas été enregistrées.\nCes modifications seront perdues si vous quittez cette page.", DELETE_WARNING: "Cette suppression ne pourra pas être annulée. Êtes-vous sûr de vouloir supprimer cet élément ?", NO_UPDATE: "Aucune modification effectuée.", diff -r f7b7e3f21da6 -r 3ea42c4b9938 src/ztfy/myams/resources/js/i18n/myams_fr.min.js --- a/src/ztfy/myams/resources/js/i18n/myams_fr.min.js Tue Oct 13 17:39:09 2015 +0200 +++ b/src/ztfy/myams/resources/js/i18n/myams_fr.min.js Thu Oct 22 13:59:28 2015 +0200 @@ -1,1 +1,1 @@ -(function(b){if(b.datepicker){var a={closeText:"Fermer",prevText:"Précédent",nextText:"Suivant",currentText:"Aujourd'hui",monthNames:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],monthNamesShort:["janv.","févr.","mars","avril","mai","juin","juil.","août","sept.","oct.","nov.","déc."],dayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],dayNamesShort:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],dayNamesMin:["D","L","M","M","J","V","S"],weekHeader:"Sem.",dateFormat:"dd/mm/yy",firstDay:1,isRTL:false,showMonthAfterYear:false,yearSuffix:""};b.datepicker.setDefaults(a)}b.extend(MyAMS.i18n,{INFO:"Information",WARNING:"!! ATTENTION !!",ERROR:"ERREUR : ",WAIT:"Veuillez patienter...",FORM_SUBMITTED:"Vous avez déjà soumis ce formulaire !",ERROR_OCCURED:"Une erreur s'est produite !",ERRORS_OCCURED:"Des erreurs se sont produites !",NO_SERVER_RESPONSE:"Pas de réponse du serveur !",BAD_LOGIN_TITLE:"Paramètres de connexion incorrects !",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirmation",CONFIRM_REMOVE:"La suppression de cet élément ne peut pas être annulée. Confirmez-vous ?",CLEAR_STORAGE_TITLE:"Effacer le stockage local ?",CLEAR_STORAGE_CONTENT:"Le stockage local permet de mémoriser au sein de votre navigateur le paramétrage des composants sur l'ensemble de ce site.
Êtes-vous sûr(e) de vouloir effacer ces paramètres pour l'ensemble de l'application ?",BTN_OK:"OK",BTN_CANCEL:"Annuler",BTN_OK_CANCEL:"[OK][Annuler]",BTN_YES:"Oui",BTN_NO:"Non",BTN_YES_NO:"[Oui][Non]",FORM_CHANGED_WARNING:"Certaines modifications n'ont pas été enregistrées.\nCes modifications seront perdues si vous quittez cette page.",DELETE_WARNING:"Cette suppression ne pourra pas être annulée. Êtes-vous sûr de vouloir supprimer cet élément ?",NO_UPDATE:"Aucune modification effectuée.",DATA_UPDATED:"Données enregistrées.",HOME:"Accueil",LOGOUT:"Déconnexion",LOGOUT_COMMENT:"Vous pouvez renforcer votre sécurité en fermant la fenêtre de ce navigateur une fois la déconnexion effectuée...",SELECT2_PLURAL:"s",SELECT2_MATCH:"Un seul résultat disponible, utilisez la touche Entrée pour le sélectionner.",SELECT2_MATCHES:" résultats sont disponibles, utilisez les flèches haut et bas pour naviguer.",SELECT2_NOMATCHES:"Pas de correspondance",SELECT2_SEARCHING:"Recherche...",SELECT2_LOADMORE:"Chargement en cours...",SELECT2_INPUT_TOOSHORT:"Veuillez saisir au moins {0} caractère{1}",SELECT2_INPUT_TOOLONG:"Veuillez supprimer {0} caractère{1}",SELECT2_SELECTION_TOOBIG:"Vous ne pouvez sélectionner que {0} élément{1}",SELECT2_FREETAG_PREFIX:"Texte libre : ",DT_COLUMNS:"Colonnes"});MyAMS.plugins.i18n={widgets:{SETTINGS_KEY_LABEL:"Réinitialiser les paramètres de ce composant ?",POSITION_KEY_LABEL:"Réinitialiser la position de ce composant ?",TIMESTAMP_FORMAT:"Dernière mise à jour: %d%/%m%/%y% %h%:%i%:%s",ERROR_LABEL:"Une erreur s'est produite : ",UPDATED_LABEL:"Dernière mise à jour : ",REFRESH_LABEL:"Rafraîchir",EDIT_BTN:"Modifier le titre",DELETE_BTN:"Supprimer",DELETE_LABEL:"Supprimer le composant : ",DELETE_MSG:"ATTENTION : cette action ne peut pas être annulée !",FULLSCREEN_BTN:"Plein écran",COLLAPSE_BTN:"Replier",REFRESH_BTN:"Recharger le contenu",LOADING_MSG:"Chargement..."},validate:{required:"Ce champ est obligatoire.",remote:"Veuillez corriger ce champ.",email:"Veuillez saisir une adresse mail valide.",url:"Veuillez saisir une URL valide.",date:"Veuillez saisir une date valide.",dateISO:"Veuillez saisir une date valide (format ISO).",number:"Veuillez saisir un nombre.",digits:"Veuillez ne saisir que des chiffres.",creditcard:"Veuillez saisir un numéro de carte valide.",equalTo:"Veuillez saisir la même valeur.",maxlength:"Ce champ est limité à {0} caractères.",minlength:"Ce champ doit faire au moins {0} caractères.",rangelength:"Ce champ doit comporter entre {0} et {1} caractères.",range:"Veuillez saisir une valeur entre {0} et {1}.",max:"Veuillez saisir une valeur inférieure ou égale à {0}.",min:"Veuillez saisir une valeur supérieure ou égale à {0}."},datatables:{sProcessing:"Traitement en cours...",sSearch:"Filtrer...",sLengthMenu:"Afficher _MENU_ éléments par page",sInfo:"Affichage des éléments _START_ à _END_ sur _TOTAL_",sInfoEmpty:"Aucun élément à afficher",sInfoFiltered:"(sur un total de _MAX_)",sInfoPostFix:"",sLoadingRecords:"Chargement en cours...",sZeroRecords:"Aucun élément à afficher",sEmptyTable:"Aucune donnée disponible dans le tableau",oPaginate:{sFirst:"Premier",sPrevious:"Précédent",sNext:"Suivant",sLast:"Dernier"},sColumns:"Colonnes",oAria:{sSortAscending:": activer pour trier la colonne par ordre croissant",sSortDescending:": activer pour trier la colonne par ordre décroissant"}}}})(jQuery); \ No newline at end of file +(function(b){if(b.datepicker){var a={closeText:"Fermer",prevText:"Précédent",nextText:"Suivant",currentText:"Aujourd'hui",monthNames:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],monthNamesShort:["janv.","févr.","mars","avril","mai","juin","juil.","août","sept.","oct.","nov.","déc."],dayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],dayNamesShort:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],dayNamesMin:["D","L","M","M","J","V","S"],weekHeader:"Sem.",dateFormat:"dd/mm/yy",firstDay:1,isRTL:false,showMonthAfterYear:false,yearSuffix:""};b.datepicker.setDefaults(a)}b.extend(MyAMS.i18n,{INFO:"Information",WARNING:"!! ATTENTION !!",ERROR:"ERREUR : ",WAIT:"Veuillez patienter...",FORM_SUBMITTED:"Vous avez déjà soumis ce formulaire !",ERROR_OCCURED:"Une erreur s'est produite !",ERRORS_OCCURED:"Des erreurs se sont produites !",NO_SERVER_RESPONSE:"Pas de réponse du serveur !",BAD_LOGIN_TITLE:"Paramètres de connexion incorrects !",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirmation",CONFIRM_REMOVE:"La suppression de cet élément ne peut pas être annulée. Confirmez-vous ?",CLEAR_STORAGE_TITLE:"Effacer le stockage local ?",CLEAR_STORAGE_CONTENT:"Le stockage local permet de mémoriser au sein de votre navigateur le paramétrage des composants sur l'ensemble de ce site.
Êtes-vous sûr(e) de vouloir effacer ces paramètres pour l'ensemble de l'application ?",BTN_OK:"OK",BTN_CANCEL:"Annuler",BTN_OK_CANCEL:"[OK][Annuler]",BTN_YES:"Oui",BTN_NO:"Non",BTN_YES_NO:"[Oui][Non]",CLIPBOARD_COPY:"Copier dans le presse-papier avec Ctrl+C, puis Entrée",FORM_CHANGED_WARNING:"Certaines modifications n'ont pas été enregistrées.\nCes modifications seront perdues si vous quittez cette page.",DELETE_WARNING:"Cette suppression ne pourra pas être annulée. Êtes-vous sûr de vouloir supprimer cet élément ?",NO_UPDATE:"Aucune modification effectuée.",DATA_UPDATED:"Données enregistrées.",HOME:"Accueil",LOGOUT:"Déconnexion",LOGOUT_COMMENT:"Vous pouvez renforcer votre sécurité en fermant la fenêtre de ce navigateur une fois la déconnexion effectuée...",SELECT2_PLURAL:"s",SELECT2_MATCH:"Un seul résultat disponible, utilisez la touche Entrée pour le sélectionner.",SELECT2_MATCHES:" résultats sont disponibles, utilisez les flèches haut et bas pour naviguer.",SELECT2_NOMATCHES:"Pas de correspondance",SELECT2_SEARCHING:"Recherche...",SELECT2_LOADMORE:"Chargement en cours...",SELECT2_INPUT_TOOSHORT:"Veuillez saisir au moins {0} caractère{1}",SELECT2_INPUT_TOOLONG:"Veuillez supprimer {0} caractère{1}",SELECT2_SELECTION_TOOBIG:"Vous ne pouvez sélectionner que {0} élément{1}",SELECT2_FREETAG_PREFIX:"Texte libre : ",DT_COLUMNS:"Colonnes"});MyAMS.plugins.i18n={widgets:{SETTINGS_KEY_LABEL:"Réinitialiser les paramètres de ce composant ?",POSITION_KEY_LABEL:"Réinitialiser la position de ce composant ?",TIMESTAMP_FORMAT:"Dernière mise à jour: %d%/%m%/%y% %h%:%i%:%s",ERROR_LABEL:"Une erreur s'est produite : ",UPDATED_LABEL:"Dernière mise à jour : ",REFRESH_LABEL:"Rafraîchir",EDIT_BTN:"Modifier le titre",DELETE_BTN:"Supprimer",DELETE_LABEL:"Supprimer le composant : ",DELETE_MSG:"ATTENTION : cette action ne peut pas être annulée !",FULLSCREEN_BTN:"Plein écran",COLLAPSE_BTN:"Replier",REFRESH_BTN:"Recharger le contenu",LOADING_MSG:"Chargement..."},validate:{required:"Ce champ est obligatoire.",remote:"Veuillez corriger ce champ.",email:"Veuillez saisir une adresse mail valide.",url:"Veuillez saisir une URL valide.",date:"Veuillez saisir une date valide.",dateISO:"Veuillez saisir une date valide (format ISO).",number:"Veuillez saisir un nombre.",digits:"Veuillez ne saisir que des chiffres.",creditcard:"Veuillez saisir un numéro de carte valide.",equalTo:"Veuillez saisir la même valeur.",maxlength:"Ce champ est limité à {0} caractères.",minlength:"Ce champ doit faire au moins {0} caractères.",rangelength:"Ce champ doit comporter entre {0} et {1} caractères.",range:"Veuillez saisir une valeur entre {0} et {1}.",max:"Veuillez saisir une valeur inférieure ou égale à {0}.",min:"Veuillez saisir une valeur supérieure ou égale à {0}."},datatables:{sProcessing:"Traitement en cours...",sSearch:"Filtrer...",sLengthMenu:"Afficher _MENU_ éléments par page",sInfo:"Affichage des éléments _START_ à _END_ sur _TOTAL_",sInfoEmpty:"Aucun élément à afficher",sInfoFiltered:"(sur un total de _MAX_)",sInfoPostFix:"",sLoadingRecords:"Chargement en cours...",sZeroRecords:"Aucun élément à afficher",sEmptyTable:"Aucune donnée disponible dans le tableau",oPaginate:{sFirst:"Premier",sPrevious:"Précédent",sNext:"Suivant",sLast:"Dernier"},sColumns:"Colonnes",oAria:{sSortAscending:": activer pour trier la colonne par ordre croissant",sSortDescending:": activer pour trier la colonne par ordre décroissant"}}}})(jQuery); \ No newline at end of file diff -r f7b7e3f21da6 -r 3ea42c4b9938 src/ztfy/myams/resources/js/myams-dataTables.js --- a/src/ztfy/myams/resources/js/myams-dataTables.js Tue Oct 13 17:39:09 2015 +0200 +++ b/src/ztfy/myams/resources/js/myams-dataTables.js Thu Oct 22 13:59:28 2015 +0200 @@ -45,6 +45,89 @@ /** + * Custom sorting plug-in + */ + $.fn.dataTableExt.aTypes.unshift( + function(sData) { + if (sData !== null && sData.match(/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/[0-3][0-9]{3}$/)) { + return 'date-euro'; + } + return null; + } + ); + + $.fn.dataTableExt.aTypes.unshift( + function(sData) { + if (sData !== null && sData.match(/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/[0-3][0-9]{3} - ([0-1][0-9]|2[0-3]):[0-5][0-9]$/)) { + return 'datetime-euro'; + } + return null; + } + ); + + $.extend($.fn.dataTableExt.oSort, { + + // numeric-comma column sorter + "numeric-comma-asc": function(a, b) { + var x = a.replace(/,/, ".").replace(/ /g, ''); + var y = b.replace(/,/, ".").replace(/ /g, ''); + x = parseFloat(x); + y = parseFloat(y); + return ((x < y) ? -1 : ((x > y) ? 1 : 0)); + }, + "numeric-comma-desc": function(a, b) { + var x = a.replace(/,/, ".").replace(/ /g, ''); + var y = b.replace(/,/, ".").replace(/ /g, ''); + x = parseFloat(x); + y = parseFloat(y); + return ((x < y) ? 1 : ((x > y) ? -1 : 0)); + }, + + // date-euro column sorter + "date-euro-pre": function(a) { + var trimmed = $.trim(a); + if (trimmed != '') { + var frDate= trimmed.split('/'); + var x = (frDate[2] + frDate[1] + frDate[0]) * 1; + } else { + x = 10000000; // = l'an 1000 ... + } + return x; + }, + + "date-euro-asc": function(a, b) { + return a - b; + }, + + "date-euro-desc": function(a, b) { + return b - a; + }, + + // datetime-euro column sorter + "datetime-euro-pre": function(a) { + var trimmed = $.trim(a); + if (trimmed != '') { + var frDateTime = trimmed.split(' - '); + var frDate= frDateTime[0].split('/'); + var frTime = frDateTime[1].split(':'); + var x = (frDate[2] + frDate[1] + frDate[0] + frTime[0] + frTime[1]) * 1; + } else { + x = 100000000000; // = l'an 1000 ... + } + return x; + }, + + "datetime-euro-asc": function(a, b) { + return a - b; + }, + + "datetime-euro-desc": function(a, b) { + return b - a; + } + }); + + + /** * Bootstrap style pagination control */ $.extend($.fn.dataTableExt.oPagination, { diff -r f7b7e3f21da6 -r 3ea42c4b9938 src/ztfy/myams/resources/js/myams-dataTables.min.js --- a/src/ztfy/myams/resources/js/myams-dataTables.min.js Tue Oct 13 17:39:09 2015 +0200 +++ b/src/ztfy/myams/resources/js/myams-dataTables.min.js Thu Oct 22 13:59:28 2015 +0200 @@ -1,1 +1,1 @@ -(function(b){b.extend(true,b.fn.dataTable.defaults,{sDom:"R<'dt-top-row'CLF>r<'dt-wrapper't><'dt-row dt-bottom-row'<'row'<'col-sm-6'i><'col-sm-6 text-right'p>>",sPaginationType:"bootstrap",oLanguage:{sLengthMenu:"_MENU_",sSearch:"_INPUT_"}});b.extend(b.fn.dataTableExt.oStdClasses,{sWrapper:"dataTables_wrapper form-inline"});b.fn.dataTableExt.oApi.fnPagingInfo=function(d){return{iStart:d._iDisplayStart,iEnd:d.fnDisplayEnd(),iLength:d._iDisplayLength,iTotal:d.fnRecordsTotal(),iFilteredTotal:d.fnRecordsDisplay(),iPage:d._iDisplayLength===-1?0:Math.ceil(d._iDisplayStart/d._iDisplayLength),iTotalPages:d._iDisplayLength===-1?0:Math.ceil(d.fnRecordsDisplay()/d._iDisplayLength)}};b.extend(b.fn.dataTableExt.oPagination,{bootstrap:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('");var f=b("a",e);b(f[0]).on("click.DT",{action:"previous"},i);b(f[1]).on("click.DT",{action:"next"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,q,g,e=Math.floor(p/2);if(k.iTotalPages=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m'+l+"").insertBefore(b("li:last",n[m])[0]).on("click",function(i){i.preventDefault();f._iDisplayStart=(parseInt(b("a",this).text(),10)-1)*k.iLength;o(f)})}if(k.iPage===0){b("li:first",n[m]).addClass("disabled")}else{b("li:first",n[m]).removeClass("disabled")}if(k.iPage===k.iTotalPages-1||k.iTotalPages===0){b("li:last",n[m]).addClass("disabled")}else{b("li:last",n[m]).removeClass("disabled")}}}}});b.extend(b.fn.dataTableExt.oPagination,{bootstrap_full:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('");var f=b("a",e);b(f[0]).on("click.DT",{action:"first"},i);b(f[1]).on("click.DT",{action:"previous"},i);b(f[2]).on("click.DT",{action:"next"},i);b(f[3]).on("click.DT",{action:"last"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,g,q,e=Math.floor(p/2);if(k.iTotalPages=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m'+l+"").insertBefore(b("li.next",n[m])[0]).on("click",function(i){i.preventDefault();f._iDisplayStart=(parseInt(b("a",this).text(),10)-1)*k.iLength;o(f)})}if(k.iPage===0){b("li.first",n[m]).addClass("disabled");b("li.prev",n[m]).addClass("disabled")}else{b("li.prev",n[m]).removeClass("disabled");b("li.first",n[m]).removeClass("disabled")}if(k.iPage===k.iTotalPages-1||k.iTotalPages===0){b("li.last",n[m]).addClass("disabled");b("li.next",n[m]).addClass("disabled")}else{b("li.next",n[m]).removeClass("disabled");b("li.last",n[m]).removeClass("disabled")}}}}});b.extend(b.fn.dataTableExt.oPagination,{bootstrap_prevnext:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('
');var f=b("a",e);b(f[0]).on("click.DT",{action:"first"},i);b(f[1]).on("click.DT",{action:"previous"},i);b(f[2]).on("click.DT",{action:"next"},i);b(f[3]).on("click.DT",{action:"last"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,q,g,e=Math.floor(p/2);if(k.iTotalPages=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m').attr("name",j);var k,h;var m=g.aLengthMenu;if(m.length==2&&typeof(m[0])=="object"&&typeof(m[1])=="object"){for(k=0,h=m[0].length;k").attr("value",m[0][k]).text(m[1][k]).appendTo(l)}}else{for(k=0,h=m.length;k").attr("value",m[k]).text(m[k]).appendTo(l)}}var p=f("
").addClass(g.oClasses.sLength).append(f("").addClass("ams-form").append(f("").addClass("select").css("width",60).append(l).append(f(""))));if(!g.aanFeatures.L){p.attr("id",g.sTableId+"_length")}this.dom.wrapper=p.get(0);f('select option[value="'+g._iDisplayLength+'"]',p).attr("selected",true);f("select",p).on("change.DT",function(i){var q=f(this).val();var r=g.aanFeatures.L;for(k=0,h=r.length;k").addClass(j.oClasses.sFilter).html('
'+l+"
");if(!j.aanFeatures.F){i.attr("id",j.sTableId+"_filter")}this.dom.wrapper=i.get(0);var k=f('input[type="text"]',i);i.data("DT_Input",k[0]);k.val(g.sSearch.replace('"',""")).addClass("form-control").attr("placeholder",j.oLanguage.sSearch).attr("aria-control",j.sTableId).on("keyup.DT",function(q){var s=j.aanFeatures.F;var r=f(this).val();for(var p=0,o=s.length;pr<'dt-wrapper't><'dt-row dt-bottom-row'<'row'<'col-sm-6'i><'col-sm-6 text-right'p>>",sPaginationType:"bootstrap",oLanguage:{sLengthMenu:"_MENU_",sSearch:"_INPUT_"}});b.extend(b.fn.dataTableExt.oStdClasses,{sWrapper:"dataTables_wrapper form-inline"});b.fn.dataTableExt.oApi.fnPagingInfo=function(d){return{iStart:d._iDisplayStart,iEnd:d.fnDisplayEnd(),iLength:d._iDisplayLength,iTotal:d.fnRecordsTotal(),iFilteredTotal:d.fnRecordsDisplay(),iPage:d._iDisplayLength===-1?0:Math.ceil(d._iDisplayStart/d._iDisplayLength),iTotalPages:d._iDisplayLength===-1?0:Math.ceil(d.fnRecordsDisplay()/d._iDisplayLength)}};b.fn.dataTableExt.aTypes.unshift(function(d){if(d!==null&&d.match(/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/[0-3][0-9]{3}$/)){return"date-euro"}return null});b.fn.dataTableExt.aTypes.unshift(function(d){if(d!==null&&d.match(/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/[0-3][0-9]{3} - ([0-1][0-9]|2[0-3]):[0-5][0-9]$/)){return"datetime-euro"}return null});b.extend(b.fn.dataTableExt.oSort,{"numeric-comma-asc":function(f,e){var d=f.replace(/,/,".").replace(/ /g,"");var g=e.replace(/,/,".").replace(/ /g,"");d=parseFloat(d);g=parseFloat(g);return((dg)?1:0))},"numeric-comma-desc":function(f,e){var d=f.replace(/,/,".").replace(/ /g,"");var g=e.replace(/,/,".").replace(/ /g,"");d=parseFloat(d);g=parseFloat(g);return((dg)?-1:0))},"date-euro-pre":function(f){var g=b.trim(f);if(g!=""){var e=g.split("/");var d=(e[2]+e[1]+e[0])*1}else{d=10000000}return d},"date-euro-asc":function(e,d){return e-d},"date-euro-desc":function(e,d){return d-e},"datetime-euro-pre":function(f){var i=b.trim(f);if(i!=""){var g=i.split(" - ");var e=g[0].split("/");var h=g[1].split(":");var d=(e[2]+e[1]+e[0]+h[0]+h[1])*1}else{d=100000000000}return d},"datetime-euro-asc":function(e,d){return e-d},"datetime-euro-desc":function(e,d){return d-e}});b.extend(b.fn.dataTableExt.oPagination,{bootstrap:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('");var f=b("a",e);b(f[0]).on("click.DT",{action:"previous"},i);b(f[1]).on("click.DT",{action:"next"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,q,g,e=Math.floor(p/2);if(k.iTotalPages=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m'+l+"").insertBefore(b("li:last",n[m])[0]).on("click",function(i){i.preventDefault();f._iDisplayStart=(parseInt(b("a",this).text(),10)-1)*k.iLength;o(f)})}if(k.iPage===0){b("li:first",n[m]).addClass("disabled")}else{b("li:first",n[m]).removeClass("disabled")}if(k.iPage===k.iTotalPages-1||k.iTotalPages===0){b("li:last",n[m]).addClass("disabled")}else{b("li:last",n[m]).removeClass("disabled")}}}}});b.extend(b.fn.dataTableExt.oPagination,{bootstrap_full:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('");var f=b("a",e);b(f[0]).on("click.DT",{action:"first"},i);b(f[1]).on("click.DT",{action:"previous"},i);b(f[2]).on("click.DT",{action:"next"},i);b(f[3]).on("click.DT",{action:"last"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,g,q,e=Math.floor(p/2);if(k.iTotalPages=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m'+l+"").insertBefore(b("li.next",n[m])[0]).on("click",function(i){i.preventDefault();f._iDisplayStart=(parseInt(b("a",this).text(),10)-1)*k.iLength;o(f)})}if(k.iPage===0){b("li.first",n[m]).addClass("disabled");b("li.prev",n[m]).addClass("disabled")}else{b("li.prev",n[m]).removeClass("disabled");b("li.first",n[m]).removeClass("disabled")}if(k.iPage===k.iTotalPages-1||k.iTotalPages===0){b("li.last",n[m]).addClass("disabled");b("li.next",n[m]).addClass("disabled")}else{b("li.next",n[m]).removeClass("disabled");b("li.last",n[m]).removeClass("disabled")}}}}});b.extend(b.fn.dataTableExt.oPagination,{bootstrap_prevnext:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('
');var f=b("a",e);b(f[0]).on("click.DT",{action:"first"},i);b(f[1]).on("click.DT",{action:"previous"},i);b(f[2]).on("click.DT",{action:"next"},i);b(f[3]).on("click.DT",{action:"last"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,q,g,e=Math.floor(p/2);if(k.iTotalPages=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m').attr("name",j);var k,h;var m=g.aLengthMenu;if(m.length==2&&typeof(m[0])=="object"&&typeof(m[1])=="object"){for(k=0,h=m[0].length;k").attr("value",m[0][k]).text(m[1][k]).appendTo(l)}}else{for(k=0,h=m.length;k").attr("value",m[k]).text(m[k]).appendTo(l)}}var p=f("
").addClass(g.oClasses.sLength).append(f("").addClass("ams-form").append(f("").addClass("select").css("width",60).append(l).append(f(""))));if(!g.aanFeatures.L){p.attr("id",g.sTableId+"_length")}this.dom.wrapper=p.get(0);f('select option[value="'+g._iDisplayLength+'"]',p).attr("selected",true);f("select",p).on("change.DT",function(i){var q=f(this).val();var r=g.aanFeatures.L;for(k=0,h=r.length;k").addClass(j.oClasses.sFilter).html('
'+l+"
");if(!j.aanFeatures.F){i.attr("id",j.sTableId+"_filter")}this.dom.wrapper=i.get(0);var k=f('input[type="text"]',i);i.data("DT_Input",k[0]);k.val(g.sSearch.replace('"',""")).addClass("form-control").attr("placeholder",j.oLanguage.sSearch).attr("aria-control",j.sTableId).on("keyup.DT",function(q){var s=j.aanFeatures.F;var r=f(this).val();for(var p=0,o=s.length;p', openedSign : '' @@ -584,6 +595,14 @@ msg = 1; } return msg; + }, + + copyToClipboard: function() { + return function() { + var source = $(this); + source.parents('.btn-group').removeClass('open'); + window.prompt(MyAMS.i18n.CLIPBOARD_COPY, source.text()); + } } }; @@ -862,7 +881,11 @@ if (result.window) { window.open(url, result.window, result.options); } else { - window.location.href = url; + if (window.location.href == url) { + window.location.reload(true); + } else { + window.location.href = url; + } } break; default: @@ -1670,6 +1693,32 @@ MyAMS.dialog = { /** + * List of registered 'shown' callbacks + */ + _shown_callbacks: [], + + /** + * Register a callback which should be called when a dialog is shown + */ + registerShownCallback: function(callback, element) { + var dialog; + if (element) { + dialog = element.objectOrParentWithClass('modal-dialog'); + } + if (dialog && dialog.exists()) { + var callbacks = dialog.data('shown-callbacks'); + if (callbacks === undefined) { + callbacks = []; + dialog.data('shown-callbacks', callbacks); + } + } else { + callbacks = ams.dialog._shown_callbacks; + } + if (callbacks.indexOf(callback) < 0) + callbacks.push(callback); + }, + + /** * List of registered 'hide' callbacks */ _hide_callbacks: [], @@ -1677,8 +1726,20 @@ /** * Register a callback which should be called when a dialog is closed */ - registerHideCallback: function(callback) { - var callbacks = ams.dialog._hide_callbacks; + registerHideCallback: function(callback, element) { + var dialog; + if (element) { + dialog = element.objectOrParentWithClass('modal-dialog'); + } + if (dialog && dialog.exists()) { + var callbacks = dialog.data('hide-callbacks'); + if (callbacks === undefined) { + callbacks = []; + dialog.data('hide-callbacks', callbacks); + } + } else { + callbacks = ams.dialog._hide_callbacks; + } if (callbacks.indexOf(callback) < 0) callbacks.push(callback); }, @@ -1793,27 +1854,40 @@ var modal = e.target; var viewport = $('.modal-viewport', modal); - if (viewport.length == 0) - return; - var maxHeight = parseInt(viewport.css('max-height')); - var barWidth = $.scrollbarWidth(); - if (viewport.height() == maxHeight) { - $('
').addClass('scrollmarker') - .addClass('top') - .css('top', 0) - .css('width', viewport.width() - barWidth) - .hide() - .appendTo(viewport); - $('
').addClass('scrollmarker') - .addClass('bottom') - .css('top', maxHeight - 20) - .css('width', viewport.width() - barWidth) - .appendTo(viewport); - viewport.scroll(resetViewport); - viewport.off('resize') + if (viewport.exists()) { + var maxHeight = parseInt(viewport.css('max-height')); + var barWidth = $.scrollbarWidth(); + if (viewport.height() == maxHeight) { + $('
').addClass('scrollmarker') + .addClass('top') + .css('top', 0) + .css('width', viewport.width() - barWidth) + .hide() + .appendTo(viewport); + $('
').addClass('scrollmarker') + .addClass('bottom') + .css('top', maxHeight - 20) + .css('width', viewport.width() - barWidth) + .appendTo(viewport); + viewport.scroll(resetViewport); + viewport.off('resize') .on('resize', resetViewport); - } else { - $('.scrollmarker', viewport).remove(); + } else { + $('.scrollmarker', viewport).remove(); + } + } + + // Call shown callbacks registered for this dialog + var callbacks = $('.modal-dialog', modal).data('shown-callbacks'); + if (callbacks) { + for (var index in callbacks) { + callbacks[index].call(modal); + } + } + // Call globally registered shown callbacks + callbacks = ams.dialog._shown_callbacks; + for (index in callbacks) { + callbacks[index].call(modal); } }, @@ -1837,9 +1911,16 @@ var modal = e.target; // Call registered cleaning callbacks ams.skin.cleanContainer(modal); - // Call registered hide callbacks - var callbacks = ams.dialog._hide_callbacks; - for (var index in callbacks) { + // Call hide callbacks registered for this dialog + var callbacks = $('.modal-dialog', modal).data('hide-callbacks'); + if (callbacks) { + for (var index in callbacks) { + callbacks[index].call(modal); + } + } + // Call globally registered hide callbacks + callbacks = ams.dialog._hide_callbacks; + for (index in callbacks) { callbacks[index].call(modal); } } @@ -2189,6 +2270,27 @@ }, /** + * Context menu plug-in + */ + contextMenu: function(element) { + var menus = $('.context-menu', element); + if (menus.length > 0) { + menus.each(function() { + var menu = $(this); + var data = menu.data(); + var data_options = { + menuSelector: data.amsContextmenuSelector, + menuSelected: ams.helpers.contextMenuHandler + }; + var settings = $.extend({}, data_options, data.amsContextmenuOptions); + settings = ams.executeFunctionByName(data.amsContextmenuInitCallback, menu, settings) || settings; + var plugin = menu.contextMenu(settings); + ams.executeFunctionByName(data.amsContextmenuAfterInitCallback, menu, plugin, settings); + }); + } + }, + + /** * Fieldset legend switcher */ switcher: function(element) { @@ -2277,7 +2379,7 @@ legend.trigger('ams.checker.before-switch', [legend, veto]); if (veto.veto) { // reset checked status because event is fired after change... - $(this).attr('checked', !isChecked); + $(this).prop('checked', !isChecked); return; } ams.executeFunctionByName(data.amsCheckerChangeHandler, legend, isChecked); @@ -2294,7 +2396,7 @@ legend.trigger('ams.checker.opened', [legend]); } else { if (data.amsCheckerMode == 'disable') - fieldset.attr('disabled', 'disabled'); + fieldset.prop('disabled', 'disabled'); else fieldset.addClass('switched'); if (hidden) @@ -2426,23 +2528,24 @@ }, /** - * Context menu plug-in + * JQuery typeahead plug-in */ - contextMenu: function(element) { - var menus = $('.context-menu', element); - if (menus.length > 0) { - menus.each(function() { - var menu = $(this); - var data = menu.data(); - var data_options = { - menuSelector: data.amsContextmenuSelector, - menuSelected: ams.helpers.contextMenuHandler - }; - var settings = $.extend({}, data_options, data.amsContextmenuOptions); - settings = ams.executeFunctionByName(data.amsContextmenuInitCallback, menu, settings) || settings; - var plugin = menu.contextMenu(settings); - ams.executeFunctionByName(data.amsContextmenuAfterInitCallback, menu, plugin, settings); - }); + 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 data_options = {}; + var settings = $.extend({}, data_options, data.amsTypeaheadOptions); + settings = ams.executeFunctionByName(data.amsTypeaheadInitCallback, input, settings) || settings; + var plugin = input.typeahead(settings); + ams.executeFunctionByName(data.amsTypeaheadAfterInitCallback, input, plugin, settings); + }); + }); } }, @@ -2782,28 +2885,6 @@ }, /** - * JQuery typeahead plug-in - */ - 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 data_options = {}; - var settings = $.extend({}, data_options, data.amsTypeaheadOptions); - settings = ams.executeFunctionByName(data.amsTypeaheadInitCallback, input, settings) || settings; - var plugin = input.typeahead(settings); - ams.executeFunctionByName(data.amsTypeaheadAfterInitCallback, input, plugin, settings); - }); - }); - } - }, - - /** * JQuery validation plug-in */ validate: function(element) { @@ -2896,28 +2977,13 @@ ams.ajax.check($.fn.dataTable, ams.baseURL + 'ext/jquery-dataTables-1.9.4' + ams.devext + '.js', function(first_load) { - if (first_load) { - $.fn.dataTableExt.oSort['numeric-comma-asc'] = function(a, b) { - var x = a.replace(/,/, ".").replace(/ /g, ''); - var y = b.replace(/,/, ".").replace(/ /g, ''); - x = parseFloat(x); - y = parseFloat(y); - return ((x < y) ? -1 : ((x > y) ? 1 : 0)); - }; - $.fn.dataTableExt.oSort['numeric-comma-desc'] = function(a, b) { - var x = a.replace(/,/, ".").replace(/ /g, ''); - var y = b.replace(/,/, ".").replace(/ /g, ''); - x = parseFloat(x); - y = parseFloat(y); - return ((x < y) ? 1 : ((x > y) ? -1 : 0)); - }; - } $(tables).each(function() { ams.ajax.check($.fn.dataTableExt.oPagination['bootstrap_full'], ams.baseURL + 'myams-dataTables' + ams.devext + '.js'); 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 || @@ -2932,13 +2998,38 @@ "><'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 in sortings) { + var col_sorting = sortings[index].split(','); + col_sorting[0] = parseInt(col_sorting[0]); + sorting.push(col_sorting); + } + } + // Check columns types + var columns = []; + var sort_types = $('th', table).listattr('data-ams-datatable-stype'); + for (index in sort_types) { + var sort_type = sort_types[index]; + if (sort_type) { + var column = columns[index] || {}; + column.sType = sort_type; + columns[index] = column; + } + } + // Set options var data_options = { bJQueryUI: false, bFilter: data.amsDatatableGlobalFilter !== false, bPaginate: data.amsDatatablePagination !== false, bInfo: data.amsDatatableInfo !== false, bSort: data.amsDatatableSort !== false, - aaSorting: data.amsDatatableSorting, + aaSorting: sorting, + aoColumns: columns.length > 0 ? columns : undefined, bDeferRender: true, bAutoWidth: false, iDisplayLength: data.amsDatatableDisplayLength || 25, @@ -2951,7 +3042,6 @@ } }; var settings = $.extend({}, data_options, data.amsDatatableOptions); - var index; if (extensions.length > 0) { for (index in extensions) { switch (extensions[index]) { @@ -3016,85 +3106,88 @@ } } settings = ams.executeFunctionByName(data.amsDatatableInitCallback, table, settings) || settings; - var plugin = table.dataTable(settings); - ams.executeFunctionByName(data.amsDatatableAfterInitCallback, table, plugin, settings); - if (extensions.length > 0) { - for (index in extensions) { - switch (extensions[index]) { - case 'autofill': - var af_settings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill); - af_settings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, af_settings) || af_settings; - table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined - ? new $.fn.dataTable.AutoFill(table, af_settings) - : ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, af_settings)); - break; - case 'columnfilter': - var cf_default = { - sPlaceHolder: 'head:after' - }; - var cf_settings = $.extend({}, cf_default, data.amsDatatableColumnfilterOptions, settings.columnfilter); - cf_settings = ams.executeFunctionByName(data.amsDatatableColumnfilterInitCallback, table, cf_settings) || cf_settings; - table.data('ams-columnfilter', data.amsDatatableColumnfilterConstructor === undefined - ? plugin.columnFilter(cf_settings) - : ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cf_settings)); - break; - case 'editable': - var ed_settings = $.extend({}, data.amsDatatableEditableOptions, settings.editable); - ed_settings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, ed_settings) || ed_settings; - table.data('ams-editable', data.amsDatatableEditableConstructor === undefined - ? table.makeEditable(ed_settings) - : ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, ed_settings)); - break; - case 'fixedcolumns': - var fc_settings = $.extend({}, data.amsDatatableFixedcolumnsOptions, settings.fixedcolumns); - fc_settings = ams.executeFunctionByName(data.amsDatatableFixedcolumnsInitCallback, table, fc_settings) || fc_settings; - table.data('ams-fixedcolumns', data.amsDatatableFixedcolumnsConstructor === undefined - ? new $.fn.dataTable.FixedColumns(table, fc_settings) - : ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fc_settings)); - break; - case 'fixedheader': - var fh_settings = $.extend({}, data.amsDatatableFixedheaderOptions, settings.fixedheader); - fh_settings = ams.executeFunctionByName(data.amsDatatableFixedheadeInitCallback, table, fh_settings) || fh_settings; - table.data('ams-fixedheader', data.amsDatatableFixedheaderConstructor === undefined - ? new $.fn.dataTable.FixedHeader(table, fh_settings) - : ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fh_settings)); - break; - case 'keytable': - var kt_default = { - table: table.get(0), - datatable: plugin - }; - var kt_settings = $.extend({}, kt_default, data.amsDatatableKeytableOptions, settings.keytable); - kt_settings = ams.executeFunctionByName(data.amsDatatableKeytableInitCallback, table, kt_settings) || kt_settings; - table.data('ams-keytable', data.amsDatatableKeytableConstructor === undefined - ? new KeyTable(kt_settings) - : ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, kt_settings)); - break; - case 'rowgrouping': - var rg_settings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping); - rg_settings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rg_settings) || rg_settings; - table.data('ams-rowgrouping', data.amsDatatableRowgroupingConstructor === undefined - ? table.rowGrouping(rg_settings) - : ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rg_settings)); - break; - case 'rowreordering': - var rr_settings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering); - rr_settings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rr_settings) || rr_settings; - table.data('ams-rowreordering', data.amsDatatableRowreorderingConstructor === undefined - ? table.rowReordering(rr_settings) - : ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rr_settings)); - break; - default: - break; + try { // Some settings can easilly generate DataTables exceptions... + var plugin = table.dataTable(settings); + ams.executeFunctionByName(data.amsDatatableAfterInitCallback, table, plugin, settings); + if (extensions.length > 0) { + for (index in extensions) { + switch (extensions[index]) { + case 'autofill': + var af_settings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill); + af_settings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, af_settings) || af_settings; + table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined + ? new $.fn.dataTable.AutoFill(table, af_settings) + : ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, af_settings)); + break; + case 'columnfilter': + var cf_default = { + sPlaceHolder: 'head:after' + }; + var cf_settings = $.extend({}, cf_default, data.amsDatatableColumnfilterOptions, settings.columnfilter); + cf_settings = ams.executeFunctionByName(data.amsDatatableColumnfilterInitCallback, table, cf_settings) || cf_settings; + table.data('ams-columnfilter', data.amsDatatableColumnfilterConstructor === undefined + ? plugin.columnFilter(cf_settings) + : ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cf_settings)); + break; + case 'editable': + var ed_settings = $.extend({}, data.amsDatatableEditableOptions, settings.editable); + ed_settings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, ed_settings) || ed_settings; + table.data('ams-editable', data.amsDatatableEditableConstructor === undefined + ? table.makeEditable(ed_settings) + : ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, ed_settings)); + break; + case 'fixedcolumns': + var fc_settings = $.extend({}, data.amsDatatableFixedcolumnsOptions, settings.fixedcolumns); + fc_settings = ams.executeFunctionByName(data.amsDatatableFixedcolumnsInitCallback, table, fc_settings) || fc_settings; + table.data('ams-fixedcolumns', data.amsDatatableFixedcolumnsConstructor === undefined + ? new $.fn.dataTable.FixedColumns(table, fc_settings) + : ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fc_settings)); + break; + case 'fixedheader': + var fh_settings = $.extend({}, data.amsDatatableFixedheaderOptions, settings.fixedheader); + fh_settings = ams.executeFunctionByName(data.amsDatatableFixedheadeInitCallback, table, fh_settings) || fh_settings; + table.data('ams-fixedheader', data.amsDatatableFixedheaderConstructor === undefined + ? new $.fn.dataTable.FixedHeader(table, fh_settings) + : ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fh_settings)); + break; + case 'keytable': + var kt_default = { + table: table.get(0), + datatable: plugin + }; + var kt_settings = $.extend({}, kt_default, data.amsDatatableKeytableOptions, settings.keytable); + kt_settings = ams.executeFunctionByName(data.amsDatatableKeytableInitCallback, table, kt_settings) || kt_settings; + table.data('ams-keytable', data.amsDatatableKeytableConstructor === undefined + ? new KeyTable(kt_settings) + : ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, kt_settings)); + break; + case 'rowgrouping': + var rg_settings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping); + rg_settings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rg_settings) || rg_settings; + table.data('ams-rowgrouping', data.amsDatatableRowgroupingConstructor === undefined + ? table.rowGrouping(rg_settings) + : ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rg_settings)); + break; + case 'rowreordering': + var rr_settings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering); + rr_settings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rr_settings) || rr_settings; + table.data('ams-rowreordering', data.amsDatatableRowreorderingConstructor === undefined + ? table.rowReordering(rr_settings) + : ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rr_settings)); + break; + default: + break; + } + } + } + var finalizers = (data.amsDatatableFinalizeCallback || '').split(/\s+/); + if (finalizers.length > 0) { + for (index in finalizers) { + ams.executeFunctionByName(finalizers[index], table, plugin, settings); } } } - var finalizers = (data.amsDatatableFinalizeCallback || '').split(/\s+/); - if (finalizers.length > 0) { - for (index in finalizers) { - ams.executeFunctionByName(finalizers[index], table, plugin, settings); - } - } + catch (e) {} }); }); } @@ -3161,7 +3254,7 @@ ams.baseURL + 'ext/jquery-imgareaselect-0.9.10' + ams.devext + '.js', function(first_load) { if (first_load) - ams.getCSS(ams.baseURL + '../css/ext/jquery-imgareaselect' + ams.devext + '.csss'); + ams.getCSS(ams.baseURL + '../css/ext/jquery-imgareaselect' + ams.devext + '.css'); images.each(function() { var image = $(this); var data = image.data(); @@ -3978,6 +4071,9 @@ } e.preventDefault(); }); + ams.shortcuts.click(function(e) { + ams.skin._hideShortcutButtons(); + }); $(document).mouseup(function(e) { if (!ams.shortcuts.is(e.target) @@ -4123,7 +4219,6 @@ if (target) { ams.form.confirmChangedForm(target, function () { ams.skin.loadURL(href, target, link.data('ams-link-options'), link.data('ams-link-callback')); - e.stopPropagation(); }); } else { ams.form.confirmChangedForm(function () { @@ -4133,7 +4228,7 @@ ams.root.removeClass('hidden-menu'); window.setTimeout(function () { window.location.hash = href; - }, 150); + }, 50); } else window.location.hash = href; } @@ -4206,6 +4301,14 @@ } }); + // Notify reset to update Select2 widgets + $(document).on('reset', 'form', function(e) { + var form = $(this); + setTimeout(function() { + form.find('.select2').trigger('change'); + }, 10); + }); + // Initialize custom reset handlers $(document).on('reset', '[data-ams-reset-handler]', function(e) { var form = $(this); @@ -4251,15 +4354,21 @@ if (data.amsUrl) { if (data.amsTabLoaded) return; - ams.skin.loadURL(data.amsUrl, link.attr('href')); - if (data.amsTabLoadOnce) - link.data('ams-tab-loaded', true); + try { + link.append(''); + ams.skin.loadURL(data.amsUrl, link.attr('href')); + if (data.amsTabLoadOnce) + link.data('ams-tab-loaded', true); + } + finally { + $('i', link).remove(); + } } }); // Init page content ams.initContent(document); - if (ams.ajax_nav && ($('nav').length > 0)) + if (ams.ajax_nav && $('nav').exists()) ams.skin.checkURL(); // Add unload event listener to check for modified forms @@ -4335,6 +4444,8 @@ BTN_NO: "No", BTN_YES_NO: "[Yes][No]", + CLIPBOARD_COPY: "Copy to clipboard with Ctrl+C, and Enter", + FORM_CHANGED_WARNING: "Some changes were not saved. These updates will be lost if you leave this page.", DELETE_WARNING: "This change can't be undone. Are you sure that you want to delete this element?", NO_UPDATE: "No changes were applied.", diff -r f7b7e3f21da6 -r 3ea42c4b9938 src/ztfy/myams/resources/js/myams.min.js --- a/src/ztfy/myams/resources/js/myams.min.js Tue Oct 13 17:39:09 2015 +0200 +++ b/src/ztfy/myams/resources/js/myams.min.js Thu Oct 22 13:59:28 2015 +0200 @@ -1,1 +1,1 @@ -(function(b){String.prototype.startsWith=function(e){var c=this.length;var d=e.length;if(c0};if(b.scrollbarWidth===undefined){b.scrollbarWidth=function(){var d=b('
').appendTo("body");var e=d.children();var c=e.innerWidth()-e.height(99).innerWidth();d.remove();return c}}b.fn.extend({exists:function(){return b(this).length>0},listattr:function(d){var c=[];this.each(function(){c.push(b(this).attr(d))});return c},style:function(d,g,c){var f=this.get(0);if(typeof f=="undefined"){return}var e=this.get(0).style;if(typeof d!="undefined"){if(typeof g!="undefined"){c=typeof c!="undefined"?c:"";e.setProperty(d,g,c);return this}else{return e.getPropertyValue(d)}}else{return e}},removeClassPrefix:function(c){this.each(function(e,f){var d=f.className.split(" ").map(function(g){return g.startsWith(c)?"":g});f.className=b.trim(d.join(" "))});return this},contextMenu:function(d){function c(g,i,f){var h=b(window)[i](),j=b(d.menuSelector)[i](),e=g;if(g+j>h&&j',openedSign:''};var d=b.extend({},e,c);var f=b(this);f.find("LI").each(function(){var g=b(this);if(g.find("UL").size()>0){g.find("A:first").append(""+d.closedSign+"");var h=g.find("A:first");if(h.attr("href")=="#"){h.click(function(){return false})}}});f.find("LI.active").each(function(){var g=b(this).parents("UL");var h=g.parent("LI");g.slideDown(d.speed);h.find("b:first").html(d.openedSign);h.addClass("open")});f.find("LI A").on("click",function(){var j=b(this);var g=j.parent().find("UL");if(d.accordion){var i=j.parent().parents("UL");var k=f.find("UL:visible");k.each(function(l){var m=true;i.each(function(n){if(i[n]==k[l]){m=false;return false}});if(m){if(g!=k[l]){b(k[l]).slideUp(d.speed,function(){j.parent("LI").find("b:first").html(d.closedSign);j.parent("LI").removeClass("open")})}}})}var h=j.parent().find("UL:first");if(!j.attr("href").replace(/^#/,"")&&h.is(":visible")&&!h.hasClass("active")){h.slideUp(d.speed,function(){j.parent("LI").removeClass("open").find("B:first").delay(d.speed).html(d.closedSign)})}else{h.slideDown(d.speed,function(){j.parent("LI").addClass("open").find("B:first").delay(d.speed).html(d.openedSign)})}})}});b.UTF8={encode:function(e){e=e.replace(/\r\n/g,"\n");var d="";for(var g=0;g127)&&(f<2048)){d+=String.fromCharCode((f>>6)|192);d+=String.fromCharCode((f&63)|128)}else{d+=String.fromCharCode((f>>12)|224);d+=String.fromCharCode(((f>>6)&63)|128);d+=String.fromCharCode((f&63)|128)}}}return d},decode:function(d){var f="";var h=0,j=0,g=0,e=0;while(h191)&&(j<224)){g=d.charCodeAt(h+1);f+=String.fromCharCode(((j&31)<<6)|(g&63));h+=2}else{g=d.charCodeAt(h+1);e=d.charCodeAt(h+2);f+=String.fromCharCode(((j&15)<<12)|((g&63)<<6)|(e&63));h+=3}}}return f}};if(window.MyAMS===undefined){window.MyAMS={devmode:true,devext:"",lang:"en",throttle_delay:350,menu_speed:235,navbar_height:49,ajax_nav:true,enable_widgets:true,enable_mobile:false,enable_fastclick:false,warn_on_form_change:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var a=MyAMS;MyAMS.baseURL=(function(){var c=b('script[src*="/myams.js"], script[src*="/myams.min.js"]');var d=c.attr("src");a.devmode=d.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return d.substring(0,d.lastIndexOf("/")+1)})();MyAMS.getQueryVar=function(e,f){if(e.indexOf("?")<0){return false}if(!e.endsWith("&")){e+="&"}var c=new RegExp(".*?[&\\?]"+f+"=(.*?)&.*");var d=e.replace(c,"$1");return d==e?false:d};MyAMS.rgb2hex=function(c){return"#"+b.map(c.match(/\b(\d+)\b/g),function(d){return("0"+parseInt(d).toString(16)).slice(-2)}).join("")};MyAMS.generateId=function(){function c(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return c()+c()+c()+c()};MyAMS.getFunctionByName=function(h,d){if(h===undefined){return undefined}else{if(typeof(h)=="function"){return h}}var g=h.split(".");var f=g.pop();d=(d===undefined||d===null)?window:d;for(var c=0;c").attr({rel:"stylesheet",type:"text/css",href:f,"data-ams-id":g}).appendTo(e)}};MyAMS.event={stop:function(c){if(!c){c=window.event}if(c){if(c.stopPropagation){c.stopPropagation();c.preventDefault()}else{c.cancelBubble=true;c.returnValue=false}}}};MyAMS.browser={getInternetExplorerVersion:function(){var e=-1;if(navigator.appName=="Microsoft Internet Explorer"){var c=navigator.userAgent;var d=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(d.exec(c)!=null){e=parseFloat(RegExp.$1)}}return e},checkVersion:function(){var d="You're not using Windows Internet Explorer.";var c=this.getInternetExplorerVersion();if(c>-1){if(c>=8){d="You're using a recent copy of Windows Internet Explorer."}else{d="You should upgrade your copy of Windows Internet Explorer."}}alert(d)},isIE8orlower:function(){var d="0";var c=this.getInternetExplorerVersion();if(c>-1){if(c>=9){d=0}else{d=1}}return d}};MyAMS.error={ajax:function(f,e){if(e.statusText=="OK"){return}var c=a.ajax.getResponse(e);if(c.content_type=="json"){a.ajax.handleJSON(c.data)}else{var g=f.statusText||f.type;var d=e.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

"+g+"

"+d+"

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

"+c+"

"+e+"

",icon:"fa fa-warning animated shake",timeout:10000})}if(window.console){console.error(e);console.debug(f)}}};MyAMS.ajax={check:function(d,f,h,c){if(typeof(h)=="object"){c=h;h=undefined}var g={async:typeof(h)=="function"};var e=b.extend({},g,c);if(d===undefined){a.getScript(f,function(){if(typeof(h)=="function"){h(true,c)}},e)}else{if(typeof(h)=="function"){h(false,c)}}},getAddr:function(d){var c=d||b("HTML HEAD BASE").attr("href")||window.location.href;return c.substr(0,c.lastIndexOf("/")+1)},start:function(){b("#ajax-gear").show()},stop:function(){b("#ajax-gear").hide()},progress:function(c){if(!c.lengthComputable){return}if(c.loaded>=c.total){return}console.log(parseInt((c.loaded/c.total*100),10)+"%")},post:function(e,g,d,j){if(e.startsWith(window.location.protocol)){var i=e}else{i=this.getAddr()+e}if(typeof(d)=="function"){j=d;d={}}else{if(!d){d={}}}if(typeof(j)=="undefined"){j=d.callback}if(typeof(j)=="string"){j=a.getFunctionByName(j)}delete d.callback;var c=undefined;var h={url:i,type:"post",cache:false,async:typeof(j)=="function",data:b.param(g),dataType:"json",success:j||function(k){c=k.result},error:a.error.show};var f=b.extend({},h,d);b.ajax(f);return c},getResponse:function(f){var d=f.getResponseHeader("content-type"),h,c;if(d){if(d.startsWith("application/javascript")){h="script";c=f.responseText}else{if(d.startsWith("text/html")){h="html";c=f.responseText}else{if(d.startsWith("text/xml")){h="xml";c=f.responseText}else{c=f.responseJSON;if(c){h="json"}else{try{c=JSON.parse(f.responseText);h="json"}catch(g){c=f.responseText;h="text"}}}}}}else{h="json";c={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{content_type:h,data:c}},handleJSON:function(n,e,j){var h=n.status;var c;switch(h){case"alert":alert(n.alert.title+"\n\n"+n.alert.content);break;case"error":a.form.showErrors(e,n);break;case"info":case"success":if(n.close_form!=false){a.dialog.close(e)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":if(n.close_form!=false){a.dialog.close(e)}break;case"modal":a.dialog.open(n.location);break;case"reload":if(n.close_form!=false){a.dialog.close(e)}c=n.location||window.location.hash;if(c.startsWith("#")){c=c.substr(1)}a.skin.loadURL(c,n.target||j||"#content");break;case"redirect":if(n.close_form==true){a.dialog.close(e)}c=n.location||window.location.href;if(n.window){window.open(c,n.window,n.options)}else{window.location.href=c}break;default:console.log("Unhandled status: "+h);break}if(n.content){var k=n.content;var d=b(k.target||j||e||"#content");if(k.raw==true){d.text(k.text)}else{d.html(k.html);a.initContent(d)}if(!k.keep_hidden){d.removeClass("hidden")}}if(n.contents){var g=n.contents;for(var i in g){k=g[i];d=b(k.target);if(k.raw==true){d.text(k.text)}else{d.html(k.html);a.initContent(d)}if(!k.keep_hidden){d.removeClass("hidden")}}}if(n.message){var m=n.message;if(typeof(m)=="string"){if((h=="info")||(h=="success")){a.skin.smallBox(h,{title:m,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}else{a.skin.alert(b(e||"#content"),h,m)}}else{a.skin.alert(b(m.target||j||e||"#content"),m.status||"success",m.header,m.body,m.subtitle)}}if(n.smallbox){a.skin.smallBox(n.smallbox_status||h,{title:n.smallbox,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}if(n.messagebox){m=n.messagebox;if(typeof(m)=="string"){a.skin.messageBox("info",{title:a.i18n.ERROR_OCCURED,content:m,timeout:10000})}else{var f=m.status||"info";if(f=="error"&&e&&j){a.executeFunctionByName(e.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",e,j)}a.skin.messageBox(f,{title:m.title||a.i18n.ERROR_OCCURED,content:m.content,icon:m.icon,number:m.number,timeout:m.timeout==null?undefined:(m.timeout||10000)})}}if(n.event){e.trigger(n.event,n.event_options)}if(n.callback){a.executeFunctionByName(n.callback,e,n.options)}if(n.callbacks){for(i in n.callbacks){if(!b.isNumeric(i)){continue}var l=n.callbacks[i];a.executeFunctionByName(l,e,l.options)}}}};MyAMS.jsonrpc={getAddr:function(e){var c=e||b("HTML HEAD BASE").attr("href")||window.location.href;var d=c.replace(/\+\+skin\+\+\w+\//,"");return d.substr(0,d.lastIndexOf("/")+1)},query:function(d,f,c,e){a.ajax.check(b.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){var g;if(typeof(c)=="function"){e=c;c={}}else{if(!c){c={}}}if(typeof(e)=="undefined"){e=c.callback}if(typeof(e)=="string"){e=a.getFunctionByName(e)}delete c.callback;var i={};if(typeof(d)=="string"){i.query=d}else{if(typeof(d)=="object"){b.extend(i,d)}}b.extend(i,c);var h={url:a.jsonrpc.getAddr(c.url),type:"post",cache:false,method:f,params:i,async:typeof(e)=="function",success:e||function(j){g=j.result},error:a.error.show};b.jsonRpc(h);return g})},post:function(f,d,c,e){a.ajax.check(b.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){var g;if(typeof(c)=="function"){e=c;c={}}else{if(!c){c={}}}if(typeof(e)=="undefined"){e=c.callback}if(typeof(e)=="string"){e=a.getFunctionByName(e)}delete c.callback;var g;var i={url:a.jsonrpc.getAddr(c.url),type:"post",cache:false,method:f,params:d,async:typeof(e)=="function",success:e||function(j){g=j.result},error:a.error.show};var h=b.extend({},i,c);b.jsonRpc(h);return g})}};MyAMS.xmlrpc={getAddr:function(e){var c=e||b("HTML HEAD BASE").attr("href")||window.location.href;var d=c.replace(/\+\+skin\+\+\w+\//,"");return d.substr(0,d.lastIndexOf("/")+1)},post:function(d,g,e,c,f){a.ajax.check(b.xmlrpc,a.baseURL+"ext/jquery-xmlrpc"+a.devext+".js",function(){var h;if(typeof(c)=="function"){f=c;c={}}else{if(!c){c={}}}if(typeof(f)=="undefined"){f=c.callback}if(typeof(f)=="string"){f=a.getFunctionByName(f)}delete c.callback;var j={url:a.xmlrpc.getAddr(d),methodName:g,params:e,success:f||function(k){h=k},error:a.error.show};var i=b.extend({},j,c);b.xmlrpc(i);return h})}};MyAMS.form={init:function(d){if(a.warn_on_form_change){var c=b('FORM[data-ams-warn-on-change!="false"]',d)}else{c=b('FORM[data-ams-warn-on-change="true"]',d)}c.each(function(){var e=b(this);b('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',e).each(function(){var g=b(this);if(g.data("ams-ignore-change")!==true){var f=g.data("ams-changed-event")||"change";g.on(f,function(){b(this).parents("FORM").attr("data-ams-form-changed",true)})}});e.on("reset",function(){b(this).removeAttr("data-ams-form-changed")})})},checkBeforeUnload:function(){var c=b('FORM[data-ams-form-changed="true"]');if(c.exists()){return a.i18n.FORM_CHANGED_WARNING}},confirmChangedForm:function(d,e){if(typeof(d)=="function"){e=d;d=undefined}var c=b('FORM[data-ams-form-changed="true"]',d);if(c.exists()){a.skin.bigBox({title:a.i18n.WARNING,content:'  '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(f){if(f==a.i18n.BTN_OK){e.call(d)}})}else{e.call(d)}},submit:function(e,d,f){e=b(e);if(!e.exists()){return false}if(typeof(d)=="object"){f=d;d=undefined}if(e.data("submitted")){if(!e.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:e.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(e)){return false}b(".alert, SPAN.state-error",e).remove();b(".state-error",e).removeClassPrefix("state-");var c=b(e.data("ams-submit-button"));if(c&&!c.data("ams-form-hide-loading")){c.button("loading")}a.ajax.check(b.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function i(k,m){var j;var C=k.data();var t=C.amsFormOptions;if(f){var o=f.formDataInitCallback}if(o){delete f.formDataInitCallback}else{o=C.amsFormDataInitCallback}if(o){var u={};if(typeof(o)=="function"){var l=o.call(k,u)}else{l=a.executeFunctionByName(o,k,u)}if(u.veto){j=k.data("ams-submit-button");if(j){j.button("reset")}a.form.finalizeSubmitFooter.call(k);return false}}else{l=C.amsFormData||{}}j=b(k.data("ams-submit-button"));var v,y;if(j){v=j.data("ams-form-handler");y=j.data("ams-form-submit-target")}var r=d||v||C.amsFormHandler||"";if(r.startsWith(window.location.protocol)){var n=r}else{var x=k.attr("action").replace(/#/,"");if(x.startsWith(window.location.protocol)){n=x}else{n=a.ajax.getAddr()+x}n+=r}var B=null;if(C.amsFormInitSubmitTarget){B=b(y||C.amsFormSubmitTarget||"#content");a.executeFunctionByName(C.amsFormInitSubmit||"MyAMS.form.initSubmit",k,B)}else{if(!C.amsFormHideSubmitFooter){a.executeFunctionByName(C.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",k)}}var p=typeof(m.uuid)!="undefined";if(p){if(n.indexOf("X-Progress-ID")<0){n+="?X-Progress-ID="+m.uuid}delete m.uuid}var s={url:n,type:"post",cache:false,data:l,dataType:C.amsFormDatatype,beforeSerialize:function(){if(typeof(tinyMCE)!="undefined"){tinyMCE.triggerSave()}},beforeSubmit:function(E,D){D.data("submitted",true)},error:function(H,D,E,G){if(B){a.executeFunctionByName(C.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",G,B)}if(G.is(":visible")){var F=G.data("ams-submit-button");if(F){F.button("reset")}a.form.finalizeSubmitFooter.call(G)}G.data("submitted",false);G.removeData("ams-submit-button")},iframe:p};var w=C.amsFormDownloadTarget;if(w){var q=b('iframe[name="'+w+'"]');if(!q.exists()){q=b("").hide().attr("name",w).appendTo(k)}s=b.extend({},s,{iframe:true,iframeTarget:q,success:function(D,E,I,H){var G=b(H).parents(".modal-dialog");if(G.exists()){a.dialog.close(H)}else{var J;var F=H.data("ams-submit-button");if(F){J=F.data("ams-form-submit-callback")}if(!J){J=a.getFunctionByName(C.amsFormSubmitCallback)||a.form._submitCallback}J.call(H,D,E,I,H);if(H.is(":visible")&&F){F.button("reset")}H.data("submitted",false);H.removeData("ams-submit-button");H.removeAttr("data-ams-form-changed")}}})}else{s=b.extend({},s,{error:function(H,D,E,G){if(B){a.executeFunctionByName(C.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",G,B)}if(G.is(":visible")){var F=G.data("ams-submit-button");if(F){F.button("reset")}a.form.finalizeSubmitFooter.call(G)}G.data("submitted",false);G.removeData("ams-submit-button")},success:function(D,E,H,G){var I;var F=G.data("ams-submit-button");if(F){I=F.data("ams-form-submit-callback")}if(!I){I=a.getFunctionByName(C.amsFormSubmitCallback)||a.form._submitCallback}I.call(G,D,E,H,G);if(G.is(":visible")&&F){F.button("reset")}G.data("submitted",false);G.removeData("ams-submit-button");G.removeAttr("data-ams-form-changed")},iframe:p})}var A=b.extend({},s,m,t,f);b(k).ajaxSubmit(A);if(w){var z=b(k).parents(".modal-dialog");if(z.exists()){a.dialog.close(k)}else{a.form.finalizeSubmitFooter.call(k);if(j){j.button("reset")}k.data("submitted",false);k.removeData("ams-submit-button");k.removeAttr("data-ams-form-changed")}}}var h=b('INPUT[type="file"]',e).length>0;if(h){a.ajax.check(b.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var g=b.extend({},{uuid:b.progressBar.submit(e)});i(e,g)}else{i(e,{})}});return false},initSubmit:function(e,d){var c=b(this);var f='';if(!d){d=c.data("ams-form-submit-message")}if(d){f+=""+d+""}b(e).html('
'+f+"
");b(e).parents(".hidden").removeClass("hidden")},finalizeSubmitOnError:function(c){b("i",c).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(d){var c=b(this);var f='';if(!d){d=b(this).data("ams-form-submit-message")}if(d){f+=''+d+""}var e=b("footer",c);b("button",e).hide();e.append('
'+f+"
")},finalizeSubmitFooter:function(){var c=b(this);var d=b("footer",c);if(d){b(".row",d).remove();b("button",d).show()}},_submitCallback:function(m,e,d,c){if(c.is(":visible")){a.form.finalizeSubmitFooter.call(c);var g=c.data("ams-submit-button");if(g){g.button("reset")}}var f=c.data();if(f.amsFormDatatype){var j=f.amsFormDatatype}else{var h=a.ajax.getResponse(d);j=h.content_type;m=h.data}if(g){var i=b(g.amsFormSubmitTarget||f.amsFormSubmitTarget||"#content")}else{i=b(f.amsFormSubmitTarget||"#content")}switch(j){case"json":a.ajax.handleJSON(m,c,i);break;case"script":break;case"xml":break;case"html":case"text":default:if(g&&(g.data("ams-keep-modal")!==true)){a.dialog.close(c)}if(!i.exists()){i=b("body")}i.parents(".hidden").removeClass("hidden");b(".alert",i.parents(".alerts-container")).remove();i.css({opacity:"0.0"}).html(m).delay(50).animate({opacity:"1.0"},300);a.initContent(i)}var k=d.getResponseHeader("X-AMS-Callback");if(k){var l=d.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(k,c,l===undefined?{}:JSON.parse(l),d)}},_getSubmitValidators:function(d){var c=new Array();var e=d.data("ams-form-validator");if(e){c.push([d,e])}b("[data-ams-form-validator]",d).each(function(){var f=b(this);c.push([f,f.data("ams-form-validator")])});return c},_checkSubmitValidators:function(e){var g=a.form._getSubmitValidators(e);if(!g.length){return true}var f=new Array();var l=true;for(var i in g){if(!b.isNumeric(i)){continue}var d=g[i];var c=d[0];var j=d[1];var k=a.executeFunctionByName(j,e,c);if(k===false){l=false}else{if(typeof(k)=="string"){f.push(k)}else{if(l.length&&(l.length>0)){f=f.concat(l)}}}}if(f.length>0){var h=f.length==1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"danger",h,f);return false}else{return l}},showErrors:function(c,j){if(typeof(j)=="string"){a.skin.alert(c,"error",a.i18n.ERROR_OCCURED,j)}else{if(j instanceof Array){var f=j.length==1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(c,"error",f,j)}else{b(".state-error",c).removeClass("state-error");f=j.error_header||(j.widgets&&(j.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var k=new Array();var i;for(i in j.messages){if(!b.isNumeric(i)){continue}if(j.messages[i].header){k.push(""+j.messages[i].header+"
"+j.messages[i].message)}else{k.push(j.messages[i].message||j.messages[i])}}for(i in j.widgets){if(!b.isNumeric(i)){continue}var d=j.widgets[i];var g=b('[name="'+d.name+'"]',c);g.parents("label:first").removeClassPrefix("state-").addClass("state-error").after(''+d.message+"");if(d.label){k.push(d.label+" : "+d.message)}var h=g.parents(".tab-pane").index()+1;if(h>0){var e=b(".nav-tabs",b(g).parents(".tabforms"));b("li:nth-child("+h+")",e).removeClassPrefix("state-").addClass("state-error");b("li.state-error:first a",c).click()}}a.skin.alert(c,j.error_level||"error",f,k,j.error_message)}}}};MyAMS.dialog={_hide_callbacks:[],registerHideCallback:function(d){var c=a.dialog._hide_callbacks;if(c.indexOf(d)<0){c.push(d)}},open:function(d,c){a.ajax.check(b.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(b.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(h){if(h){b(document).off("click.modal");b.fn.modal.defaults.spinner=b.fn.modalmanager.defaults.spinner='
'}if(typeof(d)=="string"){var g={};var f=d}else{g=d.data();f=d.attr("href")||g.amsUrl;var e=a.getFunctionByName(f);if(typeof(e)=="function"){f=e.call(d)}}if(!f){return}b("body").modalmanager("loading");if(f.indexOf("#")==0){b(f).modal("show")}else{b.ajax({url:f,type:"get",cache:g.amsAllowCache===undefined?false:g.amsAllowCache,data:c,success:function(l,k,j){b("body").modalmanager("removeLoading");var m=a.ajax.getResponse(j);var r=m.content_type;var s=m.data;switch(r){case"json":a.ajax.handleJSON(s,b(b(d).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var n=b(s);var p=b(".modal-dialog",n.wrap("
").parent());var o=p.data();var q={overflow:o.amsModalOverflow||".modal-viewport",maxHeight:o.amsModalMaxHeight===undefined?function(){return b(window).height()-b(".modal-header",n).outerHeight(true)-b("footer",n).outerHeight(true)-85}:a.getFunctionByName(o.amsModalMaxHeight)};var i=b.extend({},q,o.amsModalOptions);i=a.executeFunctionByName(o.amsModalInitCallback,p,i)||i;b("
").addClass("modal fade").append(n).modal(i).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(n)}}})}})})},shown:function(i){function h(k){var l=b(".scrollmarker.top",c);var j=c.scrollTop();if(j>0){l.show()}else{l.hide()}var e=b(".scrollmarker.bottom",c);if(f+j>=c.get(0).scrollHeight){e.hide()}else{e.show()}}var g=i.target;var c=b(".modal-viewport",g);if(c.length==0){return}var f=parseInt(c.css("max-height"));var d=b.scrollbarWidth();if(c.height()==f){b("
").addClass("scrollmarker").addClass("top").css("top",0).css("width",c.width()-d).hide().appendTo(c);b("
").addClass("scrollmarker").addClass("bottom").css("top",f-20).css("width",c.width()-d).appendTo(c);c.scroll(h);c.off("resize").on("resize",h)}else{b(".scrollmarker",c).remove()}},close:function(d){var e=d.parents(".modal").data("modal");if(e){var c=b("body").data("modalmanager");if(c&&(c.getOpenModals().indexOf(e)>=0)){e.hide()}}},hidden:function(g){var f=g.target;a.skin.cleanContainer(f);var d=a.dialog._hide_callbacks;for(var c in d){d[c].call(f)}}};MyAMS.helpers={select2ClearSelection:function(){var d=b(this);var c=d.parents("label");var e=d.data("ams-select2-target");b('[name="'+e+'"]',c).data("select2").val("")},select2FormatSelection:function(d,c){if(d instanceof Array){b(d).each(function(){if(typeof(this)=="object"){c.append(this.text)}else{c.append(this)}})}else{if(typeof(d)=="object"){c.append(d.text)}else{c.append(d)}}},select2QueryUrlResultsCallback:function(e,d,c){switch(e.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

"+e.error_message+"

",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":b(this).data("select2").dropdown.hide();a.dialog.open(result.location);break;default:return{results:e.results||e,more:e.has_more||false,context:e.context}}},select2QueryMethodSuccessCallback:function(g,d,f){var c=g.result;if(typeof(c)=="string"){try{c=JSON.parse(c)}catch(h){}}switch(c.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

"+c.error_message+"

",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":b(this).data("select2").dropdown.hide();a.dialog.open(c.location);break;default:f.callback({results:c.results||c,more:c.has_more||false,context:c.context})}},contextMenuHandler:function(f,g){var c=g.data();if(c.toggle=="modal"){a.dialog.open(g)}else{var d=g.attr("href")||c.amsUrl;if(!d||d.startsWith("javascript:")||g.attr("target")){return}a.event.stop();var e=a.getFunctionByName(d);if(typeof(e)=="function"){d=e.call(g,f)}if(typeof(d)=="function"){d.call(g,f)}else{d=d.replace(/\%23/,"#");var f=g.data("ams-target");if(f){a.form.confirmChangedForm(f,function(){a.skin.loadURL(d,f,g.data("ams-link-options"),g.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(d.startsWith("#")){if(d!=location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=d},150)}else{window.location.hash=d}}}else{window.location=d}})}}}},datetimepickerDialogHiddenCallback:function(){b(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};MyAMS.plugins={init:function(e){a.plugins.initData(e);var f=new Array();b("[data-ams-plugins-disabled]",e).each(function(){var h=b(this).data("ams-plugins-disabled").split(/\s+/);for(var i in h){f.push(h[i])}});var d;b("[data-ams-plugins]",e).each(function(){var l=b(this);var h={};if(typeof(l.data("ams-plugins"))==="string"){var m=l.data("ams-plugins").split(/\s+/);for(var j in m){d=m[j];var i={src:l.data("ams-plugin-"+d+"-src"),css:l.data("ams-plugin-"+d+"-css"),callback:l.data("ams-plugin-"+d+"-callback"),register:l.data("ams-plugin-"+d+"-register"),async:l.data("ams-plugin-"+d+"-async")};h[d]=i}}else{h=l.data("ams-plugins")}for(d in h){if(a.plugins.enabled[d]===undefined){var k=h[d];a.getScript(k.src,function(){var p=k.callback;if(p){var o=a.getFunctionByName(p);if(k.register!==false){a.plugins.enabled[d]=o}}else{if(k.register!==false){a.plugins.enabled[d]=null}}var n=k.css;if(n){a.getCSS(n,d+"_css")}},{async:k.async===undefined?true:k.async})}}});for(var c in a.plugins.enabled){if(f.indexOf(c)>=0){continue}var g=a.plugins.enabled[c];if(typeof(g)=="function"){g(e)}}},initData:function(c){b("[data-ams-data]",c).each(function(){var e=b(this);var f=e.data("ams-data");for(var d in f){e.attr("data-"+d,f[d])}})},register:function(d,c,f){if(typeof(c)=="function"){f=c;c=null}c=c||d.name;if(a.plugins.enabled.indexOf(c)>=0){if(window.console){console.warn("Plugin "+c+" is already registered!")}return}if(typeof(d)=="object"){var e=d.src;if(e){a.ajax.check(d.callback,e,function(g){if(g){a.plugins.enabled[c]=a.getFunctionByName(d.callback);if(d.css){a.getCSS(d.css,c+"_css")}if(f){a.executeFunctionByName(f)}}})}else{a.plugins.enabled[c]=a.getFunctionByName(d.callback);if(d.css){a.getCSS(d.css,c+"_css")}if(f){a.executeFunctionByName(f)}}}else{if(typeof(d)=="function"){a.plugins.enabled[c]=d;if(f){a.executeFunctionByName(f)}}}},enabled:{hint:function(c){var d=b(".hint:not(:parents(.nohints))",c);if(d.length>0){a.ajax.check(b.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");d.each(function(){var i=b(this);var h=i.data();var f={html:h.amsHintHtml,title:a.getFunctionByName(h.amsHintTitleGetter)||function(){var j=b(this);return j.attr("original-title")||j.attr(h.amsHintTitleAttr||"title")||(h.amsHintHtml?j.html():j.text())},opacity:h.amsHintOpacity||0.95,gravity:h.amsHintGravity||"sw",offset:h.amsHintOffset||0};var e=b.extend({},f,h.amsHintOptions);e=a.executeFunctionByName(h.amsHintInitCallback,i,e)||e;var g=i.tipsy(e);a.executeFunctionByName(h.amsHintAfterInitCallback,i,g,e)})})}},switcher:function(c){b("LEGEND.switcher",c).each(function(){var e=b(this);var d=e.parent("fieldset");var f=e.data();if(!f.amsSwitcher){b('').prependTo(b(this)).addClass(f.amsSwitcherState=="open"?(f.amsSwitcherMinusClass||"fa-minus"):(f.amsSwitcherPlusClass||"fa-plus"));e.on("click",function(h){h.preventDefault();var g={};e.trigger("ams.switcher.before-switch",[e,g]);if(g.veto){return}if(d.hasClass("switched")){d.removeClass("switched");b(".fa",e).removeClass(f.amsSwitcherPlusClass||"fa-plus").addClass(f.amsSwitcherMinusClass||"fa-minus");e.trigger("ams.switcher.opened",[e]);var i=e.attr("id");if(i){b('legend.switcher[data-ams-switcher-sync="'+i+'"]',d).each(function(){var j=b(this);if(j.parents("fieldset").hasClass("switched")){j.click()}})}}else{d.addClass("switched");b(".fa",e).removeClass(f.amsSwitcherMinusClass||"fa-minus").addClass(f.amsSwitcherPlusClass||"fa-plus");e.trigger("ams.switcher.closed",[e])}});if(f.amsSwitcherState!="open"){d.addClass("switched")}e.data("ams-switcher","on")}})},checker:function(c){b("LEGEND.checker",c).each(function(){var o=b(this);var p=o.parent("fieldset");var f=o.data();if(!f.amsChecker){var d=b('');var i=f.amsCheckerFieldname||("checker_"+a.generateId());var m=i.replace(/\./,"_");var g=f.amsCheckerHiddenPrefix;var h=null;var l=f.amsCheckerHiddenValueOn||"true";var j=f.amsCheckerHiddenValueOff||"false";var e=f.amsCheckerMarker||false;if(g){h=b('').attr("name",g+i).val(f.amsCheckerState=="on"?l:j).prependTo(o)}else{if(e){b('').attr("name",e).attr("value",1).prependTo(o)}}var n=b('').attr("name",i).attr("id",m).data("ams-checker-hidden-input",h).data("ams-checker-init",true).val(f.amsCheckerValue||true).attr("checked",f.amsCheckerState=="on"?"checked":null);if(f.amsCheckerReadonly){n.attr("disabled","disabled")}else{n.on("change",function(s){s.preventDefault();var q={};var t=b(this).is(":checked");o.trigger("ams.checker.before-switch",[o,q]);if(q.veto){b(this).attr("checked",!t);return}a.executeFunctionByName(f.amsCheckerChangeHandler,o,t);if(!f.amsCheckerCancelDefault){var r=n.data("ams-checker-hidden-input");if(t){if(f.amsCheckerMode=="disable"){p.removeAttr("disabled")}else{p.removeClass("switched")}if(r){r.val(l)}b("[data-required]",p).attr("required","required");o.trigger("ams.checker.opened",[o])}else{if(f.amsCheckerMode=="disable"){p.attr("disabled","disabled")}else{p.addClass("switched")}if(r){r.val(j)}b("[data-required]",p).removeAttr("required");o.trigger("ams.checker.closed",[o])}}})}n.appendTo(d);b(">label",o).attr("for",n.attr("id"));d.append("").prependTo(o);var k=b("[required]",p);k.attr("data-required",true);if(f.amsCheckerState=="on"){n.attr("checked",true)}else{if(f.amsCheckerMode=="disable"){p.attr("disabled","disabled")}else{p.addClass("switched")}k.removeAttr("required")}o.data("ams-checker","on")}})},slider:function(c){var d=b(".slider",c);if(d.length>0){a.ajax.check(b.fn.slider,a.baseURL+"ext/bootstrap-slider.min.js",function(){d.each(function(){var h=b(this);var i=h.data();var f={};var e=b.extend({},f,h.data.amsSliderOptions);e=a.executeFunctionByName(i.amsSliderInitCallback,h,e)||e;var g=h.slider(e);a.executeFunctionByName(i.amsSliderAfterInitCallback,h,g,e)})})}},draggable:function(d){var c=b(".draggable",d);if(c.length>0){c.each(function(){var e=b(this);var i=e.data();var g={containment:i.amsDraggableContainment,helper:a.getFunctionByName(i.amsDraggableHelper)||i.amsDraggableHelper,start:a.getFunctionByName(i.amsDraggableStart),stop:a.getFunctionByName(i.amsDraggableStop)};var f=b.extend({},g,i.amsDraggableOptions);f=a.executeFunctionByName(i.amsDraggableInitCallback,e,f)||f;var h=e.draggable(f);e.disableSelection();a.executeFunctionByName(i.amsDraggableAfterInitCallback,e,h,f)})}},sortable:function(c){var d=b(".sortable",c);if(d.length>0){d.each(function(){var i=b(this);var h=i.data();var f={items:h.amsSortableItems,handle:h.amsSortableHandle,connectWith:h.amsSortableConnectwith,start:a.getFunctionByName(h.amsSortableStart),over:a.getFunctionByName(h.amsSortableOver),containment:h.amsSortableContainment,placeholder:h.amsSortablePlaceholder,stop:a.getFunctionByName(h.amsSortableStop)};var e=b.extend({},f,h.amsSortableOptions);e=a.executeFunctionByName(h.amsSortableInitCallback,i,e)||e;var g=i.sortable(e);i.disableSelection();a.executeFunctionByName(h.amsSortableAfterInitCallback,i,g,e)})}},resizable:function(d){var c=b(".resizable",d);if(c.length>0){c.each(function(){var e=b(this);var i=e.data();var g={autoHide:i.amsResizableAutohide===false?true:i.amsResizableAutohide,containment:i.amsResizableContainment,grid:i.amsResizableGrid,handles:i.amsResizableHandles,start:a.getFunctionByName(i.amsResizableStart),stop:a.getFunctionByName(i.amsResizableStop)};var f=b.extend({},g,i.amsResizableOptions);f=a.executeFunctionByName(i.amsResizableInitCallback,e,f)||f;var h=e.resizable(f);e.disableSelection();a.executeFunctionByName(i.amsResizableAfterInitCallback,e,h,f)})}},contextMenu:function(c){var d=b(".context-menu",c);if(d.length>0){d.each(function(){var i=b(this);var h=i.data();var f={menuSelector:h.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var e=b.extend({},f,h.amsContextmenuOptions);e=a.executeFunctionByName(h.amsContextmenuInitCallback,i,e)||e;var g=i.contextMenu(e);a.executeFunctionByName(h.amsContextmenuAfterInitCallback,i,g,e)})}},select2:function(d){var c=b(".select2",d);if(c.length>0){a.ajax.check(b.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){c.each(function(){var e=b(this);var j=e.data();var h={placeholder:j.amsSelect2Placeholder,multiple:j.amsSelect2Multiple,minimumInputLength:j.amsSelect2MinimumInputLength||0,maximumSelectionSize:j.amsSelect2MaximumSelectionSize,openOnEnter:j.amsSelect2EnterOpen===undefined?true:j.amsSelect2EnterOpen,allowClear:j.amsSelect2AllowClear===undefined?true:j.amsSelect2AllowClear,width:j.amsSelect2Width||"100%",initSelection:a.getFunctionByName(j.amsSelect2InitSelection),formatSelection:j.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(j.amsSelect2FormatSelection),formatResult:a.getFunctionByName(j.amsSelect2FormatResult),formatMatches:j.amsSelect2FormatMatches===undefined?function(k){if(k==1){return a.i18n.SELECT2_MATCH}else{return k+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(j.amsSelect2FormatMatches),formatNoMatches:j.amsSelect2FormatResult===undefined?function(k){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(j.amsSelect2FormatResult),formatInputTooShort:j.amsSelect2FormatInputTooShort===undefined?function(k,l){var m=l-k.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,m).replace(/\{1\}/,m==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatInputTooShort),formatInputTooLong:j.amsSelect2FormatInputTooLong===undefined?function(l,k){var m=l.length-k;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,m).replace(/\{1\}/,m==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatInputTooLong),formatSelectionTooBig:j.amsSelect2FormatSelectionTooBig===undefined?function(k){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,k).replace(/\{1\}/,k==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatSelectionTooBig),formatLoadMore:j.amsSelect2FormatLoadMore===undefined?function(k){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(j.amsSelect2FormatLoadMore),formatSearching:j.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(j.amsSelect2FormatSearching),separator:j.amsSelect2Separator||",",tokenSeparators:j.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(j.amsSelect2Tokenizer)};switch(e.context.type){case"text":case"hidden":if(!h.initSelection){var f=e.data("ams-select2-values");if(f){h.initSelection=function(k,m){var l=[];b(k.val().split(h.separator)).each(function(){l.push({id:this,text:f[this]||this})});m(l)}}}break;default:break}if(e.attr("readonly")){if(e.attr("type")=="hidden"){h.query=function(){return[]}}}else{if(j.amsSelect2Query){h.query=a.getFunctionByName(j.amsSelect2Query);h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2QueryUrl){h.ajax={url:j.amsSelect2QueryUrl,quietMillis:j.amsSelect2QuietMillis||200,type:j.amsSelect2QueryType||"POST",dataType:j.amsSelect2QueryDatatype||"json",data:function(m,n,l){var k={};k[j.amsSelect2QueryParamName||"query"]=m;k[j.amsSelect2PageParamName||"page"]=n;k[j.amsSelect2ContextParamName||"context"]=l;return b.extend({},k,j.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2QueryMethod){h.query=function(k){var l={url:j.amsSelect2MethodTarget||a.jsonrpc.getAddr(),type:j.amsSelect2MethodType||"POST",cache:false,method:j.amsSelect2QueryMethod,params:j.amsSelect2QueryParams||{},success:function(n,m){return a.helpers.select2QueryMethodSuccessCallback.call(e,n,m,k)},error:a.error.show};l.params[j.amsSelect2QueryParamName||"query"]=k.term;l.params[j.amsSelect2PageParamName||"page"]=k.page;l.params[j.amsSelect2ContextParamName||"context"]=k.context;l=b.extend({},l,j.amsSelect2QueryOptions);l=a.executeFunctionByName(j.amsSelect2QueryInitCallback,e,l)||l;a.ajax.check(b.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+(a.devmode?".js":".min.js"),function(){b.jsonRpc(l)})};h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2Tags){h.tags=j.amsSelect2Tags}else{if(j.amsSelect2Data){h.data=j.amsSelect2Data}}}}}}if(j.amsSelect2EnableFreeTags){h.createSearchChoice=function(k){return{id:k,text:(j.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+k}}}var g=b.extend({},h,j.amsSelect2Options);g=a.executeFunctionByName(j.amsSelect2InitCallback,e,g)||g;var i=e.select2(g);a.executeFunctionByName(j.amsSelect2AfterInitCallback,e,i,g);if(e.hasClass("ordered")){a.ajax.check(b.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){e.select2Sortable({bindOrder:"sortableStop"})})}e.on("change",function(){var k=b(e.get(0).form).data("validator");if(k!==undefined){b(e).valid()}})})})}},maskedit:function(d){var c=b("[data-mask]",d);if(c.length>0){a.ajax.check(b.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.3.1.min.js",function(){c.each(function(){var e=b(this);var i=e.data();var g={placeholder:i.amsMaskeditPlaceholder||"X"};var f=b.extend({},g,i.amsMaskeditOptions);f=a.executeFunctionByName(i.amsMaskeditInitCallback,e,f)||f;var h=e.mask(e.attr("data-mask"),f);a.executeFunctionByName(i.amsMaskeditAfterInitCallback,e,h,f)})})}},datepicker:function(c){var d=b(".datepicker",c);if(d.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}d.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},datetimepicker:function(d){var c=b(".datetimepicker",d);if(c.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}c.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},timepicker:function(d){var c=b(".timepicker",d);if(c.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}c.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},colorpicker:function(c){var d=b(".colorpicker",c);if(d.length>0){a.ajax.check(b.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}d.each(function(){var f=b(this);var j=f.data();var h={position:j.amsColorpickerPosition||f.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var g=b.extend({},h,j.amsColorpickerOptions);g=a.executeFunctionByName(j.amsColorpickerInitCallback,f,g)||g;var i=f.minicolors(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},typeahead:function(d){var c=b(".typeahead",d);if(c.length>0){a.ajax.check(b.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){c.each(function(){var e=b(this);var i=e.data();var g={};var f=b.extend({},g,i.amsTypeaheadOptions);f=a.executeFunctionByName(i.amsTypeaheadInitCallback,e,f)||f;var h=e.typeahead(f);a.executeFunctionByName(i.amsTypeaheadAfterInitCallback,e,h,f)})})}},validate:function(d){var c=b("FORM:not([novalidate])",d);if(c.length>0){a.ajax.check(b.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(g){if(g){b.validator.setDefaults({highlight:function(h){b(h).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(h){b(h).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(i,j){var h=j.parents("label:first");if(h.length){i.insertAfter(h)}else{i.insertAfter(j)}}});if(a.plugins.i18n){for(var e in a.plugins.i18n.validate){var f=a.plugins.i18n.validate[e];if((typeof(f)=="string")&&(f.indexOf("{0}")>-1)){a.plugins.i18n.validate[e]=b.validator.format(f)}}b.extend(b.validator.messages,a.plugins.i18n.validate)}}c.each(function(){var k=b(this);var l=k.data();var i={ignore:null,submitHandler:k.attr("data-async")!==undefined?l.amsFormSubmitHandler===undefined?function(){b(".state-error",k).removeClass("state-error");a.ajax.check(b.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(k)}:a.getFunctionByName(l.amsFormSubmitHandler):undefined,invalidHandler:k.attr("data-async")!==undefined?l.amsFormInvalidHandler===undefined?function(q,p){b(".state-error",k).removeClass("state-error");for(var n in p.errorList){var m=p.errorList[n];var o=b(m.element).parents(".tab-pane").index()+1;if(o>0){var r=b(".nav-tabs",b(m.element).parents(".tabforms"));b("li:nth-child("+o+")",r).removeClassPrefix("state-").addClass("state-error");b("li.state-error:first a",r).click()}}}:a.getFunctionByName(l.amsFormInvalidHandler):undefined};var h=b.extend({},i,l.amsValidateOptions);h=a.executeFunctionByName(l.amsValidateInitCallback,k,h)||h;var j=k.validate(h);a.executeFunctionByName(l.amsValidateAfterInitCallback,k,j,h)})})}},datatable:function(d){var c=b(".datatable",d);if(c.length>0){a.ajax.check(b.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(e){if(e){b.fn.dataTableExt.oSort["numeric-comma-asc"]=function(h,g){var f=h.replace(/,/,".").replace(/ /g,"");var i=g.replace(/,/,".").replace(/ /g,"");f=parseFloat(f);i=parseFloat(i);return((fi)?1:0))};b.fn.dataTableExt.oSort["numeric-comma-desc"]=function(h,g){var f=h.replace(/,/,".").replace(/ /g,"");var i=g.replace(/,/,".").replace(/ /g,"");f=parseFloat(f);i=parseFloat(i);return((fi)?-1:0))}}b(c).each(function(){a.ajax.check(b.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var u=b(this);var x=u.data();var w=(x.amsDatatableExtensions||"").split(/\s+/);var h=x.amsDatatableSdom||"W"+((w.indexOf("colreorder")>=0||w.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(w.indexOf("colvis")>=0?"C":"")+((x.amsDatatablePagination===false||x.amsDatatablePaginationSize===false)?"":"L")+(x.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(w.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(x.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var r={bJQueryUI:false,bFilter:x.amsDatatableGlobalFilter!==false,bPaginate:x.amsDatatablePagination!==false,bInfo:x.amsDatatableInfo!==false,bSort:x.amsDatatableSort!==false,aaSorting:x.amsDatatableSorting,bDeferRender:true,bAutoWidth:false,iDisplayLength:x.amsDatatableDisplayLength||25,sPaginationType:x.amsDatatablePaginationType||"bootstrap_full",sDom:h,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(A,z){b(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' ')}};var v=b.extend({},r,x.amsDatatableOptions);var j;if(w.length>0){for(j in w){switch(w[j]){case"autofill":a.ajax.check(b.fn.dataTable.AutoFill,a.baseURL+"ext/jquery-dataTables-autoFill"+a.devext+".js");break;case"columnfilter":a.ajax.check(b.fn.columnFilter,a.baseURL+"ext/jquery-dataTables-columnFilter"+a.devext+".js");break;case"colreorder":a.ajax.check(b.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorder"+a.devext+".js");break;case"colreorderwithresize":a.ajax.check(b.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorderWithResize"+a.devext+".js");break;case"colvis":a.ajax.check(b.fn.dataTable.ColVis,a.baseURL+"ext/jquery-dataTables-colVis"+a.devext+".js");var n={activate:"click",sAlign:"right"};v.oColVis=b.extend({},n,x.amsDatatableColvisOptions);break;case"editable":a.ajax.check(b.fn.editable,a.baseURL+"ext/jquery-jeditable"+a.devext+".js");a.ajax.check(b.fn.makeEditable,a.baseURL+"ext/jquery-dataTables-editable"+a.devext+".js");break;case"fixedcolumns":a.ajax.check(b.fn.dataTable.FixedColumns,a.baseURL+"ext/jquery-dataTables-fixedColumns"+a.devext+".js");break;case"fixedheader":a.ajax.check(b.fn.dataTable.FixedHeader,a.baseURL+"ext/jquery-dataTables-fixedHeader"+a.devext+".js");break;case"keytable":a.ajax.check(window.KeyTable,a.baseURL+"ext/jquery-dataTables-keyTable"+a.devext+".js");break;case"rowgrouping":a.ajax.check(b.fn.rowGrouping,a.baseURL+"ext/jquery-dataTables-rowGrouping"+a.devext+".js");break;case"rowreordering":a.ajax.check(b.fn.rowReordering,a.baseURL+"ext/jquery-dataTables-rowReordering"+a.devext+".js");break;case"scroller":a.ajax.check(b.fn.dataTable.Scroller,a.baseURL+"ext/jquery-dataTables-scroller"+a.devext+".js");break;default:break}}}v=a.executeFunctionByName(x.amsDatatableInitCallback,u,v)||v;var g=u.dataTable(v);a.executeFunctionByName(x.amsDatatableAfterInitCallback,u,g,v);if(w.length>0){for(j in w){switch(w[j]){case"autofill":var y=b.extend({},x.amsDatatableAutofillOptions,v.autofill);y=a.executeFunctionByName(x.amsDatatableAutofillInitCallback,u,y)||y;u.data("ams-autofill",x.amsDatatableAutofillConstructor===undefined?new b.fn.dataTable.AutoFill(u,y):a.executeFunctionByName(x.amsDatatableAutofillConstructor,u,g,y));break;case"columnfilter":var k={sPlaceHolder:"head:after"};var l=b.extend({},k,x.amsDatatableColumnfilterOptions,v.columnfilter);l=a.executeFunctionByName(x.amsDatatableColumnfilterInitCallback,u,l)||l;u.data("ams-columnfilter",x.amsDatatableColumnfilterConstructor===undefined?g.columnFilter(l):a.executeFunctionByName(x.amsDatatableColumnfilterConstructor,u,g,l));break;case"editable":var m=b.extend({},x.amsDatatableEditableOptions,v.editable);m=a.executeFunctionByName(x.amsDatatableEditableInitCallback,u,m)||m;u.data("ams-editable",x.amsDatatableEditableConstructor===undefined?u.makeEditable(m):a.executeFunctionByName(x.amsDatatableEditableConstructor,u,g,m));break;case"fixedcolumns":var f=b.extend({},x.amsDatatableFixedcolumnsOptions,v.fixedcolumns);f=a.executeFunctionByName(x.amsDatatableFixedcolumnsInitCallback,u,f)||f;u.data("ams-fixedcolumns",x.amsDatatableFixedcolumnsConstructor===undefined?new b.fn.dataTable.FixedColumns(u,f):a.executeFunctionByName(x.amsDatatableFixedcolumnsConstructor,u,g,f));break;case"fixedheader":var s=b.extend({},x.amsDatatableFixedheaderOptions,v.fixedheader);s=a.executeFunctionByName(x.amsDatatableFixedheadeInitCallback,u,s)||s;u.data("ams-fixedheader",x.amsDatatableFixedheaderConstructor===undefined?new b.fn.dataTable.FixedHeader(u,s):a.executeFunctionByName(x.amsDatatableFixedheaderConstructor,u,g,s));break;case"keytable":var i={table:u.get(0),datatable:g};var q=b.extend({},i,x.amsDatatableKeytableOptions,v.keytable);q=a.executeFunctionByName(x.amsDatatableKeytableInitCallback,u,q)||q;u.data("ams-keytable",x.amsDatatableKeytableConstructor===undefined?new KeyTable(q):a.executeFunctionByName(x.amsDatatableKeytableConstructor,u,g,q));break;case"rowgrouping":var p=b.extend({},x.amsDatatableRowgroupingOptions,v.rowgrouping);p=a.executeFunctionByName(x.amsDatatableRowgroupingInitCallback,u,p)||p;u.data("ams-rowgrouping",x.amsDatatableRowgroupingConstructor===undefined?u.rowGrouping(p):a.executeFunctionByName(x.amsDatatableRowgroupingConstructor,u,g,p));break;case"rowreordering":var o=b.extend({},x.amsDatatableRowreorderingOptions,v.rowreordering);o=a.executeFunctionByName(x.amsDatatableRowreorderingInitCallback,u,o)||o;u.data("ams-rowreordering",x.amsDatatableRowreorderingConstructor===undefined?u.rowReordering(o):a.executeFunctionByName(x.amsDatatableRowreorderingConstructor,u,g,o));break;default:break}}}var t=(x.amsDatatableFinalizeCallback||"").split(/\s+/);if(t.length>0){for(j in t){a.executeFunctionByName(t[j],u,g,v)}}})})}},tablednd:function(d){var c=b(".table-dnd",d);if(c.length>0){a.ajax.check(b.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(e){c.each(function(){var i=b(this);b(i).on("mouseover","tr",function(){b(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){b(this.cells[0]).removeClass("drag-handle")});var j=i.data();var g={onDragClass:j.amsTabledndDragClass||"dragging-row",onDragStart:j.amsTabledndDragStart,dragHandle:j.amsTabledndDragHandle,scrollAmount:j.amsTabledndScrollAmount,onAllowDrop:j.amsTabledndAllowDrop,onDrop:j.amsTabledndDrop||function(m,o){var l=j.amsTabledndDropTarget;if(l){var k=[];b(m.rows).each(function(){var p=b(this).data("ams-element-name");if(p){k.push(p)}});var n=a.getFunctionByName(l);if(typeof(n)=="function"){n.call(i,m,k)}else{a.ajax.post(l,{names:JSON.stringify(k)})}}return false}};var f=b.extend({},g,j.amsTabledndOptions);f=a.executeFunctionByName(j.amsTabledndInitCallback,i,f)||f;var h=i.tableDnD(f);a.executeFunctionByName(j.amsTabledndAfterInitCallback,i,h,f)})})}},imgareaselect:function(d){var c=b(".imgareaselect",d);if(c.length>0){a.ajax.check(b.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.10"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".csss")}c.each(function(){var k=b(this);var j=k.data();var h=j.amsImgareaselectParent?k.parents(j.amsImgareaselectParent):"body";var g={instance:true,handles:true,parent:h,x1:j.amsImgareaselectX1||0,y1:j.amsImgareaselectY1||0,x2:j.amsImgareaselectX2||j.amsImgareaselectImageWidth,y2:j.amsImgareaselectY2||j.amsImgareaselectImageHeight,imageWidth:j.amsImgareaselectImageWidth,imageHeight:j.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:j.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(j.amsImgareaselectSelectEnd)||function(l,m){var n=j.amsImgareaselectTargetField||"image_";b('input[name="'+n+'x1"]',h).val(m.x1);b('input[name="'+n+'y1"]',h).val(m.y1);b('input[name="'+n+'x2"]',h).val(m.x2);b('input[name="'+n+'y2"]',h).val(m.y2)}};var f=b.extend({},g,j.amsImgareaselectOptions);f=a.executeFunctionByName(j.amsImgareaselectInitCallback,k,f)||f;var i=k.imgAreaSelect(f);a.executeFunctionByName(j.amsImgareaselectAfterInitCallback,k,i,f);setTimeout(function(){i.update()},250)})})}},fancybox:function(c){var d=b(".fancybox",c);if(d.length>0){a.ajax.check(b.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}d.each(function(){var f=b(this);var m=f.data();var l=(m.amsFancyboxHelpers||"").split(/\s+/);if(l.length>0){for(var g in l){var k=l[g];switch(k){case"buttons":a.ajax.check(b.fancybox.helpers.buttons,a.baseURL+"ext/fancybox-helpers/fancybox-buttons"+a.devext+".js");break;case"thumbs":a.ajax.check(b.fancybox.helpers.thumbs,a.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+a.devext+".js");break;case"media":a.ajax.check(b.fancybox.helpers.media,a.baseURL+"ext/fancybox-helpers/fancybox-media"+a.devext+".js");break;default:break}}}var i={type:m.amsFancyboxType,padding:m.amsFancyboxPadding||10,margin:m.amsFancyboxMargin||10,beforeLoad:a.getFunctionByName(m.amsFancyboxBeforeLoad)||function(){this.title=a.executeFunctionByName(m.amsFancyboxTitleGetter,this)||b(this.element).attr("original-title")||b(this.element).attr("title")},helpers:{title:{type:"inside"}}};var h=b.extend({},i,m.amsFancyboxOptions);h=a.executeFunctionByName(m.amsFancyboxInitCallback,f,h)||h;var j=f.fancybox(h);a.executeFunctionByName(m.amsFancyboxAfterInitCallback,f,j,h)})})}},graphs:function(d){var c=b(".sparkline",d);if(c.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(c)})}},scrollbars:function(c){var d=b(".scrollbar",c);if(d.length>0){a.ajax.check(b.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(b.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}d.each(function(){var j=b(this);var i=j.data();var g={theme:i.amsScrollbarTheme||"light"};var f=b.extend({},g,i.amsScrollbarOptions);f=a.executeFunctionByName(i.amsScrollbarInitCallback,j,f)||f;var h=j.mCustomScrollbar(f);a.executeFunctionByName(i.amsScrollbarAfterInitCallback,j,h,f)})})})}}}};MyAMS.callbacks={init:function(c){b("[data-ams-callback]",c).each(function(){var d=this;var e=b(d).data();var f=a.getFunctionByName(e.amsCallback);if(f===undefined){if(e.amsCallbackSource){a.getScript(e.amsCallbackSource,function(){a.executeFunctionByName(e.amsCallback,d,e.amsCallbackOptions)})}else{if(window.console){console.warn("Undefined callback: "+e.amsCallback)}}}else{f.call(d,e.amsCallbackOptions)}})},alert:function(k){var f=b(this).data();var c=b.extend({},k,f.amsAlertOptions);var i=b(f.amsAlertParent||c.parent||this);var e=f.amsAlertStatus||c.status||"info";var g=f.amsAlertHeader||c.header;var j=f.amsAlertMessage||c.message;var h=f.amsAlertSubtitle||c.subtitle;var d=f.amsAlertMargin===undefined?(c.margin===undefined?false:c.margin):f.amsAlertMargin;a.skin.alert(i,e,g,j,h,d)},messageBox:function(d){var g=b(this).data();var f=b.extend({},d,g.amsMessageboxOptions);var e=b.extend({},f,{title:g.amsMessageboxTitle||f.title||"",content:g.amsMessageboxContent||f.content||"",icon:g.amsMessageboxIcon||f.icon,number:g.amsMessageboxNumber||f.number,timeout:g.amsMessageboxTimeout||f.timeout});var c=g.amsMessageboxStatus||f.status||"info";var h=a.getFunctionByName(g.amsMessageboxCallback||f.callback);a.skin.messageBox(c,e,h)},smallBox:function(d){var g=b(this).data();var f=b.extend({},d,g.amsSmallboxOptions);var e=b.extend({},f,{title:g.amsSmallboxTitle||f.title||"",content:g.amsSmallboxContent||f.content||"",icon:g.amsSmallboxIcon||f.icon,iconSmall:g.amsSmallboxIconSmall||f.iconSmall,timeout:g.amsSmallboxTimeout||f.timeout});var c=g.amsSmallboxStatus||f.status||"info";var h=a.getFunctionByName(g.amsSmallboxCallback||f.callback);a.skin.smallBox(c,e,h)}};MyAMS.events={init:function(c){b("[data-ams-events-handlers]",c).each(function(){var e=b(this);var d=e.data("ams-events-handlers");for(var f in d){e.on(f,a.getFunctionByName(d[f]))}})}};MyAMS.container={changeOrder:function(d,e){var c=b('input[name="'+b(this).data("ams-input-name")+'"]',b(this));c.val(e.join(";"))},deleteElement:function(c){return function(){var d=b(this);MyAMS.skin.bigBox({title:a.i18n.WARNING,content:'  '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(g){if(g==a.i18n.BTN_OK){var i=d.parents("table");var f=i.data("ams-location")||"";var j=d.parents("tr");var h=j.data("ams-delete-target")||i.data("ams-delete-target")||"delete-element.json";var e=j.data("ams-element-name");MyAMS.ajax.post(f+"/"+h,{object_name:e},function(k,l){if(k.status=="success"){if(i.hasClass("datatable")){i.dataTable().fnDeleteRow(j[0])}else{j.remove()}}})}})}}};MyAMS.skin={_setPageHeight:function(){var e=b("#main").height();var c=a.left_panel.height();var d=b(window).height()-a.navbar_height;if(e>d){a.left_panel.css("min-height",e);a.root.css("min-height",e+a.navbar_height)}else{a.left_panel.css("min-height",d);a.root.css("min-height",d)}},_checkMobileWidth:function(){if(b(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){$this=b("#activity > .badge");if(parseInt($this.text())>0){$this.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{$this.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},_initDesktopWidgets:function(c){if(a.enable_widgets){var d=b(".ams-widget",c);if(d.length>0){a.ajax.check(b.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){d.each(function(){var h=b(this);var g=h.data();var f={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var e=b.extend({},f,g.amsWidgetOptions);e=a.executeFunctionByName(g.amsWidgetInitcallback,h,e)||e;h.MyAMSWidget(e)});MyAMSWidget.initWidgetsGrid(b(".ams-widget-grid",c))})}}},_initMobileWidgets:function(c){if(a.enable_mobile&&a.enable_widgets){a.skin._initDesktopWidgets(c)}},alert:function(j,d,e,k,i,c){b(".alert",j).remove();if(d=="error"){d="danger"}var g='

'+e+"

"+(i?("

"+i+"

"):"");if(typeof(k)=="string"){g+="
  • "+k+"
"}else{if(k){g+="
    ";for(var f in k){if(!b.isNumeric(f)){continue}g+="
  • "+k[f]+"
  • "}g+="
"}}g+="
";var h=b(g).prependTo(j);if(j.exists){a.ajax.check(b.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){b.scrollTo(j,{offset:{top:-50}})})}},bigBox:function(c,d){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(c,d)})},messageBox:function(c,d,e){if(typeof(c)=="object"){e=d;d=c||{};c="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(c){case"error":case"danger":d.color="#C46A69";break;case"warning":d.color="#C79121";break;case"success":d.color="#739E73";break;default:d.color=d.color||"#3276B1"}d.sound=false;a.notify.bigBox(d,e)})},smallBox:function(c,d,e){if(typeof(c)=="object"){e=d;d=c||{};c="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(c){case"error":case"danger":d.color="#C46A69";break;case"warning":d.color="#C79121";break;case"success":d.color="#739E73";break;default:d.color=d.color||"#3276B1"}d.sound=false;a.notify.smallBox(d,e)})},_drawBreadCrumb:function(){var c=b("#ribbon OL.breadcrumb");c.empty().append(b("
  • ").append(b("").text(a.i18n.HOME).attr("href",b('nav a[href!="#"]:first').attr("href"))));b("nav LI.active >A").each(function(){var f=b(this);var d=b.trim(f.clone().children(".badge").remove().end().text());var e=b("
  • ").append(f.attr("href").replace(/^#/,"")?b("").html(d).attr("href",f.attr("href")):d);c.append(e)})},checkURL:function(){function c(i){b("nav .active").removeClass("active");i.addClass("open").addClass("active");i.parents("li").addClass("open active").children("ul").addClass("active").show();i.parents("li:first").removeClass("open");i.parents("ul").addClass(i.attr("href").replace(/^#/,"")?"active":"").show()}var f=location.hash;var e=f.replace(/^#/,"");if(e){var d=b("#content");if(!d.exists()){d=b("body")}var g=b('nav A[href="'+f+'"]');if(g.exists()){c(g)}a.skin.loadURL(e,d);document.title=b("[data-ams-page-title]:first",d).data("ams-page-title")||g.attr("title")||document.title}else{var h=b("[data-ams-active-menu]").data("ams-active-menu");if(h){g=b('nav A[href="'+h+'"]')}else{g=b('nav >UL >LI >A[href!="#"]').first()}if(g.exists()){c(g);if(h){a.skin._drawBreadCrumb()}else{window.location.hash=g.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(d){var c=a.skin._clean_callbacks;if(c.indexOf(d)<0){c.push(d)}},cleanContainer:function(c){var e=a.skin._clean_callbacks;for(var d in e){e[d].call(c)}},loadURL:function(e,c,d,h){if(e.startsWith("#")){e=e.substr(1)}if(typeof(d)=="function"){h=d;d={}}c=b(c);var g={type:"GET",url:e,dataType:"html",cache:false,beforeSend:function(){a.skin.cleanContainer(c);c.html('

    Loading...

    ');if(c[0]==b("#content")[0]){a.skin._drawBreadCrumb();document.title=b(".breadcrumb LI:last-child").text();b("html, body").animate({scrollTop:0},"fast")}else{c.animate({scrollTop:0},"fast")}},success:function(m,j,l){if(h){a.executeFunctionByName(h,this,m,j,l,d)}else{var k=a.ajax.getResponse(l);var n=k.content_type;var i=k.data;b(".loading",c).remove();switch(n){case"json":a.ajax.handleJSON(i,c);break;case"script":break;case"xml":break;case"html":case"text":default:c.parents(".hidden").removeClass("hidden");b(".alert",c.parents(".alerts-container")).remove();c.css({opacity:"0.0"}).html(m).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(c)}if(d&&d.afterLoadCallback){a.executeFunctionByName(d.afterLoadCallback,this)}}},error:function(k,j,i){c.html('

    '+a.i18n.ERROR+i+"

    "+k.responseText)},async:false};var f=b.extend({},g,d);b.ajax(f)},setLanguage:function(d){var f=d.lang;var e=d.handler_type||"json";switch(e){case"json":var g=d.method||"setUserLanguage";a.jsonrpc.post(g,{lang:f},function(){window.location.reload(true)});break;case"ajax":var c=d.href||"setUserLanguage";a.ajax.post(c,{lang:f},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};MyAMS.initPage=function(){var c=b("body");a.root=c;a.left_panel=b("#left-panel");a.shortcuts=b("#shortcut");a.plugins.initData(c);var d=b.ajaxSettings.xhr;b.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var f=d();if(f&&(typeof(f.addEventListener)=="function")){var e=this;f.addEventListener("progress",function(g){e.progress(g)},false)}return f}});b(document).ajaxStart(a.ajax.start);b(document).ajaxStop(a.ajax.stop);b(document).ajaxError(a.error.ajax);if(!a.isMobile){a.root.addClass("desktop-detected");a.device="desktop"}else{a.root.addClass("mobile-detected");a.device="mobile";if(a.enable_fastclick){a.ajax.check(b.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){b("NAV UL A").noClickDelay();b("#hide-menu A").noClickDelay()})}}b("#hide-menu >:first-child > A").click(function(f){c.toggleClass("hidden-menu");f.preventDefault()});b("#show-shortcut").click(function(f){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}f.preventDefault()});b(document).mouseup(function(f){if(!a.shortcuts.is(f.target)&&a.shortcuts.has(f.target).length===0){a.skin._hideShortcutButtons()}});b("#search-mobile").click(function(){a.root.addClass("search-mobile")});b("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});b("#activity").click(function(g){var f=b(this);var h=f.next(".ajax-dropdown");if(!h.is(":visible")){h.css("left",f.position().left-h.innerWidth()/2+f.innerWidth()/2).fadeIn(150);f.addClass("active")}else{h.fadeOut(150);f.removeClass("active")}g.preventDefault()});a.skin.checkNotification();b(document).mouseup(function(f){var g=b(".ajax-dropdown");if(!g.is(f.target)&&g.has(f.target).length===0){g.fadeOut(150).prev().removeClass("active")}});b('input[name="activity"]').change(function(){var e=b(this).data("ams-url");container=b(".ajax-notifications");a.skin.loadURL(e,container)});b("#logout a").click(function(f){f.preventDefault();f.stopPropagation();a.loginURL=b(this).attr("href");a.skin.bigBox({title:" "+a.i18n.LOGOUT+" "+b("#show-shortcut").text()+" ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(e){if(e==a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});b("NAV UL").myams_menu({accordion:true,speed:a.menu_speed});b(".minifyme").click(function(f){b("BODY").toggleClass("minified");b(this).effect("highlight",{},500);f.preventDefault()});b("#refresh").click(function(f){a.skin.bigBox({title:" "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(e){if(e==a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});f.preventDefault()});c.on("click",function(g){var f=b(this);if(!f.is(g.target)&&f.has(g.target).length===0&&b(".popover").has(g.target).length===0){f.popover("hide")}});a.ajax.check(b.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){b("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});b("nav").resize(function(){a.skin._setPageHeight()})});if(a.ajax_nav){b(document).on("click",'a[href="#"]',function(f){f.preventDefault()});b(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(j){var h=b(j.currentTarget);var f=h.attr("href")||h.data("ams-url");if(!f||f.startsWith("javascript:")||h.attr("target")||(h.data("ams-context-menu")===true)){return}j.preventDefault();j.stopPropagation();var g=a.getFunctionByName(f);if(typeof(g)=="function"){f=g.call(h)}if(typeof(f)=="function"){f.call(h)}else{f=f.replace(/\%23/,"#");var i=h.data("ams-target");if(i){a.form.confirmChangedForm(i,function(){a.skin.loadURL(f,i,h.data("ams-link-options"),h.data("ams-link-callback"));j.stopPropagation()})}else{a.form.confirmChangedForm(function(){if(f.startsWith("#")){if(f!=location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=f},150)}else{window.location.hash=f}}}else{window.location=f}})}}});b(document).on("click",'a[target="_blank"]',function(f){f.preventDefault();window.open(b(f.currentTarget).attr("href"))});b(document).on("click",'a[target="_top"]',function(f){f.preventDefault();a.form.confirmChangedForm(function(){window.location=b(f.currentTarget).attr("href")})});b(window).on("hashchange",a.skin.checkURL)}b(document).off("click.modal").on("click",'[data-toggle="modal"]',function(g){var f=b(this);if(f.data("ams-context-menu")===true){return}if(f.data("ams-stop-propagation")===true){g.stopPropagation()}g.preventDefault();a.dialog.open(f);if(f.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});b(document).on("click",'button[type="submit"], button.submit',function(){var e=b(this);b(e.get(0).form).data("ams-submit-button",e)});b(document).on("click","[data-ams-click-handler]",function(h){var g=b(this);var f=g.data();if(f.amsClickHandler){if((f.amsStopPropagation===true)||(f.amsClickStopPropagation===true)){h.stopPropagation()}if(f.amsClickKeepDefault!==true){h.preventDefault()}var i=a.getFunctionByName(f.amsClickHandler);if(i!==undefined){i.call(g,f.amsClickHandlerOptions)}}});b(document).on("change","[data-ams-change-handler]",function(h){var g=b(this);var f=g.data();if(f.amsChangeHandler){if(f.amsChangeKeepDefault!==true){h.preventDefault()}var i=a.getFunctionByName(f.amsChangeHandler);if(i!==undefined){i.call(g,f.amsChangeHandlerOptions)}}});b(document).on("reset","[data-ams-reset-handler]",function(h){var f=b(this);var g=f.data();if(g.amsResetHandler){if(g.amsResetKeepDefault!==true){h.preventDefault()}var i=a.getFunctionByName(g.amsResetHandler);if(i!==undefined){i.call(f,g.amsResetHandlerOptions)}}});b(document).on("change",'input[type="file"]',function(h){h.preventDefault();var f=b(this);var g=f.parent(".button");if(g.exists()&&g.parent().hasClass("input-file")){g.next('input[type="text"]').val(f.val())}});b(document).on("focusin",function(f){if(b(f.target).closest(".mce-window").length){f.stopImmediatePropagation()}});b("a[data-toggle=tab]",".nav-tabs").on("click",function(f){if(b(this).parent("li").hasClass("disabled")){f.preventDefault();return false}});b(document).on("show.bs.tab",function(h){var f=b(h.target);var g=f.data();if(g.amsUrl){if(g.amsTabLoaded){return}a.skin.loadURL(g.amsUrl,f.attr("href"));if(g.amsTabLoadOnce){f.data("ams-tab-loaded",true)}}});a.initContent(document);if(a.ajax_nav&&(b("nav").length>0)){a.skin.checkURL()}b(window).on("beforeunload",a.form.checkBeforeUnload)};MyAMS.initContent=function(c){b(".tipsy").remove();b("[rel=tooltip]",c).tooltip();b("[rel=popover]",c).popover();b("[rel=popover-hover]",c).popover({trigger:"hover"});a.plugins.init(c);a.callbacks.init(c);a.events.init(c);a.form.init(c);if(a.device==="desktop"){a.skin._initDesktopWidgets(c)}else{a.skin._initMobileWidgets(c)}a.skin._setPageHeight()};MyAMS.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",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"};b(document).ready(function(){b=jQuery.noConflict();var c=b("HTML");var d=c.attr("lang")||c.attr("xml:lang");if(d&&!d.startsWith("en")){MyAMS.lang=d;MyAMS.getScript(MyAMS.baseURL+"i18n/myams_"+d.substr(0,2)+".js",function(){MyAMS.initPage()})}else{MyAMS.initPage()}})})(jQuery); \ No newline at end of file +(function(b){String.prototype.startsWith=function(e){var c=this.length;var d=e.length;if(c0};if(b.scrollbarWidth===undefined){b.scrollbarWidth=function(){var d=b('
    ').appendTo("body");var e=d.children();var c=e.innerWidth()-e.height(99).innerWidth();d.remove();return c}}b.fn.extend({exists:function(){return b(this).length>0},objectOrParentWithClass:function(c){if(this.hasClass(c)){return this}else{return this.parents("."+c)}},listattr:function(d){var c=[];this.each(function(){c.push(b(this).attr(d))});return c},style:function(d,g,c){var f=this.get(0);if(typeof f=="undefined"){return}var e=this.get(0).style;if(typeof d!="undefined"){if(typeof g!="undefined"){c=typeof c!="undefined"?c:"";e.setProperty(d,g,c);return this}else{return e.getPropertyValue(d)}}else{return e}},removeClassPrefix:function(c){this.each(function(e,f){var d=f.className.split(" ").map(function(g){return g.startsWith(c)?"":g});f.className=b.trim(d.join(" "))});return this},contextMenu:function(d){function c(g,i,f){var h=b(window)[i](),j=b(d.menuSelector)[i](),e=g;if(g+j>h&&j',openedSign:''};var d=b.extend({},e,c);var f=b(this);f.find("LI").each(function(){var g=b(this);if(g.find("UL").size()>0){g.find("A:first").append(""+d.closedSign+"");var h=g.find("A:first");if(h.attr("href")=="#"){h.click(function(){return false})}}});f.find("LI.active").each(function(){var g=b(this).parents("UL");var h=g.parent("LI");g.slideDown(d.speed);h.find("b:first").html(d.openedSign);h.addClass("open")});f.find("LI A").on("click",function(){var j=b(this);var g=j.parent().find("UL");if(d.accordion){var i=j.parent().parents("UL");var k=f.find("UL:visible");k.each(function(l){var m=true;i.each(function(n){if(i[n]==k[l]){m=false;return false}});if(m){if(g!=k[l]){b(k[l]).slideUp(d.speed,function(){j.parent("LI").find("b:first").html(d.closedSign);j.parent("LI").removeClass("open")})}}})}var h=j.parent().find("UL:first");if(!j.attr("href").replace(/^#/,"")&&h.is(":visible")&&!h.hasClass("active")){h.slideUp(d.speed,function(){j.parent("LI").removeClass("open").find("B:first").delay(d.speed).html(d.closedSign)})}else{h.slideDown(d.speed,function(){j.parent("LI").addClass("open").find("B:first").delay(d.speed).html(d.openedSign)})}})}});b.UTF8={encode:function(e){e=e.replace(/\r\n/g,"\n");var d="";for(var g=0;g127)&&(f<2048)){d+=String.fromCharCode((f>>6)|192);d+=String.fromCharCode((f&63)|128)}else{d+=String.fromCharCode((f>>12)|224);d+=String.fromCharCode(((f>>6)&63)|128);d+=String.fromCharCode((f&63)|128)}}}return d},decode:function(d){var f="";var h=0,j=0,g=0,e=0;while(h191)&&(j<224)){g=d.charCodeAt(h+1);f+=String.fromCharCode(((j&31)<<6)|(g&63));h+=2}else{g=d.charCodeAt(h+1);e=d.charCodeAt(h+2);f+=String.fromCharCode(((j&15)<<12)|((g&63)<<6)|(e&63));h+=3}}}return f}};if(window.MyAMS===undefined){window.MyAMS={devmode:true,devext:"",lang:"en",throttle_delay:350,menu_speed:235,navbar_height:49,ajax_nav:true,enable_widgets:true,enable_mobile:false,enable_fastclick:false,warn_on_form_change:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var a=MyAMS;MyAMS.baseURL=(function(){var c=b('script[src*="/myams.js"], script[src*="/myams.min.js"]');var d=c.attr("src");a.devmode=d.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return d.substring(0,d.lastIndexOf("/")+1)})();MyAMS.getQueryVar=function(e,f){if(e.indexOf("?")<0){return false}if(!e.endsWith("&")){e+="&"}var c=new RegExp(".*?[&\\?]"+f+"=(.*?)&.*");var d=e.replace(c,"$1");return d==e?false:d};MyAMS.rgb2hex=function(c){return"#"+b.map(c.match(/\b(\d+)\b/g),function(d){return("0"+parseInt(d).toString(16)).slice(-2)}).join("")};MyAMS.generateId=function(){function c(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return c()+c()+c()+c()};MyAMS.getFunctionByName=function(h,d){if(h===undefined){return undefined}else{if(typeof(h)=="function"){return h}}var g=h.split(".");var f=g.pop();d=(d===undefined||d===null)?window:d;for(var c=0;c").attr({rel:"stylesheet",type:"text/css",href:f,"data-ams-id":g}).appendTo(e)}};MyAMS.event={stop:function(c){if(!c){c=window.event}if(c){if(c.stopPropagation){c.stopPropagation();c.preventDefault()}else{c.cancelBubble=true;c.returnValue=false}}}};MyAMS.browser={getInternetExplorerVersion:function(){var e=-1;if(navigator.appName=="Microsoft Internet Explorer"){var c=navigator.userAgent;var d=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(d.exec(c)!=null){e=parseFloat(RegExp.$1)}}return e},checkVersion:function(){var d="You're not using Windows Internet Explorer.";var c=this.getInternetExplorerVersion();if(c>-1){if(c>=8){d="You're using a recent copy of Windows Internet Explorer."}else{d="You should upgrade your copy of Windows Internet Explorer."}}alert(d)},isIE8orlower:function(){var d="0";var c=this.getInternetExplorerVersion();if(c>-1){if(c>=9){d=0}else{d=1}}return d},copyToClipboard:function(){return function(){var c=b(this);c.parents(".btn-group").removeClass("open");window.prompt(MyAMS.i18n.CLIPBOARD_COPY,c.text())}}};MyAMS.error={ajax:function(f,e){if(e.statusText=="OK"){return}var c=a.ajax.getResponse(e);if(c.content_type=="json"){a.ajax.handleJSON(c.data)}else{var g=f.statusText||f.type;var d=e.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+g+"

    "+d+"

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

    "+c+"

    "+e+"

    ",icon:"fa fa-warning animated shake",timeout:10000})}if(window.console){console.error(e);console.debug(f)}}};MyAMS.ajax={check:function(d,f,h,c){if(typeof(h)=="object"){c=h;h=undefined}var g={async:typeof(h)=="function"};var e=b.extend({},g,c);if(d===undefined){a.getScript(f,function(){if(typeof(h)=="function"){h(true,c)}},e)}else{if(typeof(h)=="function"){h(false,c)}}},getAddr:function(d){var c=d||b("HTML HEAD BASE").attr("href")||window.location.href;return c.substr(0,c.lastIndexOf("/")+1)},start:function(){b("#ajax-gear").show()},stop:function(){b("#ajax-gear").hide()},progress:function(c){if(!c.lengthComputable){return}if(c.loaded>=c.total){return}console.log(parseInt((c.loaded/c.total*100),10)+"%")},post:function(e,g,d,j){if(e.startsWith(window.location.protocol)){var i=e}else{i=this.getAddr()+e}if(typeof(d)=="function"){j=d;d={}}else{if(!d){d={}}}if(typeof(j)=="undefined"){j=d.callback}if(typeof(j)=="string"){j=a.getFunctionByName(j)}delete d.callback;var c=undefined;var h={url:i,type:"post",cache:false,async:typeof(j)=="function",data:b.param(g),dataType:"json",success:j||function(k){c=k.result},error:a.error.show};var f=b.extend({},h,d);b.ajax(f);return c},getResponse:function(f){var d=f.getResponseHeader("content-type"),h,c;if(d){if(d.startsWith("application/javascript")){h="script";c=f.responseText}else{if(d.startsWith("text/html")){h="html";c=f.responseText}else{if(d.startsWith("text/xml")){h="xml";c=f.responseText}else{c=f.responseJSON;if(c){h="json"}else{try{c=JSON.parse(f.responseText);h="json"}catch(g){c=f.responseText;h="text"}}}}}}else{h="json";c={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{content_type:h,data:c}},handleJSON:function(n,e,j){var h=n.status;var c;switch(h){case"alert":alert(n.alert.title+"\n\n"+n.alert.content);break;case"error":a.form.showErrors(e,n);break;case"info":case"success":if(n.close_form!=false){a.dialog.close(e)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":if(n.close_form!=false){a.dialog.close(e)}break;case"modal":a.dialog.open(n.location);break;case"reload":if(n.close_form!=false){a.dialog.close(e)}c=n.location||window.location.hash;if(c.startsWith("#")){c=c.substr(1)}a.skin.loadURL(c,n.target||j||"#content");break;case"redirect":if(n.close_form==true){a.dialog.close(e)}c=n.location||window.location.href;if(n.window){window.open(c,n.window,n.options)}else{if(window.location.href==c){window.location.reload(true)}else{window.location.href=c}}break;default:console.log("Unhandled status: "+h);break}if(n.content){var k=n.content;var d=b(k.target||j||e||"#content");if(k.raw==true){d.text(k.text)}else{d.html(k.html);a.initContent(d)}if(!k.keep_hidden){d.removeClass("hidden")}}if(n.contents){var g=n.contents;for(var i in g){k=g[i];d=b(k.target);if(k.raw==true){d.text(k.text)}else{d.html(k.html);a.initContent(d)}if(!k.keep_hidden){d.removeClass("hidden")}}}if(n.message){var m=n.message;if(typeof(m)=="string"){if((h=="info")||(h=="success")){a.skin.smallBox(h,{title:m,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}else{a.skin.alert(b(e||"#content"),h,m)}}else{a.skin.alert(b(m.target||j||e||"#content"),m.status||"success",m.header,m.body,m.subtitle)}}if(n.smallbox){a.skin.smallBox(n.smallbox_status||h,{title:n.smallbox,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}if(n.messagebox){m=n.messagebox;if(typeof(m)=="string"){a.skin.messageBox("info",{title:a.i18n.ERROR_OCCURED,content:m,timeout:10000})}else{var f=m.status||"info";if(f=="error"&&e&&j){a.executeFunctionByName(e.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",e,j)}a.skin.messageBox(f,{title:m.title||a.i18n.ERROR_OCCURED,content:m.content,icon:m.icon,number:m.number,timeout:m.timeout==null?undefined:(m.timeout||10000)})}}if(n.event){e.trigger(n.event,n.event_options)}if(n.callback){a.executeFunctionByName(n.callback,e,n.options)}if(n.callbacks){for(i in n.callbacks){if(!b.isNumeric(i)){continue}var l=n.callbacks[i];a.executeFunctionByName(l,e,l.options)}}}};MyAMS.jsonrpc={getAddr:function(e){var c=e||b("HTML HEAD BASE").attr("href")||window.location.href;var d=c.replace(/\+\+skin\+\+\w+\//,"");return d.substr(0,d.lastIndexOf("/")+1)},query:function(d,f,c,e){a.ajax.check(b.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){var g;if(typeof(c)=="function"){e=c;c={}}else{if(!c){c={}}}if(typeof(e)=="undefined"){e=c.callback}if(typeof(e)=="string"){e=a.getFunctionByName(e)}delete c.callback;var i={};if(typeof(d)=="string"){i.query=d}else{if(typeof(d)=="object"){b.extend(i,d)}}b.extend(i,c);var h={url:a.jsonrpc.getAddr(c.url),type:"post",cache:false,method:f,params:i,async:typeof(e)=="function",success:e||function(j){g=j.result},error:a.error.show};b.jsonRpc(h);return g})},post:function(f,d,c,e){a.ajax.check(b.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){var g;if(typeof(c)=="function"){e=c;c={}}else{if(!c){c={}}}if(typeof(e)=="undefined"){e=c.callback}if(typeof(e)=="string"){e=a.getFunctionByName(e)}delete c.callback;var g;var i={url:a.jsonrpc.getAddr(c.url),type:"post",cache:false,method:f,params:d,async:typeof(e)=="function",success:e||function(j){g=j.result},error:a.error.show};var h=b.extend({},i,c);b.jsonRpc(h);return g})}};MyAMS.xmlrpc={getAddr:function(e){var c=e||b("HTML HEAD BASE").attr("href")||window.location.href;var d=c.replace(/\+\+skin\+\+\w+\//,"");return d.substr(0,d.lastIndexOf("/")+1)},post:function(d,g,e,c,f){a.ajax.check(b.xmlrpc,a.baseURL+"ext/jquery-xmlrpc"+a.devext+".js",function(){var h;if(typeof(c)=="function"){f=c;c={}}else{if(!c){c={}}}if(typeof(f)=="undefined"){f=c.callback}if(typeof(f)=="string"){f=a.getFunctionByName(f)}delete c.callback;var j={url:a.xmlrpc.getAddr(d),methodName:g,params:e,success:f||function(k){h=k},error:a.error.show};var i=b.extend({},j,c);b.xmlrpc(i);return h})}};MyAMS.form={init:function(d){if(a.warn_on_form_change){var c=b('FORM[data-ams-warn-on-change!="false"]',d)}else{c=b('FORM[data-ams-warn-on-change="true"]',d)}c.each(function(){var e=b(this);b('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',e).each(function(){var g=b(this);if(g.data("ams-ignore-change")!==true){var f=g.data("ams-changed-event")||"change";g.on(f,function(){b(this).parents("FORM").attr("data-ams-form-changed",true)})}});e.on("reset",function(){b(this).removeAttr("data-ams-form-changed")})})},checkBeforeUnload:function(){var c=b('FORM[data-ams-form-changed="true"]');if(c.exists()){return a.i18n.FORM_CHANGED_WARNING}},confirmChangedForm:function(d,e){if(typeof(d)=="function"){e=d;d=undefined}var c=b('FORM[data-ams-form-changed="true"]',d);if(c.exists()){a.skin.bigBox({title:a.i18n.WARNING,content:'  '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(f){if(f==a.i18n.BTN_OK){e.call(d)}})}else{e.call(d)}},submit:function(e,d,f){e=b(e);if(!e.exists()){return false}if(typeof(d)=="object"){f=d;d=undefined}if(e.data("submitted")){if(!e.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:e.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(e)){return false}b(".alert, SPAN.state-error",e).remove();b(".state-error",e).removeClassPrefix("state-");var c=b(e.data("ams-submit-button"));if(c&&!c.data("ams-form-hide-loading")){c.button("loading")}a.ajax.check(b.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function i(k,m){var j;var C=k.data();var t=C.amsFormOptions;if(f){var o=f.formDataInitCallback}if(o){delete f.formDataInitCallback}else{o=C.amsFormDataInitCallback}if(o){var u={};if(typeof(o)=="function"){var l=o.call(k,u)}else{l=a.executeFunctionByName(o,k,u)}if(u.veto){j=k.data("ams-submit-button");if(j){j.button("reset")}a.form.finalizeSubmitFooter.call(k);return false}}else{l=C.amsFormData||{}}j=b(k.data("ams-submit-button"));var v,y;if(j){v=j.data("ams-form-handler");y=j.data("ams-form-submit-target")}var r=d||v||C.amsFormHandler||"";if(r.startsWith(window.location.protocol)){var n=r}else{var x=k.attr("action").replace(/#/,"");if(x.startsWith(window.location.protocol)){n=x}else{n=a.ajax.getAddr()+x}n+=r}var B=null;if(C.amsFormInitSubmitTarget){B=b(y||C.amsFormSubmitTarget||"#content");a.executeFunctionByName(C.amsFormInitSubmit||"MyAMS.form.initSubmit",k,B)}else{if(!C.amsFormHideSubmitFooter){a.executeFunctionByName(C.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",k)}}var p=typeof(m.uuid)!="undefined";if(p){if(n.indexOf("X-Progress-ID")<0){n+="?X-Progress-ID="+m.uuid}delete m.uuid}var s={url:n,type:"post",cache:false,data:l,dataType:C.amsFormDatatype,beforeSerialize:function(){if(typeof(tinyMCE)!="undefined"){tinyMCE.triggerSave()}},beforeSubmit:function(E,D){D.data("submitted",true)},error:function(H,D,E,G){if(B){a.executeFunctionByName(C.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",G,B)}if(G.is(":visible")){var F=G.data("ams-submit-button");if(F){F.button("reset")}a.form.finalizeSubmitFooter.call(G)}G.data("submitted",false);G.removeData("ams-submit-button")},iframe:p};var w=C.amsFormDownloadTarget;if(w){var q=b('iframe[name="'+w+'"]');if(!q.exists()){q=b("").hide().attr("name",w).appendTo(k)}s=b.extend({},s,{iframe:true,iframeTarget:q,success:function(D,E,I,H){var G=b(H).parents(".modal-dialog");if(G.exists()){a.dialog.close(H)}else{var J;var F=H.data("ams-submit-button");if(F){J=F.data("ams-form-submit-callback")}if(!J){J=a.getFunctionByName(C.amsFormSubmitCallback)||a.form._submitCallback}J.call(H,D,E,I,H);if(H.is(":visible")&&F){F.button("reset")}H.data("submitted",false);H.removeData("ams-submit-button");H.removeAttr("data-ams-form-changed")}}})}else{s=b.extend({},s,{error:function(H,D,E,G){if(B){a.executeFunctionByName(C.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",G,B)}if(G.is(":visible")){var F=G.data("ams-submit-button");if(F){F.button("reset")}a.form.finalizeSubmitFooter.call(G)}G.data("submitted",false);G.removeData("ams-submit-button")},success:function(D,E,H,G){var I;var F=G.data("ams-submit-button");if(F){I=F.data("ams-form-submit-callback")}if(!I){I=a.getFunctionByName(C.amsFormSubmitCallback)||a.form._submitCallback}I.call(G,D,E,H,G);if(G.is(":visible")&&F){F.button("reset")}G.data("submitted",false);G.removeData("ams-submit-button");G.removeAttr("data-ams-form-changed")},iframe:p})}var A=b.extend({},s,m,t,f);b(k).ajaxSubmit(A);if(w){var z=b(k).parents(".modal-dialog");if(z.exists()){a.dialog.close(k)}else{a.form.finalizeSubmitFooter.call(k);if(j){j.button("reset")}k.data("submitted",false);k.removeData("ams-submit-button");k.removeAttr("data-ams-form-changed")}}}var h=b('INPUT[type="file"]',e).length>0;if(h){a.ajax.check(b.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var g=b.extend({},{uuid:b.progressBar.submit(e)});i(e,g)}else{i(e,{})}});return false},initSubmit:function(e,d){var c=b(this);var f='';if(!d){d=c.data("ams-form-submit-message")}if(d){f+=""+d+""}b(e).html('
    '+f+"
    ");b(e).parents(".hidden").removeClass("hidden")},finalizeSubmitOnError:function(c){b("i",c).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(d){var c=b(this);var f='';if(!d){d=b(this).data("ams-form-submit-message")}if(d){f+=''+d+""}var e=b("footer",c);b("button",e).hide();e.append('
    '+f+"
    ")},finalizeSubmitFooter:function(){var c=b(this);var d=b("footer",c);if(d){b(".row",d).remove();b("button",d).show()}},_submitCallback:function(m,e,d,c){if(c.is(":visible")){a.form.finalizeSubmitFooter.call(c);var g=c.data("ams-submit-button");if(g){g.button("reset")}}var f=c.data();if(f.amsFormDatatype){var j=f.amsFormDatatype}else{var h=a.ajax.getResponse(d);j=h.content_type;m=h.data}if(g){var i=b(g.amsFormSubmitTarget||f.amsFormSubmitTarget||"#content")}else{i=b(f.amsFormSubmitTarget||"#content")}switch(j){case"json":a.ajax.handleJSON(m,c,i);break;case"script":break;case"xml":break;case"html":case"text":default:if(g&&(g.data("ams-keep-modal")!==true)){a.dialog.close(c)}if(!i.exists()){i=b("body")}i.parents(".hidden").removeClass("hidden");b(".alert",i.parents(".alerts-container")).remove();i.css({opacity:"0.0"}).html(m).delay(50).animate({opacity:"1.0"},300);a.initContent(i)}var k=d.getResponseHeader("X-AMS-Callback");if(k){var l=d.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(k,c,l===undefined?{}:JSON.parse(l),d)}},_getSubmitValidators:function(d){var c=new Array();var e=d.data("ams-form-validator");if(e){c.push([d,e])}b("[data-ams-form-validator]",d).each(function(){var f=b(this);c.push([f,f.data("ams-form-validator")])});return c},_checkSubmitValidators:function(e){var g=a.form._getSubmitValidators(e);if(!g.length){return true}var f=new Array();var l=true;for(var i in g){if(!b.isNumeric(i)){continue}var d=g[i];var c=d[0];var j=d[1];var k=a.executeFunctionByName(j,e,c);if(k===false){l=false}else{if(typeof(k)=="string"){f.push(k)}else{if(l.length&&(l.length>0)){f=f.concat(l)}}}}if(f.length>0){var h=f.length==1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"danger",h,f);return false}else{return l}},showErrors:function(c,j){if(typeof(j)=="string"){a.skin.alert(c,"error",a.i18n.ERROR_OCCURED,j)}else{if(j instanceof Array){var f=j.length==1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(c,"error",f,j)}else{b(".state-error",c).removeClass("state-error");f=j.error_header||(j.widgets&&(j.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var k=new Array();var i;for(i in j.messages){if(!b.isNumeric(i)){continue}if(j.messages[i].header){k.push(""+j.messages[i].header+"
    "+j.messages[i].message)}else{k.push(j.messages[i].message||j.messages[i])}}for(i in j.widgets){if(!b.isNumeric(i)){continue}var d=j.widgets[i];var g=b('[name="'+d.name+'"]',c);g.parents("label:first").removeClassPrefix("state-").addClass("state-error").after(''+d.message+"");if(d.label){k.push(d.label+" : "+d.message)}var h=g.parents(".tab-pane").index()+1;if(h>0){var e=b(".nav-tabs",b(g).parents(".tabforms"));b("li:nth-child("+h+")",e).removeClassPrefix("state-").addClass("state-error");b("li.state-error:first a",c).click()}}a.skin.alert(c,j.error_level||"error",f,k,j.error_message)}}}};MyAMS.dialog={_shown_callbacks:[],registerShownCallback:function(f,d){var c;if(d){c=d.objectOrParentWithClass("modal-dialog")}if(c&&c.exists()){var e=c.data("shown-callbacks");if(e===undefined){e=[];c.data("shown-callbacks",e)}}else{e=a.dialog._shown_callbacks}if(e.indexOf(f)<0){e.push(f)}},_hide_callbacks:[],registerHideCallback:function(f,d){var c;if(d){c=d.objectOrParentWithClass("modal-dialog")}if(c&&c.exists()){var e=c.data("hide-callbacks");if(e===undefined){e=[];c.data("hide-callbacks",e)}}else{e=a.dialog._hide_callbacks}if(e.indexOf(f)<0){e.push(f)}},open:function(d,c){a.ajax.check(b.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(b.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(h){if(h){b(document).off("click.modal");b.fn.modal.defaults.spinner=b.fn.modalmanager.defaults.spinner='
    '}if(typeof(d)=="string"){var g={};var f=d}else{g=d.data();f=d.attr("href")||g.amsUrl;var e=a.getFunctionByName(f);if(typeof(e)=="function"){f=e.call(d)}}if(!f){return}b("body").modalmanager("loading");if(f.indexOf("#")==0){b(f).modal("show")}else{b.ajax({url:f,type:"get",cache:g.amsAllowCache===undefined?false:g.amsAllowCache,data:c,success:function(l,k,j){b("body").modalmanager("removeLoading");var m=a.ajax.getResponse(j);var r=m.content_type;var s=m.data;switch(r){case"json":a.ajax.handleJSON(s,b(b(d).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var n=b(s);var p=b(".modal-dialog",n.wrap("
    ").parent());var o=p.data();var q={overflow:o.amsModalOverflow||".modal-viewport",maxHeight:o.amsModalMaxHeight===undefined?function(){return b(window).height()-b(".modal-header",n).outerHeight(true)-b("footer",n).outerHeight(true)-85}:a.getFunctionByName(o.amsModalMaxHeight)};var i=b.extend({},q,o.amsModalOptions);i=a.executeFunctionByName(o.amsModalInitCallback,p,i)||i;b("
    ").addClass("modal fade").append(n).modal(i).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(n)}}})}})})},shown:function(k){function j(m){var n=b(".scrollmarker.top",c);var l=c.scrollTop();if(l>0){n.show()}else{n.hide()}var e=b(".scrollmarker.bottom",c);if(h+l>=c.get(0).scrollHeight){e.hide()}else{e.show()}}var i=k.target;var c=b(".modal-viewport",i);if(c.exists()){var h=parseInt(c.css("max-height"));var f=b.scrollbarWidth();if(c.height()==h){b("
    ").addClass("scrollmarker").addClass("top").css("top",0).css("width",c.width()-f).hide().appendTo(c);b("
    ").addClass("scrollmarker").addClass("bottom").css("top",h-20).css("width",c.width()-f).appendTo(c);c.scroll(j);c.off("resize").on("resize",j)}else{b(".scrollmarker",c).remove()}}var g=b(".modal-dialog",i).data("shown-callbacks");if(g){for(var d in g){g[d].call(i)}}g=a.dialog._shown_callbacks;for(d in g){g[d].call(i)}},close:function(d){var e=d.parents(".modal").data("modal");if(e){var c=b("body").data("modalmanager");if(c&&(c.getOpenModals().indexOf(e)>=0)){e.hide()}}},hidden:function(g){var f=g.target;a.skin.cleanContainer(f);var d=b(".modal-dialog",f).data("hide-callbacks");if(d){for(var c in d){d[c].call(f)}}d=a.dialog._hide_callbacks;for(c in d){d[c].call(f)}}};MyAMS.helpers={select2ClearSelection:function(){var d=b(this);var c=d.parents("label");var e=d.data("ams-select2-target");b('[name="'+e+'"]',c).data("select2").val("")},select2FormatSelection:function(d,c){if(d instanceof Array){b(d).each(function(){if(typeof(this)=="object"){c.append(this.text)}else{c.append(this)}})}else{if(typeof(d)=="object"){c.append(d.text)}else{c.append(d)}}},select2QueryUrlResultsCallback:function(e,d,c){switch(e.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+e.error_message+"

    ",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":b(this).data("select2").dropdown.hide();a.dialog.open(result.location);break;default:return{results:e.results||e,more:e.has_more||false,context:e.context}}},select2QueryMethodSuccessCallback:function(g,d,f){var c=g.result;if(typeof(c)=="string"){try{c=JSON.parse(c)}catch(h){}}switch(c.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"

    "+c.error_message+"

    ",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":b(this).data("select2").dropdown.hide();a.dialog.open(c.location);break;default:f.callback({results:c.results||c,more:c.has_more||false,context:c.context})}},contextMenuHandler:function(f,g){var c=g.data();if(c.toggle=="modal"){a.dialog.open(g)}else{var d=g.attr("href")||c.amsUrl;if(!d||d.startsWith("javascript:")||g.attr("target")){return}a.event.stop();var e=a.getFunctionByName(d);if(typeof(e)=="function"){d=e.call(g,f)}if(typeof(d)=="function"){d.call(g,f)}else{d=d.replace(/\%23/,"#");var f=g.data("ams-target");if(f){a.form.confirmChangedForm(f,function(){a.skin.loadURL(d,f,g.data("ams-link-options"),g.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(d.startsWith("#")){if(d!=location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=d},150)}else{window.location.hash=d}}}else{window.location=d}})}}}},datetimepickerDialogHiddenCallback:function(){b(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};MyAMS.plugins={init:function(e){a.plugins.initData(e);var f=new Array();b("[data-ams-plugins-disabled]",e).each(function(){var h=b(this).data("ams-plugins-disabled").split(/\s+/);for(var i in h){f.push(h[i])}});var d;b("[data-ams-plugins]",e).each(function(){var l=b(this);var h={};if(typeof(l.data("ams-plugins"))==="string"){var m=l.data("ams-plugins").split(/\s+/);for(var j in m){d=m[j];var i={src:l.data("ams-plugin-"+d+"-src"),css:l.data("ams-plugin-"+d+"-css"),callback:l.data("ams-plugin-"+d+"-callback"),register:l.data("ams-plugin-"+d+"-register"),async:l.data("ams-plugin-"+d+"-async")};h[d]=i}}else{h=l.data("ams-plugins")}for(d in h){if(a.plugins.enabled[d]===undefined){var k=h[d];a.getScript(k.src,function(){var p=k.callback;if(p){var o=a.getFunctionByName(p);if(k.register!==false){a.plugins.enabled[d]=o}}else{if(k.register!==false){a.plugins.enabled[d]=null}}var n=k.css;if(n){a.getCSS(n,d+"_css")}},{async:k.async===undefined?true:k.async})}}});for(var c in a.plugins.enabled){if(f.indexOf(c)>=0){continue}var g=a.plugins.enabled[c];if(typeof(g)=="function"){g(e)}}},initData:function(c){b("[data-ams-data]",c).each(function(){var e=b(this);var f=e.data("ams-data");for(var d in f){e.attr("data-"+d,f[d])}})},register:function(d,c,f){if(typeof(c)=="function"){f=c;c=null}c=c||d.name;if(a.plugins.enabled.indexOf(c)>=0){if(window.console){console.warn("Plugin "+c+" is already registered!")}return}if(typeof(d)=="object"){var e=d.src;if(e){a.ajax.check(d.callback,e,function(g){if(g){a.plugins.enabled[c]=a.getFunctionByName(d.callback);if(d.css){a.getCSS(d.css,c+"_css")}if(f){a.executeFunctionByName(f)}}})}else{a.plugins.enabled[c]=a.getFunctionByName(d.callback);if(d.css){a.getCSS(d.css,c+"_css")}if(f){a.executeFunctionByName(f)}}}else{if(typeof(d)=="function"){a.plugins.enabled[c]=d;if(f){a.executeFunctionByName(f)}}}},enabled:{hint:function(c){var d=b(".hint:not(:parents(.nohints))",c);if(d.length>0){a.ajax.check(b.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");d.each(function(){var i=b(this);var h=i.data();var f={html:h.amsHintHtml,title:a.getFunctionByName(h.amsHintTitleGetter)||function(){var j=b(this);return j.attr("original-title")||j.attr(h.amsHintTitleAttr||"title")||(h.amsHintHtml?j.html():j.text())},opacity:h.amsHintOpacity||0.95,gravity:h.amsHintGravity||"sw",offset:h.amsHintOffset||0};var e=b.extend({},f,h.amsHintOptions);e=a.executeFunctionByName(h.amsHintInitCallback,i,e)||e;var g=i.tipsy(e);a.executeFunctionByName(h.amsHintAfterInitCallback,i,g,e)})})}},contextMenu:function(c){var d=b(".context-menu",c);if(d.length>0){d.each(function(){var i=b(this);var h=i.data();var f={menuSelector:h.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var e=b.extend({},f,h.amsContextmenuOptions);e=a.executeFunctionByName(h.amsContextmenuInitCallback,i,e)||e;var g=i.contextMenu(e);a.executeFunctionByName(h.amsContextmenuAfterInitCallback,i,g,e)})}},switcher:function(c){b("LEGEND.switcher",c).each(function(){var e=b(this);var d=e.parent("fieldset");var f=e.data();if(!f.amsSwitcher){b('').prependTo(b(this)).addClass(f.amsSwitcherState=="open"?(f.amsSwitcherMinusClass||"fa-minus"):(f.amsSwitcherPlusClass||"fa-plus"));e.on("click",function(h){h.preventDefault();var g={};e.trigger("ams.switcher.before-switch",[e,g]);if(g.veto){return}if(d.hasClass("switched")){d.removeClass("switched");b(".fa",e).removeClass(f.amsSwitcherPlusClass||"fa-plus").addClass(f.amsSwitcherMinusClass||"fa-minus");e.trigger("ams.switcher.opened",[e]);var i=e.attr("id");if(i){b('legend.switcher[data-ams-switcher-sync="'+i+'"]',d).each(function(){var j=b(this);if(j.parents("fieldset").hasClass("switched")){j.click()}})}}else{d.addClass("switched");b(".fa",e).removeClass(f.amsSwitcherMinusClass||"fa-minus").addClass(f.amsSwitcherPlusClass||"fa-plus");e.trigger("ams.switcher.closed",[e])}});if(f.amsSwitcherState!="open"){d.addClass("switched")}e.data("ams-switcher","on")}})},checker:function(c){b("LEGEND.checker",c).each(function(){var o=b(this);var p=o.parent("fieldset");var f=o.data();if(!f.amsChecker){var d=b('');var i=f.amsCheckerFieldname||("checker_"+a.generateId());var m=i.replace(/\./,"_");var g=f.amsCheckerHiddenPrefix;var h=null;var l=f.amsCheckerHiddenValueOn||"true";var j=f.amsCheckerHiddenValueOff||"false";var e=f.amsCheckerMarker||false;if(g){h=b('').attr("name",g+i).val(f.amsCheckerState=="on"?l:j).prependTo(o)}else{if(e){b('').attr("name",e).attr("value",1).prependTo(o)}}var n=b('').attr("name",i).attr("id",m).data("ams-checker-hidden-input",h).data("ams-checker-init",true).val(f.amsCheckerValue||true).attr("checked",f.amsCheckerState=="on"?"checked":null);if(f.amsCheckerReadonly){n.attr("disabled","disabled")}else{n.on("change",function(s){s.preventDefault();var q={};var t=b(this).is(":checked");o.trigger("ams.checker.before-switch",[o,q]);if(q.veto){b(this).prop("checked",!t);return}a.executeFunctionByName(f.amsCheckerChangeHandler,o,t);if(!f.amsCheckerCancelDefault){var r=n.data("ams-checker-hidden-input");if(t){if(f.amsCheckerMode=="disable"){p.removeAttr("disabled")}else{p.removeClass("switched")}if(r){r.val(l)}b("[data-required]",p).attr("required","required");o.trigger("ams.checker.opened",[o])}else{if(f.amsCheckerMode=="disable"){p.prop("disabled","disabled")}else{p.addClass("switched")}if(r){r.val(j)}b("[data-required]",p).removeAttr("required");o.trigger("ams.checker.closed",[o])}}})}n.appendTo(d);b(">label",o).attr("for",n.attr("id"));d.append("").prependTo(o);var k=b("[required]",p);k.attr("data-required",true);if(f.amsCheckerState=="on"){n.attr("checked",true)}else{if(f.amsCheckerMode=="disable"){p.attr("disabled","disabled")}else{p.addClass("switched")}k.removeAttr("required")}o.data("ams-checker","on")}})},slider:function(c){var d=b(".slider",c);if(d.length>0){a.ajax.check(b.fn.slider,a.baseURL+"ext/bootstrap-slider.min.js",function(){d.each(function(){var h=b(this);var i=h.data();var f={};var e=b.extend({},f,h.data.amsSliderOptions);e=a.executeFunctionByName(i.amsSliderInitCallback,h,e)||e;var g=h.slider(e);a.executeFunctionByName(i.amsSliderAfterInitCallback,h,g,e)})})}},draggable:function(d){var c=b(".draggable",d);if(c.length>0){c.each(function(){var e=b(this);var i=e.data();var g={containment:i.amsDraggableContainment,helper:a.getFunctionByName(i.amsDraggableHelper)||i.amsDraggableHelper,start:a.getFunctionByName(i.amsDraggableStart),stop:a.getFunctionByName(i.amsDraggableStop)};var f=b.extend({},g,i.amsDraggableOptions);f=a.executeFunctionByName(i.amsDraggableInitCallback,e,f)||f;var h=e.draggable(f);e.disableSelection();a.executeFunctionByName(i.amsDraggableAfterInitCallback,e,h,f)})}},sortable:function(c){var d=b(".sortable",c);if(d.length>0){d.each(function(){var i=b(this);var h=i.data();var f={items:h.amsSortableItems,handle:h.amsSortableHandle,connectWith:h.amsSortableConnectwith,start:a.getFunctionByName(h.amsSortableStart),over:a.getFunctionByName(h.amsSortableOver),containment:h.amsSortableContainment,placeholder:h.amsSortablePlaceholder,stop:a.getFunctionByName(h.amsSortableStop)};var e=b.extend({},f,h.amsSortableOptions);e=a.executeFunctionByName(h.amsSortableInitCallback,i,e)||e;var g=i.sortable(e);i.disableSelection();a.executeFunctionByName(h.amsSortableAfterInitCallback,i,g,e)})}},resizable:function(d){var c=b(".resizable",d);if(c.length>0){c.each(function(){var e=b(this);var i=e.data();var g={autoHide:i.amsResizableAutohide===false?true:i.amsResizableAutohide,containment:i.amsResizableContainment,grid:i.amsResizableGrid,handles:i.amsResizableHandles,start:a.getFunctionByName(i.amsResizableStart),stop:a.getFunctionByName(i.amsResizableStop)};var f=b.extend({},g,i.amsResizableOptions);f=a.executeFunctionByName(i.amsResizableInitCallback,e,f)||f;var h=e.resizable(f);e.disableSelection();a.executeFunctionByName(i.amsResizableAfterInitCallback,e,h,f)})}},typeahead:function(d){var c=b(".typeahead",d);if(c.length>0){a.ajax.check(b.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){c.each(function(){var e=b(this);var i=e.data();var g={};var f=b.extend({},g,i.amsTypeaheadOptions);f=a.executeFunctionByName(i.amsTypeaheadInitCallback,e,f)||f;var h=e.typeahead(f);a.executeFunctionByName(i.amsTypeaheadAfterInitCallback,e,h,f)})})}},select2:function(d){var c=b(".select2",d);if(c.length>0){a.ajax.check(b.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){c.each(function(){var e=b(this);var j=e.data();var h={placeholder:j.amsSelect2Placeholder,multiple:j.amsSelect2Multiple,minimumInputLength:j.amsSelect2MinimumInputLength||0,maximumSelectionSize:j.amsSelect2MaximumSelectionSize,openOnEnter:j.amsSelect2EnterOpen===undefined?true:j.amsSelect2EnterOpen,allowClear:j.amsSelect2AllowClear===undefined?true:j.amsSelect2AllowClear,width:j.amsSelect2Width||"100%",initSelection:a.getFunctionByName(j.amsSelect2InitSelection),formatSelection:j.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(j.amsSelect2FormatSelection),formatResult:a.getFunctionByName(j.amsSelect2FormatResult),formatMatches:j.amsSelect2FormatMatches===undefined?function(k){if(k==1){return a.i18n.SELECT2_MATCH}else{return k+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(j.amsSelect2FormatMatches),formatNoMatches:j.amsSelect2FormatResult===undefined?function(k){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(j.amsSelect2FormatResult),formatInputTooShort:j.amsSelect2FormatInputTooShort===undefined?function(k,l){var m=l-k.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,m).replace(/\{1\}/,m==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatInputTooShort),formatInputTooLong:j.amsSelect2FormatInputTooLong===undefined?function(l,k){var m=l.length-k;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,m).replace(/\{1\}/,m==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatInputTooLong),formatSelectionTooBig:j.amsSelect2FormatSelectionTooBig===undefined?function(k){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,k).replace(/\{1\}/,k==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatSelectionTooBig),formatLoadMore:j.amsSelect2FormatLoadMore===undefined?function(k){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(j.amsSelect2FormatLoadMore),formatSearching:j.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(j.amsSelect2FormatSearching),separator:j.amsSelect2Separator||",",tokenSeparators:j.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(j.amsSelect2Tokenizer)};switch(e.context.type){case"text":case"hidden":if(!h.initSelection){var f=e.data("ams-select2-values");if(f){h.initSelection=function(k,m){var l=[];b(k.val().split(h.separator)).each(function(){l.push({id:this,text:f[this]||this})});m(l)}}}break;default:break}if(e.attr("readonly")){if(e.attr("type")=="hidden"){h.query=function(){return[]}}}else{if(j.amsSelect2Query){h.query=a.getFunctionByName(j.amsSelect2Query);h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2QueryUrl){h.ajax={url:j.amsSelect2QueryUrl,quietMillis:j.amsSelect2QuietMillis||200,type:j.amsSelect2QueryType||"POST",dataType:j.amsSelect2QueryDatatype||"json",data:function(m,n,l){var k={};k[j.amsSelect2QueryParamName||"query"]=m;k[j.amsSelect2PageParamName||"page"]=n;k[j.amsSelect2ContextParamName||"context"]=l;return b.extend({},k,j.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2QueryMethod){h.query=function(k){var l={url:j.amsSelect2MethodTarget||a.jsonrpc.getAddr(),type:j.amsSelect2MethodType||"POST",cache:false,method:j.amsSelect2QueryMethod,params:j.amsSelect2QueryParams||{},success:function(n,m){return a.helpers.select2QueryMethodSuccessCallback.call(e,n,m,k)},error:a.error.show};l.params[j.amsSelect2QueryParamName||"query"]=k.term;l.params[j.amsSelect2PageParamName||"page"]=k.page;l.params[j.amsSelect2ContextParamName||"context"]=k.context;l=b.extend({},l,j.amsSelect2QueryOptions);l=a.executeFunctionByName(j.amsSelect2QueryInitCallback,e,l)||l;a.ajax.check(b.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+(a.devmode?".js":".min.js"),function(){b.jsonRpc(l)})};h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2Tags){h.tags=j.amsSelect2Tags}else{if(j.amsSelect2Data){h.data=j.amsSelect2Data}}}}}}if(j.amsSelect2EnableFreeTags){h.createSearchChoice=function(k){return{id:k,text:(j.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+k}}}var g=b.extend({},h,j.amsSelect2Options);g=a.executeFunctionByName(j.amsSelect2InitCallback,e,g)||g;var i=e.select2(g);a.executeFunctionByName(j.amsSelect2AfterInitCallback,e,i,g);if(e.hasClass("ordered")){a.ajax.check(b.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){e.select2Sortable({bindOrder:"sortableStop"})})}e.on("change",function(){var k=b(e.get(0).form).data("validator");if(k!==undefined){b(e).valid()}})})})}},maskedit:function(d){var c=b("[data-mask]",d);if(c.length>0){a.ajax.check(b.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.3.1.min.js",function(){c.each(function(){var e=b(this);var i=e.data();var g={placeholder:i.amsMaskeditPlaceholder||"X"};var f=b.extend({},g,i.amsMaskeditOptions);f=a.executeFunctionByName(i.amsMaskeditInitCallback,e,f)||f;var h=e.mask(e.attr("data-mask"),f);a.executeFunctionByName(i.amsMaskeditAfterInitCallback,e,h,f)})})}},datepicker:function(c){var d=b(".datepicker",c);if(d.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}d.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},datetimepicker:function(d){var c=b(".datetimepicker",d);if(c.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}c.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},timepicker:function(d){var c=b(".timepicker",d);if(c.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}c.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},colorpicker:function(c){var d=b(".colorpicker",c);if(d.length>0){a.ajax.check(b.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}d.each(function(){var f=b(this);var j=f.data();var h={position:j.amsColorpickerPosition||f.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var g=b.extend({},h,j.amsColorpickerOptions);g=a.executeFunctionByName(j.amsColorpickerInitCallback,f,g)||g;var i=f.minicolors(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},validate:function(d){var c=b("FORM:not([novalidate])",d);if(c.length>0){a.ajax.check(b.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(g){if(g){b.validator.setDefaults({highlight:function(h){b(h).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(h){b(h).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(i,j){var h=j.parents("label:first");if(h.length){i.insertAfter(h)}else{i.insertAfter(j)}}});if(a.plugins.i18n){for(var e in a.plugins.i18n.validate){var f=a.plugins.i18n.validate[e];if((typeof(f)=="string")&&(f.indexOf("{0}")>-1)){a.plugins.i18n.validate[e]=b.validator.format(f)}}b.extend(b.validator.messages,a.plugins.i18n.validate)}}c.each(function(){var k=b(this);var l=k.data();var i={ignore:null,submitHandler:k.attr("data-async")!==undefined?l.amsFormSubmitHandler===undefined?function(){b(".state-error",k).removeClass("state-error");a.ajax.check(b.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(k)}:a.getFunctionByName(l.amsFormSubmitHandler):undefined,invalidHandler:k.attr("data-async")!==undefined?l.amsFormInvalidHandler===undefined?function(q,p){b(".state-error",k).removeClass("state-error");for(var n in p.errorList){var m=p.errorList[n];var o=b(m.element).parents(".tab-pane").index()+1;if(o>0){var r=b(".nav-tabs",b(m.element).parents(".tabforms"));b("li:nth-child("+o+")",r).removeClassPrefix("state-").addClass("state-error");b("li.state-error:first a",r).click()}}}:a.getFunctionByName(l.amsFormInvalidHandler):undefined};var h=b.extend({},i,l.amsValidateOptions);h=a.executeFunctionByName(l.amsValidateInitCallback,k,h)||h;var j=k.validate(h);a.executeFunctionByName(l.amsValidateAfterInitCallback,k,j,h)})})}},datatable:function(d){var c=b(".datatable",d);if(c.length>0){a.ajax.check(b.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(e){b(c).each(function(){a.ajax.check(b.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var B=b(this);var F=B.data();var D=(F.amsDatatableExtensions||"").split(/\s+/);var k=F.amsDatatableSdom||"W"+((D.indexOf("colreorder")>=0||D.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(D.indexOf("colvis")>=0?"C":"")+((F.amsDatatablePagination===false||F.amsDatatablePaginationSize===false)?"":"L")+(F.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(D.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(F.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var n;var g=F.amsDatatableSorting;if(typeof(g)==="string"){var E=g.split(";");g=[];for(n in E){var v=E[n].split(",");v[0]=parseInt(v[0]);g.push(v)}}var f=[];var r=b("th",B).listattr("data-ams-datatable-stype");for(n in r){var q=r[n];if(q){var h=f[n]||{};h.sType=q;f[n]=h}}var x={bJQueryUI:false,bFilter:F.amsDatatableGlobalFilter!==false,bPaginate:F.amsDatatablePagination!==false,bInfo:F.amsDatatableInfo!==false,bSort:F.amsDatatableSort!==false,aaSorting:g,aoColumns:f.length>0?f:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:F.amsDatatableDisplayLength||25,sPaginationType:F.amsDatatablePaginationType||"bootstrap_full",sDom:k,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(I,H){b(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' ')}};var C=b.extend({},x,F.amsDatatableOptions);if(D.length>0){for(n in D){switch(D[n]){case"autofill":a.ajax.check(b.fn.dataTable.AutoFill,a.baseURL+"ext/jquery-dataTables-autoFill"+a.devext+".js");break;case"columnfilter":a.ajax.check(b.fn.columnFilter,a.baseURL+"ext/jquery-dataTables-columnFilter"+a.devext+".js");break;case"colreorder":a.ajax.check(b.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorder"+a.devext+".js");break;case"colreorderwithresize":a.ajax.check(b.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorderWithResize"+a.devext+".js");break;case"colvis":a.ajax.check(b.fn.dataTable.ColVis,a.baseURL+"ext/jquery-dataTables-colVis"+a.devext+".js");var s={activate:"click",sAlign:"right"};C.oColVis=b.extend({},s,F.amsDatatableColvisOptions);break;case"editable":a.ajax.check(b.fn.editable,a.baseURL+"ext/jquery-jeditable"+a.devext+".js");a.ajax.check(b.fn.makeEditable,a.baseURL+"ext/jquery-dataTables-editable"+a.devext+".js");break;case"fixedcolumns":a.ajax.check(b.fn.dataTable.FixedColumns,a.baseURL+"ext/jquery-dataTables-fixedColumns"+a.devext+".js");break;case"fixedheader":a.ajax.check(b.fn.dataTable.FixedHeader,a.baseURL+"ext/jquery-dataTables-fixedHeader"+a.devext+".js");break;case"keytable":a.ajax.check(window.KeyTable,a.baseURL+"ext/jquery-dataTables-keyTable"+a.devext+".js");break;case"rowgrouping":a.ajax.check(b.fn.rowGrouping,a.baseURL+"ext/jquery-dataTables-rowGrouping"+a.devext+".js");break;case"rowreordering":a.ajax.check(b.fn.rowReordering,a.baseURL+"ext/jquery-dataTables-rowReordering"+a.devext+".js");break;case"scroller":a.ajax.check(b.fn.dataTable.Scroller,a.baseURL+"ext/jquery-dataTables-scroller"+a.devext+".js");break;default:break}}}C=a.executeFunctionByName(F.amsDatatableInitCallback,B,C)||C;try{var j=B.dataTable(C);a.executeFunctionByName(F.amsDatatableAfterInitCallback,B,j,C);if(D.length>0){for(n in D){switch(D[n]){case"autofill":var G=b.extend({},F.amsDatatableAutofillOptions,C.autofill);G=a.executeFunctionByName(F.amsDatatableAutofillInitCallback,B,G)||G;B.data("ams-autofill",F.amsDatatableAutofillConstructor===undefined?new b.fn.dataTable.AutoFill(B,G):a.executeFunctionByName(F.amsDatatableAutofillConstructor,B,j,G));break;case"columnfilter":var m={sPlaceHolder:"head:after"};var o=b.extend({},m,F.amsDatatableColumnfilterOptions,C.columnfilter);o=a.executeFunctionByName(F.amsDatatableColumnfilterInitCallback,B,o)||o;B.data("ams-columnfilter",F.amsDatatableColumnfilterConstructor===undefined?j.columnFilter(o):a.executeFunctionByName(F.amsDatatableColumnfilterConstructor,B,j,o));break;case"editable":var p=b.extend({},F.amsDatatableEditableOptions,C.editable);p=a.executeFunctionByName(F.amsDatatableEditableInitCallback,B,p)||p;B.data("ams-editable",F.amsDatatableEditableConstructor===undefined?B.makeEditable(p):a.executeFunctionByName(F.amsDatatableEditableConstructor,B,j,p));break;case"fixedcolumns":var i=b.extend({},F.amsDatatableFixedcolumnsOptions,C.fixedcolumns);i=a.executeFunctionByName(F.amsDatatableFixedcolumnsInitCallback,B,i)||i;B.data("ams-fixedcolumns",F.amsDatatableFixedcolumnsConstructor===undefined?new b.fn.dataTable.FixedColumns(B,i):a.executeFunctionByName(F.amsDatatableFixedcolumnsConstructor,B,j,i));break;case"fixedheader":var y=b.extend({},F.amsDatatableFixedheaderOptions,C.fixedheader);y=a.executeFunctionByName(F.amsDatatableFixedheadeInitCallback,B,y)||y;B.data("ams-fixedheader",F.amsDatatableFixedheaderConstructor===undefined?new b.fn.dataTable.FixedHeader(B,y):a.executeFunctionByName(F.amsDatatableFixedheaderConstructor,B,j,y));break;case"keytable":var l={table:B.get(0),datatable:j};var w=b.extend({},l,F.amsDatatableKeytableOptions,C.keytable);w=a.executeFunctionByName(F.amsDatatableKeytableInitCallback,B,w)||w;B.data("ams-keytable",F.amsDatatableKeytableConstructor===undefined?new KeyTable(w):a.executeFunctionByName(F.amsDatatableKeytableConstructor,B,j,w));break;case"rowgrouping":var u=b.extend({},F.amsDatatableRowgroupingOptions,C.rowgrouping);u=a.executeFunctionByName(F.amsDatatableRowgroupingInitCallback,B,u)||u;B.data("ams-rowgrouping",F.amsDatatableRowgroupingConstructor===undefined?B.rowGrouping(u):a.executeFunctionByName(F.amsDatatableRowgroupingConstructor,B,j,u));break;case"rowreordering":var t=b.extend({},F.amsDatatableRowreorderingOptions,C.rowreordering);t=a.executeFunctionByName(F.amsDatatableRowreorderingInitCallback,B,t)||t;B.data("ams-rowreordering",F.amsDatatableRowreorderingConstructor===undefined?B.rowReordering(t):a.executeFunctionByName(F.amsDatatableRowreorderingConstructor,B,j,t));break;default:break}}}var z=(F.amsDatatableFinalizeCallback||"").split(/\s+/);if(z.length>0){for(n in z){a.executeFunctionByName(z[n],B,j,C)}}}catch(A){}})})}},tablednd:function(d){var c=b(".table-dnd",d);if(c.length>0){a.ajax.check(b.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(e){c.each(function(){var i=b(this);b(i).on("mouseover","tr",function(){b(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){b(this.cells[0]).removeClass("drag-handle")});var j=i.data();var g={onDragClass:j.amsTabledndDragClass||"dragging-row",onDragStart:j.amsTabledndDragStart,dragHandle:j.amsTabledndDragHandle,scrollAmount:j.amsTabledndScrollAmount,onAllowDrop:j.amsTabledndAllowDrop,onDrop:j.amsTabledndDrop||function(m,o){var l=j.amsTabledndDropTarget;if(l){var k=[];b(m.rows).each(function(){var p=b(this).data("ams-element-name");if(p){k.push(p)}});var n=a.getFunctionByName(l);if(typeof(n)=="function"){n.call(i,m,k)}else{a.ajax.post(l,{names:JSON.stringify(k)})}}return false}};var f=b.extend({},g,j.amsTabledndOptions);f=a.executeFunctionByName(j.amsTabledndInitCallback,i,f)||f;var h=i.tableDnD(f);a.executeFunctionByName(j.amsTabledndAfterInitCallback,i,h,f)})})}},imgareaselect:function(d){var c=b(".imgareaselect",d);if(c.length>0){a.ajax.check(b.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.10"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".css")}c.each(function(){var k=b(this);var j=k.data();var h=j.amsImgareaselectParent?k.parents(j.amsImgareaselectParent):"body";var g={instance:true,handles:true,parent:h,x1:j.amsImgareaselectX1||0,y1:j.amsImgareaselectY1||0,x2:j.amsImgareaselectX2||j.amsImgareaselectImageWidth,y2:j.amsImgareaselectY2||j.amsImgareaselectImageHeight,imageWidth:j.amsImgareaselectImageWidth,imageHeight:j.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:j.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(j.amsImgareaselectSelectEnd)||function(l,m){var n=j.amsImgareaselectTargetField||"image_";b('input[name="'+n+'x1"]',h).val(m.x1);b('input[name="'+n+'y1"]',h).val(m.y1);b('input[name="'+n+'x2"]',h).val(m.x2);b('input[name="'+n+'y2"]',h).val(m.y2)}};var f=b.extend({},g,j.amsImgareaselectOptions);f=a.executeFunctionByName(j.amsImgareaselectInitCallback,k,f)||f;var i=k.imgAreaSelect(f);a.executeFunctionByName(j.amsImgareaselectAfterInitCallback,k,i,f);setTimeout(function(){i.update()},250)})})}},fancybox:function(c){var d=b(".fancybox",c);if(d.length>0){a.ajax.check(b.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}d.each(function(){var f=b(this);var m=f.data();var l=(m.amsFancyboxHelpers||"").split(/\s+/);if(l.length>0){for(var g in l){var k=l[g];switch(k){case"buttons":a.ajax.check(b.fancybox.helpers.buttons,a.baseURL+"ext/fancybox-helpers/fancybox-buttons"+a.devext+".js");break;case"thumbs":a.ajax.check(b.fancybox.helpers.thumbs,a.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+a.devext+".js");break;case"media":a.ajax.check(b.fancybox.helpers.media,a.baseURL+"ext/fancybox-helpers/fancybox-media"+a.devext+".js");break;default:break}}}var i={type:m.amsFancyboxType,padding:m.amsFancyboxPadding||10,margin:m.amsFancyboxMargin||10,beforeLoad:a.getFunctionByName(m.amsFancyboxBeforeLoad)||function(){this.title=a.executeFunctionByName(m.amsFancyboxTitleGetter,this)||b(this.element).attr("original-title")||b(this.element).attr("title")},helpers:{title:{type:"inside"}}};var h=b.extend({},i,m.amsFancyboxOptions);h=a.executeFunctionByName(m.amsFancyboxInitCallback,f,h)||h;var j=f.fancybox(h);a.executeFunctionByName(m.amsFancyboxAfterInitCallback,f,j,h)})})}},graphs:function(d){var c=b(".sparkline",d);if(c.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(c)})}},scrollbars:function(c){var d=b(".scrollbar",c);if(d.length>0){a.ajax.check(b.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(b.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}d.each(function(){var j=b(this);var i=j.data();var g={theme:i.amsScrollbarTheme||"light"};var f=b.extend({},g,i.amsScrollbarOptions);f=a.executeFunctionByName(i.amsScrollbarInitCallback,j,f)||f;var h=j.mCustomScrollbar(f);a.executeFunctionByName(i.amsScrollbarAfterInitCallback,j,h,f)})})})}}}};MyAMS.callbacks={init:function(c){b("[data-ams-callback]",c).each(function(){var d=this;var e=b(d).data();var f=a.getFunctionByName(e.amsCallback);if(f===undefined){if(e.amsCallbackSource){a.getScript(e.amsCallbackSource,function(){a.executeFunctionByName(e.amsCallback,d,e.amsCallbackOptions)})}else{if(window.console){console.warn("Undefined callback: "+e.amsCallback)}}}else{f.call(d,e.amsCallbackOptions)}})},alert:function(k){var f=b(this).data();var c=b.extend({},k,f.amsAlertOptions);var i=b(f.amsAlertParent||c.parent||this);var e=f.amsAlertStatus||c.status||"info";var g=f.amsAlertHeader||c.header;var j=f.amsAlertMessage||c.message;var h=f.amsAlertSubtitle||c.subtitle;var d=f.amsAlertMargin===undefined?(c.margin===undefined?false:c.margin):f.amsAlertMargin;a.skin.alert(i,e,g,j,h,d)},messageBox:function(d){var g=b(this).data();var f=b.extend({},d,g.amsMessageboxOptions);var e=b.extend({},f,{title:g.amsMessageboxTitle||f.title||"",content:g.amsMessageboxContent||f.content||"",icon:g.amsMessageboxIcon||f.icon,number:g.amsMessageboxNumber||f.number,timeout:g.amsMessageboxTimeout||f.timeout});var c=g.amsMessageboxStatus||f.status||"info";var h=a.getFunctionByName(g.amsMessageboxCallback||f.callback);a.skin.messageBox(c,e,h)},smallBox:function(d){var g=b(this).data();var f=b.extend({},d,g.amsSmallboxOptions);var e=b.extend({},f,{title:g.amsSmallboxTitle||f.title||"",content:g.amsSmallboxContent||f.content||"",icon:g.amsSmallboxIcon||f.icon,iconSmall:g.amsSmallboxIconSmall||f.iconSmall,timeout:g.amsSmallboxTimeout||f.timeout});var c=g.amsSmallboxStatus||f.status||"info";var h=a.getFunctionByName(g.amsSmallboxCallback||f.callback);a.skin.smallBox(c,e,h)}};MyAMS.events={init:function(c){b("[data-ams-events-handlers]",c).each(function(){var e=b(this);var d=e.data("ams-events-handlers");for(var f in d){e.on(f,a.getFunctionByName(d[f]))}})}};MyAMS.container={changeOrder:function(d,e){var c=b('input[name="'+b(this).data("ams-input-name")+'"]',b(this));c.val(e.join(";"))},deleteElement:function(c){return function(){var d=b(this);MyAMS.skin.bigBox({title:a.i18n.WARNING,content:'  '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(g){if(g==a.i18n.BTN_OK){var i=d.parents("table");var f=i.data("ams-location")||"";var j=d.parents("tr");var h=j.data("ams-delete-target")||i.data("ams-delete-target")||"delete-element.json";var e=j.data("ams-element-name");MyAMS.ajax.post(f+"/"+h,{object_name:e},function(k,l){if(k.status=="success"){if(i.hasClass("datatable")){i.dataTable().fnDeleteRow(j[0])}else{j.remove()}}})}})}}};MyAMS.skin={_setPageHeight:function(){var e=b("#main").height();var c=a.left_panel.height();var d=b(window).height()-a.navbar_height;if(e>d){a.left_panel.css("min-height",e);a.root.css("min-height",e+a.navbar_height)}else{a.left_panel.css("min-height",d);a.root.css("min-height",d)}},_checkMobileWidth:function(){if(b(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){$this=b("#activity > .badge");if(parseInt($this.text())>0){$this.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{$this.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},_initDesktopWidgets:function(c){if(a.enable_widgets){var d=b(".ams-widget",c);if(d.length>0){a.ajax.check(b.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){d.each(function(){var h=b(this);var g=h.data();var f={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var e=b.extend({},f,g.amsWidgetOptions);e=a.executeFunctionByName(g.amsWidgetInitcallback,h,e)||e;h.MyAMSWidget(e)});MyAMSWidget.initWidgetsGrid(b(".ams-widget-grid",c))})}}},_initMobileWidgets:function(c){if(a.enable_mobile&&a.enable_widgets){a.skin._initDesktopWidgets(c)}},alert:function(j,d,e,k,i,c){b(".alert",j).remove();if(d=="error"){d="danger"}var g='

    '+e+"

    "+(i?("

    "+i+"

    "):"");if(typeof(k)=="string"){g+="
    • "+k+"
    "}else{if(k){g+="
      ";for(var f in k){if(!b.isNumeric(f)){continue}g+="
    • "+k[f]+"
    • "}g+="
    "}}g+="
    ";var h=b(g).prependTo(j);if(j.exists){a.ajax.check(b.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){b.scrollTo(j,{offset:{top:-50}})})}},bigBox:function(c,d){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(c,d)})},messageBox:function(c,d,e){if(typeof(c)=="object"){e=d;d=c||{};c="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(c){case"error":case"danger":d.color="#C46A69";break;case"warning":d.color="#C79121";break;case"success":d.color="#739E73";break;default:d.color=d.color||"#3276B1"}d.sound=false;a.notify.bigBox(d,e)})},smallBox:function(c,d,e){if(typeof(c)=="object"){e=d;d=c||{};c="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(c){case"error":case"danger":d.color="#C46A69";break;case"warning":d.color="#C79121";break;case"success":d.color="#739E73";break;default:d.color=d.color||"#3276B1"}d.sound=false;a.notify.smallBox(d,e)})},_drawBreadCrumb:function(){var c=b("#ribbon OL.breadcrumb");c.empty().append(b("
  • ").append(b("").text(a.i18n.HOME).attr("href",b('nav a[href!="#"]:first').attr("href"))));b("nav LI.active >A").each(function(){var f=b(this);var d=b.trim(f.clone().children(".badge").remove().end().text());var e=b("
  • ").append(f.attr("href").replace(/^#/,"")?b("").html(d).attr("href",f.attr("href")):d);c.append(e)})},checkURL:function(){function c(i){b("nav .active").removeClass("active");i.addClass("open").addClass("active");i.parents("li").addClass("open active").children("ul").addClass("active").show();i.parents("li:first").removeClass("open");i.parents("ul").addClass(i.attr("href").replace(/^#/,"")?"active":"").show()}var f=location.hash;var e=f.replace(/^#/,"");if(e){var d=b("#content");if(!d.exists()){d=b("body")}var g=b('nav A[href="'+f+'"]');if(g.exists()){c(g)}a.skin.loadURL(e,d);document.title=b("[data-ams-page-title]:first",d).data("ams-page-title")||g.attr("title")||document.title}else{var h=b("[data-ams-active-menu]").data("ams-active-menu");if(h){g=b('nav A[href="'+h+'"]')}else{g=b('nav >UL >LI >A[href!="#"]').first()}if(g.exists()){c(g);if(h){a.skin._drawBreadCrumb()}else{window.location.hash=g.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(d){var c=a.skin._clean_callbacks;if(c.indexOf(d)<0){c.push(d)}},cleanContainer:function(c){var e=a.skin._clean_callbacks;for(var d in e){e[d].call(c)}},loadURL:function(e,c,d,h){if(e.startsWith("#")){e=e.substr(1)}if(typeof(d)=="function"){h=d;d={}}c=b(c);var g={type:"GET",url:e,dataType:"html",cache:false,beforeSend:function(){a.skin.cleanContainer(c);c.html('

    Loading...

    ');if(c[0]==b("#content")[0]){a.skin._drawBreadCrumb();document.title=b(".breadcrumb LI:last-child").text();b("html, body").animate({scrollTop:0},"fast")}else{c.animate({scrollTop:0},"fast")}},success:function(m,j,l){if(h){a.executeFunctionByName(h,this,m,j,l,d)}else{var k=a.ajax.getResponse(l);var n=k.content_type;var i=k.data;b(".loading",c).remove();switch(n){case"json":a.ajax.handleJSON(i,c);break;case"script":break;case"xml":break;case"html":case"text":default:c.parents(".hidden").removeClass("hidden");b(".alert",c.parents(".alerts-container")).remove();c.css({opacity:"0.0"}).html(m).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(c)}if(d&&d.afterLoadCallback){a.executeFunctionByName(d.afterLoadCallback,this)}}},error:function(k,j,i){c.html('

    '+a.i18n.ERROR+i+"

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