зеркало из https://github.com/mozilla/pjs.git
Fixing problems with showing events from currently selected day.
This commit is contained in:
Родитель
8d2a86e652
Коммит
3a33ed5d8b
|
@ -260,7 +260,8 @@ function dayEventItemDoubleClick( eventBox, event )
|
||||||
|
|
||||||
function dayViewHourClick( 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 )
|
function dayViewHourDoubleClick( event )
|
||||||
{
|
{
|
||||||
// change the date selection to the clicked hour
|
|
||||||
|
|
||||||
gCalendarWindow.setSelectedHour( event.target.getAttribute( "hour" ) );
|
|
||||||
|
|
||||||
var startDate = gCalendarWindow.dayView.getNewEventDate();
|
var startDate = gCalendarWindow.dayView.getNewEventDate();
|
||||||
|
|
||||||
newEvent( startDate );
|
newEvent( startDate );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,8 +309,16 @@ function weekEventItemClick( eventBox, event )
|
||||||
{
|
{
|
||||||
//do this check, otherwise on double click you get into an infinite loop
|
//do this check, otherwise on double click you get into an infinite loop
|
||||||
if( event.detail == 1 )
|
if( event.detail == 1 )
|
||||||
|
{
|
||||||
gCalendarWindow.EventSelection.replaceSelection( eventBox.calendarEventDisplay.event );
|
gCalendarWindow.EventSelection.replaceSelection( eventBox.calendarEventDisplay.event );
|
||||||
|
|
||||||
|
var newDate = gCalendarWindow.getSelectedDate();
|
||||||
|
|
||||||
|
newDate.setDate( eventBox.calendarEventDisplay.event.start.day );
|
||||||
|
|
||||||
|
gCalendarWindow.setSelectedDate( newDate );
|
||||||
|
}
|
||||||
|
|
||||||
if ( event )
|
if ( event )
|
||||||
{
|
{
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
@ -349,13 +355,16 @@ function weekEventItemDoubleClick( eventBox, event )
|
||||||
|
|
||||||
function weekViewHourClick( 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 )
|
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();
|
var startDate = gCalendarWindow.weekView.getNewEventDate();
|
||||||
|
|
||||||
newEvent( startDate );
|
newEvent( startDate );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,8 +410,16 @@ function monthEventBoxClickEvent( eventBox, event )
|
||||||
{
|
{
|
||||||
//do this check, otherwise on double click you get into an infinite loop
|
//do this check, otherwise on double click you get into an infinite loop
|
||||||
if( event.detail == 1 )
|
if( event.detail == 1 )
|
||||||
|
{
|
||||||
gCalendarWindow.EventSelection.replaceSelection( eventBox.calendarEventDisplay.event );
|
gCalendarWindow.EventSelection.replaceSelection( eventBox.calendarEventDisplay.event );
|
||||||
|
|
||||||
|
var newDate = gCalendarWindow.getSelectedDate();
|
||||||
|
|
||||||
|
newDate.setDate( eventBox.calendarEventDisplay.event.start.day );
|
||||||
|
|
||||||
|
gCalendarWindow.setSelectedDate( newDate );
|
||||||
|
}
|
||||||
|
|
||||||
if ( event )
|
if ( event )
|
||||||
{
|
{
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
|
@ -743,16 +743,20 @@ MonthView.prototype.clickDay = function monthView_clickDay( event )
|
||||||
|
|
||||||
var dayBoxItem = event.currentTarget;
|
var dayBoxItem = event.currentTarget;
|
||||||
|
|
||||||
if( dayBoxItem.dayNumber != null )
|
if( dayBoxItem.dayNumber != null && event.detail == 1 )
|
||||||
{
|
{
|
||||||
// turn off showingLastDay - see notes in MonthView class
|
// turn off showingLastDay - see notes in MonthView class
|
||||||
|
|
||||||
this.showingLastDay = false;
|
this.showingLastDay = false;
|
||||||
|
|
||||||
// change the selected date and redraw it
|
// 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();
|
gCalendarWindow.EventSelection.emptySelection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -773,7 +777,7 @@ MonthView.prototype.contextClickDay = function monthView_contextClickDay( event
|
||||||
|
|
||||||
// change the selected date and redraw it
|
// change the selected date and redraw it
|
||||||
|
|
||||||
gNewDateVariable = this.calendarWindow.selectedDate;
|
gNewDateVariable = gCalendarWindow.getSelectedDate();
|
||||||
|
|
||||||
gNewDateVariable.setDate( dayBoxItem.dayNumber );
|
gNewDateVariable.setDate( dayBoxItem.dayNumber );
|
||||||
}
|
}
|
||||||
|
@ -788,9 +792,7 @@ MonthView.prototype.doubleClickDay = function monthView_doubleClickDay( event )
|
||||||
if( event.button > 0 )
|
if( event.button > 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var dayBoxItem = event.currentTarget;
|
if ( event.currentTarget.dayNumber != null )
|
||||||
|
|
||||||
if ( dayBoxItem.dayNumber != null )
|
|
||||||
{
|
{
|
||||||
// change the selected date and redraw it
|
// 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
|
// Copy the date because we might mess with it in place
|
||||||
|
|
||||||
this.selectedDate = new Date( date );
|
this.selectedDate = new Date( date );
|
||||||
|
|
||||||
|
if( document.getElementById( "event-filter-menulist" ).selectedItem.value == "current" )
|
||||||
|
{
|
||||||
|
//redraw the top tree
|
||||||
|
setTimeout( "refreshEventTree( false );", 150 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PUBLIC
|
/** PUBLIC
|
||||||
|
@ -540,7 +546,7 @@ CalendarView.prototype.superConstructor = CalendarView;
|
||||||
|
|
||||||
CalendarView.prototype.goToDay = function calView_goToDay( newDate, ShowEvent )
|
CalendarView.prototype.goToDay = function calView_goToDay( newDate, ShowEvent )
|
||||||
{
|
{
|
||||||
var oldDate = this.calendarWindow.selectedDate;
|
var oldDate = this.calendarWindow.getSelectedDate();
|
||||||
|
|
||||||
this.calendarWindow.setSelectedDate( newDate );
|
this.calendarWindow.setSelectedDate( newDate );
|
||||||
|
|
||||||
|
|
|
@ -743,16 +743,20 @@ MonthView.prototype.clickDay = function monthView_clickDay( event )
|
||||||
|
|
||||||
var dayBoxItem = event.currentTarget;
|
var dayBoxItem = event.currentTarget;
|
||||||
|
|
||||||
if( dayBoxItem.dayNumber != null )
|
if( dayBoxItem.dayNumber != null && event.detail == 1 )
|
||||||
{
|
{
|
||||||
// turn off showingLastDay - see notes in MonthView class
|
// turn off showingLastDay - see notes in MonthView class
|
||||||
|
|
||||||
this.showingLastDay = false;
|
this.showingLastDay = false;
|
||||||
|
|
||||||
// change the selected date and redraw it
|
// 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();
|
gCalendarWindow.EventSelection.emptySelection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -773,7 +777,7 @@ MonthView.prototype.contextClickDay = function monthView_contextClickDay( event
|
||||||
|
|
||||||
// change the selected date and redraw it
|
// change the selected date and redraw it
|
||||||
|
|
||||||
gNewDateVariable = this.calendarWindow.selectedDate;
|
gNewDateVariable = gCalendarWindow.getSelectedDate();
|
||||||
|
|
||||||
gNewDateVariable.setDate( dayBoxItem.dayNumber );
|
gNewDateVariable.setDate( dayBoxItem.dayNumber );
|
||||||
}
|
}
|
||||||
|
@ -788,9 +792,7 @@ MonthView.prototype.doubleClickDay = function monthView_doubleClickDay( event )
|
||||||
if( event.button > 0 )
|
if( event.button > 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var dayBoxItem = event.currentTarget;
|
if ( event.currentTarget.dayNumber != null )
|
||||||
|
|
||||||
if ( dayBoxItem.dayNumber != null )
|
|
||||||
{
|
{
|
||||||
// change the selected date and redraw it
|
// change the selected date and redraw it
|
||||||
|
|
||||||
|
|
|
@ -538,8 +538,10 @@ function getEventTable( )
|
||||||
break;
|
break;
|
||||||
case "current":
|
case "current":
|
||||||
var SelectedDate = gCalendarWindow.getSelectedDate();
|
var SelectedDate = gCalendarWindow.getSelectedDate();
|
||||||
var EndDate = new Date( SelectedDate.getTime() + ( 1000 * 60 * 60 * 24 ) );
|
MidnightSelectedDate = new Date( SelectedDate.getFullYear(), SelectedDate.getMonth(), SelectedDate.getDate(), 0, 0, 0 );
|
||||||
eventTable = gEventSource.getEventsForRange( SelectedDate, EndDate );
|
|
||||||
|
var EndDate = new Date( MidnightSelectedDate.getTime() + ( 1000 * 60 * 60 * 24 ) );
|
||||||
|
eventTable = gEventSource.getEventsForRange( MidnightSelectedDate, EndDate );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
eventTable = new Array();
|
eventTable = new Array();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче