Bug 349520 working hours for calendar-multiday-view ui-r=dmose r=lilmatt

This commit is contained in:
thomas.benisch%sun.com 2007-03-14 09:17:35 +00:00
Родитель 5a8fcbdeab
Коммит f0bd391d0e
14 изменённых файлов: 567 добавлений и 196 удалений

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

@ -164,6 +164,13 @@
]]></getter> ]]></getter>
</property> </property>
<property name="viewElem">
<getter><![CDATA[
return document.getAnonymousElementByAttribute(
this, "anonid", "view-element");
]]></getter>
</property>
<method name="getSelectedItems"> <method name="getSelectedItems">
<parameter name="aCount"/> <parameter name="aCount"/>
<body><![CDATA[ <body><![CDATA[

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

@ -46,7 +46,8 @@
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl"> xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="calendar-decorated-day-view" extends="chrome://calendar/content/calendar-decorated-base.xml#calendar-decorated-base-view"> <binding id="calendar-decorated-day-view"
extends="chrome://calendar/content/calendar-decorated-multiday-base-view.xml#calendar-decorated-multiday-base-view">
<content> <content>
<xul:vbox anonid="main-box" flex="1"> <xul:vbox anonid="main-box" flex="1">
<xul:calendar-navigation-buttons anonid="nav-control"/> <xul:calendar-navigation-buttons anonid="nav-control"/>
@ -57,56 +58,6 @@
</content> </content>
<implementation implements="calIDecoratedView"> <implementation implements="calIDecoratedView">
<constructor><![CDATA[
// We don't care about weekends in the day view
var viewElement = document.getAnonymousElementByAttribute(
this, "anonid", "view-element");
viewElement.daysOffArray = [];
// add a preference observer to monitor changes
var pb2 = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
pb2.addObserver("calendar.", this.mPrefObserver, false);
viewElement.mMinVerticalPixelsPerMinute = 0.7;
viewElement.mMinHorizontalPixelsPerMinute = 1.5;
return;
]]></constructor>
<destructor><![CDATA[
var pb2 = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
pb2.removeObserver("calendar.", this.mPrefObserver);
return;
]]></destructor>
<field name="mPrefObserver"><![CDATA[
({ calView: this,
observe: function calDecWeekViewPrefChange(subj, topic, pref) {
subj.QueryInterface(Components.interfaces.nsIPrefBranch2);
switch (pref) {
case "calendar.timezone.local":
var viewElem = document.getAnonymousElementByAttribute(
this.calView, "anonid", "view-element");
viewElem.timezone = subj.getCharPref(pref);
if (!this.calView.startDay || !this.calView.endDay) {
// Don't refresh if we're not initialized
return;
}
this.calView.goToDay(this.calView.selectedDay);
break;
default:
break;
}
return;
}
})
]]></field>
<property name="observerID"> <property name="observerID">
<getter><![CDATA[ <getter><![CDATA[
return "day-view-observer"; return "day-view-observer";

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

@ -0,0 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ***** 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 Calendar view code.
-
- The Initial Developer of the Original Code is
- Joey Minta <jminta@gmail.com>
- Portions created by the Initial Developer are Copyright (C) 2007
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Dan Mosedale <dan.mosedale@oracle.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 GPL or the LGPL. 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 ***** -->
<bindings id="calendar-specific-view-bindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="calendar-decorated-multiday-base-view"
extends="chrome://calendar/content/calendar-decorated-base.xml#calendar-decorated-base-view">
<implementation implements="calIDecoratedView">
<constructor><![CDATA[
// get day start/end hour from prefs and set on the view
this.mDayStartMin = getPrefSafe(
"calendar.view.daystarthour", 8) * 60;
this.mDayEndMin = getPrefSafe(
"calendar.view.dayendhour", 17) * 60;
var viewElement = this.viewElem;
viewElement.setDayStartEndMinutes(this.mDayStartMin,
this.mDayEndMin);
// initially scroll to the day start hour in the view
viewElement.setFirstVisibleMinute(this.mDayStartMin);
// get visible hours from prefs and set on the view
var visibleMinutes = getPrefSafe(
"calendar.view.visiblehours", 9) * 60;
viewElement.setVisibleMinutes(visibleMinutes);
// add a preference observer to monitor changes
var pb2 = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
pb2.addObserver("calendar.", this.mPrefObserver, false);
this.updateDaysOffPrefs();
return;
]]></constructor>
<destructor><![CDATA[
var pb2 = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
pb2.removeObserver("calendar.", this.mPrefObserver);
return;
]]></destructor>
<field name="mDayStartMin">8*60</field>
<field name="mDayEndMin">17*60</field>
<field name="mPrefObserver"><![CDATA[
({ calView: this,
observe: function calDecMultidayViewPrefChange(subj, topic, pref) {
this.calView.handlePreference(subj, topic, pref);
return;
}
})
]]></field>
<!-- A preference handler which is called by the preference observer.
Can be overriden in derived bindings. -->
<method name="handlePreference">
<parameter name="aSubject"/>
<parameter name="aTopic"/>
<parameter name="aPreference"/>
<body><![CDATA[
this.handleCommonPreference(aSubject, aTopic, aPreference);
]]></body>
</method>
<!-- A base implementation for the handling of common preferences.
Can be called in handlePreference from derived bindings. -->
<method name="handleCommonPreference">
<parameter name="aSubject"/>
<parameter name="aTopic"/>
<parameter name="aPreference"/>
<body><![CDATA[
aSubject.QueryInterface(Components.interfaces.nsIPrefBranch2);
switch (aPreference) {
case "calendar.week.d0sundaysoff":
case "calendar.week.d1mondaysoff":
case "calendar.week.d2tuesdaysoff":
case "calendar.week.d3wednesdaysoff":
case "calendar.week.d4thursdaysoff":
case "calendar.week.d5fridaysoff":
case "calendar.week.d6saturdaysoff":
this.updateDaysOffPrefs();
if (!this.startDay || !this.endDay) {
// don't refresh if we're not initialized
return;
}
this.goToDay(this.selectedDay);
break;
case "calendar.view.daystarthour":
this.mDayStartMin = aSubject.getIntPref(aPreference) * 60;
this.viewElem.setDayStartEndMinutes(this.mDayStartMin,
this.mDayEndMin);
if (!this.startDay || !this.endDay) {
// don't refresh if we're not initialized
return;
}
this.goToDay(this.selectedDay);
break;
case "calendar.view.dayendhour":
this.mDayEndMin = aSubject.getIntPref(aPreference) * 60;
this.viewElem.setDayStartEndMinutes(this.mDayStartMin,
this.mDayEndMin);
if (!this.startDay || !this.endDay) {
// don't refresh if we're not initialized
return;
}
this.goToDay(this.selectedDay);
break;
case "calendar.view.visiblehours":
var visibleMinutes = aSubject.getIntPref(aPreference) * 60;
this.viewElem.setVisibleMinutes(visibleMinutes);
if (!this.startDay || !this.endDay) {
// don't refresh if we're not initialized
return;
}
this.goToDay(this.selectedDay);
break;
case "calendar.timezone.local":
this.viewElem.timezone = aSubject.getCharPref(aPreference);
if (!this.startDay || !this.endDay) {
// don't refresh if we're not initialized
return;
}
this.goToDay(this.selectedDay);
break;
default:
break;
}
return;
]]></body>
</method>
<method name="updateDaysOffPrefs">
<body><![CDATA[
var prefNames = ["d0sundaysoff", "d1mondaysoff", "d2tuesdaysoff",
"d3wednesdaysoff", "d4thursdaysoff",
"d5fridaysoff", "d6saturdaysoff"];
var defaults = [true, false, false, false, false, false, true];
var daysOff = new Array();
const weekPrefix = "calendar.week.";
for (var i in prefNames) {
if (getPrefSafe(weekPrefix+prefNames[i], defaults[i])) {
daysOff.push(Number(i));
}
}
this.viewElem.daysOffArray = daysOff;
]]></body>
</method>
</implementation>
</binding>
</bindings>

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

@ -40,6 +40,10 @@ calendar-decorated-base-view {
-moz-binding: url(chrome://calendar/content/calendar-decorated-base.xml#calendar-decorated-base-view); -moz-binding: url(chrome://calendar/content/calendar-decorated-base.xml#calendar-decorated-base-view);
} }
calendar-decorated-multiday-base-view {
-moz-binding: url(chrome://calendar/content/calendar-decorated-multiday-base-view.xml#calendar-decorated-multiday-base-view);
}
calendar-navigation-buttons { calendar-navigation-buttons {
-moz-binding: url(chrome://calendar/content/calendar-decorated-base.xml#calendar-navigation-buttons); -moz-binding: url(chrome://calendar/content/calendar-decorated-base.xml#calendar-navigation-buttons);
} }

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

@ -46,7 +46,8 @@
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl"> xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="calendar-decorated-week-view" extends="chrome://calendar/content/calendar-decorated-base.xml#calendar-decorated-base-view"> <binding id="calendar-decorated-week-view"
extends="chrome://calendar/content/calendar-decorated-multiday-base-view.xml#calendar-decorated-multiday-base-view">
<content> <content>
<xul:vbox anonid="main-box" flex="1"> <xul:vbox anonid="main-box" flex="1">
<xul:calendar-navigation-buttons anonid="nav-control"/> <xul:calendar-navigation-buttons anonid="nav-control"/>
@ -57,92 +58,47 @@
</content> </content>
<implementation implements="calIDecoratedView"> <implementation implements="calIDecoratedView">
<constructor><![CDATA[ <constructor><![CDATA[
this.mWeekStartOffset = getPrefSafe("calendar.week.start", 0); this.mWeekStartOffset = getPrefSafe("calendar.week.start", 0);
// add a preference observer to monitor changes
var pb2 = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
pb2.addObserver("calendar.", this.mPrefObserver, false);
this.updateDaysOffPrefs();
return; return;
]]></constructor> ]]></constructor>
<destructor><![CDATA[
var pb2 = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
pb2.removeObserver("calendar.", this.mPrefObserver);
return;
]]></destructor>
<field name="mWeekStartOffset">0</field> <field name="mWeekStartOffset">0</field>
<field name="mPrefObserver"><![CDATA[
({ calView: this,
observe: function calDecWeekViewPrefChange(subj, topic, pref) {
subj.QueryInterface(Components.interfaces.nsIPrefBranch2);
switch (pref) {
case "calendar.previousweeks.inview":
case "calendar.week.d0sundaysoff":
case "calendar.week.d1mondaysoff":
case "calendar.week.d2tuesdaysoff":
case "calendar.week.d3wednesdaysoff":
case "calendar.week.d4thursdaysoff":
case "calendar.week.d5fridaysoff":
case "calendar.week.d6saturdaysoff":
if (!this.calView.startDay || !this.calView.endDay) {
// Don't refresh if we're not initialized
return;
}
this.calView.updateDaysOffPrefs();
this.calView.goToDay(this.calView.selectedDay);
break;
case "calendar.week.start":
this.calView.mWeekStartOffset = subj.getIntPref(pref);
viewElem = document.getAnonymousElementByAttribute(
this.calView, "anonid", "view-element");
viewElem.weekStartOffset = subj.getIntPref(pref);
if (!this.calView.startDay || !this.calView.endDay) {
// Don't refresh if we're not initialized
return;
}
// Refresh the view so the settings take effect
this.calView.goToDay(this.calView.selectedDay);
break;
case "calendar.timezone.local":
var viewElem = document.getAnonymousElementByAttribute(
this.calView, "anonid", "view-element");
viewElem.timezone = subj.getCharPref(pref);
if (!this.calView.startDay || !this.calView.endDay) {
// Don't refresh if we're not initialized
return;
}
this.calView.goToDay(this.calView.selectedDay);
break;
default:
break;
}
return;
}
})
]]></field>
<property name="observerID"> <property name="observerID">
<getter><![CDATA[ <getter><![CDATA[
return "week-view-observer"; return "week-view-observer";
]]></getter> ]]></getter>
</property> </property>
<method name="handlePreference">
<parameter name="aSubject"/>
<parameter name="aTopic"/>
<parameter name="aPreference"/>
<body><![CDATA[
aSubject.QueryInterface(Components.interfaces.nsIPrefBranch2);
switch (aPreference) {
case "calendar.week.start":
this.mWeekStartOffset = aSubject.getIntPref(aPreference);
this.viewElem.weekStartOffset = aSubject.getIntPref(aPreference);
if (!this.startDay || !this.endDay) {
// Don't refresh if we're not initialized
return;
}
// Refresh the view so the settings take effect
this.goToDay(this.selectedDay);
break;
default:
this.handleCommonPreference(aSubject, aTopic, aPreference);
break;
}
return;
]]></body>
</method>
<!--Public methods--> <!--Public methods-->
<method name="goToDay"> <method name="goToDay">
<parameter name="aDate"/> <parameter name="aDate"/>
@ -209,26 +165,6 @@
document.getAnonymousElementByAttribute(this, "anonid", "nav-control").setNames(nameArray); document.getAnonymousElementByAttribute(this, "anonid", "nav-control").setNames(nameArray);
]]></body> ]]></body>
</method> </method>
<method name="updateDaysOffPrefs">
<body><![CDATA[
var prefNames = ["d0sundaysoff", "d1mondaysoff", "d2tuesdaysoff",
"d3wednesdaysoff", "d4thursdaysoff",
"d5fridaysoff", "d6saturdaysoff"];
var defaults = [true, false, false, false, false, false, true];
var daysOff = new Array();
const weekPrefix = "calendar.week.";
for (var i in prefNames) {
if (getPrefSafe(weekPrefix+prefNames[i], defaults[i])) {
daysOff.push(Number(i));
}
}
var viewElem = document.getAnonymousElementByAttribute(
this, "anonid", "view-element");
viewElem.daysOffArray = daysOff;
]]></body>
</method>
</implementation> </implementation>
</binding> </binding>
</bindings> </bindings>

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

@ -269,6 +269,8 @@
<field name="mPixPerMin">0.6</field> <field name="mPixPerMin">0.6</field>
<field name="mStartMin">0*60</field> <field name="mStartMin">0*60</field>
<field name="mEndMin">24*60</field> <field name="mEndMin">24*60</field>
<field name="mDayStartMin">8*60</field>
<field name="mDayEndMin">17*60</field>
<field name="mEvents">new Array()</field> <field name="mEvents">new Array()</field>
<field name="mEventMap">null</field> <field name="mEventMap">null</field>
<field name="mCalendarView">null</field> <field name="mCalendarView">null</field>
@ -303,17 +305,22 @@
]]></setter> ]]></setter>
</property> </property>
<field name="mSelected">false</field>
<property name="selected"> <property name="selected">
<getter><![CDATA[ <getter><![CDATA[
if (this.getAttribute("selected") == "true") return this.mSelected;
return true;
return false;
]]></getter> ]]></getter>
<setter><![CDATA[ <setter><![CDATA[
if (val) this.mSelected = val;
this.setAttribute("selected", "true"); var child = this.bgbox.firstChild;
else while (child) {
this.removeAttribute("selected"); if (val) {
child.setAttribute("selected", "true");
} else {
child.removeAttribute("selected");
}
child = child.nextSibling;
}
return val; return val;
]]></setter> ]]></setter>
</property> </property>
@ -380,6 +387,28 @@
readonly="true" readonly="true"
onget="return this.methods"/> onget="return this.methods"/>
<field name="mToday">false</field>
<property name="today">
<getter><![CDATA[
return this.mToday;
]]></getter>
<setter><![CDATA[
this.mToday = val;
return val;
]]></setter>
</property>
<field name="mDayOff">false</field>
<property name="dayOff">
<getter><![CDATA[
return this.mDayOff;
]]></getter>
<setter><![CDATA[
this.mDayOff = val;
return val;
]]></setter>
</property>
<!-- mEvents --> <!-- mEvents -->
<field name="mSelectedChunks">[]</field> <field name="mSelectedChunks">[]</field>
@ -617,6 +646,19 @@
box.setAttribute("orient", orient); box.setAttribute("orient", orient);
box.setAttribute("class", "calendar-event-column-linebox"); box.setAttribute("class", "calendar-event-column-linebox");
if (this.mSelected) {
box.setAttribute("selected", "true");
}
if (this.mToday) {
box.setAttribute("today", "true");
}
if (this.mDayOff) {
box.setAttribute("weekend", "true");
}
if (theMin < this.mDayStartMin || theMin >= this.mDayEndMin) {
box.setAttribute("off-time", "true");
}
// calculate duration pixel as the difference between // calculate duration pixel as the difference between
// start pixel and end pixel to avoid rounding errors. // start pixel and end pixel to avoid rounding errors.
var startPix = Math.round(theMin * this.mPixPerMin); var startPix = Math.round(theMin * this.mPixPerMin);
@ -1271,6 +1313,21 @@
]]></body> ]]></body>
</method> </method>
<method name="setDayStartEndMinutes">
<parameter name="aDayStartMin"/>
<parameter name="aDayEndMin"/>
<body><![CDATA[
if (aDayStartMin < this.mStartMin || aDayStartMin > aDayEndMin ||
aDayEndMin > this.mEndMin) {
throw Components.results.NS_ERROR_INVALID_ARG;
}
if (this.mDayStartMin != aDayStartMin ||
this.mDayEndMin != aDayEndMin) {
this.mDayStartMin = aDayStartMin;
this.mDayEndMin = aDayEndMin;
}
]]></body>
</method>
</implementation> </implementation>
<handlers> <handlers>
@ -1648,6 +1705,8 @@
var self = this; var self = this;
this.mResizeHandler = function resizeHandler() { self.onResize(); }; this.mResizeHandler = function resizeHandler() { self.onResize(); };
window.addEventListener("resize", this.mResizeHandler, true); window.addEventListener("resize", this.mResizeHandler, true);
this.mScrollHandler = function scrollHandler() { self.onScroll(); };
window.addEventListener("scroll", this.mScrollHandler, true);
var rButton = document.getAnonymousElementByAttribute(this, "anonid", "rotate-button"); var rButton = document.getAnonymousElementByAttribute(this, "anonid", "rotate-button");
rButton.label = calGetString("calendar", "rotate"); rButton.label = calGetString("calendar", "rotate");
@ -1675,21 +1734,33 @@
} }
var childbox = document.getAnonymousElementByAttribute(self, "anonid", "childbox"); var childbox = document.getAnonymousElementByAttribute(self, "anonid", "childbox");
var size; var size;
var minPixelsPerMinute;
if (self.orient == "horizontal") { if (self.orient == "horizontal") {
size = childbox.boxObject.width; size = childbox.boxObject.width;
minPixelsPerMinute = self.mMinHorizontalPixelsPerMinute;
} else { } else {
size = childbox.boxObject.height; size = childbox.boxObject.height;
minPixelsPerMinute = self.mMinVerticalPixelsPerMinute;
} }
var minutes = self.mEndMin - self.mStartMin; var ppm = size / self.mVisibleMinutes;
var ppm = size / minutes;
ppm = Math.floor(ppm * 10) / 10; ppm = Math.floor(ppm * 10) / 10;
if (ppm < minPixelsPerMinute) { if (ppm < self.mMinPixelsPerMinute) {
ppm = minPixelsPerMinute; ppm = self.mMinPixelsPerMinute;
} }
self.pixelsPerMinute = ppm; self.pixelsPerMinute = ppm;
setTimeout(function(){self.scrollToMinute(self.mFirstVisibleMinute)}, 1);
]]></body>
</method>
<field name="mScrollHandler">null</field>
<method name="onScroll">
<body><![CDATA[
var panel = this.parentNode.parentNode.parentNode;
var deck = panel.parentNode;
if (panel.id != deck.selectedPanel.id) {
return;
}
if (deck.style.visibility == "collapse") {
return;
}
this.mFirstVisibleMinute = this.getFirstVisibleMinute();
]]></body> ]]></body>
</method> </method>
@ -1703,13 +1774,15 @@
<field name="mDateColumns">null</field> <field name="mDateColumns">null</field>
<field name="mBatchCount">0</field> <field name="mBatchCount">0</field>
<field name="mPixPerMin">0.6</field> <field name="mPixPerMin">0.6</field>
<field name="mMinHorizontalPixelsPerMinute">1.2</field> <field name="mMinPixelsPerMinute">0.1</field>
<field name="mMinVerticalPixelsPerMinute">0.5</field>
<field name="mSelectedItems">[]</field> <field name="mSelectedItems">[]</field>
<field name="mSelectedDayCol">null</field> <field name="mSelectedDayCol">null</field>
<field name="mStartMin">0*60</field> <field name="mStartMin">0*60</field>
<field name="mEndMin">24*60</field> <field name="mEndMin">24*60</field>
<field name="mDayStartMin">8*60</field>
<field name="mDayEndMin">17*60</field>
<field name="mVisibleMinutes">9*60</field>
<field name="mTasksInView">false</field> <field name="mTasksInView">false</field>
<field name="mDisplayDaysOff">true</field> <field name="mDisplayDaysOff">true</field>
<field name="mDaysOffArray">[0,6]</field> <field name="mDaysOffArray">[0,6]</field>
@ -2253,7 +2326,6 @@
<method name="reorient"> <method name="reorient">
<body><![CDATA[ <body><![CDATA[
var firstMinute = this.getFirstVisibleMinute();
var orient = this.getAttribute("orient"); var orient = this.getAttribute("orient");
var otherorient = "vertical"; var otherorient = "vertical";
if (!orient) orient = "horizontal"; if (!orient) orient = "horizontal";
@ -2308,7 +2380,6 @@
} }
} }
this.refresh(); this.refresh();
this.scrollToMinute(firstMinute);
]]></body> ]]></body>
</method> </method>
@ -2368,7 +2439,6 @@
]]></body> ]]></body>
</method> </method>
<field name="mRelayOutCalled">false</field>
<method name="relayout"> <method name="relayout">
<body><![CDATA[ <body><![CDATA[
function createXULElement(el) { function createXULElement(el) {
@ -2402,6 +2472,8 @@
return; return;
var calView = this; var calView = this;
var dayStartMin = this.mDayStartMin;
var dayEndMin = this.mDayEndMin;
function setUpDayEventsBox(aDayBox) { function setUpDayEventsBox(aDayBox) {
aDayBox.setAttribute("class", "calendar-event-column-" + (counter % 2 == 0 ? "even" : "odd")); aDayBox.setAttribute("class", "calendar-event-column-" + (counter % 2 == 0 ? "even" : "odd"));
aDayBox.setAttribute("context", calView.getAttribute("context")); aDayBox.setAttribute("context", calView.getAttribute("context"));
@ -2410,6 +2482,7 @@
aDayBox.date = d; aDayBox.date = d;
aDayBox.setAttribute("orient", orient); aDayBox.setAttribute("orient", orient);
aDayBox.calendarView = calView; aDayBox.calendarView = calView;
aDayBox.setDayStartEndMinutes(dayStartMin, dayEndMin);
} }
function setUpDayHeaderBox(aDayBox) { function setUpDayHeaderBox(aDayBox) {
@ -2431,7 +2504,7 @@
var dayEventsBox; var dayEventsBox;
if (counter < dayboxkids.length) { if (counter < dayboxkids.length) {
dayEventsBox = dayboxkids[counter]; dayEventsBox = dayboxkids[counter];
dayEventsBox.removeAttribute("today"); dayEventsBox.today = false;
dayEventsBox.mEvents = new Array(); dayEventsBox.mEvents = new Array();
} else { } else {
dayEventsBox = createXULElement("calendar-event-column"); dayEventsBox = createXULElement("calendar-event-column");
@ -2456,16 +2529,16 @@
setUpDayHeaderBox(dayHeaderBox); setUpDayHeaderBox(dayHeaderBox);
if (0 <= this.mDaysOffArray.indexOf(d.weekday)) { if (0 <= this.mDaysOffArray.indexOf(d.weekday)) {
dayEventsBox.setAttribute("weekend", "true"); dayEventsBox.dayOff = true;
dayHeaderBox.setAttribute("weekend", "true"); dayHeaderBox.setAttribute("weekend", "true");
} else { } else {
dayEventsBox.removeAttribute("weekend"); dayEventsBox.dayOff = false;
dayHeaderBox.removeAttribute("weekend"); dayHeaderBox.removeAttribute("weekend");
} }
// highlight today // highlight today
if (this.numVisibleDates > 1 && d.compare(today) == 0) { if (this.numVisibleDates > 1 && d.compare(today) == 0) {
dayEventsBox.setAttribute("today", "true"); dayEventsBox.today = true;
dayHeaderBox.setAttribute("today", "true"); dayHeaderBox.setAttribute("today", "true");
} }
@ -2526,14 +2599,6 @@
// XXX constructor and the reorient method as soon as the views // XXX constructor and the reorient method as soon as the views
// XXX are constructed statically (24 hrs). // XXX are constructed statically (24 hrs).
this.adjustScrollBarSpacers(); this.adjustScrollBarSpacers();
// scroll to 8 a.m. the first time relayout is called
// XXX As soon as working hours are available, 8 a.m. will change to
// XXX the first working hour.
if (!this.mRelayOutCalled) {
this.mRelayOutCalled = true;
this.scrollToMinute(8 * 60);
}
]]></body> ]]></body>
</method> </method>
@ -2718,6 +2783,7 @@
]]></body> ]]></body>
</method> </method>
<field name="mFirstVisibleMinute">0</field>
<method name="getFirstVisibleMinute"> <method name="getFirstVisibleMinute">
<body><![CDATA[ <body><![CDATA[
var minute = 0; var minute = 0;
@ -2737,6 +2803,14 @@
]]></body> ]]></body>
</method> </method>
<method name="setFirstVisibleMinute">
<parameter name="aMinute"/>
<body><![CDATA[
this.mFirstVisibleMinute = aMinute;
return this.mFirstVisibleMinute;
]]></body>
</method>
<method name="scrollToMinute"> <method name="scrollToMinute">
<parameter name="aMinute"/> <parameter name="aMinute"/>
<body><![CDATA[ <body><![CDATA[
@ -2746,7 +2820,7 @@
var x = {}; var x = {};
var y = {}; var y = {};
scrollBoxObject.getPosition(x, y); scrollBoxObject.getPosition(x, y);
var pos = aMinute * this.mPixPerMin; var pos = Math.round(aMinute * this.mPixPerMin);
if (childbox.getAttribute("orient") == "horizontal") { if (childbox.getAttribute("orient") == "horizontal") {
scrollBoxObject.scrollTo(x.value, pos); scrollBoxObject.scrollTo(x.value, pos);
} else { } else {
@ -2755,6 +2829,36 @@
} }
]]></body> ]]></body>
</method> </method>
<method name="setDayStartEndMinutes">
<parameter name="aDayStartMin"/>
<parameter name="aDayEndMin"/>
<body><![CDATA[
if (aDayStartMin < this.mStartMin || aDayStartMin > aDayEndMin ||
aDayEndMin > this.mEndMin) {
throw Components.results.NS_ERROR_INVALID_ARG;
}
if (this.mDayStartMin != aDayStartMin ||
this.mDayEndMin != aDayEndMin) {
this.mDayStartMin = aDayStartMin;
this.mDayEndMin = aDayEndMin;
}
]]></body>
</method>
<method name="setVisibleMinutes">
<parameter name="aVisibleMinutes"/>
<body><![CDATA[
if (aVisibleMinutes <= 0 ||
aVisibleMinutes > (this.mEndMin - this.mStartMin)) {
throw Components.results.NS_ERROR_INVALID_ARG;
}
if (this.mVisibleMinutes != aVisibleMinutes) {
this.mVisibleMinutes = aVisibleMinutes;
}
return this.mVisibleMinutes;
]]></body>
</method>
</implementation> </implementation>
<handlers> <handlers>

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

@ -96,6 +96,7 @@
<prefpane id="paneViews" <prefpane id="paneViews"
label="&paneViews.title;" label="&paneViews.title;"
onpaneload="gViewsPane.init();"
src="chrome://calendar/content/preferences/views.xul"> src="chrome://calendar/content/preferences/views.xul">
<vbox id="calPreferencesBoxViews"/> <vbox id="calPreferencesBoxViews"/>
</prefpane> </prefpane>

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

@ -56,6 +56,8 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<vbox id="calPreferencesBoxViews"> <vbox id="calPreferencesBoxViews">
<script type="application/x-javascript"
src="chrome://calendar/content/preferences/views.js"/>
<preferences> <preferences>
<preference id="calendar.week.start" <preference id="calendar.week.start"
@ -89,6 +91,15 @@
name="calendar.week.d6saturdaysoff" name="calendar.week.d6saturdaysoff"
type="bool" type="bool"
inverted="true"/> inverted="true"/>
<preference id="calendar.view.daystarthour"
name="calendar.view.daystarthour"
type="int"/>
<preference id="calendar.view.dayendhour"
name="calendar.view.dayendhour"
type="int"/>
<preference id="calendar.view.visiblehours"
name="calendar.view.visiblehours"
type="int"/>
<preference id="calendar.weeks.inview" <preference id="calendar.weeks.inview"
name="calendar.weeks.inview" name="calendar.weeks.inview"
type="int"/> type="int"/>
@ -160,6 +171,124 @@
</groupbox> </groupbox>
<groupbox> <groupbox>
<caption label="&pref.calendar.view.dayandweekviews.caption;"/>
<grid>
<columns>
<column/>
<column/>
<column flex="1"/>
</columns>
<rows>
<row align="center">
<label value="&pref.calendar.view.daystart.label;"
accesskey="&pref.calendar.view.daystart.accesskey;"
control="daystarthour"/>
<menulist id="daystarthour"
oncommand="gViewsPane.updateViewEndMenu(this.value);"
preference="calendar.view.daystarthour">
<menupopup id="daystarthourpopup">
<menuitem label="&time.midnight;" value="0"/>
<menuitem label="&time.1;" value="1"/>
<menuitem label="&time.2;" value="2"/>
<menuitem label="&time.3;" value="3"/>
<menuitem label="&time.4;" value="4"/>
<menuitem label="&time.5;" value="5"/>
<menuitem label="&time.6;" value="6"/>
<menuitem label="&time.7;" value="7"/>
<menuitem label="&time.8;" value="8"/>
<menuitem label="&time.9;" value="9"/>
<menuitem label="&time.10;" value="10"/>
<menuitem label="&time.11;" value="11"/>
<menuitem label="&time.noon;" value="12"/>
<menuitem label="&time.13;" value="13"/>
<menuitem label="&time.14;" value="14"/>
<menuitem label="&time.15;" value="15"/>
<menuitem label="&time.16;" value="16"/>
<menuitem label="&time.17;" value="17"/>
<menuitem label="&time.18;" value="18"/>
<menuitem label="&time.19;" value="19"/>
<menuitem label="&time.20;" value="20"/>
<menuitem label="&time.21;" value="21"/>
<menuitem label="&time.22;" value="22"/>
<menuitem label="&time.23;" value="23"/>
</menupopup>
</menulist>
<hbox align="center" pack="center">
<label value="&pref.calendar.view.visiblehours.label;"
accesskey="&pref.calendar.view.visiblehours.accesskey;"
control="visiblehours"/>
<menulist id="visiblehours"
preference="calendar.view.visiblehours">
<menupopup id="visiblehourspopup">
<menuitem label="1" value="1"/>
<menuitem label="2" value="2"/>
<menuitem label="3" value="3"/>
<menuitem label="4" value="4"/>
<menuitem label="5" value="5"/>
<menuitem label="6" value="6"/>
<menuitem label="7" value="7"/>
<menuitem label="8" value="8"/>
<menuitem label="9" value="9"/>
<menuitem label="10" value="10"/>
<menuitem label="11" value="11"/>
<menuitem label="12" value="12"/>
<menuitem label="13" value="13"/>
<menuitem label="14" value="14"/>
<menuitem label="15" value="15"/>
<menuitem label="16" value="16"/>
<menuitem label="17" value="17"/>
<menuitem label="18" value="18"/>
<menuitem label="19" value="19"/>
<menuitem label="20" value="20"/>
<menuitem label="21" value="21"/>
<menuitem label="22" value="22"/>
<menuitem label="23" value="23"/>
<menuitem label="24" value="24"/>
</menupopup>
</menulist>
<label value="&pref.calendar.view.visiblehoursend.label;"/>
</hbox>
</row>
<row align="center">
<label value="&pref.calendar.view.dayend.label;"
accesskey="&pref.calendar.view.dayend.accesskey;"
control="dayendhour"/>
<menulist id="dayendhour"
oncommand="gViewsPane.updateViewStartMenu(this.value);"
preference="calendar.view.dayendhour">
<menupopup id="dayendhourpopup">
<menuitem label="&time.1;" value="1"/>
<menuitem label="&time.2;" value="2"/>
<menuitem label="&time.3;" value="3"/>
<menuitem label="&time.4;" value="4"/>
<menuitem label="&time.5;" value="5"/>
<menuitem label="&time.6;" value="6"/>
<menuitem label="&time.7;" value="7"/>
<menuitem label="&time.8;" value="8"/>
<menuitem label="&time.9;" value="9"/>
<menuitem label="&time.10;" value="10"/>
<menuitem label="&time.11;" value="11"/>
<menuitem label="&time.noon;" value="12"/>
<menuitem label="&time.13;" value="13"/>
<menuitem label="&time.14;" value="14"/>
<menuitem label="&time.15;" value="15"/>
<menuitem label="&time.16;" value="16"/>
<menuitem label="&time.17;" value="17"/>
<menuitem label="&time.18;" value="18"/>
<menuitem label="&time.19;" value="19"/>
<menuitem label="&time.20;" value="20"/>
<menuitem label="&time.21;" value="21"/>
<menuitem label="&time.22;" value="22"/>
<menuitem label="&time.23;" value="23"/>
<menuitem label="&time.midnight;" value="24"/>
</menupopup>
</menulist>
</row>
</rows>
</grid>
</groupbox>
<groupbox id="viewsMultiweekGroupbox">
<caption label="&pref.calendar.view.multiweekview.caption;"/> <caption label="&pref.calendar.view.multiweekview.caption;"/>
<hbox align="center"> <hbox align="center">
<label value="&pref.numberofweeks.label;" <label value="&pref.numberofweeks.label;"

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

@ -8,6 +8,7 @@ calendar.jar:
content/calendar/calendar-alarm-widget.xml (content/calendar-alarm-widget.xml) content/calendar/calendar-alarm-widget.xml (content/calendar-alarm-widget.xml)
content/calendar/calendar-attendee-list.xml (content/calendar-attendee-list.xml) content/calendar/calendar-attendee-list.xml (content/calendar-attendee-list.xml)
content/calendar/calendar-decorated-base.xml (content/calendar-decorated-base.xml) content/calendar/calendar-decorated-base.xml (content/calendar-decorated-base.xml)
content/calendar/calendar-decorated-multiday-base-view.xml (content/calendar-decorated-multiday-base-view.xml)
content/calendar/calendar-decorated-day-view.xml (content/calendar-decorated-day-view.xml) content/calendar/calendar-decorated-day-view.xml (content/calendar-decorated-day-view.xml)
content/calendar/calendar-decorated-week-view.xml (content/calendar-decorated-week-view.xml) content/calendar/calendar-decorated-week-view.xml (content/calendar-decorated-week-view.xml)
content/calendar/calendar-decorated-multiweek-view.xml (content/calendar-decorated-multiweek-view.xml) content/calendar/calendar-decorated-multiweek-view.xml (content/calendar-decorated-multiweek-view.xml)
@ -41,6 +42,7 @@ calendar.jar:
content/calendar/preferences/general.xul (content/preferences/general.xul) content/calendar/preferences/general.xul (content/preferences/general.xul)
content/calendar/preferences/timezones.js (content/preferences/timezones.js) content/calendar/preferences/timezones.js (content/preferences/timezones.js)
content/calendar/preferences/timezones.xul (content/preferences/timezones.xul) content/calendar/preferences/timezones.xul (content/preferences/timezones.xul)
content/calendar/preferences/views.js (content/preferences/views.js)
content/calendar/preferences/views.xul (content/preferences/views.xul) content/calendar/preferences/views.xul (content/preferences/views.xul)
% skin calendar classic/1.0 %skin/classic/calendar/ % skin calendar classic/1.0 %skin/classic/calendar/
#expand skin/classic/calendar/cal-icon32.png (themes/__THEME__/cal-icon32.png) #expand skin/classic/calendar/cal-icon32.png (themes/__THEME__/cal-icon32.png)

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

@ -55,21 +55,34 @@ calendar-header-container {
border-top: 1px solid #3F7D91; border-top: 1px solid #3F7D91;
} }
calendar-event-column[weekend="true"], calendar-header-container[weekend="true"],
calendar-header-container[weekend="true"] { .calendar-event-column-linebox[weekend="true"],
background: #FFF9E7; .calendar-event-column-linebox[off-time="true"] {
background: #f4f4f4;
} }
calendar-event-column[today="true"], calendar-header-container[today="true"],
calendar-header-container[today="true"] { .calendar-event-column-linebox[today="true"] {
background: #dfeaf4; background: #dfeaf4;
} }
calendar-event-column[selected="true"], calendar-header-container[selected="true"],
calendar-header-container[selected="true"] { .calendar-event-column-linebox[selected="true"] {
background: #ffe79c; background: #ffe79c;
} }
calendar-header-container[weekend="true"][today="true"],
.calendar-event-column-linebox[weekend="true"][today="true"],
.calendar-event-column-linebox[off-time="true"][today="true"] {
background: #d6dfe9;
}
calendar-header-container[weekend="true"][selected="true"],
.calendar-event-column-linebox[weekend="true"][selected="true"],
.calendar-event-column-linebox[off-time="true"][selected="true"] {
background: #f5dd92;
}
.calendar-event-column-linebox[orient="horizontal"] { .calendar-event-column-linebox[orient="horizontal"] {
border-right: 1px solid #3F7D91; border-right: 1px solid #3F7D91;
} }

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

