b=260120, improvements to datepicker and timepicker, patch from andrew@progressivex.com, r=vladimir

This commit is contained in:
vladimir%pobox.com 2005-05-06 21:29:54 +00:00
parent b5e78ba1b6
commit 5e13d83f37
11 changed files with 18 additions and 2236 deletions

View File

@ -21,14 +21,10 @@ calendar.jar:
content/calendar/dateUtils.js (/calendar/resources/content/dateUtils.js)
content/calendar/selectAddressesDialog.js (/calendar/resources/content/selectAddressesDialog.js)
content/calendar/attachFile.js (/calendar/resources/content/attachFile.js)
content/calendar/datetimepickers/datepicker.css (/calendar/resources/content/datetimepickers/datepicker.css)
content/calendar/datetimepickers/datepicker.xbl (/calendar/resources/content/datetimepickers/datepicker.xbl)
content/calendar/datetimepickers/datetimepicker.css (/calendar/resources/content/datetimepickers/datetimepicker.css)
content/calendar/datetimepickers/datetimepicker.xbl (/calendar/resources/content/datetimepickers/datetimepicker.xbl)
content/calendar/datetimepickers/timepicker.css (/calendar/resources/content/datetimepickers/timepicker.css)
content/calendar/datetimepickers/timepicker.xbl (/calendar/resources/content/datetimepickers/timepicker.xbl)
content/calendar/datetimepickers/datetimepickers.css (/calendar/resources/content/datetimepickers/datetimepickers.css)
content/calendar/datetimepickers/datetimepickers.xml (/calendar/resources/content/datetimepickers/datetimepickers.xml)
content/calendar/datetimepickers/minimonth.css (/calendar/resources/content/datetimepickers/minimonth.css)
content/calendar/datetimepickers/minimonth.xbl (/calendar/resources/content/datetimepickers/minimonth.xbl)
content/calendar/datetimepickers/minimonth.xml (/calendar/resources/content/datetimepickers/minimonth.xml)
content/calendar/calendar-multiday-view.css (/calendar/base/content/calendar-multiday-view.css)
content/calendar/calendar-multiday-view.xml (/calendar/base/content/calendar-multiday-view.xml)
content/calendar/calendar-item-editing.js (/calendar/base/content/calendar-item-editing.js)
@ -56,3 +52,9 @@ classic.jar:
#expand skin/classic/calendar/all_day_event_hover.png (/calendar/resources/skin/classic/all_day_event_hover.png)
#expand skin/classic/calendar/all_day_event_down.png (/calendar/resources/skin/classic/all_day_event_down.png)
#expand skin/classic/calendar/week-view-corner.png (/calendar/resources/skin/classic/week-view-corner.png)
#expand skin/classic/calendar/datetimepickers/datetimepickers.css (/calendar/resources/skin/classic/datetimepickers/datetimepickers.css)
#expand skin/classic/calendar/datetimepickers/minimonth.css (/calendar/resources/skin/classic/datetimepickers/minimonth.css)
#expand skin/classic/calendar/datetimepickers/left-arrow-hover.gif (/calendar/resources/skin/classic/datetimepickers/left-arrow-hover.gif)
#expand skin/classic/calendar/datetimepickers/left-arrow.gif (/calendar/resources/skin/classic/datetimepickers/left-arrow.gif)
#expand skin/classic/calendar/datetimepickers/right-arrow-hover.gif (/calendar/resources/skin/classic/datetimepickers/right-arrow-hover.gif)
#expand skin/classic/calendar/datetimepickers/right-arrow.gif (/calendar/resources/skin/classic/datetimepickers/right-arrow.gif)

View File

@ -1,43 +0,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):
*
* 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 ***** */
@import url("chrome://calendar/content/datetimepickers/minimonth.css");
@import url("chrome://calendar/skin/datetimepickers/datepicker.css");
datepicker {
-moz-binding: url("chrome://calendar/content/datetimepickers/datepicker.xbl#datepicker");
}

View File

@ -1,269 +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>
-
- 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 ***** -->
<!--
/* DatePicker: text box + grid button XBL component.
Editing text box sets date if parseable as date using current
numerical short date format (in operating system).
Clicking button shows datepicker-grid for picking date in month.
Used in datetimepicker.xbl, calendar eventDialog.xul
Requires:
<?xml-stylesheet type="text/css"
href="chrome://calendar/content/datetimepickers/datepicker.css" ?>
May require (probably until bug 58757 fixed):
<script type="application/x-javascript"
src="chrome://global/content/strres.js" />
<script type="application/x-javascript"
src="chrome://calendar/content/dateUtils.js"/>
At site, can provide id, and code to run when value changed by picker.
<datepicker id="my-date-picker" onchange="myDatePick( this );"/>
May get/set value in javascript with
document.getElementById("my-date-picker").value = new Date();
May disable/enable in javascript with
document.getElementById("my-date-picker").disabled = true;
*/
-->
<bindings id="xulDatePicker"
xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!-- this doesn't work, maybe bug 58757 -->
<xul:script xul:type="application/x-javascript"
xul:src="chrome://calendar/content/dateUtils.js"/>
<binding id="datepicker" extends="xul:box" xbl:inherits="value,onchange">
<!-- ::::::::::::::::: CONTENT ::::::::::::::::::::::::: -->
<!-- Desired behavior: when user is done editing the date field
and either leaves the field (onblur) or closes the dialog
(13 is enter/return key), parse the date and redisplay it
in the date field using the current format to verify
whether the date was parsed correctly.
This cannot be done with textbox oninput, so use a workaround.
This was done with textbox onkeypress="parseTextBoxDate(true)"
and onblur="parseTextBoxDate(true)" which worked in Moz1.6, but
no longer works in Moz1.7.
Therefore constructor stores attribute kDatePicker on the textbox,
and the onblur and onkeypress commands navigate to this kDatePicker.
xul:Textbox contains an xul:hbox which contains html:input.
Onkeypress and onblur are not documented attributes of xul:textbox,
but become attributes of the html:input.
Not clear how to navigate from the textbox to the input, otherwise
could put kDatePicker property on the input element.
[document.getAnonymousNodes(textBox) fails as of Moz1.7b]).
So navigate parents to textbox in order to call parseTextBoxDate.
[Note: minimonth onmonthchange reshows parent popup to fix title
month/year (bug 973914). minimonth onpopuplisthidden reshows parent
popup to avoid freeze (bug 278877).]
[this comment is outside the <content> so it won't become a
node that interferes with navigation to interior nodes.] -->
<content>
<xul:hbox flex="1" id="hbox" class="datepicker-box-class">
<xul:menulist editable="true" sizetopopup="false"
class="datepicker-text-class"
onkeypress="if (event.keyCode == 13) this.kDatePicker.parseTextBoxDate(true);"
xbl:inherits="disabled">
<xul:menupopup popupanchor="bottomright" popupalign="topright"
onpopupshowing="this.parentNode.kDatePicker.onPopup()">
<xul:minimonth onchange="this.kDatePicker.clickDate(this); "
onmonthchange="this.kDatePicker.reshowPopup();"
onpopuplisthidden="this.kDatePicker.reshowPopup();"/>
</xul:menupopup>
</xul:menulist>
</xul:hbox>
</content>
<!-- ::::::::::::::::: INTERFACE ::::::::::::::::::::::::: -->
<implementation>
<property name="value"
onset="this.update(val,false)"
onget="return this.mValue"/>
<!-- called from datetimepicker.datepickerdisabled and datetimepicker.setDisabled -->
<property name="disabled"
onget="return this.mDisabled;"
onset="this.setDisabled( val );" />
<constructor>
<![CDATA[
var hbox = document.getAnonymousNodes(this)[0];
this.kTextBox = hbox.firstChild;
this.kTextBox.kDatePicker = this; // enable call back to method in Moz1.7
this.kTextBox.menupopup.kDatePicker = this;
this.kMinimonth = this.kTextBox.menupopup.firstChild;
this.kMinimonth.kDatePicker = this; // enable call back to method in Moz1.6
this.kFormatter = new DateFormater();
// whether currently disabled
this.mDisabled = this.getAttribute("disabled") ? true : false;
this.mValue = null;
var val = this.getAttribute("value");
if (val) {
this.value = new Date(val); // setting value property calls update
} else {
this.value = new Date();
}
this.kCallback = null;
val = this.getAttribute("onchange");
if (val)
this.kCallback = function() { eval(val); };
this.mIsReshowing = false;
]]>
</constructor>
<method name="update">
<parameter name="aValue"/>
<parameter name="aRefresh"/>
<body><![CDATA[
if (aValue != null) {
// format fails if year <= 1600 on win2k, so try format first.
var formattedValue = null;
try {
formattedValue = this.formatDate(aValue);
} catch (ex) {} // fall thru
if (formattedValue) {
// format succeeded, safe to set value
this.mValue = aValue;
this.kTextBox.value = formattedValue;
// called before constructor, so check aRefresh before kCallBack
if ( aRefresh != false && "kCallback" in this && this.kCallback)
this.kCallback();
return;
}
}
// invalid date, revert to previous date
// set textBox.value property, not attribute
if (this.mValue) {
this.kTextBox.value = this.formatDate(this.mValue);
}
]]></body>
</method>
<method name="formatDate">
<parameter name="aValue"/>
<body><![CDATA[
return this.kFormatter.getShortFormatedDate(aValue);
]]></body>
</method>
<method name="setDisabled">
<parameter name="aDisabled" />
<body><![CDATA[
this.mDisabled = aDisabled;
if (this.mDisabled) {
this.kTextBox.setAttribute( "disabled", "true" );
} else {
this.kTextBox.removeAttribute( "disabled" );
}
]]></body>
</method>
<method name="onPopup">
<body><![CDATA[
// avoid reinitializing during reshow, for bugs 273914 & 278877 workaround
if (! this.mIsReshowing) {
this.kMinimonth.update( this.mValue );
// select all to remove cursor since can't type while popped-up
this.select();
}
]]></body>
</method>
<!-- Reshow hides and shows parent popup without reinitializing in onPopup
to workaround bugs 273914 (update title) & 278877 (avoid freeze) -->
<method name="reshowPopup">
<body><![CDATA[
this.mIsReshowing = true;
try {
this.kTextBox.menupopup.hidePopup();
this.kTextBox.menupopup.showPopup();
} finally {
this.mIsReshowing = false;
}
]]></body>
</method>
<method name="parseTextBoxDate">
<parameter name="aRefresh"/>
<body><![CDATA[
this.update(this.kFormatter.parseShortDate(this.kTextBox.value),
aRefresh);
]]></body>
</method>
<method name="clickDate">
<parameter name="aMiniMonthGrid" />
<body><![CDATA[
this.update(new Date(aMiniMonthGrid.value), true);
// select changed value so no cursor appears (can't type to it).
this.select();
aMiniMonthGrid.parentNode.hidePopup();
]]></body>
</method>
<method name="select">
<body><![CDATA[
// select all in text box
this.kTextBox.select();
]]></body>
</method>
</implementation>
<!-- ::::::::::::::::: HANDLERS ::::::::::::::::::::::::: -->
<handlers>
<handler event="bindingattached" action="this.initialize();"/>
<handler event="blur" phase="capturing"><![CDATA[
this.parseTextBoxDate(true);
]]></handler>
</handlers>
</binding>
</bindings>

