mirror of
https://github.com/moodle/moodle.git
synced 2025-08-03 08:09:47 +02:00
Merge branch 'MDL-43885-master' of git://github.com/andrewnicols/moodle
This commit is contained in:
commit
2f166b3284
8 changed files with 98 additions and 38 deletions
|
@ -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('<input type="button" id="id_yuialertconfirm-' + this.get('COUNT') + '" value="'+this.get(CONFIRMYES)+'" />'),
|
||||
|
@ -64,11 +64,22 @@ Y.extend(ALERT, M.core.dialogue, {
|
|||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', 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();
|
||||
|
|
|
@ -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('<input type="button" id="id_yuialertconfirm-'+this.get("COUNT")+'" value="'+this.get(s)+'" />'),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(u)+"</h1>",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('<input type="button" id="id_yuialertconfirm-'+this.get("COUNT")+'" value="'+this.get(s)+'" />'),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(u)+"</h1>",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"]});
|
||||
|
|
|
@ -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('<input type="button" id="id_yuialertconfirm-' + this.get('COUNT') + '" value="'+this.get(CONFIRMYES)+'" />'),
|
||||
|
@ -64,11 +64,22 @@ Y.extend(ALERT, M.core.dialogue, {
|
|||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', 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();
|
||||
|
|
|
@ -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,
|
||||
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', 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');
|
||||
|
|
|
@ -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('<input type="button" id="id_yuiconfirmyes-'+this.get("COUNT")+'" value="'+this.get(s)+'" />'),n=e.Node.create('<input type="button" id="id_yuiconfirmno-'+this.get("COUNT")+'" value="'+this.get(o)+'" />'),i=e.Node.create('<div class="confirmation-dialogue"></div>').append(e.Node.create('<div class="confirmation-message">'+this.get(a)+"</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,i,e.WidgetStdMod.REPLACE),this.setStdModContent(e.WidgetStdMod.HEADER,'<h1 id="moodle-dialogue-'+this.get("COUNT")+'-header-text">'+this.get(u)+"</h1>",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('<input type="button" id="id_yuiconfirmyes-'+this.get("COUNT")+'" value="'+this.get(s)+'" />'),n=e.Node.create('<input type="button" id="id_yuiconfirmno-'+this.get("COUNT")+'" value="'+this.get(o)+'" />'),i=e.Node.create('<div class="confirmation-dialogue"></div>').append(e.Node.create('<div class="confirmation-message">'+this.get(a)+"</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,i,e.WidgetStdMod.REPLACE),this.setStdModContent(e.WidgetStdMod.HEADER,'<h1 id="moodle-dialogue-'+this.get("COUNT")+'-header-text">'+this.get(u)+"</h1>",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"]});
|
||||
|
|
|
@ -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,
|
||||
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', 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');
|
||||
|
|
19
lib/yui/src/notification/js/alert.js
vendored
19
lib/yui/src/notification/js/alert.js
vendored
|
@ -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('<input type="button" id="id_yuialertconfirm-' + this.get('COUNT') + '" value="'+this.get(CONFIRMYES)+'" />'),
|
||||
|
@ -33,11 +33,22 @@ Y.extend(ALERT, M.core.dialogue, {
|
|||
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
|
||||
this.setStdModContent(Y.WidgetStdMod.HEADER,
|
||||
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', 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();
|
||||
|
|
25
lib/yui/src/notification/js/confirm.js
vendored
25
lib/yui/src/notification/js/confirm.js
vendored
|
@ -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,
|
||||
'<h1 id="moodle-dialogue-'+this.get('COUNT')+'-header-text">' + this.get(TITLE) + '</h1>', 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');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue