Monotone-Parent: b71cb031b6d81c362bbb5a411baf4cd30bcf1b01

Monotone-Revision: f0e01017c45580ffb00a3ec0ea376689e815bd26

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2006-11-07T16:13:03
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2006-11-07 16:13:03 +00:00
parent 53d90d404c
commit 0885f51b6f
10 changed files with 221 additions and 25 deletions

View File

@@ -182,3 +182,75 @@ function startDayAsShortString() {
function endDayAsShortString() {
return $('endTime_date').valueAsShortDateString();
}
this._getDate = function(which) {
var date = window.timeWidgets[which]['date'].valueAsDate();
date.setHours( window.timeWidgets[which]['hour'].value );
date.setMinutes( window.timeWidgets[which]['minute'].value );
return date;
}
this._getShadowDate = function(which) {
var date = window.timeWidgets[which]['date'].getAttribute("shadow-value").asDate();
var intValue = parseInt(window.timeWidgets[which]['hour'].getAttribute("shadow-value"));
date.setHours(intValue);
intValue = parseInt(window.timeWidgets[which]['minute'].getAttribute("shadow-value"));
date.setMinutes(intValue);
// window.alert("shadow: " + date);
return date;
}
this.getStartDate = function() {
return this._getDate('start');
}
this.getEndDate = function() {
return this._getDate('end');
}
this.getShadowStartDate = function() {
return this._getShadowDate('start');
}
this.getShadowEndDate = function() {
return this._getShadowDate('end');
}
this._setDate = function(which, newDate) {
window.timeWidgets[which]['date'].setValueAsDate(newDate);
window.timeWidgets[which]['hour'].value = newDate.getHours();
var minutes = newDate.getMinutes();
if (minutes % 15)
minutes += (15 - minutes % 15);
window.timeWidgets[which]['minute'].value = minutes;
}
this.setStartDate = function(newStartDate) {
this._setDate('start', newStartDate);
}
this.setEndDate = function(newEndDate) {
// window.alert(newEndDate);
this._setDate('end', newEndDate);
}
this.onAdjustEndTime = function(event) {
var dateDelta = (window.getStartDate().valueOf()
- window.getShadowStartDate().valueOf());
// window.alert(window.getEndDate().valueOf() + ' ' + dateDelta);
var newEndDate = new Date(window.getEndDate().valueOf() + dateDelta);
window.setEndDate(newEndDate);
window.timeWidgets['start']['date'].updateShadowValue();
window.timeWidgets['start']['hour'].updateShadowValue();
window.timeWidgets['start']['minute'].updateShadowValue();
}
this.initTimeWidgets = function (widgets) {
this.timeWidgets = widgets;
widgets['start']['date'].addEventListener("change", this.onAdjustEndTime, false);
widgets['start']['hour'].addEventListener("change", this.onAdjustEndTime, false);
widgets['start']['minute'].addEventListener("change", this.onAdjustEndTime, false);
}