Make all-day events show up.

bug 299142, r=pavlov
This commit is contained in:
mvl%exedo.nl 2005-06-29 17:35:38 +00:00
parent 1cea475c5b
commit ca0d21321a
8 changed files with 67 additions and 49 deletions

View File

@ -798,7 +798,7 @@ CalendarView.prototype.setDrawProperties = function calView_setDrawProperties( d
var i;
for( i = 0; i < dayEventList.length; i++ ) {
if( !dayEventList[i].event.isAllDay) {
if (!dayEventList[i].event.startDate.isDate) {
dayEventStartList.push(dayEventList[i]);
dayEventEndList.push(dayEventList[i]);
}

View File

@ -468,11 +468,12 @@ DayView.prototype.createEventBoxInternal = function(event)
eventBox.setAttribute("class", "day-view-event-class");
this.setEventboxClass( eventBox, calEvent, "day-view");
eventBox.setAttribute( "top", eventTop );
eventBox.setAttribute( "left", eventLeft );
eventBox.setAttribute( "height", eventHeight );
eventBox.setAttribute( "width", eventWidth );
if (!startDate.isDate) {
eventBox.setAttribute( "top", eventTop );
eventBox.setAttribute( "left", eventLeft );
eventBox.setAttribute( "height", eventHeight );
eventBox.setAttribute( "width", eventWidth );
}
eventBox.setAttribute( "flex", "1" );
eventBox.setAttribute( "eventbox", "dayview" ); // ?
@ -490,8 +491,13 @@ DayView.prototype.createEventBoxInternal = function(event)
eventBox.appendChild( eventTitleLabel );
eventBox.appendChild( eventDescription );
document.getElementById("day-view-content-board").appendChild(eventBox);
if (!startDate.isDate) {
document.getElementById("day-view-content-board").appendChild(eventBox);
} else {
allDayRow = document.createElement("hbox");
allDayRow.appendChild(eventBox);
document.getElementById("all-day-content-box").appendChild(allDayRow);
}
}
/** PUBLIC

View File

@ -100,8 +100,7 @@
<!-- Day View: -->
<vbox id="inner-day-view-box" flex="1">
<hbox id="all-day-collapsible-box" collapsed="true"
ondblclick="dayAllDayDoubleClick( event )">
<hbox id="all-day-collapsible-box" ondblclick="dayAllDayDoubleClick( event )">
<label id="all-day-content-title" value="All-day Events"/>
<vbox id="all-day-content-box" flex="1">
</vbox>

View File

@ -156,14 +156,14 @@ function loadCalendarEventDialog()
setElementValue("all-day-event-checkbox", event.isAllDay, "checked");
break;
case "todo":
var hasEntry = event.entryDate.isValid;
var entryDate = (hasEntry? event.entryDate.jsDate : null);
var hasEntry = event.entryDate ? true : false;
var entryDate = (hasEntry ? event.entryDate.jsDate : null);
setElementValue("start-datetime", entryDate);
setElementValue("start-datetime", !hasEntry, "disabled");
setElementValue("start-checkbox", hasEntry, "checked");
var hasDue = event.dueDate.isValid;
var hasDue = event.dueDate ? true : false;
var dueDate = (hasDue? event.dueDate.jsDate : null);
setElementValue("due-datetime", dueDate);
@ -489,6 +489,10 @@ function onOKCommand()
endDate.setDate(endDate.getDate() + 1);
}
event.endDate = jsDateToDateTime(endDate);
if (event.isAllDay) {
event.startDate.isDate = true;
event.endDate.isDate = true;
}
var status = getElementValue("event-status-field");
if (status)
@ -501,13 +505,13 @@ function onOKCommand()
if ( getElementValue("start-checkbox", "checked") ) {
event.entryDate = jsDateToDateTime(getElementValue("start-datetime"));
} else {
event.entryDate.reset();
event.entryDate = null;
}
if ( getElementValue("due-checkbox", "checked") ) {
event.dueDate = jsDateToDateTime(getElementValue("due-datetime"));
} else {
event.dueDate.reset();
event.dueDate = null;
}
event.status = getElementValue("todo-status-field");

View File

@ -283,7 +283,7 @@ MonthView.prototype.createEventBoxInternal = function(itemOccurrence, startDate,
eventBoxText.setAttribute("crop", "end");
eventBoxText.setAttribute("class", "month-day-event-text-class");
if (calEvent.isAllDay) {
if (calEvent.startDate.isDate) {
eventBox.setAttribute("allday", "true");
eventBoxText.setAttribute("value", calEvent.title );
// Create an image

View File

@ -295,7 +295,7 @@ MultiweekView.prototype.createEventBoxInternal = function multiweekView_createEv
eventBoxText.setAttribute( "crop", "end" );
eventBoxText.setAttribute( "class", "multiweek-day-event-text-class" );
if(calEvent.isAllDay)
if(calEvent.startDate.isDate)
{
eventBox.setAttribute("allday", "true");
eventBoxText.setAttribute("value", calEvent.title );

View File

@ -409,36 +409,40 @@ WeekView.prototype.createEventBoxInternal = function (event)
eventBox.occurrence = itemOccurrence;
eventBox.event = calEvent;
var ElementOfRef = document.getElementById("week-tree-day-" + gRefColumnIndex + "-item-" + startHour) ;
var hourHeight = ElementOfRef.boxObject.height;
var ElementOfRefEnd = document.getElementById("week-tree-day-" + gRefColumnIndex + "-item-" + endDate.hour) ;
var hourHeightEnd = ElementOfRefEnd.boxObject.height;
var hourWidth = ElementOfRef.boxObject.width;
var eventSlotWidth = Math.round(hourWidth / event.totalSlotCount);
var Width = ( event.drawSlotCount * eventSlotWidth ) - 1;
eventBox.setAttribute( "width", Width );
var top = eval( ElementOfRef.boxObject.y + ( ( startMinutes/60 ) * hourHeight ) );
top = top - ElementOfRef.parentNode.boxObject.y - 2;
eventBox.setAttribute("top", top);
var bottom = eval( ElementOfRefEnd.boxObject.y + ( ( endDate.minute/60 ) * hourHeightEnd ) );
bottom = bottom - ElementOfRefEnd.parentNode.boxObject.y - 2;
eventBox.setAttribute("height", bottom - top);
// figure out what column we need to put this on
debug("d: "+gHeaderDateItemArray[1].getAttribute("date")+"\n");
var dayIndex = new Date(gHeaderDateItemArray[1].getAttribute("date"));
var index = startDate.weekday - dayIndex.getDay();
debug("index is:" + index + "(" + startDate.weekday + " - " + dayIndex.getDay() + ")\n");
var boxLeft = document.getElementById("week-tree-day-"+index+"-item-"+startHour).boxObject.x -
document.getElementById( "week-view-content-box" ).boxObject.x +
( event.startDrawSlot * eventSlotWidth );
//dump(boxLeft + "\n");
eventBox.setAttribute("left", boxLeft);
var ElementOfRef = document.getElementById("week-tree-day-" + gRefColumnIndex + "-item-" + startHour) ;
var hourHeight = ElementOfRef.boxObject.height;
var ElementOfRefEnd = document.getElementById("week-tree-day-" + gRefColumnIndex + "-item-" + endDate.hour) ;
var hourHeightEnd = ElementOfRefEnd.boxObject.height;
var hourWidth = ElementOfRef.boxObject.width;
if (!startDate.isDate) {
var eventSlotWidth = Math.round(hourWidth / event.totalSlotCount);
var Width = ( event.drawSlotCount * eventSlotWidth ) - 1;
eventBox.setAttribute( "width", Width );
var top = eval( ElementOfRef.boxObject.y + ( ( startMinutes/60 ) * hourHeight ) );
top = top - ElementOfRef.parentNode.boxObject.y - 2;
eventBox.setAttribute("top", top);
var bottom = eval( ElementOfRefEnd.boxObject.y + ( ( endDate.minute/60 ) * hourHeightEnd ) );
bottom = bottom - ElementOfRefEnd.parentNode.boxObject.y - 2;
eventBox.setAttribute("height", bottom - top);
var boxLeft = document.getElementById("week-tree-day-"+index+"-item-"+startHour).boxObject.x -
document.getElementById( "week-view-content-box" ).boxObject.x +
( event.startDrawSlot * eventSlotWidth );
//dump(boxLeft + "\n");
eventBox.setAttribute("left", boxLeft);
} else {
eventBox.setAttribute( "width", hourWidth );
}
// set the event box to be of class week-view-event-class and the appropriate calendar-color class
this.setEventboxClass(eventBox, calEvent, "week-view");
@ -474,7 +478,12 @@ WeekView.prototype.createEventBoxInternal = function (event)
}
debug("Adding eventBox " + eventBox + "\n");
document.getElementById("week-view-content-board").appendChild(eventBox);
if (!startDate.isDate) {
document.getElementById("week-view-content-board").appendChild(eventBox);
} else {
var allDayBox = document.getElementById("all-day-content-box-week-"+(index+1));
allDayBox.appendChild(eventBox);
}
}
/** PUBLIC

View File

@ -134,7 +134,7 @@
<label id="week-header-date-text-1" class="week-header-date-text" value="&day.1.DDD;" />
</hbox>
<hbox class="all-day-content-box-week" id="all-day-content-box-week-1" flex="1"/>
<vbox class="all-day-content-box-week" id="all-day-content-box-week-1" flex="1"/>
</column>
@ -145,7 +145,7 @@
<label id="week-header-date-text-2" class="week-header-date-text" value="&day.2.DDD;" />
</hbox>
<hbox class="all-day-content-box-week" id="all-day-content-box-week-2" flex="1"/>
<vbox class="all-day-content-box-week" id="all-day-content-box-week-2" flex="1"/>
</column>
@ -156,7 +156,7 @@
<label id="week-header-date-text-3" class="week-header-date-text" value="&day.3.DDD;" />
</hbox>
<hbox class="all-day-content-box-week" id="all-day-content-box-week-3" flex="1"/>
<vbox class="all-day-content-box-week" id="all-day-content-box-week-3" flex="1"/>
</column>
<!-- DAY 3 -->
@ -166,7 +166,7 @@
<label id="week-header-date-text-4" class="week-header-date-text" value="&day.4.DDD;" />
</hbox>
<hbox class="all-day-content-box-week" id="all-day-content-box-week-4" flex="1"/>
<vbox class="all-day-content-box-week" id="all-day-content-box-week-4" flex="1"/>
</column>
<!-- DAY 4 -->
@ -176,7 +176,7 @@
<label id="week-header-date-text-5" class="week-header-date-text" value="&day.5.DDD;" />
</hbox>
<hbox class="all-day-content-box-week" id="all-day-content-box-week-5" flex="1"/>
<vbox class="all-day-content-box-week" id="all-day-content-box-week-5" flex="1"/>
</column>
<!-- DAY 5 -->
@ -186,7 +186,7 @@
<label id="week-header-date-text-6" class="week-header-date-text" value="&day.6.DDD;" />
</hbox>
<hbox class="all-day-content-box-week" id="all-day-content-box-week-6" flex="1"/>
<vbox class="all-day-content-box-week" id="all-day-content-box-week-6" flex="1"/>
</column>
<!-- DAY 6 -->
@ -196,7 +196,7 @@
<label id="week-header-date-text-7" class="week-header-date-text" value="&day.7.DDD;" />
</hbox>
<hbox class="all-day-content-box-week" id="all-day-content-box-week-7" flex="1"/>
<vbox class="all-day-content-box-week" id="all-day-content-box-week-7" flex="1"/>
</column>
</columns>
</grid>