зеркало из https://github.com/mozilla/gecko-dev.git
b=260120, improvements to datepicker and timepicker, forgot to cvs add new files last commit
This commit is contained in:
Родитель
e4740df8be
Коммит
5695848c2e
|
@ -0,0 +1,60 @@
|
|||
/* ***** 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");
|
||||
|
||||
datepicker {
|
||||
-moz-binding: url("chrome://calendar/content/datetimepickers/datetimepickers.xml#datepicker");
|
||||
}
|
||||
|
||||
datetimepicker {
|
||||
-moz-binding: url("chrome://calendar/content/datetimepickers/datetimepickers.xml#datetimepicker");
|
||||
}
|
||||
|
||||
timepicker {
|
||||
-moz-binding: url("chrome://calendar/content/datetimepickers/datetimepickers.xml#timepicker");
|
||||
}
|
||||
|
||||
timepicker-grids {
|
||||
-moz-binding: url("chrome://calendar/content/datetimepickers/datetimepickers.xml#timepicker-grids");
|
||||
}
|
||||
|
||||
timepicker-minute {
|
||||
-moz-binding: url("chrome://calendar/content/datetimepickers/datetimepickers.xml#timepicker-minute");
|
||||
}
|
||||
|
||||
timepicker-hour {
|
||||
-moz-binding: url("chrome://calendar/content/datetimepickers/datetimepickers.xml#timepicker-hour");
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,545 @@
|
|||
<?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">
|
||||
<resources>
|
||||
<stylesheet src="chrome://calendar/skin/datetimepickers/minimonth.css"/>
|
||||
</resources>
|
||||
|
||||
<!-- ::::::::::::::::: 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="event.preventBubble();"
|
||||
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="event.preventBubble();"
|
||||
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)"/>
|
||||
|
||||
<constructor>
|
||||
<![CDATA[
|
||||
this.mInitialized = false;
|
||||
this.mSelected = false;
|
||||
this.mValue = null;
|
||||
this.kMonthNames = new Array(12);
|
||||
var tempDate = new Date();
|
||||
for (var month = 0; month < 12; month++) {
|
||||
tempDate.setMonth(month);
|
||||
this.kMonthNames[month] = tempDate.toLocaleFormat("%B");
|
||||
}
|
||||
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
|
||||
try {
|
||||
var pref = Components.classes[
|
||||
"@mozilla.org/preferences-service;1"
|
||||
].getService(Components.interfaces.nsIPrefBranch);
|
||||
// this.weekStart;
|
||||
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();
|
||||
|
||||
this.setHeader();
|
||||
this.showMonth(this.mValue);
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="setHeader">
|
||||
<body>
|
||||
<![CDATA[
|
||||
// Reset the headers
|
||||
var header = document.getAnonymousNodes(this)[0].
|
||||
childNodes[1].childNodes[0];
|
||||
var dayList = new Array(7);
|
||||
var tempDate = new Date();
|
||||
var i, j;
|
||||
tempDate.setDate(tempDate.getDate() - (tempDate.getDay() - this.weekStart));
|
||||
for (i = 0; i < header.childNodes.length; i++) {
|
||||
dayList[i] = tempDate.toLocaleFormat("%a")
|
||||
tempDate.setDate(tempDate.getDate() + 1);
|
||||
}
|
||||
|
||||
//abbreviations are too long, so shrink them down
|
||||
var foundMatch;
|
||||
for (i = 0; i < header.childNodes.length; i++) {
|
||||
foundMatch = 1;
|
||||
for (j = 0; j < header.childNodes.length; j++) {
|
||||
if (i != j) {
|
||||
if (dayList[i].substring(0,1) == dayList[j].substring(0,1)) {
|
||||
foundMatch = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
dayList[i] = dayList[i].substring(0,foundMatch)
|
||||
}
|
||||
|
||||
for (var column = 0; column < header.childNodes.length; column++) {
|
||||
header.childNodes[column].setAttribute( "value", dayList[column]);
|
||||
}
|
||||
]]>
|
||||
</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="fireEvent">
|
||||
<parameter name="aEventName"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var event = document.createEvent('Events');
|
||||
event.initEvent(aEventName, false, true);
|
||||
this.dispatchEvent(event);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="firePopupListHidden">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.mPopup = null;
|
||||
this.fireEvent("popuplisthidden");
|
||||
]]>
|
||||
</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;
|
||||
this.fireEvent("monthchange");
|
||||
]]>
|
||||
</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;
|
||||
this.fireEvent('select');
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="update">
|
||||
<parameter name="aValue"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.mValue = aValue;
|
||||
this.fireEvent('change');
|
||||
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;
|
||||
this.fireEvent("monthchange");
|
||||
]]>
|
||||
</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;
|
||||
this.fireEvent("monthchange");
|
||||
]]>
|
||||
</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>
|
|
@ -0,0 +1,226 @@
|
|||
/* ***** 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 ***** */
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Datepicker (text field with minimonth popup)
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
/* flex box around menulist */
|
||||
.datepicker-box-class {
|
||||
}
|
||||
|
||||
/* menulist */
|
||||
.datepicker-text-class {
|
||||
width: 11em;
|
||||
}
|
||||
|
||||
/* text input field */
|
||||
.datepicker-text-class input {
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
* Timepicker (text menulist with popup)
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
.timepicker-box-class {
|
||||
}
|
||||
|
||||
.timepicker-text-class {
|
||||
width: 8em;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
* popup (from timepicker/timepicker.css)
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
/* Box that occupies whole window */
|
||||
|
||||
vbox[anonid="time-picker-grids"] {
|
||||
background-color : #F8F8F8;
|
||||
font-size : 8pt;
|
||||
margin-bottom : 1px;
|
||||
margin-right : 1px;
|
||||
}
|
||||
|
||||
/* Grid for hours */
|
||||
|
||||
grid[anonid="time-picker-hour-grid"] {
|
||||
border-top : 1px solid #2060c7;
|
||||
border-left : 1px solid #2060c7;
|
||||
margin-top : 1px;
|
||||
}
|
||||
|
||||
/* Box in each cell of the grid for hours */
|
||||
|
||||
.time-picker-hour-box-class {
|
||||
-moz-box-align : center;
|
||||
border-right : 1px solid #2060c7;
|
||||
border-bottom : 1px solid #2060c7;
|
||||
}
|
||||
|
||||
.time-picker-hour-box-class:hover {
|
||||
color : #ff0000;
|
||||
cursor : pointer;
|
||||
}
|
||||
|
||||
/* selected hour box */
|
||||
|
||||
.time-picker-hour-box-class[selected="true"] {
|
||||
background-color : #6699CC;
|
||||
}
|
||||
|
||||
/* label inside each minute/hour */
|
||||
|
||||
.time-picker-minute-label:hover {
|
||||
color : #ff0000;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
.time-picker-hour-label:hover {
|
||||
color : #ff0000;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
|
||||
.time-picker-minute-box-class {
|
||||
-moz-box-align : center;
|
||||
border-right : 1px solid #2060c7;
|
||||
border-bottom : 1px solid #2060c7;
|
||||
}
|
||||
|
||||
.time-picker-minute-box-class:hover {
|
||||
color : #ff0000;
|
||||
cursor : pointer;
|
||||
}
|
||||
|
||||
/* box around five minute grid */
|
||||
|
||||
vbox[anonid="time-picker-five-minute-grid-box"] {
|
||||
min-width : 195px;
|
||||
margin-left : 1px;
|
||||
}
|
||||
|
||||
/* five minute grid */
|
||||
|
||||
grid[anonid="time-picker-five-minute-grid"] {
|
||||
margin-top : 2px;
|
||||
margin-right : 2px;
|
||||
border-top : 1px solid #003399;
|
||||
border-left : 1px solid #003399;
|
||||
border-right : 1px solid #003399;
|
||||
background-color : #e7eeec;
|
||||
}
|
||||
|
||||
|
||||
/* box in five-minute grid elements */
|
||||
|
||||
.time-picker-five-minute-class {
|
||||
-moz-box-align : center;
|
||||
}
|
||||
|
||||
.time-picker-five-minute-class:hover {
|
||||
color: #ff0000;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* selected five-minute grid element box */
|
||||
|
||||
.time-picker-five-minute-class[selected="true"] {
|
||||
background-color : #6699CC;
|
||||
}
|
||||
|
||||
/* box around one minute grid */
|
||||
|
||||
vbox[anonid="time-picker-one-minute-grid-box"] {
|
||||
min-width : 195px;
|
||||
margin-left : 1px;
|
||||
}
|
||||
|
||||
/* one minute grid */
|
||||
|
||||
grid[anonid="time-picker-one-minute-grid"] {
|
||||
margin-top : 2px;
|
||||
margin-right : 2px;
|
||||
border-top : 1px solid #003399;
|
||||
border-left : 1px solid #003399;
|
||||
border-right : 1px solid #003399;
|
||||
background-color : #e7eeec;
|
||||
}
|
||||
|
||||
/* box in one-minute grid elements */
|
||||
|
||||
.time-picker-one-minute-class {
|
||||
-moz-box-align : center;
|
||||
}
|
||||
|
||||
.time-picker-one-minute-class:hover {
|
||||
color: #ff0000;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* selected one-minute grid element box */
|
||||
|
||||
.time-picker-one-minute-class[selected="true"] {
|
||||
background-color : #6699CC;
|
||||
}
|
||||
|
||||
.time-picker-more-control-label {
|
||||
background-color : #6699CC;
|
||||
color : #ffffff;
|
||||
font-size : 12pt;
|
||||
height : 12px;
|
||||
min-width : 40px;
|
||||
margin : 0px;
|
||||
border : 1px solid #003399;
|
||||
text-align : center;
|
||||
}
|
||||
|
||||
.time-picker-more-control-label:hover {
|
||||
background-color : #477eb7;
|
||||
}
|
||||
|
||||
.time-picker-more-control-label:hover:active {
|
||||
background-color : #2063a8;
|
||||
}
|
||||
|
||||
/* line across the bottom of the minute boxes, made to line up with more & less tabs */
|
||||
|
||||
.time-picker-minutes-bottom {
|
||||
background-color : #e7eeec;
|
||||
border-bottom : 1px solid #003399;
|
||||
border-left : 1px solid #003399;
|
||||
border-right : 1px solid #003399;
|
||||
margin-right : 2px;
|
||||
}
|
|
@ -0,0 +1,214 @@
|
|||
/* ***** 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 ***** */
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
* Datepicker (text field with minimonth popup)
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
/* flex box around menulist */
|
||||
.datepicker-box-class {
|
||||
}
|
||||
|
||||
/* menulist */
|
||||
.datepicker-text-class {
|
||||
width:11em;
|
||||
}
|
||||
|
||||
/* text input field */
|
||||
.datepicker-text-class input {
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
* Timepicker (text menulist with popup)
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
.timepicker-box-class {
|
||||
}
|
||||
|
||||
.timepicker-text-class {
|
||||
width: 8em;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------
|
||||
* popup (from timepicker/timepicker.css)
|
||||
*-------------------------------------------------------------------*/
|
||||
|
||||
/* Box that occupies whole window */
|
||||
|
||||
vbox[anonid="timepicker-grids"] {
|
||||
background-color : #F8F8F8;
|
||||
font-size : 8pt;
|
||||
margin-bottom : 1px;
|
||||
margin-right : 1px;
|
||||
}
|
||||
|
||||
/* Grid for hours */
|
||||
|
||||
grid[anonid="time-picker-hour-grid"] {
|
||||
border-top : 1px solid #2060c7;
|
||||
border-left : 1px solid #2060c7;
|
||||
margin-top : 1px;
|
||||
}
|
||||
|
||||
/* Box in each cell of the grid for hours */
|
||||
|
||||
.time-picker-hour-box-class {
|
||||
-moz-box-align : center;
|
||||
border-right : 1px solid #2060c7;
|
||||
border-bottom : 1px solid #2060c7;
|
||||
}
|
||||
|
||||
.time-picker-hour-box-class:hover {
|
||||
color: #ff0000;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* label inside each minute/hour */
|
||||
|
||||
.time-picker-minute-label:hover {
|
||||
color: #ff0000;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
.time-picker-hour-label:hover {
|
||||
color: #ff0000;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
|
||||
/* selected hour box */
|
||||
|
||||
.time-picker-hour-box-class[selected="true"] {
|
||||
background-color : #6699CC;
|
||||
}
|
||||
|
||||
/* box around five minute grid */
|
||||
|
||||
vbox[anonid="time-picker-five-minute-grid-box"] {
|
||||
min-width : 195px;
|
||||
margin-left : 1px;
|
||||
}
|
||||
|
||||
/* five minute grid */
|
||||
|
||||
grid[anonid="time-picker-five-minute-grid"] {
|
||||
margin-top : 2px;
|
||||
margin-right : 2px;
|
||||
border-top : 1px solid #003399;
|
||||
border-left : 1px solid #003399;
|
||||
border-right : 1px solid #003399;
|
||||
background-color : #e7eeec;
|
||||
}
|
||||
|
||||
|
||||
/* box in five-minute grid elements */
|
||||
|
||||
.time-picker-five-minute-class {
|
||||
-moz-box-align : center;
|
||||
}
|
||||
|
||||
.time-picker-five-minute-class:hover {
|
||||
color: #ff0000;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* selected five-minute grid element box */
|
||||
|
||||
.time-picker-five-minute-class[selected="true"] {
|
||||
background-color : #6699CC;
|
||||
}
|
||||
|
||||
/* box around one minute grid */
|
||||
|
||||
vbox[anonid="time-picker-one-minute-grid-box"] {
|
||||
min-width : 195px;
|
||||
margin-left : 1px;
|
||||
}
|
||||
|
||||
/* one minute grid */
|
||||
|
||||
grid[anonid="time-picker-one-minute-grid"] {
|
||||
margin-top : 2px;
|
||||
margin-right : 2px;
|
||||
border-top : 1px solid #003399;
|
||||
border-left : 1px solid #003399;
|
||||
border-right : 1px solid #003399;
|
||||
background-color : #e7eeec;
|
||||
}
|
||||
|
||||
/* box in one-minute grid elements */
|
||||
|
||||
.time-picker-one-minute-class {
|
||||
-moz-box-align : center;
|
||||
}
|
||||
|
||||
.time-picker-one-minute-class:hover {
|
||||
color: #ff0000;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* selected one-minute grid element box */
|
||||
|
||||
.time-picker-one-minute-class[selected="true"] {
|
||||
background-color : #6699CC;
|
||||
}
|
||||
|
||||
.time-picker-more-control-label {
|
||||
background-color : #6699CC;
|
||||
color : #ffffff;
|
||||
font-size : 12pt;
|
||||
height : 12px;
|
||||
min-width : 40px;
|
||||
margin : 0px;
|
||||
border : 1px solid #003399;
|
||||
text-align : center;
|
||||
}
|
||||
|
||||
.time-picker-more-control-label:hover {
|
||||
background-color : #477eb7;
|
||||
}
|
||||
|
||||
.time-picker-more-control-label:hover:active {
|
||||
background-color : #2063a8;
|
||||
}
|
||||
|
||||
/* line across the bottom of the minute boxes, made to line up with more & less tabs */
|
||||
|
||||
.time-picker-minutes-bottom {
|
||||
background-color : #e7eeec;
|
||||
border-bottom : 1px solid #003399;
|
||||
border-left : 1px solid #003399;
|
||||
border-right : 1px solid #003399;
|
||||
margin-right : 2px;
|
||||
}
|
Загрузка…
Ссылка в новой задаче