зеркало из https://github.com/mozilla/pjs.git
Fix for bug 372737 - support gregorian calendar types for xforms range. patch=msterlin, r=me,aaronr
This commit is contained in:
Родитель
50d6572901
Коммит
0ddf77ad50
|
@ -936,17 +936,17 @@
|
||||||
xbl:inherits="tabindex=mozType:tabindex"/>
|
xbl:inherits="tabindex=mozType:tabindex"/>
|
||||||
</xul:box>
|
</xul:box>
|
||||||
<xul:box class="range-box">
|
<xul:box class="range-box">
|
||||||
<xul:label control="hoursSpin" value="&xforms.datetime.hours.label;"/>
|
<xul:label control="hoursSpin" value="&xforms.time.hours.label;"/>
|
||||||
<xul:textbox type="number" size="1" anonid="hoursSpin"
|
<xul:textbox type="number" size="1" anonid="hoursSpin"
|
||||||
xbl:inherits="tabindex=mozType:tabindex"/>
|
xbl:inherits="tabindex=mozType:tabindex"/>
|
||||||
</xul:box>
|
</xul:box>
|
||||||
<xul:box class="range-box">
|
<xul:box class="range-box">
|
||||||
<xul:label control="minutesSpin" value="&xforms.datetime.minutes.label;"/>
|
<xul:label control="minutesSpin" value="&xforms.time.minutes.label;"/>
|
||||||
<xul:textbox type="number" size="1" anonid="minutesSpin"
|
<xul:textbox type="number" size="1" anonid="minutesSpin"
|
||||||
xbl:inherits="tabindex=mozType:tabindex"/>
|
xbl:inherits="tabindex=mozType:tabindex"/>
|
||||||
</xul:box>
|
</xul:box>
|
||||||
<xul:box class="range-box">
|
<xul:box class="range-box">
|
||||||
<xul:label control="secondsSpin" value="&xforms.datetime.seconds.label;"/>
|
<xul:label control="secondsSpin" value="&xforms.time.seconds.label;"/>
|
||||||
<xul:textbox type="number" size="1" anonid="secondsSpin"
|
<xul:textbox type="number" size="1" anonid="secondsSpin"
|
||||||
xbl:inherits="tabindex=mozType:tabindex"/>
|
xbl:inherits="tabindex=mozType:tabindex"/>
|
||||||
</xul:box>
|
</xul:box>
|
||||||
|
@ -1306,17 +1306,17 @@
|
||||||
<content>
|
<content>
|
||||||
<xul:label value="" anonid="minLabel"/>
|
<xul:label value="" anonid="minLabel"/>
|
||||||
<xul:box class="range-box">
|
<xul:box class="range-box">
|
||||||
<xul:label control="hoursSpin" value="&xforms.datetime.hours.label;"/>
|
<xul:label control="hoursSpin" value="&xforms.time.hours.label;"/>
|
||||||
<xul:textbox type="number" size="1" anonid="hoursSpin"
|
<xul:textbox type="number" size="1" anonid="hoursSpin"
|
||||||
xbl:inherits="tabindex=mozType:tabindex"/>
|
xbl:inherits="tabindex=mozType:tabindex"/>
|
||||||
</xul:box>
|
</xul:box>
|
||||||
<xul:box class="range-box">
|
<xul:box class="range-box">
|
||||||
<xul:label control="minutesSpin" value="&xforms.datetime.minutes.label;"/>
|
<xul:label control="minutesSpin" value="&xforms.time.minutes.label;"/>
|
||||||
<xul:textbox type="number" size="1" anonid="minutesSpin"
|
<xul:textbox type="number" size="1" anonid="minutesSpin"
|
||||||
xbl:inherits="tabindex=mozType:tabindex"/>
|
xbl:inherits="tabindex=mozType:tabindex"/>
|
||||||
</xul:box>
|
</xul:box>
|
||||||
<xul:box class="range-box">
|
<xul:box class="range-box">
|
||||||
<xul:label control="secondsSpin" value="&xforms.datetime.seconds.label;"/>
|
<xul:label control="secondsSpin" value="&xforms.time.seconds.label;"/>
|
||||||
<xul:textbox type="number" size="1" anonid="secondsSpin"
|
<xul:textbox type="number" size="1" anonid="secondsSpin"
|
||||||
xbl:inherits="tabindex=mozType:tabindex"/>
|
xbl:inherits="tabindex=mozType:tabindex"/>
|
||||||
</xul:box>
|
</xul:box>
|
||||||
|
@ -1449,5 +1449,461 @@
|
||||||
<field name="_maxLabel">null</field>
|
<field name="_maxLabel">null</field>
|
||||||
</implementation>
|
</implementation>
|
||||||
</binding>
|
</binding>
|
||||||
|
|
||||||
|
<!-- NUMERIC SPIN RANGE-->
|
||||||
|
<binding id="range-numeric-spin"
|
||||||
|
extends="chrome://xforms/content/widgets.xml#range">
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<stylesheet src="chrome://xforms/skin/widgets-xul.css"/>
|
||||||
|
</resources>
|
||||||
|
|
||||||
|
<content>
|
||||||
|
<xul:label value="" anonid="minLabel"/>
|
||||||
|
<xul:box class="range-box">
|
||||||
|
<xul:label control="spinValue" value="" anonid="spinLabel"/>
|
||||||
|
<xul:textbox type="number" size="1" anonid="spinValue"
|
||||||
|
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="updateFields">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
this.spinValue.value = this.getNumericValue(this.value);
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<method name="setSpinbuttonMinMax">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
this.spinValue.min = this.getNumericValue(this.start);
|
||||||
|
this.spinValue.max = this.getNumericValue(this.end);
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<method name="isInRange">
|
||||||
|
<parameter name="aValue"/>
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
return this.start <= aValue && aValue <= this.end;
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<method name="getNumericValue">
|
||||||
|
<parameter name="aValue"/>
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
return parseFloat(aValue);
|
||||||
|
]]>
|
||||||
|
</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="spinLabel" readonly="true">
|
||||||
|
<getter>
|
||||||
|
if (!this._spinLabel) {
|
||||||
|
this._spinLabel = this.ownerDocument.
|
||||||
|
getAnonymousElementByAttribute(this, "anonid", "spinLabel");
|
||||||
|
}
|
||||||
|
return this._spinLabel;
|
||||||
|
</getter>
|
||||||
|
</property>
|
||||||
|
<field name="_spinLabel">null</field>
|
||||||
|
|
||||||
|
<property name="spinValue" readonly="true">
|
||||||
|
<getter>
|
||||||
|
if (!this._spinValue) {
|
||||||
|
this._spinValue = this.ownerDocument.
|
||||||
|
getAnonymousElementByAttribute(this, "anonid", "spinValue");
|
||||||
|
}
|
||||||
|
return this._spinValue;
|
||||||
|
</getter>
|
||||||
|
</property>
|
||||||
|
<field name="_spinValue">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>
|
||||||
|
|
||||||
|
<!-- GDAY RANGE-->
|
||||||
|
<binding id="range-gday"
|
||||||
|
extends="#range-numeric-spin">
|
||||||
|
|
||||||
|
<implementation>
|
||||||
|
<field name="_daySpinLabel">&xforms.date.day.label.field;</field>
|
||||||
|
|
||||||
|
<method name="updateValue">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
var value = this.spinValue.value.toString();
|
||||||
|
value = this.formatValue(value, 2);
|
||||||
|
|
||||||
|
this.setAttribute("value", value);
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- private -->
|
||||||
|
<constructor>
|
||||||
|
this.spinLabel.value = this._daySpinLabel;
|
||||||
|
</constructor>
|
||||||
|
</implementation>
|
||||||
|
</binding>
|
||||||
|
|
||||||
|
<!-- GMONTH RANGE-->
|
||||||
|
<binding id="range-gmonth"
|
||||||
|
extends="#range-numeric-spin">
|
||||||
|
|
||||||
|
<implementation>
|
||||||
|
<field name="_monthSpinLabel">&xforms.date.month.label.field;</field>
|
||||||
|
|
||||||
|
<method name="updateValue">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
var value = this.spinValue.value.toString();
|
||||||
|
value = this.formatValue(value, 2);
|
||||||
|
|
||||||
|
this.setAttribute("value", value);
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- private -->
|
||||||
|
<constructor>
|
||||||
|
this.spinLabel.value = this._monthSpinLabel;
|
||||||
|
</constructor>
|
||||||
|
</implementation>
|
||||||
|
</binding>
|
||||||
|
|
||||||
|
<!-- GYEAR RANGE-->
|
||||||
|
<binding id="range-gyear"
|
||||||
|
extends="#range-numeric-spin">
|
||||||
|
|
||||||
|
<implementation>
|
||||||
|
<field name="_yearSpinLabel">&xforms.date.year.label.field;</field>
|
||||||
|
|
||||||
|
<method name="updateValue">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
var value = this.spinValue.value.toString();
|
||||||
|
value = this.formatValue(value, 4);
|
||||||
|
|
||||||
|
this.setAttribute("value", value);
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- private -->
|
||||||
|
<constructor>
|
||||||
|
this.spinLabel.value = this._yearSpinLabel;
|
||||||
|
this.spinValue.size = 3;
|
||||||
|
</constructor>
|
||||||
|
</implementation>
|
||||||
|
</binding>
|
||||||
|
|
||||||
|
<!-- GMONTHDAY RANGE-->
|
||||||
|
<binding id="range-gmonthday"
|
||||||
|
extends="chrome://xforms/content/widgets.xml#gmonthday">
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<stylesheet src="chrome://xforms/skin/widgets-xul.css"/>
|
||||||
|
</resources>
|
||||||
|
|
||||||
|
<content>
|
||||||
|
<xul:label value="" anonid="minLabel"/>
|
||||||
|
<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[
|
||||||
|
// Month
|
||||||
|
var month = this.monthSpin.value.toString();
|
||||||
|
month = this.formatValue(month, 2);
|
||||||
|
// Day
|
||||||
|
var day = this.daySpin.value.toString();
|
||||||
|
day = this.formatValue(day, 2);
|
||||||
|
|
||||||
|
var value = month + "-" + day;
|
||||||
|
this.setAttribute("value", value);
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<method name="updateFields">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
var value = this.value;
|
||||||
|
|
||||||
|
this.monthSpin.value = this.getMonth(value);
|
||||||
|
this.daySpin.value = this.getDay(value);
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<method name="setSpinbuttonMinMax">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
// 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[
|
||||||
|
// Use JS Date objects to determine if the current gMonthDay
|
||||||
|
// falls between the start and end gMonthDay.
|
||||||
|
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="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>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- GYEARMONTH RANGE-->
|
||||||
|
<binding id="range-gyearmonth"
|
||||||
|
extends="chrome://xforms/content/widgets.xml#gyearmonth">
|
||||||
|
|
||||||
|
<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: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[
|
||||||
|
// Year
|
||||||
|
var year = this.yearSpin.value.toString();
|
||||||
|
year = this.formatValue(year, 4);
|
||||||
|
// Month
|
||||||
|
var month = this.monthSpin.value.toString();
|
||||||
|
month = this.formatValue(month, 2);
|
||||||
|
|
||||||
|
var value = year + "-" + month;
|
||||||
|
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);
|
||||||
|
]]>
|
||||||
|
</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();
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<method name="isInRange">
|
||||||
|
<parameter name="aValue"/>
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
// Use JS Date objects to determine if the current gYearMonth
|
||||||
|
// falls between the start and end gYearMonth.
|
||||||
|
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="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>
|
</bindings>
|
||||||
|
|
||||||
|
|
|
@ -524,10 +524,10 @@
|
||||||
<binding id="range">
|
<binding id="range">
|
||||||
<implementation>
|
<implementation>
|
||||||
<!-- Start label separator -->
|
<!-- Start label separator -->
|
||||||
<field name="_startSeparator">&xforms.range.start.separator;</field>
|
<field name="_startSeparator">&xforms.range.start.separator.field;</field>
|
||||||
|
|
||||||
<!-- End label separator -->
|
<!-- End label separator -->
|
||||||
<field name="_endSeparator">&xforms.range.end.separator;</field>
|
<field name="_endSeparator">&xforms.range.end.separator.field;</field>
|
||||||
|
|
||||||
<!-- interface -->
|
<!-- interface -->
|
||||||
<!-- Get/set lower bound of values. -->
|
<!-- Get/set lower bound of values. -->
|
||||||
|
@ -1188,4 +1188,245 @@
|
||||||
</implementation>
|
</implementation>
|
||||||
</binding>
|
</binding>
|
||||||
|
|
||||||
|
<!-- GREGORIAN
|
||||||
|
This widget is the base interface for ranges that support gregorian
|
||||||
|
calendar types: gDay, gMonth, gMonthDay, gYear, and gYearMonth.
|
||||||
|
-->
|
||||||
|
<binding id="gregorian" extends="#range">
|
||||||
|
<implementation>
|
||||||
|
<method name="getDaysCount">
|
||||||
|
<parameter name="aMonth"/>
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
switch (aMonth) {
|
||||||
|
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
|
||||||
|
return 31;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
return 28;
|
||||||
|
|
||||||
|
case 4: case 6: case 9: case 11:
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
</implementation>
|
||||||
|
</binding>
|
||||||
|
|
||||||
|
<!-- GMONTHDAY -->
|
||||||
|
<binding id="gmonthday" extends="#gregorian">
|
||||||
|
<implementation>
|
||||||
|
<!-- interface -->
|
||||||
|
<!-- gMonthDay format: mm-dd -->
|
||||||
|
|
||||||
|
<!-- Extract the month from a gMonthDay -->
|
||||||
|
<method name="getMonth">
|
||||||
|
<parameter name="aMonthDay"/>
|
||||||
|
<body>
|
||||||
|
return parseFloat(aMonthDay.substr(0,2));
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- Extract the day from a gMonthDay -->
|
||||||
|
<method name="getDay">
|
||||||
|
<parameter name="aMonthDay"/>
|
||||||
|
<body>
|
||||||
|
return parseFloat(aMonthDay.substr(3,2));
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- Get the minimum Month value. -->
|
||||||
|
<method name="getMonthMin">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
// The min value for the month spinbutton will always be
|
||||||
|
// the month of the start gMonthDay.
|
||||||
|
return this.getMonth(this.start);
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- Get the maximum Month value. -->
|
||||||
|
<method name="getMonthMax">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
// The max value for the month spinbutton will always be
|
||||||
|
// the month of the end gMonthDay.
|
||||||
|
return this.getMonth(this.end);
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- Get the minimum Day value. -->
|
||||||
|
<method name="getDayMin">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
var startMonth = this.getMonth(this.start);
|
||||||
|
var endMonth = this.getMonth(this.end);
|
||||||
|
var currentMonth = this.getMonth(this.value);
|
||||||
|
var minDay = 0;
|
||||||
|
|
||||||
|
if (startMonth == endMonth || currentMonth == startMonth) {
|
||||||
|
// Min day is the day of the start gMonthDay.
|
||||||
|
minDay = this.getDay(this.start);
|
||||||
|
} else {
|
||||||
|
// Current month falls between the start and end month.
|
||||||
|
// Min day is the first day of the month.
|
||||||
|
minDay = 1;
|
||||||
|
}
|
||||||
|
return minDay;
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- Get the maximum Day value. -->
|
||||||
|
<method name="getDayMax">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
var startMonth = this.getMonth(this.start);
|
||||||
|
var endMonth = this.getMonth(this.end);
|
||||||
|
var currentMonth = this.getMonth(this.value);
|
||||||
|
var maxDay = 0;
|
||||||
|
|
||||||
|
if (startMonth == endMonth || currentMonth == endMonth) {
|
||||||
|
// Max day is the day of the end gMonthDay.
|
||||||
|
maxDay = this.getDay(this.end);
|
||||||
|
} else {
|
||||||
|
// Current month falls between the start and end month.
|
||||||
|
// Max day is the number of days in the month.
|
||||||
|
maxDay = this.getDaysCount(currentMonth);
|
||||||
|
}
|
||||||
|
return maxDay;
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- Get a Javacript Date object initialized to the value of aMonthDay.
|
||||||
|
JS Date objects can be used to compare gMonthDays.
|
||||||
|
-->
|
||||||
|
<method name="getDate">
|
||||||
|
<parameter name="aMonthDay"/>
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
var date = new Date();
|
||||||
|
// A gMonthDay type does not have a year. Any year is acceptable.
|
||||||
|
date.setFullYear(2007);
|
||||||
|
date.setMonth(this.getMonth(aMonthDay));
|
||||||
|
date.setDate(this.getDay(aMonthDay));
|
||||||
|
return date;
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
</implementation>
|
||||||
|
</binding>
|
||||||
|
|
||||||
|
<!-- GYEARMONTH -->
|
||||||
|
<binding id="gyearmonth" extends="#gregorian">
|
||||||
|
<implementation>
|
||||||
|
<!-- interface -->
|
||||||
|
<!-- gYearMonth format: yyyy-mm -->
|
||||||
|
|
||||||
|
<!-- Extract the year from a gYearMonth -->
|
||||||
|
<method name="getYear">
|
||||||
|
<parameter name="aYearMonth"/>
|
||||||
|
<body>
|
||||||
|
return parseFloat(aYearMonth.substr(0,4));
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- Extract the month from a gYearMonth -->
|
||||||
|
<method name="getMonth">
|
||||||
|
<parameter name="aYearMonth"/>
|
||||||
|
<body>
|
||||||
|
return parseFloat(aYearMonth.substr(5,2));
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- Get the minimum Year value. -->
|
||||||
|
<method name="getYearMin">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
// The min value for the year spinbutton will always be
|
||||||
|
// the year of the start gYearMonth.
|
||||||
|
return this.getYear(this.start);
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- Get the maximum Year value. -->
|
||||||
|
<method name="getYearMax">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
// The max value for the year spinbutton will always be
|
||||||
|
// the year of the end gYearMonth.
|
||||||
|
return this.getYear(this.end);
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- Get the minimum Month value. -->
|
||||||
|
<method name="getMonthMin">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
var startYear = this.getYear(this.start);
|
||||||
|
var endYear = this.getYear(this.end);
|
||||||
|
var currentYear = this.getYear(this.value);
|
||||||
|
var minMonth = 0;
|
||||||
|
|
||||||
|
if (startYear == endYear || currentYear == endYear) {
|
||||||
|
// Min month is the month of the start gYearMonth.
|
||||||
|
minMonth = this.getMonth(this.start);
|
||||||
|
} else {
|
||||||
|
// Current year falls between the start and end year.
|
||||||
|
// Min month is the first month of the year.
|
||||||
|
minMonth = 1;
|
||||||
|
}
|
||||||
|
return minMonth;
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- Get the maximum Month value. -->
|
||||||
|
<method name="getMonthMax">
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
var startYear = this.getYear(this.start);
|
||||||
|
var endYear = this.getYear(this.end);
|
||||||
|
var currentYear = this.getYear(this.value);
|
||||||
|
var maxMonth = 0;
|
||||||
|
|
||||||
|
if (startYear == endYear || currentYear == endYear) {
|
||||||
|
// Max month is the month of the end gYearMonth.
|
||||||
|
maxMonth = this.getMonth(this.end);
|
||||||
|
} else {
|
||||||
|
// Current year falls between the start and end year.
|
||||||
|
// Max month is the last month of the year.
|
||||||
|
maxMonth = 12;
|
||||||
|
}
|
||||||
|
return maxMonth;
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<!-- Get a Javacript Date object initialized to the value of aYearMonth.
|
||||||
|
JS Date objects can be used to compare gYearMonths.
|
||||||
|
-->
|
||||||
|
<method name="getDate">
|
||||||
|
<parameter name="aYearMonth"/>
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
var date = new Date();
|
||||||
|
date.setFullYear(this.getYear(aYearMonth));
|
||||||
|
date.setMonth(this.getMonth(aYearMonth));
|
||||||
|
// A gYearMonth type does not have a day. Any day is acceptable.
|
||||||
|
date.setDate(1);
|
||||||
|
return date;
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
</implementation>
|
||||||
|
</binding>
|
||||||
|
|
||||||
</bindings>
|
</bindings>
|
||||||
|
|
|
@ -251,7 +251,17 @@ html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#dateTime"]
|
||||||
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#date"],
|
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#date"],
|
||||||
html|*: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"],
|
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#time"],
|
||||||
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#time"] {
|
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#time"],
|
||||||
|
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gDay"],
|
||||||
|
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gDay"],
|
||||||
|
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gMonth"],
|
||||||
|
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gMonth"],
|
||||||
|
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gMonthDay"],
|
||||||
|
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gMonthDay"],
|
||||||
|
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gYear"],
|
||||||
|
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gYear"],
|
||||||
|
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gYearMonth"],
|
||||||
|
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gYearMonth"] {
|
||||||
-moz-binding: url('chrome://xforms/content/range-xul.xml#xformswidget-range-datesandtimes');
|
-moz-binding: url('chrome://xforms/content/range-xul.xml#xformswidget-range-datesandtimes');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,6 +283,36 @@ html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#time"] > x
|
||||||
-moz-binding: url('chrome://xforms/content/widgets-xul.xml#range-time');
|
-moz-binding: url('chrome://xforms/content/widgets-xul.xml#range-time');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* range type="xsd:gDay" */
|
||||||
|
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gDay"] > xul|box,
|
||||||
|
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gDay"] > xul|box {
|
||||||
|
-moz-binding: url('chrome://xforms/content/widgets-xul.xml#range-gday');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* range type="xsd:gMonth" */
|
||||||
|
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gMonth"] > xul|box,
|
||||||
|
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gMonth"] > xul|box {
|
||||||
|
-moz-binding: url('chrome://xforms/content/widgets-xul.xml#range-gmonth');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* range type="xsd:gMonthDay" */
|
||||||
|
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gMonthDay"] > xul|box,
|
||||||
|
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gMonthDay"] > xul|box {
|
||||||
|
-moz-binding: url('chrome://xforms/content/widgets-xul.xml#range-gmonthday');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* range type="xsd:gYear" */
|
||||||
|
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gYear"] > xul|box,
|
||||||
|
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gYear"] > xul|box {
|
||||||
|
-moz-binding: url('chrome://xforms/content/widgets-xul.xml#range-gyear');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* range type="xsd:gYearMonth" */
|
||||||
|
xul|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gYearMonth"] > xul|box,
|
||||||
|
html|*:root range[mozType|typelist~="http://www.w3.org/2001/XMLSchema#gYearMonth"] > xul|box {
|
||||||
|
-moz-binding: url('chrome://xforms/content/widgets-xul.xml#range-gyearmonth');
|
||||||
|
}
|
||||||
|
|
||||||
xul|box.xf-value {
|
xul|box.xf-value {
|
||||||
-moz-box-align: end;
|
-moz-box-align: end;
|
||||||
-moz-box-orient: horizontal;
|
-moz-box-orient: horizontal;
|
||||||
|
|
|
@ -68,17 +68,21 @@
|
||||||
<!ENTITY xforms.datepicker.prevYear.title "Previous Year">
|
<!ENTITY xforms.datepicker.prevYear.title "Previous Year">
|
||||||
<!ENTITY xforms.datepicker.nextYear.title "Next Year">
|
<!ENTITY xforms.datepicker.nextYear.title "Next Year">
|
||||||
|
|
||||||
<!ENTITY xforms.date.year.label "Year">
|
<!ENTITY xforms.date.year.label "Year">
|
||||||
<!ENTITY xforms.date.month.label "Month">
|
<!ENTITY xforms.date.month.label "Month">
|
||||||
<!ENTITY xforms.date.day.label "Day">
|
<!ENTITY xforms.date.day.label "Day">
|
||||||
<!ENTITY xforms.datetime.hours.label "Hours">
|
|
||||||
<!ENTITY xforms.datetime.minutes.label "Minutes">
|
<!ENTITY xforms.time.hours.label "Hours">
|
||||||
<!ENTITY xforms.datetime.seconds.label "Seconds">
|
<!ENTITY xforms.time.minutes.label "Minutes">
|
||||||
|
<!ENTITY xforms.time.seconds.label "Seconds">
|
||||||
|
|
||||||
<!-- " evaluates to a single quote
|
<!-- " evaluates to a single quote
|
||||||
(http://www.w3.org/TR/html401/sgml/entities.html)
|
(http://www.w3.org/TR/html401/sgml/entities.html)
|
||||||
Since we are using these to initialize xbl fields, we need to quote them
|
Since we are using these to initialize xbl fields, we need to quote them
|
||||||
or we'll get an assortment of errors.
|
or we'll get an assortment of errors.
|
||||||
-->
|
-->
|
||||||
<!ENTITY xforms.range.start.separator "<![CDATA[" >> "]]>">
|
<!ENTITY xforms.date.year.label.field ""Year"">
|
||||||
<!ENTITY xforms.range.end.separator "<![CDATA[" << "]]>">
|
<!ENTITY xforms.date.month.label.field ""Month"">
|
||||||
|
<!ENTITY xforms.date.day.label.field ""Day"">
|
||||||
|
<!ENTITY xforms.range.start.separator.field "<![CDATA[" >> "]]>">
|
||||||
|
<!ENTITY xforms.range.end.separator.field "<![CDATA[" << "]]>">
|
||||||
|
|
Загрузка…
Ссылка в новой задаче