now handling freebusy for allday events properly

This commit is contained in:
michael.buettner%sun.com 2006-08-02 16:26:25 +00:00
Родитель c15df7d453
Коммит 0eb79b3cb8
3 изменённых файлов: 20 добавлений и 1 удалений

Просмотреть файл

@ -1350,6 +1350,7 @@
var kDefaultTimezone = calendarDefaultTimezone(); var kDefaultTimezone = calendarDefaultTimezone();
this.mStartDate = aStartDate.getInTimezone(kDefaultTimezone); this.mStartDate = aStartDate.getInTimezone(kDefaultTimezone);
this.mEndDate = aEndDate.getInTimezone(kDefaultTimezone); this.mEndDate = aEndDate.getInTimezone(kDefaultTimezone);
var endDate = this.mEndDate.clone();
// Check if an all-day event has been passed in (to adapt endDate). // Check if an all-day event has been passed in (to adapt endDate).
if (this.mStartDate.isDate) { if (this.mStartDate.isDate) {
@ -1362,9 +1363,11 @@
// in local timezone. // in local timezone.
this.mEndDate.normalize(); this.mEndDate.normalize();
this.mStartDate.normalize(); this.mStartDate.normalize();
endDate.normalize();
} }
this.mStartDate.makeImmutable(); this.mStartDate.makeImmutable();
this.mEndDate.makeImmutable(); this.mEndDate.makeImmutable();
endDate.makeImmutable();
document.getAnonymousElementByAttribute(this, "anonid", "event-starttime").value = this.mStartDate.jsDate; document.getAnonymousElementByAttribute(this, "anonid", "event-starttime").value = this.mStartDate.jsDate;
document.getAnonymousElementByAttribute(this, "anonid", "event-endtime").value = this.mEndDate.jsDate; document.getAnonymousElementByAttribute(this, "anonid", "event-endtime").value = this.mEndDate.jsDate;
@ -1372,7 +1375,7 @@
// tell the timebar about the new start/enddate // tell the timebar about the new start/enddate
var timebar = document.getAnonymousElementByAttribute(this, "anonid", "timebar"); var timebar = document.getAnonymousElementByAttribute(this, "anonid", "timebar");
timebar.startDate = this.mStartDate; timebar.startDate = this.mStartDate;
timebar.endDate = this.mEndDate; timebar.endDate = endDate;
timebar.refresh(); timebar.refresh();
]]> ]]>
</body> </body>

Просмотреть файл

@ -159,6 +159,7 @@
var date = val.clone(); var date = val.clone();
date.hour = 0; date.hour = 0;
date.minute = 0; date.minute = 0;
date.isDate = false;
if (!this.mDateFormatter) { if (!this.mDateFormatter) {
this.mDateFormatter = Components.classes["@mozilla.org/calendar/datetime-formatter;1"] this.mDateFormatter = Components.classes["@mozilla.org/calendar/datetime-formatter;1"]
@ -298,11 +299,13 @@
var container = document.getAnonymousElementByAttribute(this, "anonid", "container"); var container = document.getAnonymousElementByAttribute(this, "anonid", "container");
var date = this.mStartDate.clone(); var date = this.mStartDate.clone();
date.day += val; date.day += val;
date.normalize();
var numChilds = container.childNodes.length; var numChilds = container.childNodes.length;
for(var i=0; i<numChilds; i++) { for(var i=0; i<numChilds; i++) {
var child = container.childNodes[i]; var child = container.childNodes[i];
child.date = date; child.date = date;
date.day++; date.day++;
date.normalize();
} }
return val; return val;
]]> ]]>
@ -410,6 +413,7 @@
child.endDate = this.mEndDate; child.endDate = this.mEndDate;
child.date = date; child.date = date;
date.day++; date.day++;
date.normalize();
} }
var offset = this.mDayOffset; var offset = this.mDayOffset;
this.dayOffset = offset; this.dayOffset = offset;
@ -442,6 +446,7 @@
if(count > 0) { if(count > 0) {
for(var i=0; i<count; i++) { for(var i=0; i<count; i++) {
date.day++; date.day++;
date.normalize();
var newNode = template.cloneNode(false); var newNode = template.cloneNode(false);
newNode.startDate = this.mStartDate; newNode.startDate = this.mStartDate;
newNode.endDate = this.mEndDate; newNode.endDate = this.mEndDate;
@ -615,6 +620,7 @@
} }
date.hour = this.mStartHour; date.hour = this.mStartHour;
date.day++; date.day++;
date.normalize();
} }
} }
]]> ]]>

Просмотреть файл

@ -142,6 +142,16 @@ function onTabSelected()
var kDefaultTimezone = calendarDefaultTimezone(); var kDefaultTimezone = calendarDefaultTimezone();
var startDate = jsDateToDateTime(getElementValue("event-starttime")); var startDate = jsDateToDateTime(getElementValue("event-starttime"));
var endDate = jsDateToDateTime(getElementValue("event-endtime")); var endDate = jsDateToDateTime(getElementValue("event-endtime"));
startDate = startDate.getInTimezone(kDefaultTimezone);
endDate = endDate.getInTimezone(kDefaultTimezone);
var isAllDay = getElementValue("event-all-day", "checked");
if (isAllDay) {
startDate.isDate = true;
startDate.normalize();
endDate.isDate = true;
endDate.day += 1;
endDate.normalize();
}
attendees.setTimeRange(startDate,endDate); attendees.setTimeRange(startDate,endDate);
} }
} }