@ -55,21 +55,34 @@ calendar-header-container {
border-top: 1px solid #3F7D91; border-top: 1px solid #3F7D91;
} }
calendar-event-column[weekend="true"], calendar-header-container[weekend="true"],
calendar-header-container[weekend="true"] { .calendar-event-column-linebox[weekend="true"],
background: #FFF9E7; .calendar-event-column-linebox[off-time="true"] {
background: #f4f4f4;
} }
calendar-event-column[today="true"], calendar-header-container[today="true"],
calendar-header-container[today="true"] { .calendar-event-column-linebox[today="true"] {
background: #dfeaf4; background: #dfeaf4;
} }
calendar-event-column[selected="true"], calendar-header-container[selected="true"],
calendar-header-container[selected="true"] { .calendar-event-column-linebox[selected="true"] {
background: #ffe79c; background: #ffe79c;
} }
calendar-header-container[weekend="true"][today="true"],
.calendar-event-column-linebox[weekend="true"][today="true"],
.calendar-event-column-linebox[off-time="true"][today="true"] {
background: #d6dfe9;
}
calendar-header-container[weekend="true"][selected="true"],
.calendar-event-column-linebox[weekend="true"][selected="true"],
.calendar-event-column-linebox[off-time="true"][selected="true"] {
background: #f5dd92;
}
.calendar-event-column-linebox[orient="horizontal"] { .calendar-event-column-linebox[orient="horizontal"] {
border-right: 1px solid #3F7D91; border-right: 1px solid #3F7D91;
} }

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

