Showing day numbers and adding double click to launch new events in months besides the current one.

This commit is contained in:
mikep%oeone.com 2002-04-11 17:03:19 +00:00
Родитель fe48b0bd1d
Коммит bbf9aef02f
2 изменённых файлов: 56 добавлений и 24 удалений

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

@ -409,14 +409,9 @@ MonthView.prototype.refreshDisplay = function( )
for (var i=-2; i < 3; i++){ for (var i=-2; i < 3; i++){
titleMonthArray[i] = newMonth + i; titleMonthArray[i] = newMonth + i;
titleMonthArray[i] = (titleMonthArray[i] >= 0)? titleMonthArray[i] % 12 : titleMonthArray[i] + 12; titleMonthArray[i] = (titleMonthArray[i] >= 0)? titleMonthArray[i] % 12 : titleMonthArray[i] + 12;
try{ titleMonthArray[i] = this.calendarWindow.dateFormater.getMonthName( titleMonthArray[i] );
titleMonthArray[i] = this.calendarWindow.dateFormater.getMonthName( titleMonthArray[i] ); var idName = i + "-month-title";
var idName = i + "-month-title"; document.getElementById( idName ).setAttribute( "value" , titleMonthArray[i] );
document.getElementById( idName ).setAttribute( "value" , titleMonthArray[i] );
}catch(errorObj){
alert(toDebug);
alert(errorObj);
}
} }
document.getElementById( "0-year-title" ).setAttribute( "value" , newYear ); document.getElementById( "0-year-title" ).setAttribute( "value" , newYear );
@ -436,7 +431,7 @@ MonthView.prototype.refreshDisplay = function( )
NewArrayOfDayNames.push( FirstElement ); NewArrayOfDayNames.push( FirstElement );
} }
//set the day names (Some people start on Sunday, others start on Monday //set the day names
for( i = 1; i <= 7; i++ ) for( i = 1; i <= 7; i++ )
{ {
document.getElementById( "month-view-header-day-"+i ).value = NewArrayOfDayNames[ (i-1) ]; document.getElementById( "month-view-header-day-"+i ).value = NewArrayOfDayNames[ (i-1) ];
@ -470,11 +465,28 @@ MonthView.prototype.refreshDisplay = function( )
if( dayIndex < firstDayOfWeek || dayNumber > lastDayOfMonth ) if( dayIndex < firstDayOfWeek || dayNumber > lastDayOfMonth )
{ {
// this day box is NOT in the month, // this day box is NOT in the month,
dayBoxItem.dayNumber = null;
dayNumberItem.setAttribute( "value" , "" );
dayBoxItem.setAttribute( "empty" , "true" ); dayBoxItem.setAttribute( "empty" , "true" );
dayBoxItem.setAttribute( "weekend", "false" ); dayBoxItem.setAttribute( "weekend", "false" );
dayBoxItem.dayNumber = null;
if( dayIndex < firstDayOfWeek )
{
var thisDate = new Date( newYear, newMonth, 1-(firstDayOfWeek - dayIndex ) );
dayBoxItem.date = thisDate;
dayNumberItem.setAttribute( "value" , thisDate.getDate() );
}
else
{
var thisDate = new Date( newYear, newMonth, lastDayOfMonth+( dayIndex - lastDayOfMonth - firstDayOfWeek + 1 ) );
dayBoxItem.date = thisDate;
dayNumberItem.setAttribute( "value" , thisDate.getDate() );
}
} }
else else
{ {
@ -733,6 +745,10 @@ MonthView.prototype.doubleClickDay = function( dayBoxItem )
newEvent( startDate, false ); newEvent( startDate, false );
} }
else
{
newEvent( dayBoxItem.date, false );
}
} }

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

@ -409,14 +409,9 @@ MonthView.prototype.refreshDisplay = function( )
for (var i=-2; i < 3; i++){ for (var i=-2; i < 3; i++){
titleMonthArray[i] = newMonth + i; titleMonthArray[i] = newMonth + i;
titleMonthArray[i] = (titleMonthArray[i] >= 0)? titleMonthArray[i] % 12 : titleMonthArray[i] + 12; titleMonthArray[i] = (titleMonthArray[i] >= 0)? titleMonthArray[i] % 12 : titleMonthArray[i] + 12;
try{ titleMonthArray[i] = this.calendarWindow.dateFormater.getMonthName( titleMonthArray[i] );
titleMonthArray[i] = this.calendarWindow.dateFormater.getMonthName( titleMonthArray[i] ); var idName = i + "-month-title";
var idName = i + "-month-title"; document.getElementById( idName ).setAttribute( "value" , titleMonthArray[i] );
document.getElementById( idName ).setAttribute( "value" , titleMonthArray[i] );
}catch(errorObj){
alert(toDebug);
alert(errorObj);
}
} }
document.getElementById( "0-year-title" ).setAttribute( "value" , newYear ); document.getElementById( "0-year-title" ).setAttribute( "value" , newYear );
@ -436,7 +431,7 @@ MonthView.prototype.refreshDisplay = function( )
NewArrayOfDayNames.push( FirstElement ); NewArrayOfDayNames.push( FirstElement );
} }
//set the day names (Some people start on Sunday, others start on Monday //set the day names
for( i = 1; i <= 7; i++ ) for( i = 1; i <= 7; i++ )
{ {
document.getElementById( "month-view-header-day-"+i ).value = NewArrayOfDayNames[ (i-1) ]; document.getElementById( "month-view-header-day-"+i ).value = NewArrayOfDayNames[ (i-1) ];
@ -470,11 +465,28 @@ MonthView.prototype.refreshDisplay = function( )
if( dayIndex < firstDayOfWeek || dayNumber > lastDayOfMonth ) if( dayIndex < firstDayOfWeek || dayNumber > lastDayOfMonth )
{ {
// this day box is NOT in the month, // this day box is NOT in the month,
dayBoxItem.dayNumber = null;
dayNumberItem.setAttribute( "value" , "" );
dayBoxItem.setAttribute( "empty" , "true" ); dayBoxItem.setAttribute( "empty" , "true" );
dayBoxItem.setAttribute( "weekend", "false" ); dayBoxItem.setAttribute( "weekend", "false" );
dayBoxItem.dayNumber = null;
if( dayIndex < firstDayOfWeek )
{
var thisDate = new Date( newYear, newMonth, 1-(firstDayOfWeek - dayIndex ) );
dayBoxItem.date = thisDate;
dayNumberItem.setAttribute( "value" , thisDate.getDate() );
}
else
{
var thisDate = new Date( newYear, newMonth, lastDayOfMonth+( dayIndex - lastDayOfMonth - firstDayOfWeek + 1 ) );
dayBoxItem.date = thisDate;
dayNumberItem.setAttribute( "value" , thisDate.getDate() );
}
} }
else else
{ {
@ -733,6 +745,10 @@ MonthView.prototype.doubleClickDay = function( dayBoxItem )
newEvent( startDate, false ); newEvent( startDate, false );
} }
else
{
newEvent( dayBoxItem.date, false );
}
} }