View File

@ -1,12 +0,0 @@
@import url("chrome://calendar/content/datetimepickers/datepicker.css");
@import url("chrome://calendar/content/datetimepickers/timepicker.css");
datetimepicker {
-moz-binding: url("chrome://calendar/content/datetimepickers/datetimepicker.xbl#datetimepicker");
}
.menu-right
{
visibility : hidden;
}

View File

@ -1,198 +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>
-
- 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 ***** -->
<!--
/* DateTimePicker: datepicker + timepicker (+ timezone in future)
Used in calendar/content/eventDialog.xul
Requires:
<?xml-stylesheet
href="chrome://calendar/content/datetimepickers/datetimepicker.css" ?>
May require (probably until bug 58757 fixed):
<script type="application/x-javascript"
src="chrome://global/content/strres.js" />
<script type="application/x-javascript"
src="chrome://calendar/content/dateUtils.js"/>
At site, can provide id, and code to run when changed by picker.
<datetimepicker id="my-picker" onchange="myOnPick(this);"
disabled="false" datepickerdisabled="false" timepickerdisabled="false"/>
May get/set value with
document.getElementById("my-picker").value = new Date();
May disable/enable from javascript with
document.getElementById("my-picker").disabled = true;
May also dis/enable datepicker and timepicker individually with
document.getElementById("my-picker").datepickerdisabled = true;
document.getElementById("my-picker").timepickerdisabled = true;
*/
-->
<!-- -->
<bindings id="xulDateTimePicker"
xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="datetimepicker" extends="xul:box"
inherits="value,onchange,disabled,datepickerdisabled,timepickerdisabled">
<!-- ::::::::::::::::: CONTENT ::::::::::::::::::::::::: -->
<!-- onchange was simply "onDatePick()" in Moz1.6, but stopped working in Moz1.7
so had to add navigation by parents. -->
<content id="content">
<xul:hbox flex="1" id="hbox">
<datepicker id="date-picker" onchange="this.parentNode.parentNode.onDatePick();"
xbl:inherits="value,disabled,disabled=datepickerdisabled" />
<timepicker id="time-picker" onchange="this.parentNode.parentNode.onTimePick();"
xbl:inherits="value,disabled,disabled=timepickerdisabled" />
<!-- timezonepicker -->
</xul:hbox>
</content>
<!-- ::::::::::::::::: INTERFACE ::::::::::::::::::::::::: -->
<implementation>
<property name="value"
onset="this.update(val,false)"
onget="return this.mValue"/>
<property name="disabled"
onget="return this.mDisabled;"
onset="this.setDisabled( val );" />
<property name="datepickerdisabled"
onget="return this.kDatePicker.disabled;"
onset="this.kDatePicker.disabled = val;" />
<!-- timepicker may be disabled alone for all day events -->
<property name="timepickerdisabled"
onget="return this.kTimePicker.disabled;"
onset="this.kTimePicker.disabled = val;" />
<constructor><![CDATA[
//java.lang.System.err.println(">>datetime()");
this.kDatePicker =
document.getAnonymousElementByAttribute(this, "id", "date-picker");
this.kTimePicker =
document.getAnonymousElementByAttribute(this, "id", "time-picker");
// init this.mValue:
var val = this.getAttribute("value");
this.mValue = (val ? new Date(val)
: new Date());
// Make the function a member of the picker
// so that 'this' will be the picker
val = this.getAttribute("onchange");
if (val) this.kCallback = function(){ eval( val ) };
//java.lang.System.err.println("<<datetime()"+this.mValue);
]]></constructor>
<!-- update values. If aRefresh is true, call user's onchange.
(aRefresh is false if externally set from user program,
aRefresh is true if internally updated from gui.) -->
<method name="update">
<parameter name="aValue"/>
<parameter name="aRefresh"/>
<body><![CDATA[
if (aValue != null) {
this.mValue = aValue;
}
// set textBox.value property, not attribute
this.kDatePicker.value = this.mValue;
this.kTimePicker.value = this.mValue;
if (aValue != null && this.kCallback && aRefresh != false) {
this.kCallback();
}
]]></body>
</method>
<!-- Date was changed by gui: update value. -->
<method name="onDatePick">
<body><![CDATA[
var oldTime = new Date(this.mValue);
var newDate = new Date(this.kDatePicker.value);
// Note: create new date because setting month and date of month in
// either order can lead to unexpected results (month may be advanced
// automatically if day of month is temporarily out of range).
var dateTime = new Date(newDate.getFullYear(),
newDate.getMonth(),
newDate.getDate(),
oldTime.getHours(),
oldTime.getMinutes(),
oldTime.getSeconds());
this.update(dateTime, true);
]]></body>
</method>
<!-- Time was changed by gui: update value -->
<method name="onTimePick">
<body><![CDATA[
var dateTime = new Date(this.mValue);
var newTime = this.kTimePicker.value;
dateTime.setHours(newTime.getHours());
dateTime.setMinutes(newTime.getMinutes());
dateTime.setSeconds(newTime.getSeconds());
this.update(dateTime, true);
]]></body>
</method>
<!-- Propagate aDisabled to datepicker and timepicker -->
<method name="setDisabled">
<parameter name="aDisabled" />
<body><![CDATA[
this.mDisabled = aDisabled;
this.kDatePicker.disabled = aDisabled;
this.kTimePicker.disabled = aDisabled;
]]></body>
</method>
</implementation>
<!-- ::::::::::::::::: HANDLERS ::::::::::::::::::::::::: -->
<handlers>
<handler event="bindingattached" action="this.initialize();"/>
</handlers>
</binding>
</bindings>

View File

@ -1,14 +1,14 @@
@import url("chrome://calendar/skin/datetimepickers/minimonth.css");
minimonth {
-moz-binding: url("chrome://calendar/content/datetimepickers/minimonth.xbl#minimonth");
-moz-binding: url("chrome://calendar/content/datetimepickers/minimonth.xml#minimonth");
}
.minimonth-navbtn {
-moz-binding: url("chrome://calendar/content/datetimepickers/minimonth.xbl#minimonth-navbtn");
-moz-binding: url("chrome://calendar/content/datetimepickers/minimonth.xml#minimonth-navbtn");
}
.minimonth-day {
-moz-binding: url("chrome://calendar/content/datetimepickers/minimonth.xbl#minimonth-day");
-moz-binding: url("chrome://calendar/content/datetimepickers/minimonth.xml#minimonth-day");
}

View File

@ -1,574 +0,0 @@
<?xml version="1.0"?>
<!--
/* MiniMonth Calendar: day-of-month grid XBL component.
Displays month name and year above grid of days of month by week rows.
Arrows move forward or back a month.
Selecting a month name from month menu moves to that month in same year.
Selecting a year from year menu moves to same month in selected year.
Clicking on a day cell calls onchange attribute.
Changing month via arrows or menus calls onmonthchange attribute.
Used in datepicker.xbl and as mini-month in calendar.xul of Calendar.
At site, can provide id, and code to run when value changed by picker.
<calendar id="my-date-picker" onchange="myDatePick( this );"/>
May get/set value in javascript with
document.getElementById("my-date-picker").value = new Date();
Use attributes onpopuplisthidden and onmonthchange for working around
bugs that occur when minimonth is displayed in a popup (as in datepicker):
Currently (2005.3)
whenever a child popup is hidden, the parent popup needs to be reshown.
Use onpopuplisthidden to reshow parent popop (hidePopup, showPopup).
When title month or year changes, parent popup may need to be reshown.
Use onmonthchange to reshow parent popop (hidePopup, showPopup).
*/
-->
<bindings id="xulMiniMonth"
xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="minimonth" extends="xul:box" xbl:inherits="onchange,onmonthchange,onpopuplisthidden">
<!-- ::::::::::::::::: CONTENT ::::::::::::::::::::::::: -->
<content>
<xul:vbox class="minimonth-mainbox" flex="1">
<xul:hbox class="minimonth-month-box">
<xul:image class="minimonth-navbtn" dir="-1"/>
<xul:spacer flex="1"/>
<xul:text class="minimonth-month-name" value="Month" onclick="showPopupList('month')"/>
<xul:text class="minimonth-year-name" value="Year" onclick="showPopupList('year')"/>
<xul:spacer flex="1"/>
<xul:image class="minimonth-navbtn" dir="1"/>
</xul:hbox>
<xul:vbox class="minimonth-cal-box" flex="1">
<xul:hbox class="minimonth-row-head" equalsize="always">
<xul:text class="minimonth-header" flex="1"/>
<xul:text class="minimonth-header" flex="1"/>
<xul:text class="minimonth-header" flex="1"/>
<xul:text class="minimonth-header" flex="1"/>
<xul:text class="minimonth-header" flex="1"/>
<xul:text class="minimonth-header" flex="1"/>
<xul:text class="minimonth-header" flex="1"/>
</xul:hbox>
<xul:hbox class="minimonth-row-body" equalsize="always" flex="1">
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
</xul:hbox>
<xul:hbox class="minimonth-row-body" equalsize="always" flex="1">
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
</xul:hbox>
<xul:hbox class="minimonth-row-body" equalsize="always" flex="1">
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
</xul:hbox>
<xul:hbox class="minimonth-row-body" equalsize="always" flex="1">
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
</xul:hbox>
<xul:hbox class="minimonth-row-body" equalsize="always" flex="1">
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
</xul:hbox>
<xul:hbox class="minimonth-row-body" equalsize="always" flex="1">
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
<xul:text class="minimonth-day" flex="1"/>
</xul:hbox>
</xul:vbox>
</xul:vbox>
<xul:popupset>
<xul:popup anonid="months-popup" position="after_start"
onpopupshowing="preventBubble(event);"
onpopuphidden="firePopupListHidden();">
<xul:vbox>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
</xul:vbox>
</xul:popup>
<xul:popup anonid="years-popup" position="after_start"
onpopupshowing="preventBubble(event);"
onpopuphidden="firePopupListHidden();">
<xul:vbox>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
<xul:text class="minimonth-list"/>
</xul:vbox>
</xul:popup>
</xul:popupset>
</content>
<!-- ::::::::::::::::: INTERFACE ::::::::::::::::::::::::: -->
<implementation>
<property name="value"
onget="return this.mValue"
onset="this.update(val)"/>
<property name="onchange"/>
<property name="onmonthchange"/>
<property name="onpopuplisthidden"/>
<constructor>
<![CDATA[
this.mInitialized = false;
this.mSelected = false;
this.mValue = null;
this.kMonthNames = new Array(12);
var dateStringBundle = srGetStrBundle("chrome://calendar/locale/dateFormat.properties");
for (var month = 0; month < 12; month++) {
// this.kMonthNames[0] is from "month.1.name" (January)
this.kMonthNames[month] = dateStringBundle.GetStringFromName("month."+(month+1)+".name");
}
this.mPopup = null;
this.refreshDisplay( );
]]>
</constructor>
<method name="refreshDisplay">
<body>
<![CDATA[
if (!this.mInitialized) {
this.mInitialized = true;
// Find out which should be the first day of the week
var pref = Components.classes[
"@mozilla.org/preferences-service;1"
].getService(Components.interfaces.nsIPrefBranch);
// this.weekStart;
try {
this.weekStart = pref.getIntPref("calendar.week.start");
} catch (e) {
this.weekStart = 0;
}
// save references for convenience
var anonContent = document.getAnonymousNodes(this);
var mainBox = anonContent[0];
var headBox = mainBox.childNodes[0];
this.kLeftBtn = headBox.firstChild;
this.kLeftBtn.kMinimonth = this;
this.kRightBtn = headBox.lastChild;
this.kRightBtn.kMinimonth = this;
this.kMonthCell = headBox.childNodes[2];
this.kYearCell = headBox.childNodes[3];
this.kDaysOfMonthBox = mainBox.childNodes[1];
var popupSet = anonContent[1];
this.kMonthPopup = popupSet.childNodes[0];
this.kMonthList = this.kMonthPopup.firstChild.childNodes;
this.kYearPopup = popupSet.childNodes[1];
this.kYearList = this.kYearPopup.firstChild.childNodes;
if (!this.mValue) this.mValue = new Date();
// In moz 1.7, onchange event handler attributes must be read as:
// yes: "this.onchange = function(){ eval(onChangeAttr); };"
// The following alternatives break for some expressions:
// no: "this.onchange = new Function(eval(onChangeAttr));"
// no: "this.onchange = new Function(onChangeAttr);"
// The latter two can produce unbound identifier errors
// for free variables of the onchange expression
// (variables defined outside the expression, such as globals).
var onChangeAttr = this.getAttribute("onchange");
if (onChangeAttr) this.onchange = function(){ eval(onChangeAttr); };
else this.onchange = null;
var onMonthChangeAttr = this.getAttribute("onmonthchange");
if (onMonthChangeAttr)
this.onmonthchange = function(){ eval(onMonthChangeAttr) };
else this.onmonthchange = null;
var onPopupListHiddenAttr = this.getAttribute("onpopuplisthidden");
if (onPopupListHiddenAttr)
this.onpopuplisthidden = function(){ eval(onPopupListHiddenAttr) };
else this.onpopuplisthidden = null;
this.setHeader();
this.showMonth(this.mValue);
}
]]></body>
</method>
<method name="setHeader">
<body><![CDATA[
// need to create string bundle manually instead of
// using <xul:stringbundle/> see bug 63370 for details
var localeService = Components.classes[
"@mozilla.org/intl/nslocaleservice;1"
].getService(Components.interfaces.nsILocaleService);
var stringBundleService = Components.classes[
"@mozilla.org/intl/stringbundle;1"
].getService(Components.interfaces.nsIStringBundleService);
var bundleURL = "chrome://calendar/locale/dateFormat.properties";
var dateBundle = stringBundleService.createBundle(
bundleURL, localeService.getApplicationLocale()
);
// Reset the headers
var header = document.getAnonymousNodes(this)[0].
childNodes[1].childNodes[0]
;
for (var column = 0; column < header.childNodes.length; column++) {
header.childNodes[column].setAttribute( "value",
dateBundle.GetStringFromName(
"day."+
((this.weekStart + column) % 7 + 1) +
".short"
)
);
}
]]></body>
</method>
<method name="showMonth">
<parameter name="aDate"/>
<body><![CDATA[
if (!aDate) {
aDate = new Date();
} else {
aDate = new Date(aDate);
}
aDate.setDate(1);
this.mEditorDate = aDate;
if (this.mSelected) {
this.mSelected.setAttribute("selected", "");
this.mSelected = null;
}
//-------- Update the month and year title
var mon = this.getMonthName(aDate);
this.kMonthCell.setAttribute("value", mon);
this.kYearCell.setAttribute("value", aDate.getFullYear());
//-------- Update the month popup
var i;
var months = this.kMonthList;
for (i = 0; i < months.length; i++) {
months[i].setAttribute("value", this.kMonthNames[i]);
months[i].setAttribute("index", i);
months[i].setAttribute("current", "false");
if (i == aDate.getMonth())
months[i].setAttribute("current", "true");
}
//-------- Update the year popup
var years = this.kYearList;
var year = new Date(aDate);
year.setFullYear(aDate.getFullYear() - (years.length%2 + 1));
for (i = 0; i < years.length; i++) {
years[i].setAttribute("value", year.getFullYear());
years[i].setAttribute("current", "false");
if (year.getFullYear() == aDate.getFullYear())
years[i].setAttribute("current", "true");
year.setFullYear(year.getFullYear() + 1);
}
//-------- Update the calendar
var calbox = this.kDaysOfMonthBox;
var firstWeekday = (7 + aDate.getDay() - this.weekStart) % 7;
var date = new Date(aDate);
date.setDate(date.getDate()-firstWeekday);
for (var k = 1; k < calbox.childNodes.length; k++) {
var row = calbox.childNodes[k];
for (i = 0; i < 7; i++) {
var day = row.childNodes[i];
if (aDate.getMonth() != date.getMonth()) {
day.setAttribute("othermonth", "true");
} else {
day.setAttribute("othermonth", "");
}
// highlight the current date
var val = this.value;
if (val) {
if ((val.getFullYear() == date.getFullYear()) &&
(val.getMonth() == date.getMonth()) &&
(val.getDate() == date.getDate()))
{
this.mSelected = day;
day.setAttribute("selected", "true");
}
}
day.date = new Date(date);
day.calendar = this;
day.setAttribute("value", date.getDate());
date.setDate(date.getDate() + 1);
}
}
]]></body>
</method>
<method name="showPopupList">
<parameter name="type"/> <!-- 'month' or 'year' -->
<body><![CDATA[
// Close open popups (if any), to prevent linux crashes
if (this.mPopup)
this.mPopup.hidePopup();
this.mPopup = (type == 'month'? this.kMonthPopup : this.kYearPopup);
var base = (type == 'month'? this.kMonthCell : this.kYearCell);
this.mPopup.showPopup(base, -1, -1, "popup", "bottomleft", "topleft");
]]></body>
</method>
<method name="preventBubble">
<parameter name="anEvent"/>
<body><![CDATA[
// avoid calling popup handlers of higher popups in DOM (datepicker)
anEvent.preventBubble();
]]></body>
</method>
<method name="firePopupListHidden">
<body><![CDATA[
this.mPopup = null;
if (this.onpopuplisthidden)
this.onpopuplisthidden();
]]></body>
</method>
<method name="setBusyDates">
<parameter name="arrayOfDates"/>
<body><![CDATA[
/* CODE FROM monthView.js for finding the events for the month. */
/*
document.getElementById( "lefthandcalendar" ).value = date;
//get a list of events for this month.
var monthEvents =
this.eventSource.getEventsForMonth( this.getSelectedDate() );
var arrayOfDates = new Array();
for( var eventIndex = 0; eventIndex < monthEvents.length; ++eventIndex )
{
var calendarEventDisplay = monthEvents[ eventIndex ];
var eventDate = new Date( calendarEventDisplay.displayDate );
//add them to an array
arrayOfDates[ eventDate.getDate() ] = true;
}
document.getElementById( "lefthandcalendar" ).setBusyDates( arrayOfDates );
*/
var aDate = new Date();
aDate.setDate( 1 );
//-------- Update the calendar
var calbox = document.getAnonymousNodes(this)[0].childNodes[1];
// weekStart day is set by preference
var firstWeekday = (7 + aDate.getDay() - this.weekStart) % 7;
var date = new Date(aDate.getTime());
date.setDate(date.getDate() - firstWeekday);
for (var k = 1; k < calbox.childNodes.length; k++) {
var row = calbox.childNodes[k];
for (var i = 0; i < 7; i++) {
var day = row.childNodes[i];
if (aDate.getMonth() == date.getMonth() &&
arrayOfDates[ date.getDate() ] == true ) {
day.setAttribute("busy", "true");
} else {
day.removeAttribute("busy");
}
// next date of month, may increment month
date.setDate(date.getDate() + 1);
}
}
]]></body>
</method>
<method name="advanceMonth">
<parameter name="aDir"/>
<body><![CDATA[
var ad = this.mEditorDate.getMonth() + aDir;
this.mEditorDate.setMonth(ad);
this.showMonth(this.mEditorDate);
if (this.mSelected) {
this.mSelected.removeAttribute("selected");
}
this.value = this.mEditorDate;
if (this.onmonthchange) this.onmonthchange();
]]></body>
</method>
<method name="dayClicked">
<parameter name="aDay"/>
<body><![CDATA[
if (this.mSelected) {
this.mSelected.setAttribute("selected", "");
}
this.mSelected = aDay;
aDay.setAttribute("selected", "true");
this.value = aDay.date;
if (this.onchange) this.onchange();
]]></body>
</method>
<method name="update">
<parameter name="aValue"/>
<body><![CDATA[
this.mValue = aValue;
this.showMonth(aValue);
]]></body>
</method>
<method name="getMonthName">
<parameter name="aDate"/>
<body><![CDATA[
return this.kMonthNames[aDate.getMonth()];
]]></body>
</method>
<method name="switchMonth">
<parameter name="aMonth"/>
<body><![CDATA[
this.mEditorDate.setMonth(aMonth);
this.showMonth(this.mEditorDate);
if (this.mSelected)
this.mSelected.removeAttribute("selected");
this.value = this.mEditorDate;
if (this.onmonthchange) this.onmonthchange();
]]></body>
</method>
<method name="switchYear">
<parameter name="aYear"/>
<body><![CDATA[
this.mEditorDate.setFullYear(aYear);
this.showMonth(this.mEditorDate);
if (this.mSelected)
this.mSelected.removeAttribute("selected");
this.value = this.mEditorDate;
if (this.onmonthchange) this.onmonthchange();
]]></body>
</method>
</implementation>
<!-- ::::::::::::::::: HANDLERS ::::::::::::::::::::::::: -->
<handlers>
<handler event="bindingattached" action="this.initialize();"/>
<!-- handle click from nested months popup and years popup -->
<handler event="click"><![CDATA[
var element = event.originalTarget;
if (element.parentNode && element.parentNode.parentNode) {
var grandparent = element.parentNode.parentNode;
switch(grandparent) {
case this.kMonthPopup:
grandparent.hidePopup();
this.switchMonth(element.getAttribute("index"));
break;
case this.kYearPopup:
grandparent.hidePopup();
this.switchYear(element.getAttribute("value"));
break;
}
}
]]></handler>
</handlers>
</binding>
<binding id="minimonth-navbtn" inherits="dir">
<!-- ::::::::::::::::: HANDLERS ::::::::::::::::::::::::: -->
<handlers>
<handler event="click">
<![CDATA[
this.kMinimonth.advanceMonth(parseInt(this.getAttribute('dir')));
]]>
</handler>
</handlers>
</binding>
<binding id="minimonth-day" extends="xul:text">
<!-- ::::::::::::::::: HANDLERS ::::::::::::::::::::::::: -->
<handlers>
<handler event="click" action="if (event.button == 0) this.calendar.dayClicked(this)"/>
</handlers>
</binding>
</bindings>