@ -78,6 +78,13 @@ pref("calendar.week.d4thursdaysoff", false);
pref("calendar.week.d5fridaysoff", false); pref("calendar.week.d5fridaysoff", false);
pref("calendar.week.d6saturdaysoff", true); pref("calendar.week.d6saturdaysoff", true);
// start and end work hour for day and week views
pref("calendar.view.daystarthour", 8);
pref("calendar.view.dayendhour", 17);
// number of visible hours for day and week views
pref("calendar.view.visiblehours", 9);
// Do not set this! If it's not there, then we guess the system timezone // Do not set this! If it's not there, then we guess the system timezone
//pref("calendar.timezone.local", ""); //pref("calendar.timezone.local", "");

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

@ -53,7 +53,8 @@
<prefpane id="paneLightning" <prefpane id="paneLightning"
label="&lightning.taskLabel;" label="&lightning.taskLabel;"
onpaneload="gCalendarGeneralPane.init(); gAlarmsPane.init(); onpaneload="gCalendarGeneralPane.init(); gAlarmsPane.init();
gCategoriesPane.init(); gTimezonesPane.init();"> gCategoriesPane.init(); gViewsPane.init();
gTimezonesPane.init();">
<tabbox id="calPreferencesTabbox" flex="1" onselect=""> <tabbox id="calPreferencesTabbox" flex="1" onselect="">
<tabs> <tabs>
<tab id="calPreferencesTabGeneral" <tab id="calPreferencesTabGeneral"
@ -78,7 +79,9 @@
<vbox id="calPreferencesBoxCategories"/> <vbox id="calPreferencesBoxCategories"/>
</tabpanel> </tabpanel>
<tabpanel orient="vertical"> <tabpanel orient="vertical">
<vbox id="calPreferencesBoxViews"/> <vbox id="calPreferencesBoxViews">
<groupbox id="viewsMultiweekGroupbox" hidden="true"/>
</vbox>
</tabpanel> </tabpanel>
<tabpanel orient="vertical"> <tabpanel orient="vertical">
<vbox id="calPreferencesBoxTimezones"/> <vbox id="calPreferencesBoxTimezones"/>

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

@ -57,6 +57,9 @@ pref("calendar.date.format", 0);
pref("calendar.event.defaultlength", 60); pref("calendar.event.defaultlength", 60);
// Do NOT set this. If it is unset, we guess the timezone from the system // Do NOT set this. If it is unset, we guess the timezone from the system
//pref("calendar.timezone.local", "America/New_York); //pref("calendar.timezone.local", "America/New_York);
pref("calendar.view.daystarthour", 8);
pref("calendar.view.dayendhour", 17);
pref("calendar.view.visiblehours", 9);
pref("calendar.weeks.inview", 4); pref("calendar.weeks.inview", 4);
pref("calendar.previousweeks.inview", 0); pref("calendar.previousweeks.inview", 0);