/
var
/
www
/
html
/
cdhu
/
message
/
amd
/
build
/
Upload File
HOME
define(["jquery","core/ajax","core/notification","core/custom_interaction_events"],function(a,b,c,d){var e=function(b){this.root=a(b),this.userId=this.root.attr("data-user-id"),this.name=this.root.attr("data-processor-name"),this.root.find("form").on("submit",function(b){b.preventDefault(),this.save().done(function(){a(document).trigger("mpp:formsubmitted")})}.bind(this));var c=this.root.find("[data-cancel-button]");d.define(c,[d.events.activate]),c.on(d.events.activate,function(){a(document).trigger("mpp:formcancelled")})};return e.prototype.startLoading=function(){this.root.addClass("loading")},e.prototype.stopLoading=function(){this.root.removeClass("loading")},e.prototype.isLoading=function(){return this.root.hasClass("loading")},e.prototype.save=function(){if(this.isLoading())return a.Deferred();this.startLoading();var d=this.root.find("form").serializeArray(),e={methodname:"core_message_message_processor_config_form",args:{userid:this.userId,name:this.name,formvalues:d}};return b.call([e])[0].fail(c.exception).always(function(){this.stopLoading()}.bind(this))},e});