diff --git a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-debug.js b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-debug.js
index c16a3653b82..8b3d5363350 100644
--- a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-debug.js
+++ b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-debug.js
@@ -52,7 +52,7 @@ ALERT = function(config) {
ALERT.superclass.constructor.apply(this, [config]);
};
Y.extend(ALERT, M.core.dialogue, {
- _enterKeypress : null,
+ closeEvents: [],
initializer : function() {
this.publish('complete');
var yes = Y.Node.create(''),
@@ -64,11 +64,22 @@ Y.extend(ALERT, M.core.dialogue, {
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
'
', Y.WidgetStdMod.REPLACE);
- this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this);
- yes.on('click', this.submit, this);
+
+ this.closeEvents.push(
+ Y.on('key', this.submit, window, 'down:13', this),
+ yes.on('click', this.submit, this)
+ );
+
+ var closeButton = this.get('boundingBox').one('.closebutton');
+ if (closeButton) {
+ // The close button should act exactly like the 'No' button.
+ this.closeEvents.push(
+ closeButton.on('click', this.submit, this)
+ );
+ }
},
submit : function() {
- this._enterKeypress.detach();
+ new Y.EventHandle(this.closeEvents).detach();
this.fire('complete');
this.hide();
this.destroy();
diff --git a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-min.js b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-min.js
index b78d2a9f370..c831e541d3e 100644
--- a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-min.js
+++ b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert-min.js
@@ -1 +1 @@
-YUI.add("moodle-core-notification-alert",function(e,t){var n,r,i,s,o,u,a,f;n="moodle-dialogue",r="notificationBase",i=0,s="yesLabel",o="noLabel",u="title",a="question",f={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 l="Moodle alert",c;c=function(e){e.closeButton=!1,c.superclass.constructor.apply(this,[e])},e.extend(c,M.core.dialogue,{_enterKeypress:null,initializer:function(){this.publish("complete");var t=e.Node.create(''),n=e.Node.create('').append(e.Node.create(''+this.get("message")+"
")).append(e.Node.create('').append(t));this.get(r).addClass("moodle-dialogue-confirm"),this.setStdModContent(e.WidgetStdMod.BODY,n,e.WidgetStdMod.REPLACE),this.setStdModContent(e.WidgetStdMod.HEADER,''+this.get(u)+"
",e.WidgetStdMod.REPLACE),this._enterKeypress=e.on("key",this.submit,window,"down:13",this),t.on("click",this.submit,this)},submit:function(){this._enterKeypress.detach(),this.fire("complete"),this.hide(),this.destroy()}},{NAME:l,CSS_PREFIX:n,ATTRS:{title:{validator:e.Lang.isString,value:"Alert"},message:{validator:e.Lang.isString,value:"Confirm"},yesLabel:{validator:e.Lang.isString,setter:function(e){return e||(e="Ok"),e},value:"Ok"}}}),M.core.alert=c},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
+YUI.add("moodle-core-notification-alert",function(e,t){var n,r,i,s,o,u,a,f;n="moodle-dialogue",r="notificationBase",i=0,s="yesLabel",o="noLabel",u="title",a="question",f={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 l="Moodle alert",c;c=function(e){e.closeButton=!1,c.superclass.constructor.apply(this,[e])},e.extend(c,M.core.dialogue,{closeEvents:[],initializer:function(){this.publish("complete");var t=e.Node.create(''),n=e.Node.create('').append(e.Node.create(''+this.get("message")+"
")).append(e.Node.create('').append(t));this.get(r).addClass("moodle-dialogue-confirm"),this.setStdModContent(e.WidgetStdMod.BODY,n,e.WidgetStdMod.REPLACE),this.setStdModContent(e.WidgetStdMod.HEADER,''+this.get(u)+"
",e.WidgetStdMod.REPLACE),this.closeEvents.push(e.on("key",this.submit,window,"down:13",this),t.on("click",this.submit,this));var i=this.get("boundingBox").one(".closebutton");i&&this.closeEvents.push(i.on("click",this.submit,this))},submit:function(){(new e.EventHandle(this.closeEvents)).detach(),this.fire("complete"),this.hide(),this.destroy()}},{NAME:l,CSS_PREFIX:n,ATTRS:{title:{validator:e.Lang.isString,value:"Alert"},message:{validator:e.Lang.isString,value:"Confirm"},yesLabel:{validator:e.Lang.isString,setter:function(e){return e||(e="Ok"),e},value:"Ok"}}}),M.core.alert=c},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
diff --git a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert.js b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert.js
index c16a3653b82..8b3d5363350 100644
--- a/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert.js
+++ b/lib/yui/build/moodle-core-notification-alert/moodle-core-notification-alert.js
@@ -52,7 +52,7 @@ ALERT = function(config) {
ALERT.superclass.constructor.apply(this, [config]);
};
Y.extend(ALERT, M.core.dialogue, {
- _enterKeypress : null,
+ closeEvents: [],
initializer : function() {
this.publish('complete');
var yes = Y.Node.create(''),
@@ -64,11 +64,22 @@ Y.extend(ALERT, M.core.dialogue, {
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
'', Y.WidgetStdMod.REPLACE);
- this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this);
- yes.on('click', this.submit, this);
+
+ this.closeEvents.push(
+ Y.on('key', this.submit, window, 'down:13', this),
+ yes.on('click', this.submit, this)
+ );
+
+ var closeButton = this.get('boundingBox').one('.closebutton');
+ if (closeButton) {
+ // The close button should act exactly like the 'No' button.
+ this.closeEvents.push(
+ closeButton.on('click', this.submit, this)
+ );
+ }
},
submit : function() {
- this._enterKeypress.detach();
+ new Y.EventHandle(this.closeEvents).detach();
this.fire('complete');
this.hide();
this.destroy();
diff --git a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-debug.js b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-debug.js
index 4336981bc0f..c34e8673b34 100644
--- a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-debug.js
+++ b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-debug.js
@@ -51,8 +51,7 @@ CONFIRM = function(config) {
CONFIRM.superclass.constructor.apply(this, [config]);
};
Y.extend(CONFIRM, M.core.dialogue, {
- _enterKeypress : null,
- _escKeypress : null,
+ closeEvents: [],
initializer : function() {
this.publish('complete');
this.publish('complete-yes');
@@ -68,14 +67,24 @@ Y.extend(CONFIRM, M.core.dialogue, {
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
'', Y.WidgetStdMod.REPLACE);
- this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this, true);
- this._escKeypress = Y.on('key', this.submit, window, 'down:27', this, false);
- yes.on('click', this.submit, this, true);
- no.on('click', this.submit, this, false);
+
+ this.closeEvents.push(
+ Y.on('key', this.submit, window, 'down:13', this, true),
+ Y.on('key', this.submit, window, 'down:27', this, false),
+ yes.on('click', this.submit, this, true),
+ no.on('click', this.submit, this, false)
+ );
+
+ var closeButton = this.get('boundingBox').one('.closebutton');
+ if (closeButton) {
+ // The close button should act exactly like the 'No' button.
+ this.closeEvents.push(
+ closeButton.on('click', this.submit, this)
+ );
+ }
},
submit : function(e, outcome) {
- this._enterKeypress.detach();
- this._escKeypress.detach();
+ new Y.EventHandle(this.closeEvents).detach();
this.fire('complete', outcome);
if (outcome) {
this.fire('complete-yes');
diff --git a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-min.js b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-min.js
index 6f75da2bd6a..0a7c6364ed4 100644
--- a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-min.js
+++ b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm-min.js
@@ -1 +1 @@
-YUI.add("moodle-core-notification-confirm",function(e,t){var n,r,i,s,o,u,a,f;n="moodle-dialogue",r="notificationBase",i=0,s="yesLabel",o="noLabel",u="title",a="question",f={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 l="Moodle confirmation dialogue",c;c=function(e){c.superclass.constructor.apply(this,[e])},e.extend(c,M.core.dialogue,{_enterKeypress:null,_escKeypress:null,initializer:function(){this.publish("complete"),this.publish("complete-yes"),this.publish("complete-no");var t=e.Node.create(''),n=e.Node.create(''),i=e.Node.create('').append(e.Node.create(''+this.get(a)+"
")).append(e.Node.create('').append(t).append(n));this.get(r).addClass("moodle-dialogue-confirm"),this.setStdModContent(e.WidgetStdMod.BODY,i,e.WidgetStdMod.REPLACE),this.setStdModContent(e.WidgetStdMod.HEADER,''+this.get(u)+"
",e.WidgetStdMod.REPLACE),this._enterKeypress=e.on("key",this.submit,window,"down:13",this,!0),this._escKeypress=e.on("key",this.submit,window,"down:27",this,!1),t.on("click",this.submit,this,!0),n.on("click",this.submit,this,!1)},submit:function(e,t){this._enterKeypress.detach(),this._escKeypress.detach(),this.fire("complete",t),t?this.fire("complete-yes"):this.fire("complete-no"),this.hide(),this.destroy()}},{NAME:l,CSS_PREFIX:n,ATTRS:{yesLabel:{validator:e.Lang.isString,value:"Yes"},noLabel:{validator:e.Lang.isString,value:"No"},title:{validator:e.Lang.isString,value:"Confirm"},question:{validator:e.Lang.isString,value:"Are you sure?"}}}),e.augment(c,e.EventTarget),M.core.confirm=c},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
+YUI.add("moodle-core-notification-confirm",function(e,t){var n,r,i,s,o,u,a,f;n="moodle-dialogue",r="notificationBase",i=0,s="yesLabel",o="noLabel",u="title",a="question",f={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 l="Moodle confirmation dialogue",c;c=function(e){c.superclass.constructor.apply(this,[e])},e.extend(c,M.core.dialogue,{closeEvents:[],initializer:function(){this.publish("complete"),this.publish("complete-yes"),this.publish("complete-no");var t=e.Node.create(''),n=e.Node.create(''),i=e.Node.create('').append(e.Node.create(''+this.get(a)+"
")).append(e.Node.create('').append(t).append(n));this.get(r).addClass("moodle-dialogue-confirm"),this.setStdModContent(e.WidgetStdMod.BODY,i,e.WidgetStdMod.REPLACE),this.setStdModContent(e.WidgetStdMod.HEADER,''+this.get(u)+"
",e.WidgetStdMod.REPLACE),this.closeEvents.push(e.on("key",this.submit,window,"down:13",this,!0),e.on("key",this.submit,window,"down:27",this,!1),t.on("click",this.submit,this,!0),n.on("click",this.submit,this,!1));var f=this.get("boundingBox").one(".closebutton");f&&this.closeEvents.push(f.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:l,CSS_PREFIX:n,ATTRS:{yesLabel:{validator:e.Lang.isString,value:"Yes"},noLabel:{validator:e.Lang.isString,value:"No"},title:{validator:e.Lang.isString,value:"Confirm"},question:{validator:e.Lang.isString,value:"Are you sure?"}}}),e.augment(c,e.EventTarget),M.core.confirm=c},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
diff --git a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm.js b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm.js
index 4336981bc0f..c34e8673b34 100644
--- a/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm.js
+++ b/lib/yui/build/moodle-core-notification-confirm/moodle-core-notification-confirm.js
@@ -51,8 +51,7 @@ CONFIRM = function(config) {
CONFIRM.superclass.constructor.apply(this, [config]);
};
Y.extend(CONFIRM, M.core.dialogue, {
- _enterKeypress : null,
- _escKeypress : null,
+ closeEvents: [],
initializer : function() {
this.publish('complete');
this.publish('complete-yes');
@@ -68,14 +67,24 @@ Y.extend(CONFIRM, M.core.dialogue, {
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
'', Y.WidgetStdMod.REPLACE);
- this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this, true);
- this._escKeypress = Y.on('key', this.submit, window, 'down:27', this, false);
- yes.on('click', this.submit, this, true);
- no.on('click', this.submit, this, false);
+
+ this.closeEvents.push(
+ Y.on('key', this.submit, window, 'down:13', this, true),
+ Y.on('key', this.submit, window, 'down:27', this, false),
+ yes.on('click', this.submit, this, true),
+ no.on('click', this.submit, this, false)
+ );
+
+ var closeButton = this.get('boundingBox').one('.closebutton');
+ if (closeButton) {
+ // The close button should act exactly like the 'No' button.
+ this.closeEvents.push(
+ closeButton.on('click', this.submit, this)
+ );
+ }
},
submit : function(e, outcome) {
- this._enterKeypress.detach();
- this._escKeypress.detach();
+ new Y.EventHandle(this.closeEvents).detach();
this.fire('complete', outcome);
if (outcome) {
this.fire('complete-yes');
diff --git a/lib/yui/src/notification/js/alert.js b/lib/yui/src/notification/js/alert.js
index c6ea2e459db..b7a0edcd879 100644
--- a/lib/yui/src/notification/js/alert.js
+++ b/lib/yui/src/notification/js/alert.js
@@ -21,7 +21,7 @@ ALERT = function(config) {
ALERT.superclass.constructor.apply(this, [config]);
};
Y.extend(ALERT, M.core.dialogue, {
- _enterKeypress : null,
+ closeEvents: [],
initializer : function() {
this.publish('complete');
var yes = Y.Node.create(''),
@@ -33,11 +33,22 @@ Y.extend(ALERT, M.core.dialogue, {
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
'', Y.WidgetStdMod.REPLACE);
- this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this);
- yes.on('click', this.submit, this);
+
+ this.closeEvents.push(
+ Y.on('key', this.submit, window, 'down:13', this),
+ yes.on('click', this.submit, this)
+ );
+
+ var closeButton = this.get('boundingBox').one('.closebutton');
+ if (closeButton) {
+ // The close button should act exactly like the 'No' button.
+ this.closeEvents.push(
+ closeButton.on('click', this.submit, this)
+ );
+ }
},
submit : function() {
- this._enterKeypress.detach();
+ new Y.EventHandle(this.closeEvents).detach();
this.fire('complete');
this.hide();
this.destroy();
diff --git a/lib/yui/src/notification/js/confirm.js b/lib/yui/src/notification/js/confirm.js
index a5313d8c31d..6c4bfaaaba0 100644
--- a/lib/yui/src/notification/js/confirm.js
+++ b/lib/yui/src/notification/js/confirm.js
@@ -20,8 +20,7 @@ CONFIRM = function(config) {
CONFIRM.superclass.constructor.apply(this, [config]);
};
Y.extend(CONFIRM, M.core.dialogue, {
- _enterKeypress : null,
- _escKeypress : null,
+ closeEvents: [],
initializer : function() {
this.publish('complete');
this.publish('complete-yes');
@@ -37,14 +36,24 @@ Y.extend(CONFIRM, M.core.dialogue, {
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
'', Y.WidgetStdMod.REPLACE);
- this._enterKeypress = Y.on('key', this.submit, window, 'down:13', this, true);
- this._escKeypress = Y.on('key', this.submit, window, 'down:27', this, false);
- yes.on('click', this.submit, this, true);
- no.on('click', this.submit, this, false);
+
+ this.closeEvents.push(
+ Y.on('key', this.submit, window, 'down:13', this, true),
+ Y.on('key', this.submit, window, 'down:27', this, false),
+ yes.on('click', this.submit, this, true),
+ no.on('click', this.submit, this, false)
+ );
+
+ var closeButton = this.get('boundingBox').one('.closebutton');
+ if (closeButton) {
+ // The close button should act exactly like the 'No' button.
+ this.closeEvents.push(
+ closeButton.on('click', this.submit, this)
+ );
+ }
},
submit : function(e, outcome) {
- this._enterKeypress.detach();
- this._escKeypress.detach();
+ new Y.EventHandle(this.closeEvents).detach();
this.fire('complete', outcome);
if (outcome) {
this.fire('complete-yes');