mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-09 21:33:43 +00:00
[XForms] Support Date and Time types for Range. Bug 372736, p=msterlin r=surkov+aaronr
This commit is contained in:
parent
a7dee2db8c
commit
5445f3f9fb
@ -48,9 +48,12 @@
|
||||
binding declared in 'range.xml' file.
|
||||
-->
|
||||
|
||||
<!-- RANGE: <DATETIME>
|
||||
<!-- RANGE: <DATESANDTIMES>
|
||||
The datesandtimes binding is used for all range types related to
|
||||
dates and times: dateTime, date, time, gDay, gMonth, gMonthDay, gYear,
|
||||
gYearMonth, dayTimeDuration, and yearMonthDuration.
|
||||
-->
|
||||
<binding id="xformswidget-range-datetime"
|
||||
<binding id="xformswidget-range-datesandtimes"
|
||||
extends="chrome://xforms/content/range.xml#xformswidget-range-base">
|
||||
|
||||
<content>
|
||||
@ -72,13 +75,7 @@
|
||||
<method name="isInRange">
|
||||
<parameter name="aValue"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var control = this.control;
|
||||
var startDate = control.getDateTime(this.start);
|
||||
var endDate = control.getDateTime(this.end);
|
||||
var currentDate = control.getDateTime(aValue);
|
||||
return startDate <= currentDate && currentDate <= endDate;
|
||||
]]>
|
||||
return this.control.isInRange(aValue);
|
||||
</body>
|
||||
</method>
|
||||
|
||||
|
@ -920,7 +920,7 @@
|
||||
|
||||
<content>
|
||||
<xul:label value="" anonid="minLabel"/>
|
||||
<xul:box class="xf-value range-box">
|
||||
<xul:box class="range-box">
|
||||
<xul:label control="yearSpin" value="&xforms.date.year.label;"/>
|
||||
<xul:textbox type="number" size="3" anonid="yearSpin"
|
||||
xbl:inherits="tabindex=mozType:tabindex"/>
|
||||
@ -957,8 +957,8 @@
|
||||
<method name="updateLabels">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.minLabel.value = this.start + " >> ";
|
||||
this.maxLabel.value = " << " + this.end;
|
||||
this.minLabel.value = this.start + this._startSeparator;
|
||||
this.maxLabel.value = this._endSeparator + this.end;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
@ -1038,6 +1038,18 @@
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="isInRange">
|
||||
<parameter name="aValue"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var startDate = this.getDate(this.start);
|
||||
var endDate = this.getDate(this.end);
|
||||
var currentDate = this.getDate(aValue);
|
||||
return startDate <= currentDate && currentDate <= endDate;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Private -->
|
||||
<property name="minLabel" readonly="true">
|
||||
<getter>
|
||||
@ -1129,5 +1141,313 @@
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<!-- DATE RANGE-->
|
||||
<binding id="range-date"
|
||||
extends="chrome://xforms/content/widgets.xml#date">
|
||||
|
||||
<resources>
|
||||
<stylesheet src="chrome://xforms/skin/widgets-xul.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:label value="" anonid="minLabel"/>
|
||||
<xul:box class="range-box">
|
||||
<xul:label control="yearSpin" value="&xforms.date.year.label;"/>
|
||||
<xul:textbox type="number" size="3" anonid="yearSpin"
|
||||
xbl:inherits="tabindex=mozType:tabindex"/>
|
||||
</xul:box>
|
||||
<xul:box class="range-box">
|
||||
<xul:label control="monthSpin" value="&xforms.date.month.label;"/>
|
||||
<xul:textbox type="number" size="1" anonid="monthSpin"
|
||||
xbl:inherits="tabindex=mozType:tabindex"/>
|
||||
</xul:box>
|
||||
<xul:box class="range-box">
|
||||
<xul:label control="daySpin" value="&xforms.date.day.label;"/>
|
||||
<xul:textbox type="number" size="1" anonid="daySpin"
|
||||
xbl:inherits="tabindex=mozType:tabindex"/>
|
||||
</xul:box>
|
||||
<xul:label value="" anonid="maxLabel"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="updateLabels">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.minLabel.value = this.start + this._startSeparator;
|
||||
this.maxLabel.value = this._endSeparator + this.end;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="updateValue">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var year = this.yearSpin.value.toString();
|
||||
year = this.formatValue(year, 4);
|
||||
|
||||
var month = this.monthSpin.value.toString();
|
||||
month = this.formatValue(month, 2);
|
||||
|
||||
var day = this.daySpin.value.toString();
|
||||
day = this.formatValue(day, 2);
|
||||
|
||||
var value = year + "-" + month + "-" + day;
|
||||
this.setAttribute("value", value);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="updateFields">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var value = this.value;
|
||||
|
||||
this.yearSpin.value = this.getYear(value);
|
||||
this.monthSpin.value = this.getMonth(value);
|
||||
this.daySpin.value = this.getDay(value);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="setSpinbuttonMinMax">
|
||||
<body>
|
||||
<![CDATA[
|
||||
// Year
|
||||
this.yearSpin.min = this.getYearMin();
|
||||
this.yearSpin.max = this.getYearMax();
|
||||
// Month
|
||||
this.monthSpin.min = this.getMonthMin();
|
||||
this.monthSpin.max = this.getMonthMax();
|
||||
// Day
|
||||
this.daySpin.min = this.getDayMin();
|
||||
this.daySpin.max = this.getDayMax();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="isInRange">
|
||||
<parameter name="aValue"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var startDate = this.getDate(this.start);
|
||||
var endDate = this.getDate(this.end);
|
||||
var currentDate = this.getDate(aValue);
|
||||
return startDate <= currentDate && currentDate <= endDate;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Private -->
|
||||
<property name="minLabel" readonly="true">
|
||||
<getter>
|
||||
if (!this._minLabel) {
|
||||
this._minLabel = this.ownerDocument.
|
||||
getAnonymousElementByAttribute(this, "anonid", "minLabel");
|
||||
}
|
||||
return this._minLabel;
|
||||
</getter>
|
||||
</property>
|
||||
<field name="_minLabel">null</field>
|
||||
|
||||
<property name="yearSpin" readonly="true">
|
||||
<getter>
|
||||
if (!this._yearSpin) {
|
||||
this._yearSpin = this.ownerDocument.
|
||||
getAnonymousElementByAttribute(this, "anonid", "yearSpin");
|
||||
}
|
||||
return this._yearSpin;
|
||||
</getter>
|
||||
</property>
|
||||
<field name="_yearSpin">null</field>
|
||||
|
||||
<property name="monthSpin" readonly="true">
|
||||
<getter>
|
||||
if (!this._monthSpin) {
|
||||
this._monthSpin = this.ownerDocument.
|
||||
getAnonymousElementByAttribute(this, "anonid", "monthSpin");
|
||||
}
|
||||
return this._monthSpin;
|
||||
</getter>
|
||||
</property>
|
||||
<field name="_monthSpin">null</field>
|
||||
|
||||
<property name="daySpin" readonly="true">
|
||||
<getter>
|
||||
if (!this._daySpin) {
|
||||
this._daySpin = this.ownerDocument.
|
||||
getAnonymousElementByAttribute(this, "anonid", "daySpin");
|
||||
}
|
||||
return this._daySpin;
|
||||
</getter>
|
||||
</property>
|
||||
<field name="_daySpin">null</field>
|
||||
|
||||
<property name="maxLabel" readonly="true">
|
||||
<getter>
|
||||
if (!this._maxLabel) {
|
||||
this._maxLabel = this.ownerDocument.
|
||||
getAnonymousElementByAttribute(this, "anonid", "maxLabel");
|
||||
}
|
||||
return this._maxLabel;
|
||||
</getter>
|
||||
</property>
|
||||
<field name="_maxLabel">null</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<!-- TIME RANGE-->
|
||||
<binding id="range-time"
|
||||
extends="chrome://xforms/content/widgets.xml#time">
|
||||
|
||||
<resources>
|
||||
<stylesheet src="chrome://xforms/skin/widgets-xul.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:label value="" anonid="minLabel"/>
|
||||
<xul:box class="range-box">
|
||||
<xul:label control="hoursSpin" value="&xforms.datetime.hours.label;"/>
|
||||
<xul:textbox type="number" size="1" anonid="hoursSpin"
|
||||
xbl:inherits="tabindex=mozType:tabindex"/>
|
||||
</xul:box>
|
||||
<xul:box class="range-box">
|
||||
<xul:label control="minutesSpin" value="&xforms.datetime.minutes.label;"/>
|
||||
<xul:textbox type="number" size="1" anonid="minutesSpin"
|
||||
xbl:inherits="tabindex=mozType:tabindex"/>
|
||||
</xul:box>
|
||||
<xul:box class="range-box">
|
||||
<xul:label control="secondsSpin" value="&xforms.datetime.seconds.label;"/>
|
||||
<xul:textbox type="number" size="1" anonid="secondsSpin"
|
||||
xbl:inherits="tabindex=mozType:tabindex"/>
|
||||
</xul:box>
|
||||
<xul:label value="" anonid="maxLabel"/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<method name="updateLabels">
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.minLabel.value = this.start + this._startSeparator;
|
||||
this.maxLabel.value = this._endSeparator + this.end;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="updateValue">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var hours = this.hoursSpin.value.toString();
|
||||
hours = this.formatValue(hours, 2);
|
||||
|
||||
var minutes = this.minutesSpin.value.toString();
|
||||
minutes = this.formatValue(minutes, 2);
|
||||
|
||||
var seconds = this.secondsSpin.value.toString();
|
||||
seconds = this.formatValue(seconds, 2);
|
||||
|
||||
var value = hours + ":" + minutes + ":" + seconds;
|
||||
|
||||
this.setAttribute("value", value);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="updateFields">
|
||||
<body>
|
||||
<![CDATA[
|
||||
var value = this.value;
|
||||
|
||||
this.hoursSpin.value = this.getHours(value);
|
||||
this.minutesSpin.value = this.getMinutes(value);
|
||||
this.secondsSpin.value = this.getSeconds(value);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="setSpinbuttonMinMax">
|
||||
<body>
|
||||
<![CDATA[
|
||||
// Hours
|
||||
this.hoursSpin.min = this.getHoursMin();
|
||||
this.hoursSpin.max = this.getHoursMax();
|
||||
// Minutes
|
||||
this.minutesSpin.min = this.getMinutesMin();
|
||||
this.minutesSpin.max = this.getMinutesMax();
|
||||
// Seconds
|
||||
this.secondsSpin.min = this.getSecondsMin();
|
||||
this.secondsSpin.max = this.getSecondsMax();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="isInRange">
|
||||
<parameter name="aValue"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var startTime = this.getDate(this.start);
|
||||
var endTime = this.getDate(this.end);
|
||||
var currentTime = this.getDate(aValue);
|
||||
return startTime <= currentTime && currentTime <= endTime;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Private -->
|
||||
<property name="minLabel" readonly="true">
|
||||
<getter>
|
||||
if (!this._minLabel) {
|
||||
this._minLabel = this.ownerDocument.
|
||||
getAnonymousElementByAttribute(this, "anonid", "minLabel");
|
||||
}
|
||||
return this._minLabel;
|
||||
</getter>
|
||||
</property>
|
||||
<field name="_minLabel">null</field>
|
||||
|
||||
<property name="hoursSpin" readonly="true">
|
||||
<getter>
|
||||
if (!this._hoursSpin) {
|
||||
this._hoursSpin = this.ownerDocument.
|
||||
getAnonymousElementByAttribute(this, "anonid", "hoursSpin");
|
||||
}
|
||||
return this._hoursSpin;
|
||||
</getter>
|
||||
</property>
|
||||
<field name="_hoursSpin">null</field>
|
||||
|
||||
<property name="minutesSpin" readonly="true">
|
||||
<getter>
|
||||
if (!this._minutesSpin) {
|
||||
this._minutesSpin = this.ownerDocument.
|
||||
getAnonymousElementByAttribute(this, "anonid", "minutesSpin");
|
||||
}
|
||||
return this._minutesSpin;
|
||||
</getter>
|
||||
</property>
|
||||
<field name="_minutesSpin">null</field>
|
||||
|
||||
<property name="secondsSpin" readonly="true">
|
||||
<getter>
|
||||
if (!this._secondsSpin) {
|
||||
this._secondsSpin = this.ownerDocument.
|
||||
getAnonymousElementByAttribute(this, "anonid", "secondsSpin");
|
||||
}
|
||||
return this._secondsSpin;
|
||||
</getter>
|
||||
</property>
|
||||
<field name="_secondsSpin">null</field>
|
||||
|
||||
<property name="maxLabel" readonly="true">
|
||||
<getter>
|
||||
if (!this._maxLabel) {
|
||||
this._maxLabel = this.ownerDocument.
|
||||
getAnonymousElementByAttribute(this, "anonid", "maxLabel");
|
||||
}
|
||||
return this._maxLabel;
|
||||
</getter>
|
||||
</property>
|
||||
<field name="_maxLabel">null</field>
|
||||
</implementation>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
||||
|
@ -37,6 +37,10 @@
|
||||
-
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!DOCTYPE bindings [
|
||||
<!ENTITY % xformsDTD SYSTEM "chrome://xforms/locale/xforms.dtd">
|
||||
%xformsDTD;
|
||||
]>
|
||||
|
||||
<bindings id="widgetsBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
@ -515,10 +519,17 @@
|
||||
This method is called when a new value is set.
|
||||
setSpinButtonMinMax() - Set the min and max attributes of the
|
||||
spinbuttons.
|
||||
isInRange(aValue) - Is aValue between the start and end values?
|
||||
-->
|
||||
<binding id="range">
|
||||
<implementation>
|
||||
<!-- interface -->
|
||||
<!-- Start label separator -->
|
||||
<field name="_startSeparator">&xforms.range.start.separator;</field>
|
||||
|
||||
<!-- End label separator -->
|
||||
<field name="_endSeparator">&xforms.range.end.separator;</field>
|
||||
|
||||
<!-- interface -->
|
||||
<!-- Get/set lower bound of values. -->
|
||||
<property name="start"
|
||||
onget="return this.getAttribute('start');"
|
||||
@ -553,6 +564,7 @@
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
|
||||
<!-- Set start/end/step/value -->
|
||||
<method name="set">
|
||||
<parameter name="aStart"/>
|
||||
@ -632,6 +644,14 @@
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Is aValue between the start and end values? -->
|
||||
<method name="isInRange">
|
||||
<parameter name="aValue"/>
|
||||
<body>
|
||||
return true;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Increment value -->
|
||||
<method name="increment">
|
||||
<body>
|
||||
@ -707,11 +727,11 @@
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<!-- DATE -->
|
||||
<binding id="date" extends="#range">
|
||||
<!-- DATETIME -->
|
||||
<binding id="datetime" extends="#range">
|
||||
<implementation>
|
||||
<!-- interface -->
|
||||
<!-- date format: yyyy-mm-dd -->
|
||||
<!-- dateTime format: yyyy-mm-ddThh:mm:ss[.s+] -->
|
||||
|
||||
<!-- Extract the year from a date or dateTime -->
|
||||
<method name="getYear">
|
||||
@ -737,6 +757,30 @@
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Extract the hours from a dateTime -->
|
||||
<method name="getHours">
|
||||
<parameter name="aDateTime"/>
|
||||
<body>
|
||||
return parseFloat(aDateTime.substr(11,2));
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Extract the minutes from a dateTime -->
|
||||
<method name="getMinutes">
|
||||
<parameter name="aDateTime"/>
|
||||
<body>
|
||||
return parseFloat(aDateTime.substr(14,2));
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Extract the seconds from a dateTime -->
|
||||
<method name="getSeconds">
|
||||
<parameter name="aDateTime"/>
|
||||
<body>
|
||||
return parseFloat(aDateTime.substr(17,2));
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Get the minimum Year value. -->
|
||||
<method name="getYearMin">
|
||||
<body>
|
||||
@ -909,74 +953,6 @@
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Get the number of days in the month for a given year. -->
|
||||
<method name="getDaysCount">
|
||||
<parameter name="aMonth"/>
|
||||
<parameter name="aYear"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
switch (aMonth) {
|
||||
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
|
||||
return 31;
|
||||
|
||||
case 2:
|
||||
if (aYear % 4 == 0 && aYear % 100 != 0 || aYear % 400 == 0)
|
||||
return 29; // leap-year
|
||||
return 28;
|
||||
|
||||
case 4: case 6: case 9: case 11:
|
||||
return 30;
|
||||
}
|
||||
return 0;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Get a Javacript Date object initialized to the value of aDate.
|
||||
-->
|
||||
<method name="getDate">
|
||||
<parameter name="aDate"/>
|
||||
<body>
|
||||
var date = new Date();
|
||||
date.setFullYear(this.getYear(aDate));
|
||||
date.setMonth(this.getMonth(aDate));
|
||||
date.setDate(this.getDay(aDate));
|
||||
return date;
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<!-- DATETIME -->
|
||||
<binding id="datetime" extends="#date">
|
||||
<implementation>
|
||||
<!-- interface -->
|
||||
<!-- dateTime format: yyyy-mm-ddThh:mm:ss[.s+] -->
|
||||
|
||||
<!-- Extract the hours from a dateTime -->
|
||||
<method name="getHours">
|
||||
<parameter name="aDateTime"/>
|
||||
<body>
|
||||
return parseFloat(aDateTime.substr(11,2));
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Extract the minutes from a dateTime -->
|
||||
<method name="getMinutes">
|
||||
<parameter name="aDateTime"/>
|
||||
<body>
|
||||
return parseFloat(aDateTime.substr(14,2));
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Extract the seconds from a dateTime -->
|
||||
<method name="getSeconds">
|
||||
<parameter name="aDateTime"/>
|
||||
<body>
|
||||
return parseFloat(aDateTime.substr(17,2));
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Get the minimum Hours value. -->
|
||||
<method name="getHoursMin">
|
||||
<body>
|
||||
@ -1103,12 +1079,38 @@
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Get the number of days in the month for a given year. -->
|
||||
<method name="getDaysCount">
|
||||
<parameter name="aMonth"/>
|
||||
<parameter name="aYear"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
switch (aMonth) {
|
||||
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
|
||||
return 31;
|
||||
|
||||
case 2:
|
||||
if (aYear % 4 == 0 && aYear % 100 != 0 || aYear % 400 == 0)
|
||||
return 29; // leap-year
|
||||
return 28;
|
||||
|
||||
case 4: case 6: case 9: case 11:
|
||||
return 30;
|
||||
}
|
||||
return 0;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Get a Javacript Date object initialized to the value of aDateTime.
|
||||
-->
|
||||
<method name="getDateTime">
|
||||
<method name="getDate">
|
||||
<parameter name="aDateTime"/>
|
||||
<body>
|
||||
var date = this.getDate(aDateTime);
|
||||
var date = new Date();
|
||||
date.setFullYear(this.getYear(aDateTime));
|
||||
date.setMonth(this.getMonth(aDateTime));
|
||||
date.setDate(this.getDay(aDateTime));
|
||||
date.setHours(this.getHours(aDateTime));
|
||||
date.setMinutes(this.getMinutes(aDateTime));
|
||||
date.setSeconds(this.getSeconds(aDateTime));
|
||||
@ -1118,4 +1120,72 @@
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<!-- DATE -->
|
||||
<binding id="date" extends="#datetime">
|
||||
<implementation>
|
||||
<!-- interface -->
|
||||
<!-- date format: yyyy-mm-dd -->
|
||||
|
||||
<!-- Get a Javacript Date object initialized to the value of aDate.
|
||||
-->
|
||||
<method name="getDate">
|
||||
<parameter name="aDate"/>
|
||||
<body>
|
||||
var date = new Date();
|
||||
date.setFullYear(this.getYear(aDate));
|
||||
date.setMonth(this.getMonth(aDate));
|
||||
date.setDate(this.getDay(aDate));
|
||||
return date;
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<!-- TIME -->
|
||||
<binding id="time" extends="#datetime">
|
||||
<implementation>
|
||||
<!-- interface -->
|
||||
<!-- Time format: hh:mm:ss[.s+] -->
|
||||
|
||||
<!-- Extract the hours from a time -->
|
||||
<method name="getHours">
|
||||
<parameter name="aTime"/>
|
||||
<body>
|
||||
return parseFloat(aTime.substr(0,2));
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Extract the minutes from a time -->
|
||||
<method name="getMinutes">
|
||||
<parameter name="aTime"/>
|
||||
<body>
|
||||
return parseFloat(aTime.substr(3,2));
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Extract the seconds from a time -->
|
||||
<method name="getSeconds">
|
||||
<parameter name="aTime"/>
|
||||
<body>
|
||||
return parseFloat(aTime.substr(6,2));
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<!-- Get a Javacript Date object initialized to the value of aTime.
|
||||
A JS Date object also accepts a time and we can use a Date
|
||||
initialized with a Time to compare times.
|
||||
-->
|
||||
<method name="getDate">
|
||||
<parameter name="aTime"/>
|
||||
<body>
|
||||
var date = new Date();
|
||||
date.setHours(this.getHours(aTime));
|
||||
date.setMinutes(this.getMinutes(aTime));
|
||||
date.setSeconds(this.getSeconds(aTime));
|
||||
return date;
|
||||
</body>
|
||||
</method>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
@ -245,17 +245,34 @@ html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#double"] h
|
||||
-moz-binding: url('chrome://xforms/content/widgets-xhtml.xml#slider');
|
||||
}
|
||||
|
||||
/* range type="xsd:dateTime" */
|
||||
/* range widgets (Dates and Times) */
|
||||
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#dateTime"],
|
||||
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#dateTime"] {
|
||||
-moz-binding: url('chrome://xforms/content/range-xul.xml#xformswidget-range-datetime');
|
||||
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#dateTime"],
|
||||
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#date"],
|
||||
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#date"],
|
||||
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#time"],
|
||||
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#time"] {
|
||||
-moz-binding: url('chrome://xforms/content/range-xul.xml#xformswidget-range-datesandtimes');
|
||||
}
|
||||
|
||||
/* range type="xsd:dateTime" */
|
||||
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#dateTime"] > xul|box,
|
||||
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#dateTime"] > xul|box {
|
||||
-moz-binding: url('chrome://xforms/content/widgets-xul.xml#range-datetime');
|
||||
}
|
||||
|
||||
/* range type="xsd:date" */
|
||||
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#date"] > xul|box,
|
||||
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#date"] > xul|box {
|
||||
-moz-binding: url('chrome://xforms/content/widgets-xul.xml#range-date');
|
||||
}
|
||||
|
||||
/* range type="xsd:time" */
|
||||
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#time"] > xul|box,
|
||||
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#time"] > xul|box {
|
||||
-moz-binding: url('chrome://xforms/content/widgets-xul.xml#range-time');
|
||||
}
|
||||
|
||||
xul|box.xf-value {
|
||||
-moz-box-align: end;
|
||||
-moz-box-orient: horizontal;
|
||||
|
@ -74,3 +74,11 @@
|
||||
<!ENTITY xforms.datetime.hours.label "Hours">
|
||||
<!ENTITY xforms.datetime.minutes.label "Minutes">
|
||||
<!ENTITY xforms.datetime.seconds.label "Seconds">
|
||||
|
||||
<!-- " evaluates to a single quote
|
||||
(http://www.w3.org/TR/html401/sgml/entities.html)
|
||||
Since we are using these to initialize xbl fields, we need to quote them
|
||||
or we'll get an assortment of errors.
|
||||
-->
|
||||
<!ENTITY xforms.range.start.separator "<![CDATA[" >> "]]>">
|
||||
<!ENTITY xforms.range.end.separator "<![CDATA[" << "]]>">
|
||||
|
Loading…
Reference in New Issue
Block a user