Fixing problems with showing events from currently selected day.

This commit is contained in:
mikep%oeone.com 2002-09-18 19:46:00 +00:00
Родитель 8d2a86e652
Коммит 3a33ed5d8b
5 изменённых файлов: 58 добавлений и 38 удалений

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

@ -260,7 +260,8 @@ function dayEventItemDoubleClick( eventBox, event )
function dayViewHourClick( event )
{
gCalendarWindow.setSelectedHour( event.target.getAttribute( "hour" ) );
if( event.detail == 1 )
gCalendarWindow.setSelectedHour( event.target.getAttribute( "hour" ) );
}
@ -290,11 +291,8 @@ function dayViewHourContextClick( event )
function dayViewHourDoubleClick( event )
{
// change the date selection to the clicked hour
gCalendarWindow.setSelectedHour( event.target.getAttribute( "hour" ) );
var startDate = gCalendarWindow.dayView.getNewEventDate();
newEvent( startDate );
}
@ -311,8 +309,16 @@ function weekEventItemClick( eventBox, event )
{
//do this check, otherwise on double click you get into an infinite loop
if( event.detail == 1 )
{
gCalendarWindow.EventSelection.replaceSelection( eventBox.calendarEventDisplay.event );
var newDate = gCalendarWindow.getSelectedDate();
newDate.setDate( eventBox.calendarEventDisplay.event.start.day );
gCalendarWindow.setSelectedDate( newDate );
}
if ( event )
{
event.stopPropagation();
@ -349,13 +355,16 @@ function weekEventItemDoubleClick( eventBox, event )
function weekViewHourClick( event )
{
var dayIndex = event.target.getAttribute( "day" );
if( event.detail == 1 )
{
var dayIndex = event.target.getAttribute( "day" );
newDate = gHeaderDateItemArray[dayIndex].getAttribute( "date" );
newDate = new Date( gHeaderDateItemArray[dayIndex].getAttribute( "date" ) );
gCalendarWindow.setSelectedDate( newDate );
newDate.setHours( event.target.getAttribute( "hour" ) );
gCalendarWindow.setSelectedHour( event.target.getAttribute( "hour" ) );
gCalendarWindow.setSelectedDate( newDate );
}
}
@ -383,17 +392,8 @@ function weekViewContextClick( event )
function weekViewHourDoubleClick( event )
{
var dayIndex = event.target.getAttribute( "day" );
newDate = gHeaderDateItemArray[dayIndex].getAttribute( "date" );
gCalendarWindow.setSelectedDate( newDate );
// change the date selection to the clicked hour
gCalendarWindow.setSelectedHour( event.target.getAttribute( "hour" ) );
var startDate = gCalendarWindow.weekView.getNewEventDate();
newEvent( startDate );
}
@ -410,8 +410,16 @@ function monthEventBoxClickEvent( eventBox, event )
{
//do this check, otherwise on double click you get into an infinite loop
if( event.detail == 1 )
{
gCalendarWindow.EventSelection.replaceSelection( eventBox.calendarEventDisplay.event );
var newDate = gCalendarWindow.getSelectedDate();
newDate.setDate( eventBox.calendarEventDisplay.event.start.day );
gCalendarWindow.setSelectedDate( newDate );
}
if ( event )
{
event.stopPropagation();

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

@ -743,16 +743,20 @@ MonthView.prototype.clickDay = function monthView_clickDay( event )
var dayBoxItem = event.currentTarget;
if( dayBoxItem.dayNumber != null )
if( dayBoxItem.dayNumber != null && event.detail == 1 )
{
// turn off showingLastDay - see notes in MonthView class
this.showingLastDay = false;
// change the selected date and redraw it
var newDate = this.calendarWindow.getSelectedDate();
this.calendarWindow.selectedDate.setDate( dayBoxItem.dayNumber );
newDate.setDate( dayBoxItem.dayNumber );
this.calendarWindow.setSelectedDate( newDate );
//changing the selection will redraw the day as selected (colored blue) in the month view.
//therefor, this has to happen after setSelectedDate
gCalendarWindow.EventSelection.emptySelection();
}
}
@ -773,7 +777,7 @@ MonthView.prototype.contextClickDay = function monthView_contextClickDay( event
// change the selected date and redraw it
gNewDateVariable = this.calendarWindow.selectedDate;
gNewDateVariable = gCalendarWindow.getSelectedDate();
gNewDateVariable.setDate( dayBoxItem.dayNumber );
}
@ -788,9 +792,7 @@ MonthView.prototype.doubleClickDay = function monthView_doubleClickDay( event )
if( event.button > 0 )
return;
var dayBoxItem = event.currentTarget;
if ( dayBoxItem.dayNumber != null )
if ( event.currentTarget.dayNumber != null )
{
// change the selected date and redraw it

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

@ -355,6 +355,12 @@ CalendarWindow.prototype.setSelectedDate = function calWin_setSelectedDate( date
// Copy the date because we might mess with it in place
this.selectedDate = new Date( date );
if( document.getElementById( "event-filter-menulist" ).selectedItem.value == "current" )
{
//redraw the top tree
setTimeout( "refreshEventTree( false );", 150 );
}
}
/** PUBLIC
@ -540,7 +546,7 @@ CalendarView.prototype.superConstructor = CalendarView;
CalendarView.prototype.goToDay = function calView_goToDay( newDate, ShowEvent )
{
var oldDate = this.calendarWindow.selectedDate;
var oldDate = this.calendarWindow.getSelectedDate();
this.calendarWindow.setSelectedDate( newDate );

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

@ -743,16 +743,20 @@ MonthView.prototype.clickDay = function monthView_clickDay( event )
var dayBoxItem = event.currentTarget;
if( dayBoxItem.dayNumber != null )
if( dayBoxItem.dayNumber != null && event.detail == 1 )
{
// turn off showingLastDay - see notes in MonthView class
this.showingLastDay = false;
// change the selected date and redraw it
var newDate = this.calendarWindow.getSelectedDate();
this.calendarWindow.selectedDate.setDate( dayBoxItem.dayNumber );
newDate.setDate( dayBoxItem.dayNumber );
this.calendarWindow.setSelectedDate( newDate );
//changing the selection will redraw the day as selected (colored blue) in the month view.
//therefor, this has to happen after setSelectedDate
gCalendarWindow.EventSelection.emptySelection();
}
}
@ -773,7 +777,7 @@ MonthView.prototype.contextClickDay = function monthView_contextClickDay( event
// change the selected date and redraw it
gNewDateVariable = this.calendarWindow.selectedDate;
gNewDateVariable = gCalendarWindow.getSelectedDate();
gNewDateVariable.setDate( dayBoxItem.dayNumber );
}
@ -788,9 +792,7 @@ MonthView.prototype.doubleClickDay = function monthView_doubleClickDay( event )
if( event.button > 0 )
return;
var dayBoxItem = event.currentTarget;
if ( dayBoxItem.dayNumber != null )
if ( event.currentTarget.dayNumber != null )
{
// change the selected date and redraw it

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

@ -538,8 +538,10 @@ function getEventTable( )
break;
case "current":
var SelectedDate = gCalendarWindow.getSelectedDate();
var EndDate = new Date( SelectedDate.getTime() + ( 1000 * 60 * 60 * 24 ) );
eventTable = gEventSource.getEventsForRange( SelectedDate, EndDate );
MidnightSelectedDate = new Date( SelectedDate.getFullYear(), SelectedDate.getMonth(), SelectedDate.getDate(), 0, 0, 0 );
var EndDate = new Date( MidnightSelectedDate.getTime() + ( 1000 * 60 * 60 * 24 ) );
eventTable = gEventSource.getEventsForRange( MidnightSelectedDate, EndDate );
break;
default:
eventTable = new Array();