Merge branch 'MDL-39581_master' of https://github.com/markn86/moodle

This commit is contained in:
Damyon Wiese 2013-05-13 14:05:30 +08:00
commit 2c59e0ffaa

View File

@ -97,7 +97,7 @@ YUI.add('moodle-form-dateselector', function(Y) {
focus_event : function(e) {
M.form.dateselector.cancel_any_timeout();
// If the current owner is set, then the pop-up is currently being displayed, so hide it.
if (M.form.dateselector.currentowner) {
if (M.form.dateselector.currentowner == this) {
this.release_calendar();
} else if ((this.enablecheckbox == null)
|| (this.enablecheckbox.get('checked'))) { // Must be hidden. If the field is enabled display the pop-up.
@ -116,8 +116,16 @@ YUI.add('moodle-form-dateselector', function(Y) {
},
claim_calendar : function() {
M.form.dateselector.cancel_any_timeout();
this.connect_handlers();
this.set_date_from_selects();
if (M.form.dateselector.currentowner == this) {
return;
}
if (M.form.dateselector.currentowner) {
M.form.dateselector.currentowner.release_calendar();
}
if (M.form.dateselector.currentowner != this) {
this.connect_handlers();
this.set_date_from_selects();
}
M.form.dateselector.currentowner = this;
M.form.dateselector.calendar.cfg.setProperty('mindate', new Date(this.yearselect.firstOptionValue(), 0, 1));
M.form.dateselector.calendar.cfg.setProperty('maxdate', new Date(this.yearselect.lastOptionValue(), 11, 31));