Merge branch 'MDL-44855-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Marina Glancy 2014-04-23 13:12:25 +08:00
commit ff35a0129f
8 changed files with 170 additions and 122 deletions

View File

@ -50,8 +50,16 @@ ALERT = function(config) {
ALERT.superclass.constructor.apply(this, [config]);
};
Y.extend(ALERT, M.core.notification.info, {
closeEvents: [],
initializer : function() {
/**
* The list of events to detach when destroying this dialogue.
*
* @property _closeEvents
* @type EventHandle[]
* @private
*/
_closeEvents: null,
initializer: function() {
this._closeEvents = [];
this.publish('complete');
var yes = Y.Node.create('<input type="button" id="id_yuialertconfirm-' + this.get('COUNT') + '" value="'+this.get(CONFIRMYES)+'" />'),
content = Y.Node.create('<div class="confirmation-dialogue"></div>')
@ -63,7 +71,7 @@ Y.extend(ALERT, M.core.notification.info, {
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
this.closeEvents.push(
this._closeEvents.push(
Y.on('key', this.submit, window, 'down:13', this),
yes.on('click', this.submit, this)
);
@ -71,21 +79,21 @@ Y.extend(ALERT, M.core.notification.info, {
var closeButton = this.get('boundingBox').one('.closebutton');
if (closeButton) {
// The close button should act exactly like the 'No' button.
this.closeEvents.push(
this._closeEvents.push(
closeButton.on('click', this.submit, this)
);
}
},
submit : function() {
new Y.EventHandle(this.closeEvents).detach();
submit: function() {
new Y.EventHandle(this._closeEvents).detach();
this.fire('complete');
this.hide();
this.destroy();
}
}, {
NAME : ALERT_NAME,
CSS_PREFIX : DIALOGUE_PREFIX,
ATTRS : {
NAME: ALERT_NAME,
CSS_PREFIX: DIALOGUE_PREFIX,
ATTRS: {
/**
* The title of the alert.
@ -94,9 +102,9 @@ Y.extend(ALERT, M.core.notification.info, {
* @type String
* @default 'Alert'
*/
title : {
validator : Y.Lang.isString,
value : 'Alert'
title: {
validator: Y.Lang.isString,
value: 'Alert'
},
/**
@ -106,9 +114,9 @@ Y.extend(ALERT, M.core.notification.info, {
* @type String
* @default 'Confirm'
*/
message : {
validator : Y.Lang.isString,
value : 'Confirm'
message: {
validator: Y.Lang.isString,
value: 'Confirm'
},
/**
@ -118,15 +126,15 @@ Y.extend(ALERT, M.core.notification.info, {
* @type String
* @default 'Ok'
*/
yesLabel : {
validator : Y.Lang.isString,
setter : function(txt) {
yesLabel: {
validator: Y.Lang.isString,
setter: function(txt) {
if (!txt) {
txt = 'Ok';
}
return txt;
},
value : 'Ok'
value: 'Ok'
}
}
});

View File

@ -1 +1 @@
YUI.add("moodle-core-notification-alert",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 alert",l;l=function(e){e.closeButton=!1,l.superclass.constructor.apply(this,[e])},e.extend(l,M.core.notification.info,{closeEvents:[],initializer:function(){this.publish("complete");var t=e.Node.create('<input type="button" id="id_yuialertconfirm-'+this.get("COUNT")+'" value="'+this.get(i)+'" />'),n=e.Node.create('<div class="confirmation-dialogue"></div>').append(e.Node.create('<div class="confirmation-message">'+this.get("message")+"</div>")).append(e.Node.create('<div class="confirmation-buttons"></div>').append(t));this.get(r).addClass("moodle-dialogue-confirm"),this.setStdModContent(e.WidgetStdMod.BODY,n,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:13",this),t.on("click",this.submit,this));var s=this.get("boundingBox").one(".closebutton");s&&this.closeEvents.push(s.on("click",this.submit,this))},submit:function(){(new e.EventHandle(this.closeEvents)).detach(),this.fire("complete"),this.hide(),this.destroy()}},{NAME:f,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=l},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
YUI.add("moodle-core-notification-alert",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 alert",l;l=function(e){e.closeButton=!1,l.superclass.constructor.apply(this,[e])},e.extend(l,M.core.notification.info,{_closeEvents:null,initializer:function(){this._closeEvents=[],this.publish("complete");var t=e.Node.create('<input type="button" id="id_yuialertconfirm-'+this.get("COUNT")+'" value="'+this.get(i)+'" />'),n=e.Node.create('<div class="confirmation-dialogue"></div>').append(e.Node.create('<div class="confirmation-message">'+this.get("message")+"</div>")).append(e.Node.create('<div class="confirmation-buttons"></div>').append(t));this.get(r).addClass("moodle-dialogue-confirm"),this.setStdModContent(e.WidgetStdMod.BODY,n,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:13",this),t.on("click",this.submit,this));var s=this.get("boundingBox").one(".closebutton");s&&this._closeEvents.push(s.on("click",this.submit,this))},submit:function(){(new e.EventHandle(this._closeEvents)).detach(),this.fire("complete"),this.hide(),this.destroy()}},{NAME:f,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=l},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});

View File

@ -50,8 +50,16 @@ ALERT = function(config) {
ALERT.superclass.constructor.apply(this, [config]);
};
Y.extend(ALERT, M.core.notification.info, {
closeEvents: [],
initializer : function() {
/**
* The list of events to detach when destroying this dialogue.
*
* @property _closeEvents
* @type EventHandle[]
* @private
*/
_closeEvents: null,
initializer: function() {
this._closeEvents = [];
this.publish('complete');
var yes = Y.Node.create('<input type="button" id="id_yuialertconfirm-' + this.get('COUNT') + '" value="'+this.get(CONFIRMYES)+'" />'),
content = Y.Node.create('<div class="confirmation-dialogue"></div>')
@ -63,7 +71,7 @@ Y.extend(ALERT, M.core.notification.info, {
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
this.closeEvents.push(
this._closeEvents.push(
Y.on('key', this.submit, window, 'down:13', this),
yes.on('click', this.submit, this)
);
@ -71,21 +79,21 @@ Y.extend(ALERT, M.core.notification.info, {
var closeButton = this.get('boundingBox').one('.closebutton');
if (closeButton) {
// The close button should act exactly like the 'No' button.
this.closeEvents.push(
this._closeEvents.push(
closeButton.on('click', this.submit, this)
);
}
},
submit : function() {
new Y.EventHandle(this.closeEvents).detach();
submit: function() {
new Y.EventHandle(this._closeEvents).detach();
this.fire('complete');
this.hide();
this.destroy();
}
}, {
NAME : ALERT_NAME,
CSS_PREFIX : DIALOGUE_PREFIX,
ATTRS : {
NAME: ALERT_NAME,
CSS_PREFIX: DIALOGUE_PREFIX,
ATTRS: {
/**
* The title of the alert.
@ -94,9 +102,9 @@ Y.extend(ALERT, M.core.notification.info, {
* @type String
* @default 'Alert'
*/
title : {
validator : Y.Lang.isString,
value : 'Alert'
title: {
validator: Y.Lang.isString,
value: 'Alert'
},
/**
@ -106,9 +114,9 @@ Y.extend(ALERT, M.core.notification.info, {
* @type String
* @default 'Confirm'
*/
message : {
validator : Y.Lang.isString,
value : 'Confirm'
message: {
validator: Y.Lang.isString,
value: 'Confirm'
},
/**
@ -118,15 +126,15 @@ Y.extend(ALERT, M.core.notification.info, {
* @type String
* @default 'Ok'
*/
yesLabel : {
validator : Y.Lang.isString,
setter : function(txt) {
yesLabel: {
validator: Y.Lang.isString,
setter: function(txt) {
if (!txt) {
txt = 'Ok';
}
return txt;
},
value : 'Ok'
value: 'Ok'
}
}
});

View File

@ -49,8 +49,16 @@ CONFIRM = function(config) {
CONFIRM.superclass.constructor.apply(this, [config]);
};
Y.extend(CONFIRM, M.core.notification.info, {
closeEvents: [],
initializer : function() {
/**
* The list of events to detach when destroying this dialogue.
*
* @property _closeEvents
* @type EventHandle[]
* @private
*/
_closeEvents: null,
initializer: function() {
this._closeEvents = [];
this.publish('complete');
this.publish('complete-yes');
this.publish('complete-no');
@ -66,7 +74,7 @@ Y.extend(CONFIRM, M.core.notification.info, {
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
this.closeEvents.push(
this._closeEvents.push(
Y.on('key', this.submit, window, 'down:27', this, false),
yes.on('click', this.submit, this, true),
no.on('click', this.submit, this, false)
@ -75,13 +83,13 @@ Y.extend(CONFIRM, M.core.notification.info, {
var closeButton = this.get('boundingBox').one('.closebutton');
if (closeButton) {
// The close button should act exactly like the 'No' button.
this.closeEvents.push(
this._closeEvents.push(
closeButton.on('click', this.submit, this)
);
}
},
submit : function(e, outcome) {
new Y.EventHandle(this.closeEvents).detach();
submit: function(e, outcome) {
new Y.EventHandle(this._closeEvents).detach();
this.fire('complete', outcome);
if (outcome) {
this.fire('complete-yes');
@ -92,9 +100,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
this.destroy();
}
}, {
NAME : CONFIRM_NAME,
CSS_PREFIX : DIALOGUE_PREFIX,
ATTRS : {
NAME: CONFIRM_NAME,
CSS_PREFIX: DIALOGUE_PREFIX,
ATTRS: {
/**
* The button text to use to accept the confirmation.
@ -103,9 +111,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @type String
* @default 'Yes'
*/
yesLabel : {
validator : Y.Lang.isString,
value : 'Yes'
yesLabel: {
validator: Y.Lang.isString,
value: 'Yes'
},
/**
@ -115,9 +123,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @type String
* @default 'No'
*/
noLabel : {
validator : Y.Lang.isString,
value : 'No'
noLabel: {
validator: Y.Lang.isString,
value: 'No'
},
/**
@ -127,9 +135,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @type String
* @default 'Confirm'
*/
title : {
validator : Y.Lang.isString,
value : 'Confirm'
title: {
validator: Y.Lang.isString,
value: 'Confirm'
},
/**
@ -139,9 +147,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @type String
* @default 'Are you sure?'
*/
question : {
validator : Y.Lang.isString,
value : 'Are you sure?'
question: {
validator: Y.Lang.isString,
value: 'Are you sure?'
}
}
});

View File

@ -1 +1 @@
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:[],initializer:function(){this.publish("complete"),this.publish("complete-yes"),this.publish("complete-no");var t=e.Node.create('<input type="button" id="id_yuiconfirmyes-'+this.get("COUNT")+'" value="'+this.get(i)+'" />'),n=e.Node.create('<input type="button" id="id_yuiconfirmno-'+this.get("COUNT")+'" value="'+this.get(s)+'" />'),a=e.Node.create('<div class="confirmation-dialogue"></div>').append(e.Node.create('<div class="confirmation-message">'+this.get(u)+"</div>")).append(e.Node.create('<div class="confirmation-buttons"></div>').append(t).append(n));this.get(r).addClass("moodle-dialogue-confirm"),this.setStdModContent(e.WidgetStdMod.BODY,a,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),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:f,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(l,e.EventTarget),M.core.confirm=l},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});
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,initializer:function(){this._closeEvents=[],this.publish("complete"),this.publish("complete-yes"),this.publish("complete-no");var t=e.Node.create('<input type="button" id="id_yuiconfirmyes-'+this.get("COUNT")+'" value="'+this.get(i)+'" />'),n=e.Node.create('<input type="button" id="id_yuiconfirmno-'+this.get("COUNT")+'" value="'+this.get(s)+'" />'),a=e.Node.create('<div class="confirmation-dialogue"></div>').append(e.Node.create('<div class="confirmation-message">'+this.get(u)+"</div>")).append(e.Node.create('<div class="confirmation-buttons"></div>').append(t).append(n));this.get(r).addClass("moodle-dialogue-confirm"),this.setStdModContent(e.WidgetStdMod.BODY,a,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),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:f,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(l,e.EventTarget),M.core.confirm=l},"@VERSION@",{requires:["moodle-core-notification-dialogue"]});

View File

@ -49,8 +49,16 @@ CONFIRM = function(config) {
CONFIRM.superclass.constructor.apply(this, [config]);
};
Y.extend(CONFIRM, M.core.notification.info, {
closeEvents: [],
initializer : function() {
/**
* The list of events to detach when destroying this dialogue.
*
* @property _closeEvents
* @type EventHandle[]
* @private
*/
_closeEvents: null,
initializer: function() {
this._closeEvents = [];
this.publish('complete');
this.publish('complete-yes');
this.publish('complete-no');
@ -66,7 +74,7 @@ Y.extend(CONFIRM, M.core.notification.info, {
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
this.closeEvents.push(
this._closeEvents.push(
Y.on('key', this.submit, window, 'down:27', this, false),
yes.on('click', this.submit, this, true),
no.on('click', this.submit, this, false)
@ -75,13 +83,13 @@ Y.extend(CONFIRM, M.core.notification.info, {
var closeButton = this.get('boundingBox').one('.closebutton');
if (closeButton) {
// The close button should act exactly like the 'No' button.
this.closeEvents.push(
this._closeEvents.push(
closeButton.on('click', this.submit, this)
);
}
},
submit : function(e, outcome) {
new Y.EventHandle(this.closeEvents).detach();
submit: function(e, outcome) {
new Y.EventHandle(this._closeEvents).detach();
this.fire('complete', outcome);
if (outcome) {
this.fire('complete-yes');
@ -92,9 +100,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
this.destroy();
}
}, {
NAME : CONFIRM_NAME,
CSS_PREFIX : DIALOGUE_PREFIX,
ATTRS : {
NAME: CONFIRM_NAME,
CSS_PREFIX: DIALOGUE_PREFIX,
ATTRS: {
/**
* The button text to use to accept the confirmation.
@ -103,9 +111,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @type String
* @default 'Yes'
*/
yesLabel : {
validator : Y.Lang.isString,
value : 'Yes'
yesLabel: {
validator: Y.Lang.isString,
value: 'Yes'
},
/**
@ -115,9 +123,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @type String
* @default 'No'
*/
noLabel : {
validator : Y.Lang.isString,
value : 'No'
noLabel: {
validator: Y.Lang.isString,
value: 'No'
},
/**
@ -127,9 +135,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @type String
* @default 'Confirm'
*/
title : {
validator : Y.Lang.isString,
value : 'Confirm'
title: {
validator: Y.Lang.isString,
value: 'Confirm'
},
/**
@ -139,9 +147,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @type String
* @default 'Are you sure?'
*/
question : {
validator : Y.Lang.isString,
value : 'Are you sure?'
question: {
validator: Y.Lang.isString,
value: 'Are you sure?'
}
}
});

View File

@ -21,8 +21,16 @@ ALERT = function(config) {
ALERT.superclass.constructor.apply(this, [config]);
};
Y.extend(ALERT, M.core.notification.info, {
closeEvents: [],
initializer : function() {
/**
* The list of events to detach when destroying this dialogue.
*
* @property _closeEvents
* @type EventHandle[]
* @private
*/
_closeEvents: null,
initializer: function() {
this._closeEvents = [];
this.publish('complete');
var yes = Y.Node.create('<input type="button" id="id_yuialertconfirm-' + this.get('COUNT') + '" value="'+this.get(CONFIRMYES)+'" />'),
content = Y.Node.create('<div class="confirmation-dialogue"></div>')
@ -34,7 +42,7 @@ Y.extend(ALERT, M.core.notification.info, {
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
this.closeEvents.push(
this._closeEvents.push(
Y.on('key', this.submit, window, 'down:13', this),
yes.on('click', this.submit, this)
);
@ -42,21 +50,21 @@ Y.extend(ALERT, M.core.notification.info, {
var closeButton = this.get('boundingBox').one('.closebutton');
if (closeButton) {
// The close button should act exactly like the 'No' button.
this.closeEvents.push(
this._closeEvents.push(
closeButton.on('click', this.submit, this)
);
}
},
submit : function() {
new Y.EventHandle(this.closeEvents).detach();
submit: function() {
new Y.EventHandle(this._closeEvents).detach();
this.fire('complete');
this.hide();
this.destroy();
}
}, {
NAME : ALERT_NAME,
CSS_PREFIX : DIALOGUE_PREFIX,
ATTRS : {
NAME: ALERT_NAME,
CSS_PREFIX: DIALOGUE_PREFIX,
ATTRS: {
/**
* The title of the alert.
@ -65,9 +73,9 @@ Y.extend(ALERT, M.core.notification.info, {
* @type String
* @default 'Alert'
*/
title : {
validator : Y.Lang.isString,
value : 'Alert'
title: {
validator: Y.Lang.isString,
value: 'Alert'
},
/**
@ -77,9 +85,9 @@ Y.extend(ALERT, M.core.notification.info, {
* @type String
* @default 'Confirm'
*/
message : {
validator : Y.Lang.isString,
value : 'Confirm'
message: {
validator: Y.Lang.isString,
value: 'Confirm'
},
/**
@ -89,15 +97,15 @@ Y.extend(ALERT, M.core.notification.info, {
* @type String
* @default 'Ok'
*/
yesLabel : {
validator : Y.Lang.isString,
setter : function(txt) {
yesLabel: {
validator: Y.Lang.isString,
setter: function(txt) {
if (!txt) {
txt = 'Ok';
}
return txt;
},
value : 'Ok'
value: 'Ok'
}
}
});

View File

@ -20,8 +20,16 @@ CONFIRM = function(config) {
CONFIRM.superclass.constructor.apply(this, [config]);
};
Y.extend(CONFIRM, M.core.notification.info, {
closeEvents: [],
initializer : function() {
/**
* The list of events to detach when destroying this dialogue.
*
* @property _closeEvents
* @type EventHandle[]
* @private
*/
_closeEvents: null,
initializer: function() {
this._closeEvents = [];
this.publish('complete');
this.publish('complete-yes');
this.publish('complete-no');
@ -37,7 +45,7 @@ Y.extend(CONFIRM, M.core.notification.info, {
this.setStdModContent(Y.WidgetStdMod.HEADER,
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', Y.WidgetStdMod.REPLACE);
this.closeEvents.push(
this._closeEvents.push(
Y.on('key', this.submit, window, 'down:27', this, false),
yes.on('click', this.submit, this, true),
no.on('click', this.submit, this, false)
@ -46,13 +54,13 @@ Y.extend(CONFIRM, M.core.notification.info, {
var closeButton = this.get('boundingBox').one('.closebutton');
if (closeButton) {
// The close button should act exactly like the 'No' button.
this.closeEvents.push(
this._closeEvents.push(
closeButton.on('click', this.submit, this)
);
}
},
submit : function(e, outcome) {
new Y.EventHandle(this.closeEvents).detach();
submit: function(e, outcome) {
new Y.EventHandle(this._closeEvents).detach();
this.fire('complete', outcome);
if (outcome) {
this.fire('complete-yes');
@ -63,9 +71,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
this.destroy();
}
}, {
NAME : CONFIRM_NAME,
CSS_PREFIX : DIALOGUE_PREFIX,
ATTRS : {
NAME: CONFIRM_NAME,
CSS_PREFIX: DIALOGUE_PREFIX,
ATTRS: {
/**
* The button text to use to accept the confirmation.
@ -74,9 +82,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @type String
* @default 'Yes'
*/
yesLabel : {
validator : Y.Lang.isString,
value : 'Yes'
yesLabel: {
validator: Y.Lang.isString,
value: 'Yes'
},
/**
@ -86,9 +94,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @type String
* @default 'No'
*/
noLabel : {
validator : Y.Lang.isString,
value : 'No'
noLabel: {
validator: Y.Lang.isString,
value: 'No'
},
/**
@ -98,9 +106,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @type String
* @default 'Confirm'
*/
title : {
validator : Y.Lang.isString,
value : 'Confirm'
title: {
validator: Y.Lang.isString,
value: 'Confirm'
},
/**
@ -110,9 +118,9 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @type String
* @default 'Are you sure?'
*/
question : {
validator : Y.Lang.isString,
value : 'Are you sure?'
question: {
validator: Y.Lang.isString,
value: 'Are you sure?'
}
}
});