View File

@ -1,44 +0,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):
*
* 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 ***** */
@import url("chrome://calendar/skin/datetimepickers/timepicker.css");
timepicker {
-moz-binding: url("chrome://calendar/content/datetimepickers/timepicker.xbl#timepicker");
}
timepicker-grids {
-moz-binding: url("chrome://calendar/content/datetimepickers/timepicker.xbl#timepicker-grids");
}

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@
<!-- CSS File with all styles specific to the dialog -->
<?xml-stylesheet href="chrome://calendar/skin/eventDialog.css" ?>
<?xml-stylesheet href="chrome://calendar/content/datetimepickers/datetimepicker.css" ?>
<?xml-stylesheet href="chrome://calendar/content/datetimepickers/datetimepickers.css" ?>
<!-- CSS for selecting contacts to invite to event -->
<?xml-stylesheet href="chrome://calendar/skin/selectAddresses.css" ?>

View File

@ -63,14 +63,10 @@ calendar.jar:
content/calendar/converters/xcs2ics.xsl (content/converters/xcs2ics.xsl)
content/calendar/converters/xcs2rdf.xsl (content/converters/xcs2rdf.xsl)
content/calendar/converters/xml2xcs.xsl (content/converters/xml2xcs.xsl)
content/calendar/datetimepickers/datepicker.css (content/datetimepickers/datepicker.css)
content/calendar/datetimepickers/datepicker.xbl (content/datetimepickers/datepicker.xbl)
content/calendar/datetimepickers/datetimepicker.css (content/datetimepickers/datetimepicker.css)
content/calendar/datetimepickers/datetimepicker.xbl (content/datetimepickers/datetimepicker.xbl)
content/calendar/datetimepickers/timepicker.css (content/datetimepickers/timepicker.css)
content/calendar/datetimepickers/timepicker.xbl (content/datetimepickers/timepicker.xbl)
content/calendar/datetimepickers/datetimepickers.css (content/datetimepickers/datetimepickers.css)
content/calendar/datetimepickers/datetimepickers.xml (content/datetimepickers/datetimepickers.xml)
content/calendar/datetimepickers/minimonth.css (content/datetimepickers/minimonth.css)
content/calendar/datetimepickers/minimonth.xbl (content/datetimepickers/minimonth.xbl)
content/calendar/datetimepickers/minimonth.xml (content/datetimepickers/minimonth.xml)
content/calendar/pref/pref.xul (content/pref/pref.xul)
content/calendar/pref/alarmPrefs.xul (content/pref/alarmPrefs.xul)
content/calendar/pref/calendarPref.xul (content/pref/calendarPref.xul)
@ -123,8 +119,7 @@ calendar.jar:
skin/classic/calendar/taskbar-calalarm.gif (skin/classic/taskbar-calalarm.gif)
skin/classic/calendar/taskbar-calalarm-act.gif (skin/classic/taskbar-calalarm-act.gif)
skin/classic/calendar/week-view-corner.png (skin/classic/week-view-corner.png)
skin/classic/calendar/datetimepickers/datepicker.css (skin/classic/datetimepickers/datepicker.css)
skin/classic/calendar/datetimepickers/timepicker.css (skin/classic/datetimepickers/timepicker.css)
skin/classic/calendar/datetimepickers/datetimepickers.css (skin/classic/datetimepickers/datetimepickers.css)
skin/classic/calendar/datetimepickers/minimonth.css (skin/classic/datetimepickers/minimonth.css)
skin/classic/calendar/datetimepickers/left-arrow-hover.gif (skin/classic/datetimepickers/left-arrow-hover.gif)
skin/classic/calendar/datetimepickers/left-arrow.gif (skin/classic/datetimepickers/left-arrow.gif)
@ -162,8 +157,7 @@ calendar.jar:
skin/modern/calendar/taskbar-calalarm.gif (skin/modern/taskbar-calalarm.gif)
skin/modern/calendar/taskbar-calalarm-act.gif (skin/modern/taskbar-calalarm-act.gif)
skin/modern/calendar/week-view-corner.png (skin/modern/week-view-corner.png)
skin/modern/calendar/datetimepickers/datepicker.css (skin/modern/datetimepickers/datepicker.css)
skin/modern/calendar/datetimepickers/timepicker.css (skin/modern/datetimepickers/timepicker.css)
skin/modern/calendar/datetimepickers/datetimepickers.css (skin/modern/datetimepickers/datetimepickers.css)
skin/modern/calendar/datetimepickers/minimonth.css (skin/modern/datetimepickers/minimonth.css)
skin/modern/calendar/datetimepickers/left-arrow-hover.gif (skin/modern/datetimepickers/left-arrow-hover.gif)
skin/modern/calendar/datetimepickers/left-arrow.gif (skin/modern/datetimepickers/left-arrow.gif)