Merge branch 'MDL-45759-27' of git://github.com/andrewnicols/moodle into MOODLE_27_STABLE

This commit is contained in:
Dan Poltawski
2014-08-11 11:24:20 +01:00
4 changed files with 193 additions and 34 deletions
@@ -57,18 +57,47 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @private
*/
_closeEvents: null,
/**
* A reference to the yes button.
*
* @property _yesButton
* @type Node
* @private
*/
_yesButton: null,
/**
* A reference to the No button.
*
* @property _noButton
* @type Node
* @private
*/
_noButton: null,
/**
* A reference to the Question.
*
* @property _question
* @type Node
* @private
*/
_question: null,
initializer: function() {
this._closeEvents = [];
this.publish('complete');
this.publish('complete-yes');
this.publish('complete-no');
var yes = Y.Node.create('<input type="button" id="id_yuiconfirmyes-' + this.get('COUNT') + '" value="'+this.get(CONFIRMYES)+'" />'),
no = Y.Node.create('<input type="button" id="id_yuiconfirmno-' + this.get('COUNT') + '" value="'+this.get(CONFIRMNO)+'" />'),
content = Y.Node.create('<div class="confirmation-dialogue"></div>')
.append(Y.Node.create('<div class="confirmation-message">'+this.get(QUESTION)+'</div>'))
this._yesButton = Y.Node.create('<input type="button" id="id_yuiconfirmyes-' + this.get('COUNT') + '" value="'+this.get(CONFIRMYES)+'" />');
this._noButton = Y.Node.create('<input type="button" id="id_yuiconfirmno-' + this.get('COUNT') + '" value="'+this.get(CONFIRMNO)+'" />');
this._question = Y.Node.create('<div class="confirmation-message">' + this.get(QUESTION) + '</div>');
var content = Y.Node.create('<div class="confirmation-dialogue"></div>')
.append(this._question)
.append(Y.Node.create('<div class="confirmation-buttons"></div>')
.append(yes)
.append(no));
.append(this._yesButton)
.append(this._noButton));
this.get(BASE).addClass('moodle-dialogue-confirm');
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
@@ -76,8 +105,8 @@ Y.extend(CONFIRM, M.core.notification.info, {
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)
this._yesButton.on('click', this.submit, this, true),
this._noButton.on('click', this.submit, this, false)
);
var closeButton = this.get('boundingBox').one('.closebutton');
@@ -113,7 +142,15 @@ Y.extend(CONFIRM, M.core.notification.info, {
*/
yesLabel: {
validator: Y.Lang.isString,
value: M.util.get_string('yes', 'moodle')
valueFn: function() {
return M.util.get_string('yes', 'moodle');
},
setter: function(value) {
if (this._yesButton) {
this._yesButton.set('value', value);
}
return value;
}
},
/**
@@ -125,7 +162,15 @@ Y.extend(CONFIRM, M.core.notification.info, {
*/
noLabel: {
validator: Y.Lang.isString,
value: M.util.get_string('no', 'moodle')
valueFn: function() {
return M.util.get_string('no', 'moodle');
},
setter: function(value) {
if (this._noButton) {
this._noButton.set('value', value);
}
return value;
}
},
/**
@@ -149,7 +194,15 @@ Y.extend(CONFIRM, M.core.notification.info, {
*/
question: {
validator: Y.Lang.isString,
value: M.util.get_string('areyousure', 'moodle')
valueFn: function() {
return M.util.get_string('areyousure', 'moodle');
},
setter: function(value) {
if (this._question) {
this._question.set('value', value);
}
return value;
}
}
}
});
@@ -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: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:M.util.get_string("yes","moodle")},noLabel:{validator:e.Lang.isString,value:M.util.get_string("no","moodle")},title:{validator:e.Lang.isString,value:M.util.get_string("confirm","moodle")},question:{validator:e.Lang.isString,value:M.util.get_string("areyousure","moodle")}}}),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,_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" id="id_yuiconfirmyes-'+this.get("COUNT")+'" value="'+this.get(i)+'" />'),this._noButton=e.Node.create('<input type="button" 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"></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"]});
@@ -57,18 +57,47 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @private
*/
_closeEvents: null,
/**
* A reference to the yes button.
*
* @property _yesButton
* @type Node
* @private
*/
_yesButton: null,
/**
* A reference to the No button.
*
* @property _noButton
* @type Node
* @private
*/
_noButton: null,
/**
* A reference to the Question.
*
* @property _question
* @type Node
* @private
*/
_question: null,
initializer: function() {
this._closeEvents = [];
this.publish('complete');
this.publish('complete-yes');
this.publish('complete-no');
var yes = Y.Node.create('<input type="button" id="id_yuiconfirmyes-' + this.get('COUNT') + '" value="'+this.get(CONFIRMYES)+'" />'),
no = Y.Node.create('<input type="button" id="id_yuiconfirmno-' + this.get('COUNT') + '" value="'+this.get(CONFIRMNO)+'" />'),
content = Y.Node.create('<div class="confirmation-dialogue"></div>')
.append(Y.Node.create('<div class="confirmation-message">'+this.get(QUESTION)+'</div>'))
this._yesButton = Y.Node.create('<input type="button" id="id_yuiconfirmyes-' + this.get('COUNT') + '" value="'+this.get(CONFIRMYES)+'" />');
this._noButton = Y.Node.create('<input type="button" id="id_yuiconfirmno-' + this.get('COUNT') + '" value="'+this.get(CONFIRMNO)+'" />');
this._question = Y.Node.create('<div class="confirmation-message">' + this.get(QUESTION) + '</div>');
var content = Y.Node.create('<div class="confirmation-dialogue"></div>')
.append(this._question)
.append(Y.Node.create('<div class="confirmation-buttons"></div>')
.append(yes)
.append(no));
.append(this._yesButton)
.append(this._noButton));
this.get(BASE).addClass('moodle-dialogue-confirm');
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
@@ -76,8 +105,8 @@ Y.extend(CONFIRM, M.core.notification.info, {
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)
this._yesButton.on('click', this.submit, this, true),
this._noButton.on('click', this.submit, this, false)
);
var closeButton = this.get('boundingBox').one('.closebutton');
@@ -113,7 +142,15 @@ Y.extend(CONFIRM, M.core.notification.info, {
*/
yesLabel: {
validator: Y.Lang.isString,
value: M.util.get_string('yes', 'moodle')
valueFn: function() {
return M.util.get_string('yes', 'moodle');
},
setter: function(value) {
if (this._yesButton) {
this._yesButton.set('value', value);
}
return value;
}
},
/**
@@ -125,7 +162,15 @@ Y.extend(CONFIRM, M.core.notification.info, {
*/
noLabel: {
validator: Y.Lang.isString,
value: M.util.get_string('no', 'moodle')
valueFn: function() {
return M.util.get_string('no', 'moodle');
},
setter: function(value) {
if (this._noButton) {
this._noButton.set('value', value);
}
return value;
}
},
/**
@@ -149,7 +194,15 @@ Y.extend(CONFIRM, M.core.notification.info, {
*/
question: {
validator: Y.Lang.isString,
value: M.util.get_string('areyousure', 'moodle')
valueFn: function() {
return M.util.get_string('areyousure', 'moodle');
},
setter: function(value) {
if (this._question) {
this._question.set('value', value);
}
return value;
}
}
}
});
+64 -11
View File
@@ -28,18 +28,47 @@ Y.extend(CONFIRM, M.core.notification.info, {
* @private
*/
_closeEvents: null,
/**
* A reference to the yes button.
*
* @property _yesButton
* @type Node
* @private
*/
_yesButton: null,
/**
* A reference to the No button.
*
* @property _noButton
* @type Node
* @private
*/
_noButton: null,
/**
* A reference to the Question.
*
* @property _question
* @type Node
* @private
*/
_question: null,
initializer: function() {
this._closeEvents = [];
this.publish('complete');
this.publish('complete-yes');
this.publish('complete-no');
var yes = Y.Node.create('<input type="button" id="id_yuiconfirmyes-' + this.get('COUNT') + '" value="'+this.get(CONFIRMYES)+'" />'),
no = Y.Node.create('<input type="button" id="id_yuiconfirmno-' + this.get('COUNT') + '" value="'+this.get(CONFIRMNO)+'" />'),
content = Y.Node.create('<div class="confirmation-dialogue"></div>')
.append(Y.Node.create('<div class="confirmation-message">'+this.get(QUESTION)+'</div>'))
this._yesButton = Y.Node.create('<input type="button" id="id_yuiconfirmyes-' + this.get('COUNT') + '" value="'+this.get(CONFIRMYES)+'" />');
this._noButton = Y.Node.create('<input type="button" id="id_yuiconfirmno-' + this.get('COUNT') + '" value="'+this.get(CONFIRMNO)+'" />');
this._question = Y.Node.create('<div class="confirmation-message">' + this.get(QUESTION) + '</div>');
var content = Y.Node.create('<div class="confirmation-dialogue"></div>')
.append(this._question)
.append(Y.Node.create('<div class="confirmation-buttons"></div>')
.append(yes)
.append(no));
.append(this._yesButton)
.append(this._noButton));
this.get(BASE).addClass('moodle-dialogue-confirm');
this.setStdModContent(Y.WidgetStdMod.BODY, content, Y.WidgetStdMod.REPLACE);
this.setStdModContent(Y.WidgetStdMod.HEADER,
@@ -47,8 +76,8 @@ Y.extend(CONFIRM, M.core.notification.info, {
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)
this._yesButton.on('click', this.submit, this, true),
this._noButton.on('click', this.submit, this, false)
);
var closeButton = this.get('boundingBox').one('.closebutton');
@@ -84,7 +113,15 @@ Y.extend(CONFIRM, M.core.notification.info, {
*/
yesLabel: {
validator: Y.Lang.isString,
value: M.util.get_string('yes', 'moodle')
valueFn: function() {
return M.util.get_string('yes', 'moodle');
},
setter: function(value) {
if (this._yesButton) {
this._yesButton.set('value', value);
}
return value;
}
},
/**
@@ -96,7 +133,15 @@ Y.extend(CONFIRM, M.core.notification.info, {
*/
noLabel: {
validator: Y.Lang.isString,
value: M.util.get_string('no', 'moodle')
valueFn: function() {
return M.util.get_string('no', 'moodle');
},
setter: function(value) {
if (this._noButton) {
this._noButton.set('value', value);
}
return value;
}
},
/**
@@ -120,7 +165,15 @@ Y.extend(CONFIRM, M.core.notification.info, {
*/
question: {
validator: Y.Lang.isString,
value: M.util.get_string('areyousure', 'moodle')
valueFn: function() {
return M.util.get_string('areyousure', 'moodle');
},
setter: function(value) {
if (this._question) {
this._question.set('value', value);
}
return value;
}
}
}
});