Checked in patch for bug 258956: Recurrence does not show up when "All day event"

along with missing part from https://bugzilla.mozilla.org/show_bug.cgi?id=258956#c9
This commit is contained in:
mostafah%oeone.com 2004-10-01 20:26:51 +00:00
parent 1c4cc70fe1
commit 58de7f95c5
2 changed files with 21 additions and 42 deletions

View File

@ -597,10 +597,13 @@ function eventTitleOrEmpty(event) {
CalendarEventDataSource.prototype.orderRawEventsByDate = function calEvent_orderRawEventsByDate( eventA, eventB )
{
return( getNextOrPreviousRecurrence( eventA ).getTime() - getNextOrPreviousRecurrence( eventB ).getTime() );
return( getCurrentNextOrPreviousRecurrence( eventA ).getTime() - getCurrentNextOrPreviousRecurrence( eventB ).getTime() );
}
function getNextOrPreviousRecurrence( calendarEvent )
/** If now is during an occurrence, return the ocurrence.
Else if now is before an ocurrence, return the next ocurrence.
Otherwise return the previous ocurrence. **/
function getCurrentNextOrPreviousRecurrence( calendarEvent )
{
var isValid = false;
@ -612,7 +615,13 @@ function getNextOrPreviousRecurrence( calendarEvent )
var result = new Object();
isValid = calendarEvent.getNextRecurrence( now.getTime(), result );
var dur = calendarEvent.end.getTime() - calendarEvent.start.getTime();
// To find current event when now is during event, look for occurrence
// starting duration ago.
var probeTime = now.getTime() - dur;
isValid = calendarEvent.getNextRecurrence( probeTime, result );
if( isValid )
{
@ -620,9 +629,12 @@ function getNextOrPreviousRecurrence( calendarEvent )
}
else
{
isValid = calendarEvent.getPreviousOccurrence( now.getTime(), result );
isValid = calendarEvent.getPreviousOccurrence( probeTime, result );
eventStartDate = new Date( result.value );
if (isValid)
{
eventStartDate = new Date( result.value );
}
}
}

View File

@ -308,7 +308,7 @@ function unifinderOnSelect( event )
if( ArrayOfEvents.length == 1 )
{
/*start date is either the next or last occurence, or the start date of the event */
var eventStartDate = getNextOrPreviousRecurrence( calendarEvent );
var eventStartDate = getCurrentNextOrPreviousRecurrence( calendarEvent );
/* you need this in case the current day is not visible. */
if( gCalendarWindow.currentView.getVisibleEvent( calendarEvent ) == false )
@ -529,11 +529,11 @@ var treeView =
return( calendarEvent.title );
case "unifinder-search-results-tree-col-startdate":
var eventStartDate = getNextOrPreviousRecurrence( calendarEvent );
var eventStartDate = getCurrentNextOrPreviousRecurrence( calendarEvent );
return formatUnifinderEventDateTime(eventStartDate, calendarEvent.allDay);
case "unifinder-search-results-tree-col-enddate":
var eventEndDate = getNextOrPreviousRecurrence( calendarEvent );
var eventEndDate = getCurrentNextOrPreviousRecurrence( calendarEvent );
var eventLength = calendarEvent.end.getTime() - calendarEvent.start.getTime();
var actualEndDate = eventEndDate.getTime() + eventLength;
eventEndDate = new Date( actualEndDate );
@ -724,7 +724,7 @@ function focusFirstItemIfNoSelection()
gCalendarWindow.EventSelection.setArrayToSelection( ArrayOfEvents );
/*start date is either the next or last occurence, or the start date of the event */
var eventStartDate = getNextOrPreviousRecurrence( SelectedEvent );
var eventStartDate = getCurrentNextOrPreviousRecurrence( SelectedEvent );
/* you need this in case the current day is not visible. */
gCalendarWindow.currentView.goToDay( eventStartDate, true);
@ -732,39 +732,6 @@ function focusFirstItemIfNoSelection()
}
}
function getNextOrPreviousRecurrence( calendarEvent )
{
var isValid;
if( calendarEvent.recur )
{
var now = new Date();
var result = new Object();
isValid = calendarEvent.getNextRecurrence( now.getTime(), result );
if( isValid )
{
return( new Date( result.value ) );
}
else
{
isValid = calendarEvent.getPreviousOccurrence( now.getTime(), result );
return( new Date( result.value ) );
}
}
if( !isValid || !calendarEvent.recur )
{
return( new Date( calendarEvent.start.getTime() ) );
}
return( false );
}
function changeToolTipTextForEvent( event )
{
var thisEvent = getCalendarEventFromEvent( event );