зеркало из https://github.com/mozilla/pjs.git
Checked in patches for bug 218068
This commit is contained in:
Родитель
f06ad4fae8
Коммит
48c00a85c0
|
@ -599,6 +599,7 @@ CalendarWindow.prototype.onMouseUpCalendarViewSplitter = function calWinOnMouseU
|
|||
function CalendarView( calendarWindow )
|
||||
{
|
||||
this.calendarWindow = calendarWindow;
|
||||
this.localeDefaultsStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
|
||||
}
|
||||
|
||||
/** A way for subclasses to invoke the super constructor */
|
||||
|
@ -805,7 +806,7 @@ CalendarView.prototype.setDrawProperties = function calView_setDrawProperties( d
|
|||
}
|
||||
|
||||
//update vars for next loop
|
||||
if( dayEventStartList[eventStartListIndex] == null )
|
||||
if( !(eventStartListIndex in dayEventStartList) || dayEventStartList[eventStartListIndex] == null )
|
||||
done = true;
|
||||
else
|
||||
nextEventIsStarting = ( dayEventStartList[eventStartListIndex].displayDate < dayEventEndList[eventEndListIndex].displayEndDate );
|
||||
|
@ -968,3 +969,32 @@ CalendarView.prototype.removeAttributeFromElements =
|
|||
liveList.item(i).removeAttribute(attributeName);
|
||||
}
|
||||
}
|
||||
|
||||
/** PROTECTED
|
||||
|
||||
Return the preferred start day of the week as an integer.
|
||||
0: Sun, 1: Mon, 2: Tue, 3: Wed, 4: Thu, 5: Fri, 6: Sat
|
||||
Based on current preference setting or locale default.
|
||||
**/
|
||||
CalendarView.prototype.preferredWeekStart = function() {
|
||||
var defaultWeekStart = this.localeDefaultsStringBundle.GetStringFromName("defaultWeekStart" );
|
||||
return getIntPref(this.calendarWindow.calendarPreferences.calendarPref, "week.start", defaultWeekStart );
|
||||
}
|
||||
|
||||
/** PROTECTED
|
||||
|
||||
Return an array of booleans for each day of week: true means isDayOff.
|
||||
Indexed using integers for days of the week.
|
||||
0: Sun, 1: Mon, 2: Tue, 3: Wed, 4: Thu, 5: Fri, 6: Sat
|
||||
Constructed based on current preference settings or locale default.
|
||||
**/
|
||||
CalendarView.prototype.preferredDaysOff = function() {
|
||||
var isDayOff = new Array();
|
||||
var daysOffPropNames = ["SundaysOff","MondaysOff","TuesdaysOff","WednesdaysOff","ThursdaysOff","FridaysOff","SaturdaysOff"];
|
||||
for (var i = 0; i < daysOffPropNames.length; i++) {
|
||||
var isDefaultDayOff = ("true"==this.localeDefaultsStringBundle.GetStringFromName("defaultWeek"+ daysOffPropNames[i]));
|
||||
var prefName = "week.d"+i+daysOffPropNames[i].toLowerCase();
|
||||
isDayOff[i] = getBoolPref(this.calendarWindow.calendarPreferences.calendarPref, prefName, isDefaultDayOff);
|
||||
}
|
||||
return isDayOff;
|
||||
}
|
||||
|
|
|
@ -242,14 +242,13 @@ MonthView.prototype.refreshEvents = function monthView_refreshEvents( )
|
|||
var DisplayDate = new Date( );
|
||||
var eventDayInView;
|
||||
var dayBoxItem;
|
||||
var calendarEventDisplay;
|
||||
var calIndex;
|
||||
var calNumber;
|
||||
|
||||
// add each calendarEvent
|
||||
for( var eventIndex = 0; eventIndex < monthEventList.length; ++eventIndex )
|
||||
{
|
||||
calendarEventDisplay = monthEventList[ eventIndex ];
|
||||
var calendarEventDisplay = monthEventList[ eventIndex ];
|
||||
|
||||
// get the day box for the calendarEvent's day
|
||||
DisplayDate.setTime( calendarEventDisplay.displayDate );
|
||||
|
@ -263,6 +262,7 @@ MonthView.prototype.refreshEvents = function monthView_refreshEvents( )
|
|||
|
||||
dayBoxItem.numEvents += 1;
|
||||
|
||||
var eventBox;
|
||||
if( dayBoxItem.numEvents <= this.numberOfEventsToShow )
|
||||
{
|
||||
// Make a box item to hold the event
|
||||
|
@ -303,7 +303,7 @@ MonthView.prototype.refreshEvents = function monthView_refreshEvents( )
|
|||
{
|
||||
eventBoxText.setAttribute( "value", calendarEventDisplay.event.title );
|
||||
// Create an image
|
||||
newImage = document.createElement("image");
|
||||
var newImage = document.createElement("image");
|
||||
newImage.setAttribute( "class", "all-day-event-class" );
|
||||
eventBox.appendChild( newImage );
|
||||
}
|
||||
|
@ -329,6 +329,7 @@ MonthView.prototype.refreshEvents = function monthView_refreshEvents( )
|
|||
else
|
||||
{
|
||||
//if there is not a box to hold the little dots for this day...
|
||||
var dotBoxHolder;
|
||||
if ( !document.getElementById( "dotboxholder"+eventDayInView ) )
|
||||
{
|
||||
//make one
|
||||
|
@ -451,11 +452,10 @@ MonthView.prototype.refreshDisplay = function monthView_refreshDisplay( )
|
|||
|
||||
document.getElementById( "m0-month-title" ).setAttribute( "value" , titleMonthArray[0] + " " + newYear );
|
||||
|
||||
var categoriesStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
|
||||
var defaultWeekStart = categoriesStringBundle.GetStringFromName("defaultWeekStart" );
|
||||
|
||||
var Offset = getIntPref(this.calendarWindow.calendarPreferences.calendarPref, "week.start", defaultWeekStart );
|
||||
|
||||
var Offset = this.preferredWeekStart();
|
||||
var isOnlyWorkDays = (gOnlyWorkdayChecked == "true");
|
||||
var isDayOff = (isOnlyWorkDays? this.preferredDaysOff() : null);
|
||||
|
||||
var NewArrayOfDayNames = new Array();
|
||||
|
||||
for( i = 0; i < ArrayOfDayNames.length; i++ )
|
||||
|
@ -483,44 +483,77 @@ MonthView.prototype.refreshDisplay = function monthView_refreshDisplay( )
|
|||
// figure out first and last days of the month, first and last date of view
|
||||
|
||||
var firstDate = new Date( newYear, newMonth, 1 );
|
||||
var firstDayOfWeek = firstDate.getDay() - Offset;
|
||||
if( firstDayOfWeek < 0 )
|
||||
firstDayOfWeek+=7;
|
||||
|
||||
this.firstDayOfWeek = firstDayOfWeek;
|
||||
var firstDateCol = (7 - Offset + firstDate.getDay()) % 7;
|
||||
|
||||
var lastDayOfMonth = DateUtils.getLastDayOfMonth( newYear, newMonth );
|
||||
this.firstDateOfView = new Date( newYear, newMonth, 1 - firstDayOfWeek, 0, 0, 0 );
|
||||
this.lastDateOfView = new Date( newYear, newMonth, 42 - firstDayOfWeek, 23, 59, 59 );
|
||||
|
||||
var Checked = gOnlyWorkdayChecked ;
|
||||
var lastDateCol = (firstDateCol + lastDayOfMonth - 1) % 7;
|
||||
|
||||
for( i = - Offset; i <= 1 - Offset; i++ ){
|
||||
//ni = i - Offset ;
|
||||
var ni = (i >0)? i : i + 7;
|
||||
if( Checked === "true" )
|
||||
document.getElementById( "month-view-column-"+ni ).setAttribute( "collapsed", "true" );
|
||||
else
|
||||
document.getElementById( "month-view-column-"+ ni).removeAttribute( "collapsed");
|
||||
}
|
||||
|
||||
if( Checked === "true" && Offset <= 1 && firstDayOfWeek >= 6-Offset) {
|
||||
document.getElementById( "month-week-1-row" ).setAttribute( "collapsed", "true" );
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById( "month-week-1-row" ).removeAttribute( "collapsed" );
|
||||
}
|
||||
|
||||
if(this.dayNumberItemArray.length-firstDayOfWeek-lastDayOfMonth >= 7)
|
||||
{
|
||||
document.getElementById( "month-week-6-row" ).setAttribute( "collapsed", "true" );
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById( "month-week-6-row" ).removeAttribute( "collapsed" );
|
||||
}
|
||||
this.firstDateOfView = new Date( newYear, newMonth, 1 - firstDateCol, 0, 0, 0 );
|
||||
this.lastDateOfView = new Date( newYear, newMonth, 42 - firstDateCol, 23, 59, 59 );
|
||||
|
||||
// hide or unhide columns for days off
|
||||
for(var day = 0; day < 7; day++) {
|
||||
var dayCol = ((7 - Offset + day) % 7) + 1;
|
||||
if( isOnlyWorkDays && isDayOff[day])
|
||||
document.getElementById( "month-view-column-"+dayCol ).setAttribute( "collapsed", "true" );
|
||||
else
|
||||
document.getElementById( "month-view-column-"+dayCol ).removeAttribute( "collapsed" );
|
||||
}
|
||||
|
||||
{ // first week should not display if holds only off days and only work days displayed
|
||||
var isFirstWeekDisplayed = true;
|
||||
if (isOnlyWorkDays) {
|
||||
isFirstWeekDisplayed = false;
|
||||
for (var col = firstDateCol; col < 7; col++) {
|
||||
if (!isDayOff[(Offset + col) % 7]) {
|
||||
isFirstWeekDisplayed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isFirstWeekDisplayed) {
|
||||
document.getElementById( "month-week-1-row" ).setAttribute( "collapsed", "true" );
|
||||
} else {
|
||||
document.getElementById( "month-week-1-row" ).removeAttribute( "collapsed" );
|
||||
}
|
||||
}
|
||||
|
||||
{ // sixth week should not display if holds only off days and only work days displayed
|
||||
var isSixthWeekDisplayed = (firstDateCol + lastDayOfMonth > 5 * 7);
|
||||
if (isSixthWeekDisplayed && isOnlyWorkDays) {
|
||||
isSixthWeekDisplayed = false;
|
||||
for (var sixthWeekCol = 0; sixthWeekCol <= lastDateCol; sixthWeekCol++) {
|
||||
if (!isDayOff[(Offset + sixthWeekCol) % 7]) {
|
||||
isSixthWeekDisplayed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!isSixthWeekDisplayed) {
|
||||
document.getElementById( "month-week-6-row" ).setAttribute( "collapsed", "true" );
|
||||
} else {
|
||||
document.getElementById( "month-week-6-row" ).removeAttribute( "collapsed" );
|
||||
}
|
||||
|
||||
// fifth week should not display if holds only off days and only work days displayed
|
||||
var isFifthWeekDisplayed = (firstDateCol + lastDayOfMonth > 4 * 7);
|
||||
if (isFifthWeekDisplayed && !isSixthWeekDisplayed && isOnlyWorkDays) {
|
||||
isFifthWeekDisplayed = false;
|
||||
for (var fifthWeekCol = 0; fifthWeekCol <= lastDateCol; fifthWeekCol++) {
|
||||
if (!isDayOff[(Offset + fifthWeekCol) % 7]) {
|
||||
isFifthWeekDisplayed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!isFifthWeekDisplayed) {
|
||||
document.getElementById( "month-week-5-row" ).setAttribute( "collapsed", "true" );
|
||||
} else {
|
||||
document.getElementById( "month-week-5-row" ).removeAttribute( "collapsed" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// To Set Week Number
|
||||
var weekNumberItem;
|
||||
var weekNumber ;
|
||||
|
@ -545,13 +578,13 @@ MonthView.prototype.refreshDisplay = function monthView_refreshDisplay( )
|
|||
{
|
||||
var dayNumberItem = this.dayNumberItemArray[ dayIndex ];
|
||||
var dayBoxItem = this.dayBoxItemArray[ dayIndex ];
|
||||
var thisDate = new Date( newYear, newMonth, 1-(firstDayOfWeek - dayIndex ) );
|
||||
var thisDate = new Date( newYear, newMonth, 1-(firstDateCol - dayIndex ) );
|
||||
|
||||
dayBoxItem.date = thisDate;
|
||||
|
||||
dayNumberItem.setAttribute( "value" , thisDate.getDate() );
|
||||
|
||||
if( dayIndex < firstDayOfWeek || dayNumber > lastDayOfMonth )
|
||||
if( dayIndex < firstDateCol || dayNumber > lastDayOfMonth )
|
||||
{
|
||||
// this day box is NOT in the month,
|
||||
dayBoxItem.dayNumber = null;
|
||||
|
@ -612,11 +645,12 @@ MonthView.prototype.hiliteSelectedDate = function monthView_hiliteSelectedDate(
|
|||
this.clearSelectedBoxes();
|
||||
|
||||
// Set the background for selection
|
||||
var IndexInView = this.indexOfDate(this.calendarWindow.getSelectedDate());
|
||||
var ThisBox = this.dayBoxItemArray[ IndexInView ];
|
||||
|
||||
if( ThisBox )
|
||||
ThisBox.setAttribute( "monthselected" , "true" );
|
||||
var indexInView = this.indexOfDate(this.calendarWindow.getSelectedDate());
|
||||
if (indexInView in this.dayBoxItemArray) {
|
||||
var thisBox = this.dayBoxItemArray[ indexInView ];
|
||||
if( thisBox )
|
||||
thisBox.setAttribute( "monthselected" , "true" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,374 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is OEone Calendar Code, released October 31st, 2001.
|
||||
-
|
||||
- The Initial Developer of the Original Code is
|
||||
- OEone Corporation.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2001
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s): Garth Smedley <garths@oeone.com>
|
||||
- Mike Potter <mikep@oeone.com>
|
||||
- Karl Guertin <grayrest@grayrest.com>
|
||||
- Colin Phillips <colinp@oeone.com>
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!-- DTD File with all strings specific to the calendar -->
|
||||
<!DOCTYPE overlay
|
||||
[
|
||||
<!ENTITY % dtd1 SYSTEM "chrome://calendar/locale/global.dtd" > %dtd1;
|
||||
<!ENTITY % dtd2 SYSTEM "chrome://calendar/locale/calendar.dtd" > %dtd2;
|
||||
]>
|
||||
|
||||
|
||||
<!-- The Window -->
|
||||
|
||||
<overlay
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
>
|
||||
<script type="application/x-javascript" src="chrome://calendar/content/monthView.js"/>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
var ArrayOfDayNames = new Array();
|
||||
|
||||
ArrayOfDayNames[0] = "&calendar.monthview.column.1.name;";
|
||||
ArrayOfDayNames[1] = "&calendar.monthview.column.2.name;";
|
||||
ArrayOfDayNames[2] = "&calendar.monthview.column.3.name;";
|
||||
ArrayOfDayNames[3] = "&calendar.monthview.column.4.name;";
|
||||
ArrayOfDayNames[4] = "&calendar.monthview.column.5.name;";
|
||||
ArrayOfDayNames[5] = "&calendar.monthview.column.6.name;";
|
||||
ArrayOfDayNames[6] = "&calendar.monthview.column.7.name;";
|
||||
|
||||
</script>
|
||||
|
||||
<vbox id="month-view-box" flex="1">
|
||||
|
||||
<!-- Month View: Controls-->
|
||||
|
||||
<hbox id="month-controls-box"> <!-- DO NOT SET FLEX, breaks resizing -->
|
||||
<box class="month-previous-button-box">
|
||||
<image id="month-previous-button" class="prevnextbuttons" onclick="gCalendarWindow.goToPrevious()"/>
|
||||
</box>
|
||||
|
||||
<vbox id="month-title-container" flex="1">
|
||||
<hbox id="month-title-box" flex="1">
|
||||
<vbox class="month-title-label-box" flex="1">
|
||||
<label id="m-2-month-title" onclick="gCalendarWindow.goToPrevious( 2 )"/>
|
||||
</vbox>
|
||||
<vbox class="month-title-label-box" flex="1">
|
||||
<label id="m-1-month-title" onclick="gCalendarWindow.goToPrevious( 1 )"/>
|
||||
</vbox>
|
||||
<vbox class="month-title-label-box" flex="1">
|
||||
<label id="m0-month-title" />
|
||||
</vbox>
|
||||
<vbox class="month-title-label-box" flex="1">
|
||||
<label id="m1-month-title" onclick="gCalendarWindow.goToNext( 1 )"/>
|
||||
</vbox>
|
||||
<vbox class="month-title-label-box" flex="1">
|
||||
<label id="m2-month-title" onclick="gCalendarWindow.goToNext( 2 )"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<!-- Eric modification : the year is now included in the 0-month-title by the JS file
|
||||
<hbox id="year-title-box" flex="1">
|
||||
<vbox class="month-title-label-box" flex="1">
|
||||
<label id="m0-year-title"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
-->
|
||||
</vbox>
|
||||
|
||||
|
||||
<box id="month-next-button-box">
|
||||
<image id="month-next-button" class="prevnextbuttons" onclick="gCalendarWindow.goToNext()"/>
|
||||
</box>
|
||||
|
||||
</hbox>
|
||||
|
||||
|
||||
<vbox id="month-content-box">
|
||||
|
||||
<!-- Month View: Calendar Grid -->
|
||||
|
||||
<box id="month-grid-box" flex="1">
|
||||
<grid id="month-grid" flex="1">
|
||||
<columns>
|
||||
<column id="month-view-leftcol" class="month-leftcol-class"/>
|
||||
<column id="month-view-column-1" class="month-column-class" flex="1"/>
|
||||
<column id="month-view-column-2" class="month-column-class" flex="1"/>
|
||||
<column id="month-view-column-3" class="month-column-class" flex="1"/>
|
||||
<column id="month-view-column-4" class="month-column-class" flex="1"/>
|
||||
<column id="month-view-column-5" class="month-column-class" flex="1"/>
|
||||
<column id="month-view-column-6" class="month-column-class" flex="1"/>
|
||||
<column id="month-view-column-7" class="month-column-class" flex="1"/>
|
||||
</columns>
|
||||
|
||||
<rows >
|
||||
<row id="month-week-header-row" flex="1">
|
||||
<vbox>
|
||||
</vbox>
|
||||
<vbox class="month-column-center-day-class">
|
||||
<label class="month-view-header-days" id="month-view-header-day-1"/>
|
||||
</vbox>
|
||||
<vbox class="month-column-center-day-class">
|
||||
<label class="month-view-header-days" id="month-view-header-day-2"/>
|
||||
</vbox>
|
||||
<vbox class="month-column-center-day-class">
|
||||
<label class="month-view-header-days" id="month-view-header-day-3"/>
|
||||
</vbox>
|
||||
<vbox class="month-column-center-day-class">
|
||||
<label class="month-view-header-days" id="month-view-header-day-4"/>
|
||||
</vbox>
|
||||
<vbox class="month-column-center-day-class">
|
||||
<label class="month-view-header-days" id="month-view-header-day-5"/>
|
||||
</vbox>
|
||||
<vbox class="month-column-center-day-class">
|
||||
<label class="month-view-header-days" id="month-view-header-day-6"/>
|
||||
</vbox>
|
||||
<vbox class="month-column-center-day-class">
|
||||
<label class="month-view-header-days" id="month-view-header-day-7"/>
|
||||
</vbox>
|
||||
</row>
|
||||
|
||||
<row id="month-week-1-row" flex="1" >
|
||||
<vbox class="month-leftcol-box-class" flex="1" id="month-week-1-left-box">
|
||||
<label class="week-short-text" value="&week.short;"/>
|
||||
<label class="month-leftcol-number-class" id="month-week-1-left"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-1-day-1-box">
|
||||
<label class="month-day-number-class" id="month-week-1-day-1"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-1-day-2-box">
|
||||
<label class="month-day-number-class" id="month-week-1-day-2"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-1-day-3-box">
|
||||
<label class="month-day-number-class" id="month-week-1-day-3"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-1-day-4-box">
|
||||
<label class="month-day-number-class" id="month-week-1-day-4"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-1-day-5-box">
|
||||
<label class="month-day-number-class" id="month-week-1-day-5"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-1-day-6-box">
|
||||
<label class="month-day-number-class" id="month-week-1-day-6"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-1-day-7-box">
|
||||
<label class="month-day-number-class" id="month-week-1-day-7"/>
|
||||
</vbox>
|
||||
</row>
|
||||
|
||||
<row flex="1" >
|
||||
<vbox class="month-leftcol-box-class" flex="1" id="month-week-2-left-box">
|
||||
<label class="week-short-text" value="&week.short;" />
|
||||
<label class="month-leftcol-number-class" id="month-week-2-left"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-2-day-1-box">
|
||||
<label class="month-day-number-class" id="month-week-2-day-1"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-2-day-2-box">
|
||||
<label class="month-day-number-class" id="month-week-2-day-2"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-2-day-3-box">
|
||||
<label class="month-day-number-class" id="month-week-2-day-3"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-2-day-4-box">
|
||||
<label class="month-day-number-class" id="month-week-2-day-4"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-2-day-5-box">
|
||||
<label class="month-day-number-class" id="month-week-2-day-5"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-2-day-6-box">
|
||||
<label class="month-day-number-class" id="month-week-2-day-6"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-2-day-7-box">
|
||||
<label class="month-day-number-class" id="month-week-2-day-7"/>
|
||||
</vbox>
|
||||
</row>
|
||||
|
||||
<row flex="1" >
|
||||
<vbox class="month-leftcol-box-class" flex="1" id="month-week-3-left-box">
|
||||
<label class="week-short-text" value="&week.short;" />
|
||||
<label class="month-leftcol-number-class" id="month-week-3-left"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-3-day-1-box">
|
||||
<label class="month-day-number-class" id="month-week-3-day-1"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-3-day-2-box">
|
||||
<label class="month-day-number-class" id="month-week-3-day-2"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-3-day-3-box">
|
||||
<label class="month-day-number-class" id="month-week-3-day-3"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-3-day-4-box">
|
||||
<label class="month-day-number-class" id="month-week-3-day-4"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-3-day-5-box">
|
||||
<label class="month-day-number-class" id="month-week-3-day-5"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-3-day-6-box">
|
||||
<label class="month-day-number-class" id="month-week-3-day-6"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-3-day-7-box">
|
||||
<label class="month-day-number-class" id="month-week-3-day-7"/>
|
||||
</vbox>
|
||||
</row>
|
||||
|
||||
<row flex="1" >
|
||||
<vbox class="month-leftcol-box-class" flex="1" id="month-week-4-left-box">
|
||||
<label class="week-short-text" value="&week.short;" />
|
||||
<label class="month-leftcol-number-class" id="month-week-4-left"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-4-day-1-box">
|
||||
<label class="month-day-number-class" id="month-week-4-day-1"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-4-day-2-box">
|
||||
<label class="month-day-number-class" id="month-week-4-day-2"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-4-day-3-box">
|
||||
<label class="month-day-number-class" id="month-week-4-day-3"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-4-day-4-box">
|
||||
<label class="month-day-number-class" id="month-week-4-day-4"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-4-day-5-box">
|
||||
<label class="month-day-number-class" id="month-week-4-day-5"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-4-day-6-box">
|
||||
<label class="month-day-number-class" id="month-week-4-day-6"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-4-day-7-box">
|
||||
<label class="month-day-number-class" id="month-week-4-day-7"/>
|
||||
</vbox>
|
||||
</row>
|
||||
|
||||
<row flex="1" >
|
||||
<vbox class="month-leftcol-box-class" flex="1" id="month-week-5-left-box">
|
||||
<label class="week-short-text" value="&week.short;" />
|
||||
<label class="month-leftcol-number-class" id="month-week-5-left"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-5-day-1-box">
|
||||
<label class="month-day-number-class" id="month-week-5-day-1"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-5-day-2-box">
|
||||
<label class="month-day-number-class" id="month-week-5-day-2"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-5-day-3-box">
|
||||
<label class="month-day-number-class" id="month-week-5-day-3"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-5-day-4-box">
|
||||
<label class="month-day-number-class" id="month-week-5-day-4"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-5-day-5-box">
|
||||
<label class="month-day-number-class" id="month-week-5-day-5"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-5-day-6-box">
|
||||
<label class="month-day-number-class" id="month-week-5-day-6"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-5-day-7-box">
|
||||
<label class="month-day-number-class" id="month-week-5-day-7"/>
|
||||
</vbox>
|
||||
</row>
|
||||
|
||||
<row id="month-week-6-row" flex="1">
|
||||
<vbox class="month-leftcol-box-class" flex="1" id="month-week-6-left-box">
|
||||
<label class="week-short-text" value="&week.short;" />
|
||||
<label class="month-leftcol-number-class" id="month-week-6-left"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-6-day-1-box">
|
||||
<label class="month-day-number-class" id="month-week-6-day-1"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-6-day-2-box">
|
||||
<label class="month-day-number-class" id="month-week-6-day-2"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-6-day-3-box">
|
||||
<label class="month-day-number-class" id="month-week-6-day-3"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-6-day-4-box">
|
||||
<label class="month-day-number-class" id="month-week-6-day-4"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-6-day-5-box">
|
||||
<label class="month-day-number-class" id="month-week-6-day-5"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-6-day-6-box">
|
||||
<label class="month-day-number-class" id="month-week-6-day-6"/>
|
||||
</vbox>
|
||||
|
||||
<vbox class="month-day-box-class" flex="1" id="month-week-6-day-7-box">
|
||||
<label class="month-day-number-class" id="month-week-6-day-7"/>
|
||||
</vbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
||||
</box> <!-- End: Month grid box -->
|
||||
|
||||
</vbox> <!-- End: Month content box -->
|
||||
</vbox>
|
||||
</overlay>
|
|
@ -136,7 +136,7 @@ function MultiweekView( calendarWindow )
|
|||
for( i = 0; i < EventSelectionArray.length; i++ )
|
||||
{
|
||||
var EventBoxes;
|
||||
if( EventSelectionArray[i].due )
|
||||
if("due" in EventSelectionArray[i] && EventSelectionArray[i].due )
|
||||
{
|
||||
EventBoxes = document.getElementsByAttribute( "name", "multiweek-view-todo-box-"+EventSelectionArray[i].id );
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ function MultiweekView( calendarWindow )
|
|||
{
|
||||
EventBoxes = document.getElementsByAttribute( "name", "multiweek-view-event-box-"+EventSelectionArray[i].id );
|
||||
}
|
||||
for ( j = 0; j < EventBoxes.length; j++ )
|
||||
for (var j = 0; j < EventBoxes.length; j++ )
|
||||
{
|
||||
EventBoxes[j].setAttribute( "eventselected", "true" );
|
||||
}
|
||||
|
@ -170,8 +170,8 @@ function MultiweekView( calendarWindow )
|
|||
this.lastDateOfView = new Date();
|
||||
|
||||
// Get the default number of WeeksInView
|
||||
this.categoriesStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
|
||||
var defaultWeeksInView = this.categoriesStringBundle.GetStringFromName("defaultWeeksInView" );
|
||||
this.localeDefaultsStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
|
||||
var defaultWeeksInView = this.localeDefaultsStringBundle.GetStringFromName("defaultWeeksInView" );
|
||||
var WeeksInView = getIntPref(this.calendarWindow.calendarPreferences.calendarPref, "weeks.inview", defaultWeeksInView );
|
||||
this.WeeksInView = ( WeeksInView >= 6 ) ? 6 : WeeksInView ;
|
||||
|
||||
|
@ -267,16 +267,15 @@ MultiweekView.prototype.refreshEvents = function multiweekView_refreshEvents( )
|
|||
// Only displayed if there is enough room
|
||||
if( dayBoxItem.numEvents <= this.numberOfEventsToShow)
|
||||
{
|
||||
eventBox = this.getToDoBox( calendarToDo,"due" );
|
||||
dayBoxItem.appendChild( eventBox );
|
||||
var todoBox = this.getToDoBox( calendarToDo,"due" );
|
||||
dayBoxItem.appendChild( todoBox );
|
||||
}
|
||||
}
|
||||
}
|
||||
var calendarEventDisplay;
|
||||
// add each calendarEvent
|
||||
for( var eventIndex = 0; eventIndex < viewEventList.length; ++eventIndex )
|
||||
{
|
||||
calendarEventDisplay = viewEventList[ eventIndex ];
|
||||
var calendarEventDisplay = viewEventList[ eventIndex ];
|
||||
|
||||
// get the day box for the calendarEvent's day
|
||||
DisplayDate.setTime( calendarEventDisplay.displayDate );
|
||||
|
@ -290,6 +289,7 @@ MultiweekView.prototype.refreshEvents = function multiweekView_refreshEvents( )
|
|||
|
||||
dayBoxItem.numEvents += 1;
|
||||
|
||||
var eventBox;
|
||||
if( dayBoxItem.numEvents <= this.numberOfEventsToShow )
|
||||
{
|
||||
// Make a box item to hold the event
|
||||
|
@ -332,7 +332,7 @@ MultiweekView.prototype.refreshEvents = function multiweekView_refreshEvents( )
|
|||
{
|
||||
eventBoxText.setAttribute( "value", calendarEventDisplay.event.title );
|
||||
// Create an image
|
||||
newImage = document.createElement("image");
|
||||
var newImage = document.createElement("image");
|
||||
newImage.setAttribute( "class", "all-day-event-class" );
|
||||
eventBox.appendChild( newImage );
|
||||
}
|
||||
|
@ -356,6 +356,7 @@ MultiweekView.prototype.refreshEvents = function multiweekView_refreshEvents( )
|
|||
else
|
||||
{
|
||||
//if there is not a box to hold the little dots for this day...
|
||||
var dotBoxHolder;
|
||||
if ( !document.getElementById( "multiweekdotbox"+eventDayInView ) )
|
||||
{
|
||||
//make one
|
||||
|
@ -374,7 +375,7 @@ MultiweekView.prototype.refreshEvents = function multiweekView_refreshEvents( )
|
|||
|
||||
if( dotBoxHolder.childNodes.length < kMAX_NUMBER_OF_DOTS_IN_MONTH_VIEW )
|
||||
{
|
||||
eventDotBox = document.createElement( "box" );
|
||||
var eventDotBox = document.createElement( "box" );
|
||||
eventDotBox.setAttribute( "eventbox", "multiweekview" );
|
||||
|
||||
//show a dot representing an event.
|
||||
|
@ -534,17 +535,17 @@ MultiweekView.prototype.refreshDisplay = function multiweekView_refreshDisplay(
|
|||
var newYear = selectedDate.getFullYear();
|
||||
document.getElementById( "multiweek-title" ).setAttribute( "value" , newYear );
|
||||
|
||||
var Offset = this.preferredWeekStart();
|
||||
var isOnlyWorkDays = (gOnlyWorkdayChecked == "true");
|
||||
var isDayOff = (isOnlyWorkDays? this.preferredDaysOff() : null);
|
||||
|
||||
var defaultWeekStart = this.categoriesStringBundle.GetStringFromName("defaultWeekStart" );
|
||||
var Offset = getIntPref(this.calendarWindow.calendarPreferences.calendarPref, "week.start", defaultWeekStart );
|
||||
|
||||
var defaultPreviousWeeksInView = this.categoriesStringBundle.GetStringFromName("defaultPreviousWeeksInView" );
|
||||
var defaultPreviousWeeksInView = this.localeDefaultsStringBundle.GetStringFromName("defaultPreviousWeeksInView" );
|
||||
var PreviousWeeksInView = getIntPref(this.calendarWindow.calendarPreferences.calendarPref, "previousweeks.inview", defaultPreviousWeeksInView );
|
||||
this.PreviousWeeksInView = ( PreviousWeeksInView >= this.WeeksInView - 1 ) ? this.WeeksInView - 1 : PreviousWeeksInView ;
|
||||
|
||||
var NewArrayOfDayNames = new Array();
|
||||
|
||||
for( i = 0; i < ArrayOfDayNames.length; i++ )
|
||||
for(var i = 0; i < ArrayOfDayNames.length; i++ )
|
||||
{
|
||||
NewArrayOfDayNames[i] = ArrayOfDayNames[i];
|
||||
}
|
||||
|
@ -576,43 +577,41 @@ MultiweekView.prototype.refreshDisplay = function multiweekView_refreshDisplay(
|
|||
|
||||
// figure out first and last days of the month, first and last date of view
|
||||
|
||||
newDay = newDay - 7 * this.PreviousWeeksInView ;
|
||||
var firstDate = new Date( newYear, newMonth, newDay );
|
||||
var firstDayOfWeek = firstDate.getDay() - Offset;
|
||||
if( firstDayOfWeek < 0 )
|
||||
firstDayOfWeek+=7;
|
||||
|
||||
newDay = newDay - firstDayOfWeek ;
|
||||
|
||||
var lastDayOfMonth = DateUtils.getLastDayOfMonth( newYear, newMonth );
|
||||
{ // set newDay to first day of newMonth in prev week (negative ok)
|
||||
var prevWeekDay = newDay - 7 * this.PreviousWeeksInView;
|
||||
var prevWeekDate = new Date( newYear, newMonth, prevWeekDay );
|
||||
var prevWeekDateCol = (7 - Offset + prevWeekDate.getDay()) % 7;
|
||||
newDay = prevWeekDay - prevWeekDateCol;
|
||||
}
|
||||
this.firstDateOfView = new Date( newYear, newMonth, newDay );
|
||||
this.lastDateOfView = new Date( newYear, newMonth, newDay + this.WeeksInView*7 -1, 23, 59, 59 );
|
||||
|
||||
var firstDayOfMonth = new Date( newYear, newMonth, 1 );
|
||||
var firstDayOfMonthIndex = this.indexOfDate( firstDayOfMonth );
|
||||
var lastDayOfMonth = DateUtils.getLastDayOfMonth( newYear, newMonth );
|
||||
var lastDayOfMonthDate = new Date( newYear, newMonth, lastDayOfMonth );
|
||||
var lastDayOfMonthIndex = this.indexOfDate( lastDayOfMonthDate );
|
||||
|
||||
var Checked = gOnlyWorkdayChecked ;
|
||||
// hide or unhide columns for days off
|
||||
for(var day = 0; day < 7; day++) {
|
||||
var col = ((7 - Offset + day) % 7) + 1;
|
||||
if( isOnlyWorkDays && isDayOff[day])
|
||||
document.getElementById( "multiweek-view-column-"+col ).setAttribute( "collapsed", "true" );
|
||||
else
|
||||
document.getElementById( "multiweek-view-column-"+col ).removeAttribute( "collapsed" );
|
||||
}
|
||||
|
||||
for( var i = - Offset; i <= 1 - Offset; i++ ){
|
||||
//ni = i - Offset ;
|
||||
var ni = (i >0)? i : i + 7;
|
||||
if( Checked === "true" )
|
||||
document.getElementById( "multiweek-view-column-"+ ni).setAttribute( "collapsed", "true" );
|
||||
else
|
||||
document.getElementById( "multiweek-view-column-"+ ni).removeAttribute( "collapsed");
|
||||
}
|
||||
|
||||
if( Checked === "true" ) {
|
||||
if( isOnlyWorkDays ) {
|
||||
//Is firstDayOfMonth and firstDayOfNextMonth during a weekend ?
|
||||
//If so we change the firstDayOfMonthIndex to the first day displayed
|
||||
var tempvar = 7 - firstDayOfMonth.getDay() ;
|
||||
tempvar = ( tempvar >= 7) ? tempvar - 6 : tempvar + 1 ;
|
||||
if( tempvar <= 2) firstDayOfMonthIndex += tempvar ;
|
||||
tempvar = 7 - (lastDayOfMonthDate.getDay()+1) ;
|
||||
tempvar = ( tempvar >= 7) ? tempvar - 6 : tempvar + 1 ;
|
||||
if( tempvar <= 2) lastDayOfMonthIndex += tempvar ;
|
||||
var firstOfMonthWeekDay = firstDayOfMonth.getDay();
|
||||
for (var addDays = 0; addDays < 7; addDays++) {
|
||||
var weekDay = (7 - Offset + firstOfMonthWeekDay + addDays) % 7;
|
||||
if (!isDayOff[weekDay]) {
|
||||
firstDayOfMonthIndex += addDays;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -732,11 +731,12 @@ MultiweekView.prototype.hiliteSelectedDate = function multiweekView_hiliteSelect
|
|||
this.clearSelectedEvent();
|
||||
|
||||
// Set the background for selection
|
||||
var IndexInView = this.indexOfDate( this.calendarWindow.getSelectedDate() );
|
||||
var ThisBox = this.dayBoxItemArray[ IndexInView ];
|
||||
|
||||
if( ThisBox )
|
||||
ThisBox.setAttribute( "multiweekselected" , "true" );
|
||||
var indexInView = this.indexOfDate( this.calendarWindow.getSelectedDate() );
|
||||
if (indexInView in this.dayBoxItemArray) {
|
||||
var thisBox = this.dayBoxItemArray[ indexInView ];
|
||||
if( thisBox )
|
||||
thisBox.setAttribute( "multiweekselected" , "true" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -925,7 +925,7 @@ MultiweekView.prototype.selectBoxForEvent = function multiweekView_selectBoxForE
|
|||
{
|
||||
var EventBoxes = document.getElementsByAttribute( "name", "multiweek-view-event-box-"+calendarEvent.id );
|
||||
|
||||
for ( j = 0; j < EventBoxes.length; j++ )
|
||||
for (var j = 0; j < EventBoxes.length; j++ )
|
||||
{
|
||||
EventBoxes[j].setAttribute( "eventselected", "true" );
|
||||
}
|
||||
|
|
|
@ -59,6 +59,14 @@ calendarPrefObserver.prototype =
|
|||
case "calendar.event.defaultendhour":
|
||||
case "calendar.weeks.inview":
|
||||
case "calendar.previousweeks.inview":
|
||||
case "calendar.week.d0sundaysoff":
|
||||
case "calendar.week.d1mondaysoff":
|
||||
case "calendar.week.d2tuesdaysoff":
|
||||
case "calendar.week.d2wednesdaysoff":
|
||||
case "calendar.week.d2thursdaysoff":
|
||||
case "calendar.week.d2fridaysoff":
|
||||
case "calendar.week.d2saturdaysoff":
|
||||
if (this.CalendarPreferences.calendarWindow.currentView != null)
|
||||
this.CalendarPreferences.calendarWindow.currentView.refresh();
|
||||
break;
|
||||
|
||||
|
@ -124,6 +132,13 @@ function calendarPreferences( CalendarWindow )
|
|||
getIntPref( this.calendarPref, "event.defaultstarthour", calendarStringBundle.GetStringFromName("defaultStartHour" ) );
|
||||
getIntPref( this.calendarPref, "event.defaultendhour", calendarStringBundle.GetStringFromName("defaultEndHour" ) );
|
||||
getIntPref( this.calendarPref, "week.start", calendarStringBundle.GetStringFromName("defaultWeekStart" ) );
|
||||
getBoolPref( this.calendarPref, "week.d0sundaysoff", "true"==calendarStringBundle.GetStringFromName("defaultWeekSundaysOff" ) );
|
||||
getBoolPref( this.calendarPref, "week.d1mondaysoff", "true"==calendarStringBundle.GetStringFromName("defaultWeekMondaysOff" ) );
|
||||
getBoolPref( this.calendarPref, "week.d2tuesdaysoff", "true"==calendarStringBundle.GetStringFromName("defaultWeekTuesdaysOff" ) );
|
||||
getBoolPref( this.calendarPref, "week.d3wednesdaysoff", "true"==calendarStringBundle.GetStringFromName("defaultWeekWednesdaysOff" ) );
|
||||
getBoolPref( this.calendarPref, "week.d4thursdaysoff", "true"==calendarStringBundle.GetStringFromName("defaultWeekThursdaysOff" ) );
|
||||
getBoolPref( this.calendarPref, "week.d5fridaysoff", "true"==calendarStringBundle.GetStringFromName("defaultWeekFridaysOff" ) );
|
||||
getBoolPref( this.calendarPref, "week.d6saturdaysoff", "true"==calendarStringBundle.GetStringFromName("defaultWeekSaturdaysOff" ) );
|
||||
getIntPref( this.calendarPref, "weeks.inview", calendarStringBundle.GetStringFromName("defaultWeeksInView" ) );
|
||||
getIntPref( this.calendarPref, "previousweeks.inview", calendarStringBundle.GetStringFromName("defaultPreviousWeeksInView" ) );
|
||||
getIntPref( this.calendarPref, "alarms.onforevents", 0 );
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
<!DOCTYPE page
|
||||
[
|
||||
<!ENTITY % dtd1 SYSTEM "chrome://calendar/locale/prefs.dtd" > %dtd1;
|
||||
<!ENTITY % dtd2 SYSTEM "chrome://calendar/locale/global.dtd" > %dtd2;
|
||||
]>
|
||||
|
||||
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
|
@ -61,15 +62,16 @@
|
|||
*/
|
||||
|
||||
var _elementIDs = [
|
||||
"nbofpreviousweeks", "nbofweeks", "weekstarts", "daystarthour", "dayendhour"
|
||||
"nbofpreviousweeks", "nbofweeks", "weekstarts", "daystarthour", "dayendhour",
|
||||
"sundaysoff","mondaysoff","tuesdaysoff","wednesdaysoff","thursdaysoff","fridaysoff","saturdaysoff"
|
||||
];
|
||||
</script>>
|
||||
</script>
|
||||
|
||||
<groupbox>
|
||||
<caption label="&pref.calendar.view.allview.caption;"/>
|
||||
<hbox align="center">
|
||||
<description>&pref.weekstarts.label;</description>
|
||||
<menulist id="weekstarts" prefstring="calendar.week.start">
|
||||
<description>&pref.weekstarts.label;</description>
|
||||
<menulist id="weekstarts" prefstring="calendar.week.start">
|
||||
<menupopup id="weekstarts">
|
||||
<menuitem label="&pref.weekstarts.sunday;" value="0"/>
|
||||
<menuitem label="&pref.weekstarts.monday;" value="1"/>
|
||||
|
@ -80,7 +82,35 @@
|
|||
<menuitem label="&pref.weekstarts.saturday;" value="6" selected="true"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
</hbox>
|
||||
<vbox align="start">
|
||||
<description>&pref.daysoff.label;</description>
|
||||
<grid id="daysoffgrid">
|
||||
<columns>
|
||||
<column /> <column /> <column /> <column /> <column /> <column /> <column />
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<caption label="&day.1.Ddd;" />
|
||||
<caption label="&day.2.Ddd;" />
|
||||
<caption label="&day.3.Ddd;" />
|
||||
<caption label="&day.4.Ddd;" />
|
||||
<caption label="&day.5.Ddd;" />
|
||||
<caption label="&day.6.Ddd;" />
|
||||
<caption label="&day.7.Ddd;" />
|
||||
</row>
|
||||
<row>
|
||||
<checkbox id="sundaysoff" prefstring="calendar.week.d0sundaysoff" />
|
||||
<checkbox id="mondaysoff" prefstring="calendar.week.d1mondaysoff" />
|
||||
<checkbox id="tuesdaysoff" prefstring="calendar.week.d2tuesdaysoff"/>
|
||||
<checkbox id="wednesdaysoff" prefstring="calendar.week.d3wednesdaysoff"/>
|
||||
<checkbox id="thursdaysoff" prefstring="calendar.week.d4thursdaysoff"/>
|
||||
<checkbox id="fridaysoff" prefstring="calendar.week.d5fridaysoff"/>
|
||||
<checkbox id="saturdaysoff" prefstring="calendar.week.d6saturdaysoff"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
|
||||
<groupbox>
|
||||
|
|
|
@ -111,6 +111,9 @@ function WeekView( calendarWindow )
|
|||
*/
|
||||
WeekView.prototype.refreshEvents = function( )
|
||||
{
|
||||
var isOnlyWorkDays = (gOnlyWorkdayChecked == "true");
|
||||
var isDayOff = (isOnlyWorkDays? this.preferredDaysOff() : null);
|
||||
|
||||
this.kungFooDeathGripOnEventBoxes = new Array();
|
||||
|
||||
this.removeElementsByAttribute("eventbox","weekview");
|
||||
|
@ -140,10 +143,9 @@ WeekView.prototype.refreshEvents = function( )
|
|||
for ( dayIndex = 1; dayIndex <= 7; ++dayIndex ) {
|
||||
// get the events for the day and loop through them
|
||||
var dayToGet = new Date( gHeaderDateItemArray[dayIndex].getAttribute( "date" ) );
|
||||
|
||||
var dayToGetDay = dayToGet.getDay() ;
|
||||
if( gOnlyWorkdayChecked === "true" && ( dayToGetDay == 0 || dayToGetDay == 6 )) {
|
||||
continue ;
|
||||
if (isOnlyWorkDays && isDayOff[dayToGetDay]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
eventList[dayIndex] = gEventSource.getEventsForDay( dayToGet );
|
||||
|
@ -193,9 +195,8 @@ WeekView.prototype.refreshEvents = function( )
|
|||
for ( dayIndex = 1; dayIndex <= 7; ++dayIndex ) {
|
||||
dayToGet = new Date( gHeaderDateItemArray[dayIndex].getAttribute( "date" ) );
|
||||
dayToGetDay = dayToGet.getDay() ;
|
||||
if( gOnlyWorkdayChecked == "true" && ( dayToGetDay == 0 || dayToGetDay == 6 )) {
|
||||
/* its a weekend */
|
||||
continue ;
|
||||
if (isOnlyWorkDays && isDayOff[dayToGetDay]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Calculate event draw properties (where events are drawn on view)
|
||||
|
@ -243,7 +244,7 @@ WeekView.prototype.refreshEvents = function( )
|
|||
|
||||
//note the use of the WeekViewAllDayText Attribute.
|
||||
//This is used to remove the text when the day is changed.
|
||||
newHTMLNode = document.createElement( "label" );
|
||||
var newHTMLNode = document.createElement( "label" );
|
||||
newHTMLNode.setAttribute( "crop", "end" );
|
||||
newHTMLNode.setAttribute( "flex", "1" );
|
||||
newHTMLNode.setAttribute( "value", eventText );
|
||||
|
@ -254,7 +255,7 @@ WeekView.prototype.refreshEvents = function( )
|
|||
newHTMLNode.setAttribute( "ondblclick", "weekEventItemDoubleClick( this, event )" );
|
||||
newHTMLNode.setAttribute( "tooltip", "eventTooltip" );
|
||||
|
||||
newImage = document.createElement("image");
|
||||
var newImage = document.createElement("image");
|
||||
newImage.setAttribute( "class", "all-day-event-class" );
|
||||
newImage.setAttribute( "WeekViewAllDayText", "true" );
|
||||
newImage.calendarEventDisplay = calendarEventDisplay;
|
||||
|
@ -400,17 +401,24 @@ WeekView.prototype.switchTo = function( )
|
|||
*/
|
||||
WeekView.prototype.refreshDisplay = function( )
|
||||
{
|
||||
var categoriesStringBundle = srGetStrBundle("chrome://calendar/locale/calendar.properties");
|
||||
var defaultWeekStart = categoriesStringBundle.GetStringFromName("defaultWeekStart" );
|
||||
var Offset = this.preferredWeekStart();
|
||||
var isOnlyWorkDays = (gOnlyWorkdayChecked == "true");
|
||||
var isDayOff = (isOnlyWorkDays? this.preferredDaysOff() : null);
|
||||
|
||||
// Set the from-to title string, based on the selected date
|
||||
var Offset = getIntPref(this.calendarWindow.calendarPreferences.calendarPref, "week.start", defaultWeekStart );
|
||||
// Define a reference column (which will not be collapsed latter) to use to get its width.
|
||||
// This is used to place the event Box
|
||||
if (Offset == 0 || Offset == 6) {
|
||||
gRefColumnIndex = 3 ;
|
||||
gRefColumnIndex = Offset;
|
||||
if (isOnlyWorkDays) {
|
||||
for (var day = 0; day < 7; day++) {
|
||||
if (!isDayOff[day]) {
|
||||
gRefColumnIndex = day;
|
||||
break;
|
||||
}
|
||||
}
|
||||
isDayOff[gRefColumnIndex] = false; // in case all days off, make one visible.
|
||||
}
|
||||
|
||||
// Set the from-to title string, based on the selected date
|
||||
var selectedDate = this.calendarWindow.getSelectedDate();
|
||||
var viewDay = selectedDate.getDay();
|
||||
var viewDayOfMonth = selectedDate.getDate();
|
||||
|
@ -443,10 +451,10 @@ WeekView.prototype.refreshDisplay = function( )
|
|||
var firstDayMonthName = this.calendarWindow.dateFormater.getFormatedDateWithoutYear( firstDayOfWeek );
|
||||
var lastDayMonthName = this.calendarWindow.dateFormater.getFormatedDateWithoutYear( lastDayOfWeek );
|
||||
|
||||
var newoffset = (Offset >= 5) ? 8 -Offset : 1 - Offset ;
|
||||
var mondayDiff = (Offset >= 5) ? 8 - Offset : 1 - Offset ;
|
||||
var mondayDate = new Date( firstDayOfWeek.getFullYear(),
|
||||
firstDayOfWeek.getMonth(),
|
||||
firstDayOfWeek.getDate()+newoffset );
|
||||
firstDayOfWeek.getDate() + mondayDiff );
|
||||
|
||||
var weekNumber = DateUtils.getWeekNumber(mondayDate);
|
||||
|
||||
|
@ -458,7 +466,7 @@ WeekView.prototype.refreshDisplay = function( )
|
|||
/* done setting the header information */
|
||||
|
||||
/* Fix the day names because users can choose which day the week starts on */
|
||||
for( var dayIndex = 1; dayIndex < 8; ++dayIndex ) {
|
||||
for( var dayIndex = 1; dayIndex <= 7; ++dayIndex ) {
|
||||
var dateOfDay = firstDayOfWeek.getDate();
|
||||
|
||||
var headerDateItem = document.getElementById( "week-header-date-"+dayIndex );
|
||||
|
@ -466,28 +474,16 @@ WeekView.prototype.refreshDisplay = function( )
|
|||
headerDateItem.setAttribute( "date", firstDayOfWeek );
|
||||
headerDateItem.numEvents = 0;
|
||||
|
||||
document.getElementById( "week-header-date-text-"+dayIndex ).setAttribute( "value", NewArrayOfDayNames[dayIndex-1] );
|
||||
|
||||
var arrayOfBoxes = new Array();
|
||||
|
||||
if( firstDayOfWeek.getDay() == 0 || firstDayOfWeek.getDay() == 6 ) {
|
||||
/* its a weekend */
|
||||
arrayOfBoxes = document.getElementsByAttribute( "day", dayIndex );
|
||||
var col = dayIndex - 1;
|
||||
|
||||
document.getElementById( "week-header-date-text-"+dayIndex ).setAttribute( "value", NewArrayOfDayNames[col] );
|
||||
|
||||
if( gOnlyWorkdayChecked === "true" ) {
|
||||
if( isOnlyWorkDays && isDayOff[(Offset + col) % 7]) {
|
||||
document.getElementById( "weekview-column-day-"+dayIndex ).setAttribute( "collapsed", "true" );
|
||||
} else {
|
||||
document.getElementById( "weekview-column-day-"+dayIndex ).removeAttribute( "collapsed" );
|
||||
}
|
||||
|
||||
for( i = 0; i < arrayOfBoxes.length; i++ ) {
|
||||
arrayOfBoxes[i].setAttribute( "weekend", "true" );
|
||||
}
|
||||
} else {
|
||||
/* it's not a weekend */
|
||||
this.removeAttributeFromElements("weekend", dayIndex);
|
||||
}
|
||||
|
||||
// advance to next day
|
||||
firstDayOfWeek.setDate( dateOfDay + 1 );
|
||||
}
|
||||
|
@ -574,7 +570,7 @@ WeekView.prototype.hiliteSelectedDate = function multiweekView_hiliteSelectedDat
|
|||
}
|
||||
}
|
||||
//dayIndex now contains the box numbers that we need.
|
||||
for ( i = 0; i < 24; i++ ) {
|
||||
for (var i = 0; i < 24; i++ ) {
|
||||
document.getElementById( "week-tree-day-"+(dayIndex-1)+"-item-"+i ).setAttribute( "weekselected", "true" );
|
||||
}
|
||||
}
|
||||
|
@ -609,7 +605,7 @@ WeekView.prototype.hiliteTodaysDate = function( )
|
|||
}
|
||||
}
|
||||
//dayIndex now contains the box numbers that we need.
|
||||
for ( i = 0; i < 24; i++ ) {
|
||||
for (var i = 0; i < 24; i++ ) {
|
||||
document.getElementById( "week-tree-day-"+(dayIndex-1)+"-item-"+i ).setAttribute( "today", "true" );
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче