/
var
/
www
/
html
/
lgpd
/
message
/
amd
/
build
/
Upload File
HOME
define ("core_message/notification_processor_settings",["jquery","core/ajax","core/str","core/notification","core/custom_interaction_events","core/modal","core/modal_registry","core/fragment"],function(a,b,c,d,e,f,g,h){var i=!1,j={SAVE_BUTTON:"[data-action=\"save\"]",CANCEL_BUTTON:"[data-action=\"cancel\"]",PROCESSOR:"[data-processor-name]",PREFERENCE_ROW:"[data-region=\"preference-row\"]"},k=function(a){f.call(this,a);this.name=null;this.userId=null;this.contextId=null;this.element=null;this.saveButton=this.getFooter().find(j.SAVE_BUTTON);this.cancelButton=this.getFooter().find(j.CANCEL_BUTTON)};k.TYPE="core_message-notification_processor_settings";k.prototype=Object.create(f.prototype);k.prototype.constructor=k;k.prototype.setUserId=function(a){this.userId=a};k.prototype.getUserId=function(){return this.userId};k.prototype.setElement=function(a){this.element=a};k.prototype.getElement=function(){return this.element};k.prototype.setName=function(a){this.name=a};k.prototype.getName=function(){return this.name};k.prototype.setContextId=function(a){this.contextId=a};k.prototype.getContextId=function(){return this.contextId};k.prototype.getForm=function(){return this.getBody().find("form")};k.prototype.disableButtons=function(){this.saveButton.prop("disabled",!0);this.cancelButton.prop("disabled",!0)};k.prototype.enableButtons=function(){this.saveButton.prop("disabled",!1);this.cancelButton.prop("disabled",!1)};k.prototype.loadTitleContent=function(){this.titlePromise=c.get_string("processorsettings","message");this.setTitle(this.titlePromise);return this.titlePromise};k.prototype.loadBodyContent=function(){this.disableButtons();var a={userid:this.getUserId(),type:this.getName()};this.bodyPromise=h.loadFragment("message","processor_settings",this.getContextId(),a);this.setBody(this.bodyPromise);this.bodyPromise.then(function(){this.enableButtons()}.bind(this)).fail(d.exception);return this.bodyPromise};k.prototype.loadAllContent=function(){return a.when(this.loadTitleContent(),this.loadBodyContent())};k.prototype.show=function(){this.loadAllContent();f.prototype.show.call(this)};k.prototype.hide=function(){f.prototype.hide.call(this);this.setContextId(null);this.setName(null);this.setUserId(null)};k.prototype.updateConfiguredStatus=function(){var c=a(this.getElement()).closest(j.PROCESSOR);if(!c.hasClass("unconfigured")){return!1}var e=c.attr("data-processor-name"),f={methodname:"core_message_get_message_processor",args:{name:e,userid:this.userId}};return b.call([f])[0].fail(d.exception).done(function(b){if(b.userconfigured){var d=a(j.PREFERENCE_ROW+" [data-processor-name=\""+e+"\"]");c.removeClass("unconfigured");d.removeClass("disabled")}})};k.prototype.registerEventListeners=function(){f.prototype.registerEventListeners.call(this);this.getModal().on(e.events.activate,j.SAVE_BUTTON,function(a,b){this.getForm().submit();b.originalEvent.preventDefault()}.bind(this));this.getModal().on("mpp:formsubmitted",function(a){this.hide();this.updateConfiguredStatus();a.stopPropagation()}.bind(this));this.getModal().on(e.events.activate,j.CANCEL_BUTTON,function(a,b){this.hide();b.originalEvent.preventDefault();a.stopPropagation()}.bind(this))};if(!i){g.register(k.TYPE,k,"core/modal_save_cancel");i=!0}return k}); //# sourceMappingURL=notification_processor_settings.min.js.map