first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
/**
* Unified filter page JS module for the course participants page.
*
* @module tool_policy/acceptances_filter
* @copyright 2017 Jun Pataleta
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("tool_policy/acceptances_filter",["jquery","core/form-autocomplete","core/str","core/notification"],(function($,Autocomplete,Str,Notification){var SELECTORS_UNIFIED_FILTERS="#unified-filters";return{init:function(){!function(){M.util.js_pending("acceptances_filter_datasource"),Str.get_strings([{key:"filterplaceholder",component:"tool_policy"},{key:"nofiltersapplied",component:"tool_policy"}]).done((function(langstrings){var placeholder=langstrings[0],noSelectionString=langstrings[1];Autocomplete.enhance(SELECTORS_UNIFIED_FILTERS,!0,"tool_policy/acceptances_filter_datasource",placeholder,!1,!0,noSelectionString,!0).then((function(){M.util.js_complete("acceptances_filter_datasource")})).fail(Notification.exception)})).fail(Notification.exception);var last=$(SELECTORS_UNIFIED_FILTERS).val();$(SELECTORS_UNIFIED_FILTERS).on("change",(function(){var current=$(this).val(),listoffilters=[],textfilters=[],updatedselectedfilters=!1;if($.each(current,(function(index,catoption){var catandoption=catoption.split(":",2);if(2!==catandoption.length)return textfilters.push(catoption),!0;var category=catandoption[0],option=catandoption[1];return void 0!==listoffilters[category]&&(updatedselectedfilters=!0),listoffilters[category]=option,!0})),updatedselectedfilters){var updatefilters=[];for(var category in listoffilters)updatefilters.push(category+":"+listoffilters[category]);updatefilters=updatefilters.concat(textfilters),$(this).val(updatefilters)}last.join(",")!=current.join(",")&&this.form.submit()}))}()},getForm:function(){return $(SELECTORS_UNIFIED_FILTERS).closest("form")}}}));
//# sourceMappingURL=acceptances_filter.min.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
/**
* Datasource for the tool_policy/acceptances_filter.
*
* This module is compatible with core/form-autocomplete.
*
* @copyright 2017 Jun Pataleta
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("tool_policy/acceptances_filter_datasource",["jquery","core/ajax","core/notification"],(function($,Ajax,Notification){return{list:function(selector,query){var filteredOptions=[],el=$(selector),originalOptions=$(selector).data("originaloptionsjson"),selectedFilters=el.val();$.each(originalOptions,(function(index,option){return""!==query.trim()&&-1===option.label.toLocaleLowerCase().indexOf(query.toLocaleLowerCase())||$.inArray(option.value,selectedFilters)>-1||filteredOptions.push(option),!0}));var deferred=new $.Deferred;return deferred.resolve(filteredOptions),deferred.promise()},processResults:function(selector,results){var options=[];return $.each(results,(function(index,data){options.push({value:data.value,label:data.label})})),options},transport:function(selector,query,callback){this.list(selector,query).then(callback).catch(Notification.exception)}}}));
//# sourceMappingURL=acceptances_filter_datasource.min.js.map
@@ -0,0 +1 @@
{"version":3,"file":"acceptances_filter_datasource.min.js","sources":["../src/acceptances_filter_datasource.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Datasource for the tool_policy/acceptances_filter.\n *\n * This module is compatible with core/form-autocomplete.\n *\n * @copyright 2017 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax', 'core/notification'], function($, Ajax, Notification) {\n\n return /** @alias module:tool_policy/acceptances_filter_datasource */ {\n /**\n * List filter options.\n *\n * @param {String} selector The select element selector.\n * @param {String} query The query string.\n * @return {Promise}\n */\n list: function(selector, query) {\n var filteredOptions = [];\n\n var el = $(selector);\n var originalOptions = $(selector).data('originaloptionsjson');\n var selectedFilters = el.val();\n $.each(originalOptions, function(index, option) {\n // Skip option if it does not contain the query string.\n if (query.trim() !== '' && option.label.toLocaleLowerCase().indexOf(query.toLocaleLowerCase()) === -1) {\n return true;\n }\n // Skip filters that have already been selected.\n if ($.inArray(option.value, selectedFilters) > -1) {\n return true;\n }\n\n filteredOptions.push(option);\n return true;\n });\n\n var deferred = new $.Deferred();\n deferred.resolve(filteredOptions);\n\n return deferred.promise();\n },\n\n /**\n * Process the results for auto complete elements.\n *\n * @param {String} selector The selector of the auto complete element.\n * @param {Array} results An array or results.\n * @return {Array} New array of results.\n */\n processResults: function(selector, results) {\n var options = [];\n $.each(results, function(index, data) {\n options.push({\n value: data.value,\n label: data.label\n });\n });\n return options;\n },\n\n /**\n * Source of data for Ajax element.\n *\n * @param {String} selector The selector of the auto complete element.\n * @param {String} query The query string.\n * @param {Function} callback A callback function receiving an array of results.\n */\n /* eslint-disable promise/no-callback-in-promise */\n transport: function(selector, query, callback) {\n this.list(selector, query).then(callback).catch(Notification.exception);\n }\n };\n\n});\n"],"names":["define","$","Ajax","Notification","list","selector","query","filteredOptions","el","originalOptions","data","selectedFilters","val","each","index","option","trim","label","toLocaleLowerCase","indexOf","inArray","value","push","deferred","Deferred","resolve","promise","processResults","results","options","transport","callback","then","catch","exception"],"mappings":";;;;;;;;AAwBAA,mDAAO,CAAC,SAAU,YAAa,sBAAsB,SAASC,EAAGC,KAAMC,oBAEG,CAQlEC,KAAM,SAASC,SAAUC,WACjBC,gBAAkB,GAElBC,GAAKP,EAAEI,UACPI,gBAAkBR,EAAEI,UAAUK,KAAK,uBACnCC,gBAAkBH,GAAGI,MACzBX,EAAEY,KAAKJ,iBAAiB,SAASK,MAAOC,cAEf,KAAjBT,MAAMU,SAA0F,IAAzED,OAAOE,MAAMC,oBAAoBC,QAAQb,MAAMY,sBAItEjB,EAAEmB,QAAQL,OAAOM,MAAOV,kBAAoB,GAIhDJ,gBAAgBe,KAAKP,SAPV,SAWXQ,SAAW,IAAItB,EAAEuB,gBACrBD,SAASE,QAAQlB,iBAEVgB,SAASG,WAUpBC,eAAgB,SAAStB,SAAUuB,aAC3BC,QAAU,UACd5B,EAAEY,KAAKe,SAAS,SAASd,MAAOJ,MAC5BmB,QAAQP,KAAK,CACTD,MAAOX,KAAKW,MACZJ,MAAOP,KAAKO,WAGbY,SAWXC,UAAW,SAASzB,SAAUC,MAAOyB,eAC5B3B,KAAKC,SAAUC,OAAO0B,KAAKD,UAAUE,MAAM9B,aAAa+B"}
+10
View File
@@ -0,0 +1,10 @@
/**
* Add policy consent modal to the page
*
* @module tool_policy/acceptmodal
* @copyright 2018 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("tool_policy/acceptmodal",["jquery","core/str","core/modal_save_cancel","core/modal_events","core/notification","core/fragment","core/ajax","core_form/changechecker"],(function($,Str,ModalSaveCancel,ModalEvents,Notification,Fragment,Ajax,FormChangeChecker){var AcceptOnBehalf=function(contextid){this.contextid=contextid,this.init()};return AcceptOnBehalf.prototype.modal=null,AcceptOnBehalf.prototype.contextid=-1,AcceptOnBehalf.prototype.currentTrigger=null,AcceptOnBehalf.prototype.triggers={SINGLE:"a[data-action=acceptmodal]",BULK:"input[data-action=acceptmodal]"},AcceptOnBehalf.prototype.init=function(){$(this.triggers.SINGLE).on("click",function(e){e.preventDefault(),this.currentTrigger=$(e.currentTarget);var href=$(e.currentTarget).attr("href"),formData=href.slice(href.indexOf("?")+1);this.showFormModal(formData)}.bind(this)),$(this.triggers.BULK).on("click",function(e){e.preventDefault(),this.currentTrigger=$(e.currentTarget);var form=$(e.currentTarget).closest("form");if(form.find('input[type=checkbox][name="userids[]"]:checked').length){var formData=form.serialize();this.showFormModal(formData)}else Str.get_strings([{key:"notice"},{key:"selectusersforconsent",component:"tool_policy"},{key:"ok"}]).then((function(strings){Notification.alert(strings[0],strings[1],strings[2])})).fail(Notification.exception)}.bind(this))},AcceptOnBehalf.prototype.showFormModal=function(formData){for(var action,params=formData.split("&"),i=0;i<params.length;i++){var pair=params[i].split("=");"action"==pair[0]&&(action=pair[1])}Str.get_strings([{key:"statusformtitleaccept",component:"tool_policy"},{key:"iagreetothepolicy",component:"tool_policy"},{key:"statusformtitlerevoke",component:"tool_policy"},{key:"irevokethepolicy",component:"tool_policy"},{key:"statusformtitledecline",component:"tool_policy"},{key:"declinethepolicy",component:"tool_policy"}]).then(function(strings){var title,saveText;return"accept"==action?(title=strings[0],saveText=strings[1]):"revoke"==action?(title=strings[2],saveText=strings[3]):"decline"==action&&(title=strings[4],saveText=strings[5]),ModalSaveCancel.create({title:title,body:""}).then(function(modal){this.modal=modal,this.setupFormModal(formData,saveText)}.bind(this))}.bind(this)).catch(Notification.exception)},AcceptOnBehalf.prototype.setupFormModal=function(formData,saveText){var modal=this.modal;modal.setLarge(),modal.setSaveButtonText(saveText),modal.getRoot().on(ModalEvents.hidden,this.destroy.bind(this)),modal.setBody(this.getBody(formData)),modal.getRoot().on(ModalEvents.save,this.submitForm.bind(this)),modal.getRoot().on("submit","form",this.submitFormAjax.bind(this)),modal.show()},AcceptOnBehalf.prototype.getBody=function(formData){void 0===formData&&(formData={});var params={jsonformdata:JSON.stringify(formData)};return Fragment.loadFragment("tool_policy","accept_on_behalf",this.contextid,params)},AcceptOnBehalf.prototype.submitFormAjax=function(e){e.preventDefault();var formData=this.modal.getRoot().find("form").serialize();Ajax.call([{methodname:"tool_policy_submit_accept_on_behalf",args:{jsonformdata:JSON.stringify(formData)}}])[0].done(function(data){data.validationerrors?this.modal.setBody(this.getBody(formData)):this.close()}.bind(this)).fail(Notification.exception)},AcceptOnBehalf.prototype.submitForm=function(e){e.preventDefault(),this.modal.getRoot().find("form").submit()},AcceptOnBehalf.prototype.close=function(){this.destroy(),document.location.reload()},AcceptOnBehalf.prototype.destroy=function(){FormChangeChecker.resetAllFormDirtyStates(),this.modal.destroy(),this.currentTrigger.focus()},{getInstance:function(contextid){return new AcceptOnBehalf(contextid)}}}));
//# sourceMappingURL=acceptmodal.min.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
define("tool_policy/jquery-eu-cookie-law-popup",["jquery"],(function($){window.console||(window.console={}),window.console.log||(window.console.log=function(){}),$.fn.euCookieLawPopup=function(){var _self=this;_self.params={cookiePolicyUrl:"/?cookie-policy",popupPosition:"top",colorStyle:"default",compactStyle:!1,popupTitle:"This website is using cookies",popupText:"We use cookies to ensure that we give you the best experience on our website. If you continue without changing your settings, we'll assume that you are happy to receive all cookies on this website.",buttonContinueTitle:"Continue",buttonLearnmoreTitle:"Learn&nbsp;more",buttonLearnmoreOpenInNewWindow:!0,agreementExpiresInDays:30,autoAcceptCookiePolicy:!1,htmlMarkup:null},_self.vars={INITIALISED:!1,HTML_MARKUP:null,COOKIE_NAME:"EU_COOKIE_LAW_CONSENT"};var setUserAcceptsCookies=function(consent){var d=new Date,expiresInDays=24*_self.params.agreementExpiresInDays*60*60*1e3;d.setTime(d.getTime()+expiresInDays);var expires="expires="+d.toGMTString();document.cookie=_self.vars.COOKIE_NAME+"="+consent+"; "+expires+";path=/",$(document).trigger("user_cookie_consent_changed",{consent:consent})},hideContainer=function(){$(".eupopup-container").animate({opacity:0,height:0},200,(function(){$(".eupopup-container").hide(0)}))};return{init:function(settings){!function(object,markup,settings){if(object){var className=$(object).attr("class")?$(object).attr("class"):"";className.indexOf("eupopup-top")>-1?_self.params.popupPosition="top":className.indexOf("eupopup-fixedtop")>-1?_self.params.popupPosition="fixedtop":className.indexOf("eupopup-bottomright")>-1?_self.params.popupPosition="bottomright":className.indexOf("eupopup-bottomleft")>-1?_self.params.popupPosition="bottomleft":className.indexOf("eupopup-bottom")>-1?_self.params.popupPosition="bottom":className.indexOf("eupopup-block")>-1&&(_self.params.popupPosition="block"),className.indexOf("eupopup-color-default")>-1?_self.params.colorStyle="default":className.indexOf("eupopup-color-inverse")>-1&&(_self.params.colorStyle="inverse"),className.indexOf("eupopup-style-compact")>-1&&(_self.params.compactStyle=!0)}markup&&(_self.params.htmlMarkup=markup),settings&&(void 0!==settings.cookiePolicyUrl&&(_self.params.cookiePolicyUrl=settings.cookiePolicyUrl),void 0!==settings.popupPosition&&(_self.params.popupPosition=settings.popupPosition),void 0!==settings.colorStyle&&(_self.params.colorStyle=settings.colorStyle),void 0!==settings.popupTitle&&(_self.params.popupTitle=settings.popupTitle),void 0!==settings.popupText&&(_self.params.popupText=settings.popupText),void 0!==settings.buttonContinueTitle&&(_self.params.buttonContinueTitle=settings.buttonContinueTitle),void 0!==settings.buttonLearnmoreTitle&&(_self.params.buttonLearnmoreTitle=settings.buttonLearnmoreTitle),void 0!==settings.buttonLearnmoreOpenInNewWindow&&(_self.params.buttonLearnmoreOpenInNewWindow=settings.buttonLearnmoreOpenInNewWindow),void 0!==settings.agreementExpiresInDays&&(_self.params.agreementExpiresInDays=settings.agreementExpiresInDays),void 0!==settings.autoAcceptCookiePolicy&&(_self.params.autoAcceptCookiePolicy=settings.autoAcceptCookiePolicy),void 0!==settings.htmlMarkup&&(_self.params.htmlMarkup=settings.htmlMarkup))}($(".eupopup").first(),$(".eupopup-markup").html(),settings),function(){for(var userAcceptedCookies=!1,cookies=document.cookie.split(";"),i=0;i<cookies.length;i++){var c=cookies[i].trim();-1!==c.indexOf(_self.vars.COOKIE_NAME)&&(userAcceptedCookies=c.substring(_self.vars.COOKIE_NAME.length+1,c.length))}return userAcceptedCookies}()?$(document).trigger("user_cookie_already_accepted",{consent:!0}):_self.vars.INITIALISED||(_self.vars.INITIALISED=!0,_self.vars.HTML_MARKUP=_self.params.htmlMarkup?_self.params.htmlMarkup:'<div class="eupopup-container eupopup-container-'+_self.params.popupPosition+(_self.params.compactStyle?" eupopup-style-compact":"")+" eupopup-color-"+_self.params.colorStyle+'"><div class="eupopup-head">'+_self.params.popupTitle+'</div><div class="eupopup-body">'+_self.params.popupText+'</div><div class="eupopup-buttons"><a href="#" class="eupopup-button eupopup-button_1">'+_self.params.buttonContinueTitle+'</a><a href="'+_self.params.cookiePolicyUrl+'"'+(_self.params.buttonLearnmoreOpenInNewWindow?" target=_blank ":"")+' class="eupopup-button eupopup-button_2">'+_self.params.buttonLearnmoreTitle+'</a><div class="clearfix"></div></div><a href="#" class="eupopup-closebutton">x</a></div>',$(".eupopup-block").length>0?$(".eupopup-block").append(_self.vars.HTML_MARKUP):$("BODY").append(_self.vars.HTML_MARKUP),$(".eupopup-button_1").click((function(){return setUserAcceptsCookies(!0),hideContainer(),!1})),$(".eupopup-closebutton").click((function(){return setUserAcceptsCookies(!0),hideContainer(),!1})),$(".eupopup-container").show(),_self.params.autoAcceptCookiePolicy&&setUserAcceptsCookies(!0))}}}}));
//# sourceMappingURL=jquery-eu-cookie-law-popup.min.js.map
File diff suppressed because one or more lines are too long
+10
View File
@@ -0,0 +1,10 @@
/**
* Adds support for confirmation via JS modal for some management actions at the Manage policies page.
*
* @module tool_policy/managedocsactions
* @copyright 2018 David Mudrák <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("tool_policy/managedocsactions",["jquery","core/log","core/config","core/str","core/modal_save_cancel","core/modal_events"],(function($,Log,Config,Str,ModalSaveCancel,ModalEvents){var ACTION_LINKS="[data-action]",ACTION_MAKE_CURRENT='[data-action="makecurrent"]',ACTION_INACTIVATE='[data-action="inactivate"]',ACTION_DELETE='[data-action="delete"]';function ManageDocsActions(base){this.base=base,this.initEvents()}return ManageDocsActions.prototype.initEvents=function(){this.base.on("click",ACTION_LINKS,(function(e){e.stopPropagation();var promise,strings,link=$(e.currentTarget);if(link.is(ACTION_MAKE_CURRENT))promise=Str.get_strings([{key:"activating",component:"tool_policy"},{key:"activateconfirm",component:"tool_policy",param:{name:link.closest("[data-policy-name]").attr("data-policy-name"),revision:link.closest("[data-policy-revision]").attr("data-policy-revision")}},{key:"activateconfirmyes",component:"tool_policy"}]);else if(link.is(ACTION_INACTIVATE))promise=Str.get_strings([{key:"inactivating",component:"tool_policy"},{key:"inactivatingconfirm",component:"tool_policy",param:{name:link.closest("[data-policy-name]").attr("data-policy-name"),revision:link.closest("[data-policy-revision]").attr("data-policy-revision")}},{key:"inactivatingconfirmyes",component:"tool_policy"}]);else{if(!link.is(ACTION_DELETE))return void Log.error("unknown action type detected","tool_policy/managedocsactions");promise=Str.get_strings([{key:"deleting",component:"tool_policy"},{key:"deleteconfirm",component:"tool_policy",param:{name:link.closest("[data-policy-name]").attr("data-policy-name"),revision:link.closest("[data-policy-revision]").attr("data-policy-revision")}},{key:"delete",component:"core"}])}e.preventDefault(),promise.then((function(strs){return strings=strs,ModalSaveCancel.create({title:strings[0],body:strings[1]})})).then((function(modal){return modal.setSaveButtonText(strings[2]),modal.getRoot().on(ModalEvents.save,(function(){window.location.href=link.attr("href")+"&sesskey="+Config.sesskey+"&confirm=1"})),modal.getRoot().on(ModalEvents.hidden,(function(){modal.destroy()})),modal.show(),!0})).catch((function(e){return Log.error(e),!1}))}))},{init:function(baseid){var base=$(document.getElementById(baseid));if(base.length)return new ManageDocsActions(base);throw new Error("managedocsactions: Invalid base element identifier")}}}));
//# sourceMappingURL=managedocsactions.min.js.map
File diff suppressed because one or more lines are too long
+10
View File
@@ -0,0 +1,10 @@
/**
* Policy actions.
*
* @module tool_policy/policyactions
* @copyright 2018 Sara Arjona (sara@moodle.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("tool_policy/policyactions",["jquery","core/ajax","core/notification","core/modal"],(function($,Ajax,Notification,Modal){var PolicyActions=function(root){this.registerEvents(root)};return PolicyActions.prototype.registerEvents=function(root){root.on("click",(function(e){e.preventDefault();var request={methodname:"tool_policy_get_policy_version",args:{versionid:$(this).data("versionid"),behalfid:$(this).data("behalfid")}},modalTitle=$.Deferred(),modalBody=$.Deferred(),modal=Modal.create({title:modalTitle,body:modalBody,large:!0,removeOnClose:!0,show:!0}).catch(Notification.exception),promises=Ajax.call([request]);$.when(promises[0]).then((function(data){if(data.result.policy)return modalTitle.resolve(data.result.policy.name),modalBody.resolve(data.result.policy.content),data;throw new Error(data.warnings[0].message)})).catch((function(message){return modal.then((function(modal){return modal.hide(),modal})).catch(Notification.exception),Notification.addNotification({message:message,type:"error"})}))}))},{init:function(root){return root=$(root),new PolicyActions(root)}}}));
//# sourceMappingURL=policyactions.min.js.map
@@ -0,0 +1 @@
{"version":3,"file":"policyactions.min.js","sources":["../src/policyactions.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Policy actions.\n *\n * @module tool_policy/policyactions\n * @copyright 2018 Sara Arjona (sara@moodle.com)\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/ajax',\n 'core/notification',\n 'core/modal',\n], function($, Ajax, Notification, Modal) {\n\n /**\n * PolicyActions class.\n *\n * @param {jQuery} root\n */\n var PolicyActions = function(root) {\n this.registerEvents(root);\n };\n\n /**\n * Register event listeners.\n *\n * @param {jQuery} root\n */\n PolicyActions.prototype.registerEvents = function(root) {\n root.on(\"click\", function(e) {\n e.preventDefault();\n\n var versionid = $(this).data('versionid');\n var behalfid = $(this).data('behalfid');\n\n var params = {\n 'versionid': versionid,\n 'behalfid': behalfid\n };\n\n var request = {\n methodname: 'tool_policy_get_policy_version',\n args: params\n };\n\n var modalTitle = $.Deferred();\n var modalBody = $.Deferred();\n\n var modal = Modal.create({\n title: modalTitle,\n body: modalBody,\n large: true,\n removeOnClose: true,\n show: true,\n })\n .catch(Notification.exception);\n\n // Make the request now that the modal is configured.\n var promises = Ajax.call([request]);\n $.when(promises[0]).then(function(data) {\n if (data.result.policy) {\n modalTitle.resolve(data.result.policy.name);\n modalBody.resolve(data.result.policy.content);\n\n return data;\n } else {\n throw new Error(data.warnings[0].message);\n }\n }).catch(function(message) {\n modal.then(function(modal) {\n modal.hide();\n\n return modal;\n })\n .catch(Notification.exception);\n\n return Notification.addNotification({\n message: message,\n type: 'error'\n });\n });\n });\n\n };\n\n return /** @alias module:tool_policy/policyactions */ {\n // Public variables and functions.\n\n /**\n * Initialise the actions helper.\n *\n * @method init\n * @param {object} root\n * @return {PolicyActions}\n */\n 'init': function(root) {\n root = $(root);\n return new PolicyActions(root);\n }\n };\n});\n"],"names":["define","$","Ajax","Notification","Modal","PolicyActions","root","registerEvents","prototype","on","e","preventDefault","request","methodname","args","this","data","modalTitle","Deferred","modalBody","modal","create","title","body","large","removeOnClose","show","catch","exception","promises","call","when","then","result","policy","resolve","name","content","Error","warnings","message","hide","addNotification","type"],"mappings":";;;;;;;AAsBAA,mCAAO,CACH,SACA,YACA,oBACA,eACD,SAASC,EAAGC,KAAMC,aAAcC,WAO3BC,cAAgB,SAASC,WACpBC,eAAeD,cAQxBD,cAAcG,UAAUD,eAAiB,SAASD,MAC9CA,KAAKG,GAAG,SAAS,SAASC,GACtBA,EAAEC,qBAUEC,QAAU,CACVC,WAAY,iCACZC,KAPS,WAHGb,EAAEc,MAAMC,KAAK,sBACdf,EAAEc,MAAMC,KAAK,cAYxBC,WAAahB,EAAEiB,WACfC,UAAYlB,EAAEiB,WAEdE,MAAQhB,MAAMiB,OAAO,CACrBC,MAAOL,WACPM,KAAMJ,UACNK,OAAO,EACPC,eAAe,EACfC,MAAM,IAETC,MAAMxB,aAAayB,WAGhBC,SAAW3B,KAAK4B,KAAK,CAAClB,UAC1BX,EAAE8B,KAAKF,SAAS,IAAIG,MAAK,SAAShB,SAC1BA,KAAKiB,OAAOC,cACZjB,WAAWkB,QAAQnB,KAAKiB,OAAOC,OAAOE,MACtCjB,UAAUgB,QAAQnB,KAAKiB,OAAOC,OAAOG,SAE9BrB,WAED,IAAIsB,MAAMtB,KAAKuB,SAAS,GAAGC,YAEtCb,OAAM,SAASa,gBACdpB,MAAMY,MAAK,SAASZ,cAChBA,MAAMqB,OAECrB,SAEVO,MAAMxB,aAAayB,WAEbzB,aAAauC,gBAAgB,CAChCF,QAASA,QACTG,KAAM,iBAOgC,MAU1C,SAASrC,aACbA,KAAOL,EAAEK,MACF,IAAID,cAAcC"}