You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1 lines
2.7 KiB

YUI.add("moodle-core-notification-confirm",function(e,t){var n,r,i,s,o,u,a;n="moodle-dialogue",r="notificationBase",i="yesLabel",s="noLabel",o="title",u="question",a={BASE:"moodle-dialogue-base",WRAP:"moodle-dialogue-wrap",HEADER:"moodle-dialogue-hd",BODY:"moodle-dialogue-bd",CONTENT:"moodle-dialogue-content",FOOTER:"moodle-dialogue-ft",HIDDEN:"hidden",LIGHTBOX:"moodle-dialogue-lightbox"},M.core=M.core||{};var f="Moodle confirmation dialogue",l;l=function(e){l.superclass.constructor.apply(this,[e])},e.extend(l,M.core.notification.info,{_closeEvents:null,_yesButton:null,_noButton:null,_question:null,initializer:function(){this._closeEvents=[],this.publish("complete"),this.publish("complete-yes"),this.publish("complete-no"),this._yesButton=e.Node.create('<input type="button" class="btn btn-primary" id="id_yuiconfirmyes-'+this.get("COUNT")+'" value="'+this.get(i)+'" />'),this._noButton=e.Node.create('<input type="button" class="btn btn-secondary" id="id_yuiconfirmno-'+this.get("COUNT")+'" value="'+this.get(s)+'" />'),this._question=e.Node.create('<div class="confirmation-message">'+this.get(u)+"</div>");var t=e.Node.create('<div class="confirmation-dialogue"></div>').append(this._question).append(e.Node.create('<div class="confirmation-buttons form-inline justify-content-around"></div>').append(this._yesButton).append(this._noButton));this.get(r).addClass("moodle-dialogue-confirm"),this.setStdModContent(e.WidgetStdMod.BODY,t,e.WidgetStdMod.REPLACE),this.setStdModContent(e.WidgetStdMod.HEADER,'<h1 id="moodle-dialogue-'+this.get("COUNT")+'-header-text">'+this.get(o)+"</h1>",e.WidgetStdMod.REPLACE),this._closeEvents.push(e.on("key",this.submit,window,"down:27",this,!1),this._yesButton.on("click",this.submit,this,!0),this._noButton.on("click",this.submit,this,!1));var n=this.get("boundingBox").one(".closebutton");n&&this._closeEvents.push(n.on("click",this.submit,this))},submit:function(t,n){(new e.EventHandle(this._closeEvents)).detach(),this.fire("complete",n),n?this.fire("complete-yes"):this.fire("complete-no"),this.hide(),this.destroy()}},{NAME:f,CSS_PREFIX:n,ATTRS:{yesLabel:{validator:e.Lang.isString,valueFn:function(){return M.util.get_string("yes","moodle")},setter:function(e){return this._yesButton&&this._yesButton.set("value",e),e}},noLabel:{validator:e.Lang.isString,valueFn:function(){return M.util.get_string("no","moodle")},setter:function(e){return this._noButton&&this._noButton.set("value",e),e}},title:{validator:e.Lang.isString,value:M.util.get_string("confirm","moodle")},question:{validator:e.Lang.isString,valueFn:function(){return M.util.get_string("areyousure","moodle")},setter:function(e){return this._question&&this._question.set("value",e),e}}}}),e.augment(l,e.EventTarget),M.core.confirm=l},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});