{iframe: false, hide_blank_weeks: true, start_weekday: firstdayofweek});
date_selector_calendar.calendar.renderEvent.subscribe(function() {
date_selector_calendar.panel.fireEvent('changeContent');
+ date_selector_calendar.delayed_reposition();
});
-
- // TODO, find a way to hide the calendar when shift-tabbing.
-// date_selector_calendar.calendar.render();
-// var prev_month_link = YAHOO.util.Dom.getElementsByClassName('calnavleft', 'a', div)[0];
-// YAHOO.util.Event.addBlurListener(prev_month_link, this.blur_event, this);
}
this.fieldset = el;
} else if (/\[day\]$/.test(controls[i].name)) {
this.dayselect = controls[i];
} else {
- YAHOO.util.Event.addFocusListener(controls[i], this.cancel_any_timeout, this);
+ YAHOO.util.Event.addFocusListener(controls[i], date_selector_calendar.cancel_any_timeout, this);
YAHOO.util.Event.addBlurListener(controls[i], this.blur_event, this);
}
}
* if we are just jumping from on of our controls to another. */
date_selector_calendar.hidetimeout = null;
+/** Timeout for repositioning after a delay after a change of months. */
+date_selector_calendar.repositiontimeout = null;
+/** Member variables. Pointers to various bits of the DOM. */
date_selector_calendar.prototype.fieldset = null;
date_selector_calendar.prototype.yearselect = null;
date_selector_calendar.prototype.monthselect = null;
date_selector_calendar.prototype.dayselect = null;
date_selector_calendar.prototype.enablecheckbox = null;
-date_selector_calendar.prototype.cancel_any_timeout = function() {
+date_selector_calendar.cancel_any_timeout = function() {
if (date_selector_calendar.hidetimeout) {
clearTimeout(date_selector_calendar.hidetimeout);
date_selector_calendar.hidetimeout = null;
}
+ if (date_selector_calendar.repositiontimeout) {
+ clearTimeout(date_selector_calendar.repositiontimeout);
+ date_selector_calendar.repositiontimeout = null;
+ }
+}
+
+date_selector_calendar.delayed_reposition = function() {
+ if (date_selector_calendar.repositiontimeout) {
+ clearTimeout(date_selector_calendar.repositiontimeout);
+ date_selector_calendar.repositiontimeout = null;
+ }
+ date_selector_calendar.repositiontimeout = setTimeout(
+ function() {date_selector_calendar.fix_position();}, 500);
+}
+
+date_selector_calendar.fix_position = function() {
+ if (date_selector_calendar.currentowner) {
+ date_selector_calendar.panel.cfg.setProperty('context', [date_selector_calendar.currentowner.fieldset, 'bl', 'tl']);
+ }
}
date_selector_calendar.prototype.focus_event = function(e, me) {
- me.cancel_any_timeout();
+ date_selector_calendar.cancel_any_timeout();
if (me.enablecheckbox == null || me.enablecheckbox.checked) {
me.claim_calendar();
} else {
}
date_selector_calendar.prototype.claim_calendar = function() {
- this.cancel_any_timeout();
+ date_selector_calendar.cancel_any_timeout();
if (date_selector_calendar.currentowner == this) {
return;
}
date_selector_calendar.currentowner.release_calendar();
}
+ if (date_selector_calendar.currentowner != this) {
+ this.connect_handlers();
+ }
+ date_selector_calendar.currentowner = this;
+
date_selector_calendar.calendar.cfg.setProperty('mindate', new Date(this.yearselect.options[0].value, 0, 1));
date_selector_calendar.calendar.cfg.setProperty('maxdate', new Date(this.yearselect.options[this.yearselect.options.length - 1].value, 11, 31));
- this.fieldset.insertBefore(date_selector_calendar.panel.element, this.fieldset.firstChild);
+ this.fieldset.insertBefore(date_selector_calendar.panel.element, this.yearselect.nextSibling);
this.set_date_from_selects();
date_selector_calendar.panel.show();
var me = this;
- setTimeout(function() {me.cancel_any_timeout()}, 100);
-
- if (date_selector_calendar.currentowner != this) {
- this.connect_handlers();
- }
-
- date_selector_calendar.currentowner = this;
+ setTimeout(function() {date_selector_calendar.cancel_any_timeout()}, 100);
}
date_selector_calendar.prototype.set_date_from_selects = function() {
date_selector_calendar.calendar.select(new Date(year, month, day));
date_selector_calendar.calendar.setMonth(month);
date_selector_calendar.calendar.setYear(year);
- date_selector_calendar.calendar.render();
- date_selector_calendar.panel.cfg.setProperty('context', [this.fieldset, 'bl', 'tl']);
+ date_selector_calendar.calendar.render();
+ date_selector_calendar.fix_position();
}
date_selector_calendar.prototype.set_selects_from_date = function(eventtype, args) {