Bug 295146 Mouseover preview of repeated event shows original start datetime instead of time of occurrence.

patch by gekacheka@yahoo.com, r=mvl
This commit is contained in:
mvl%exedo.nl 2005-06-01 13:33:25 +00:00
parent 5dcb6e70c4
commit 35cf8c1baf
5 changed files with 39 additions and 38 deletions

View File

@ -429,6 +429,7 @@ DayView.prototype.createEventBoxInternal = function(itemOccurrence, startDate, e
//create actual eventbox
var eventBox = document.createElement( "vbox" );
eventBox.occurrence = itemOccurrence;
eventBox.event = calEvent;
eventBox.setAttribute( "name", "day-view-event-box-"+calEvent.id );
@ -446,7 +447,7 @@ DayView.prototype.createEventBoxInternal = function(itemOccurrence, startDate, e
eventBox.setAttribute( "onclick", "dayEventItemClick( this, event )" );
eventBox.setAttribute( "ondblclick", "dayEventItemDoubleClick( this, event )" );
eventBox.setAttribute( "onmouseover", "getEventToolTip(this, event)" );
eventBox.setAttribute( "onmouseover", "onMouseOverGridOccurrence(event)" );
eventBox.setAttribute( "tooltip", "gridOccurrenceTooltip" );
eventBox.setAttribute( "ondraggesture", "nsDragAndDrop.startDrag(event,calendarViewDNDObserver);" );
eventBox.setAttribute( "ondragover", "nsDragAndDrop.dragOver(event,calendarViewDNDObserver)" );

View File

@ -269,12 +269,13 @@ MonthView.prototype.createEventBoxInternal = function(itemOccurrence, startDate,
eventBox.setAttribute("eventbox", "monthview" );
eventBox.setAttribute("onclick", "monthEventBoxClickEvent( this, event )" );
eventBox.setAttribute("ondblclick", "monthEventBoxDoubleClickEvent( this, event )" );
eventBox.setAttribute("onmouseover", "getEventToolTip(this, event)" );
eventBox.setAttribute("onmouseover", "onMouseOverGridOccurrence(event)" );
eventBox.setAttribute("tooltip", "gridOccurrenceTooltip" );
eventBox.setAttribute("ondraggesture", "nsDragAndDrop.startDrag(event,monthViewEventDragAndDropObserver);" );
// add a property to the event box that holds the calendarEvent that the
// box represents
eventBox.occurrence = itemOccurrence; // for mouseover preview
eventBox.event = calEvent;
// Make a text item to show the event title

View File

@ -49,6 +49,37 @@
some of it duplicated.)
**/
/** PUBLIC
*
* This changes the mouseover preview based on the start and end dates
* of an occurrence of a (one-time or recurring) calEvent or calToDo.
* Used by all grid views.
*/
function onMouseOverGridOccurrence( occurrenceBoxMouseEvent )
{
if ("occurrence" in occurrenceBoxMouseEvent.currentTarget) {
// occurrence of repeating event or todo
var occurrence = occurrenceBoxMouseEvent.currentTarget.occurrence;
var item = occurrence.item;
var start = occurrence.occurrenceStartDate.jsDate;
var endEx = occurrence.occurrenceEndDate.jsDate;
const toolTip = document.getElementById( "gridOccurrenceTooltip" );
var holderBox = null;
if (isEvent(item)) {
holderBox = getPreviewForEvent(item, start, endEx);
} else if (isToDo(item)) {
holderBox = getPreviewForToDo(item, start, endEx);
}
if (holderBox) {
setToolTipContent(toolTip, holderBox);
return true;
}
}
return false;
}
/** For all instances of an event, as displayed by unifinder. **/
function onMouseOverEventTree( toolTip, mouseEvent )
{
@ -169,37 +200,6 @@ function getPreviewForTask( toDoItem )
}
}
/* Draws tooltip for events in the various views */
function getEventToolTip(eventbox, event )
{
var toolTip = document.getElementById( "gridOccurrenceTooltip" );
while( toolTip.hasChildNodes() )
{
toolTip.removeChild( toolTip.firstChild );
}
var holderBox = getPreviewForEvent( eventbox.event );
if (holderBox) {
toolTip.appendChild( holderBox );
}
}
/**
* Called when mouse moves over a different event display box.
* An ICalEventDisplay represents an instance of a possibly recurring event.
*/
function getPreviewForEventDisplay( calendarEventDisplay )
{
var instStartDate = new Date(calendarEventDisplay.displayDate);
// End date is normally at the time at which event ends.
// So AllDay displayed ending today end at 0:00 next day.
var instEndDate = new Date(calendarEventDisplay.displayEndDate);
if (calendarEventDisplay.event.isAllDay)
instEndDate.setDate(instEndDate.getDate() + 1);
return getPreviewForEvent(calendarEventDisplay.event,
instStartDate, instEndDate);
}
/**
* Called when mouse moves over a different, or
* when mouse moves over event in event list.
@ -240,10 +240,7 @@ function getPreviewForEvent( event, instStartDate, instEndDate )
relativeToDate = instStartDate || new Date(); // today
} else {
// event spanning multiple days, do not omit dates.
// For multiday events use event start/end, not grid start/end.
relativeToDate = false;
instStartDate = null;
instEndDate = null;
}
var startDate, endDate;

View File

@ -284,10 +284,11 @@ MultiweekView.prototype.createEventBoxInternal = function multiweekView_createEv
eventBox.setAttribute( "onclick", "monthEventBoxClickEvent( this, event )" );
eventBox.setAttribute( "ondblclick", "monthEventBoxDoubleClickEvent( this, event )" );
eventBox.setAttribute( "onmouseover", "getEventToolTip(this, event)" );
eventBox.setAttribute( "onmouseover", "onMouseOverGridOccurrence(event)" );
eventBox.setAttribute( "tooltip", "gridOccurrenceTooltip" );
eventBox.setAttribute( "ondraggesture", "nsDragAndDrop.startDrag(event,monthViewEventDragAndDropObserver);" );
eventBox.occurrence = itemOccurrence;
eventBox.event = calEvent;
var eventBoxText = document.createElement( "label" );

View File

@ -376,6 +376,7 @@ dump(this.displayEndDate+"\n");
var eventBox = document.createElement("vbox");
// XXX Consider changing this to only store the ID
eventBox.occurrence = itemOccurrence;
eventBox.event = calEvent;
var ElementOfRef = document.getElementById("week-tree-day-" + gRefColumnIndex + "-item-" + startHour) ;
@ -421,7 +422,7 @@ dump(this.displayEndDate+"\n");
eventBox.setAttribute("ondragdrop", "nsDragAndDrop.drop(event,calendarViewDNDObserver)");
eventBox.setAttribute("id", "week-view-event-box-" + calEvent.id);
eventBox.setAttribute("name", "week-view-event-box-" + calEvent.id);
eventBox.setAttribute("onmouseover", "getEventToolTip(this, event)" );
eventBox.setAttribute("onmouseover", "onMouseOverGridOccurrence(event)" );
eventBox.setAttribute("tooltip", "gridOccurrenceTooltip");
// Event box text (title, location and description)