From 5445f3f9fbfdd6f2c25088db3bae83cd901f0146 Mon Sep 17 00:00:00 2001 From: "aaronr%us.ibm.com" Date: Thu, 15 Mar 2007 21:41:37 +0000 Subject: [PATCH] [XForms] Support Date and Time types for Range. Bug 372736, p=msterlin r=surkov+aaronr --- .../xforms/resources/content/range-xul.xml | 15 +- .../xforms/resources/content/widgets-xul.xml | 326 +++++++++++++++++- .../xforms/resources/content/widgets.xml | 218 ++++++++---- .../xforms/resources/content/xforms.css | 23 +- .../xforms/resources/locale/en-US/xforms.dtd | 8 + 5 files changed, 501 insertions(+), 89 deletions(-) diff --git a/extensions/xforms/resources/content/range-xul.xml b/extensions/xforms/resources/content/range-xul.xml index 8bbecb14b66d..27159d52af55 100644 --- a/extensions/xforms/resources/content/range-xul.xml +++ b/extensions/xforms/resources/content/range-xul.xml @@ -48,9 +48,12 @@ binding declared in 'range.xml' file. --> - - @@ -72,13 +75,7 @@ - + return this.control.isInRange(aValue); diff --git a/extensions/xforms/resources/content/widgets-xul.xml b/extensions/xforms/resources/content/widgets-xul.xml index ac051ef2d974..a3ab0f476cde 100644 --- a/extensions/xforms/resources/content/widgets-xul.xml +++ b/extensions/xforms/resources/content/widgets-xul.xml @@ -920,7 +920,7 @@ - + @@ -957,8 +957,8 @@ > "; - this.maxLabel.value = " << " + this.end; + this.minLabel.value = this.start + this._startSeparator; + this.maxLabel.value = this._endSeparator + this.end; ]]> @@ -1038,6 +1038,18 @@ + + + + + + + @@ -1129,5 +1141,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + if (!this._minLabel) { + this._minLabel = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "minLabel"); + } + return this._minLabel; + + + null + + + + if (!this._yearSpin) { + this._yearSpin = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "yearSpin"); + } + return this._yearSpin; + + + null + + + + if (!this._monthSpin) { + this._monthSpin = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "monthSpin"); + } + return this._monthSpin; + + + null + + + + if (!this._daySpin) { + this._daySpin = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "daySpin"); + } + return this._daySpin; + + + null + + + + if (!this._maxLabel) { + this._maxLabel = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "maxLabel"); + } + return this._maxLabel; + + + null + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + if (!this._minLabel) { + this._minLabel = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "minLabel"); + } + return this._minLabel; + + + null + + + + if (!this._hoursSpin) { + this._hoursSpin = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "hoursSpin"); + } + return this._hoursSpin; + + + null + + + + if (!this._minutesSpin) { + this._minutesSpin = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "minutesSpin"); + } + return this._minutesSpin; + + + null + + + + if (!this._secondsSpin) { + this._secondsSpin = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "secondsSpin"); + } + return this._secondsSpin; + + + null + + + + if (!this._maxLabel) { + this._maxLabel = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "maxLabel"); + } + return this._maxLabel; + + + null + + diff --git a/extensions/xforms/resources/content/widgets.xml b/extensions/xforms/resources/content/widgets.xml index 35a755afe0ad..22d1629e5f1b 100644 --- a/extensions/xforms/resources/content/widgets.xml +++ b/extensions/xforms/resources/content/widgets.xml @@ -37,6 +37,10 @@ - - ***** END LICENSE BLOCK ***** --> + + %xformsDTD; +]> - + + &xforms.range.start.separator; + + + &xforms.range.end.separator; + + + @@ -632,6 +644,14 @@ + + + + + return true; + + + @@ -707,11 +727,11 @@ - - + + - + @@ -737,6 +757,30 @@ + + + + + return parseFloat(aDateTime.substr(11,2)); + + + + + + + + return parseFloat(aDateTime.substr(14,2)); + + + + + + + + return parseFloat(aDateTime.substr(17,2)); + + + @@ -909,74 +953,6 @@ - - - - - - - - - - - - - - var date = new Date(); - date.setFullYear(this.getYear(aDate)); - date.setMonth(this.getMonth(aDate)); - date.setDate(this.getDay(aDate)); - return date; - - - - - - - - - - - - - - - - return parseFloat(aDateTime.substr(11,2)); - - - - - - - - return parseFloat(aDateTime.substr(14,2)); - - - - - - - - return parseFloat(aDateTime.substr(17,2)); - - - @@ -1103,12 +1079,38 @@ + + + + + + + + + - + - 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 @@ + + + + + + + + + + + var date = new Date(); + date.setFullYear(this.getYear(aDate)); + date.setMonth(this.getMonth(aDate)); + date.setDate(this.getDay(aDate)); + return date; + + + + + + + + + + + + + + + + return parseFloat(aTime.substr(0,2)); + + + + + + + + return parseFloat(aTime.substr(3,2)); + + + + + + + + return parseFloat(aTime.substr(6,2)); + + + + + + + + var date = new Date(); + date.setHours(this.getHours(aTime)); + date.setMinutes(this.getMinutes(aTime)); + date.setSeconds(this.getSeconds(aTime)); + return date; + + + + + diff --git a/extensions/xforms/resources/content/xforms.css b/extensions/xforms/resources/content/xforms.css index cc10089b1808..940e9d5f171d 100755 --- a/extensions/xforms/resources/content/xforms.css +++ b/extensions/xforms/resources/content/xforms.css @@ -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; diff --git a/extensions/xforms/resources/locale/en-US/xforms.dtd b/extensions/xforms/resources/locale/en-US/xforms.dtd index 110dec54f6d4..76c510716361 100644 --- a/extensions/xforms/resources/locale/en-US/xforms.dtd +++ b/extensions/xforms/resources/locale/en-US/xforms.dtd @@ -74,3 +74,11 @@ + + +> "]]>"> +">