diff --git a/extensions/xforms/resources/content/input-xul.xml b/extensions/xforms/resources/content/input-xul.xml index 75f8a5048e5f..5005a5663c40 100644 --- a/extensions/xforms/resources/content/input-xul.xml +++ b/extensions/xforms/resources/content/input-xul.xml @@ -104,7 +104,7 @@ extends="#xformswidget-input-base"> - @@ -171,7 +171,78 @@ - + + + + + + + + + + + + + + + + var pickerChangeHandler = { + inputControl: this, + handleEvent: function(aEvent) { + this.inputControl.control.value = this.inputControl.picker.value; + this.inputControl.popup.hidePopup(); + } + }; + this.picker.addEventListener("change", pickerChangeHandler, false); + + + + + if (!this._dropmarker) + this._dropmarker = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "dropmarker"); + return this._dropmarker; + + + null + + + + if (!this._picker) + this._picker = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "picker"); + return this._picker; + + + null + + + + if (!this._popup) + this._popup = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "popup"); + return this._popup; + + + null + + + + + if (event.originalTarget == this.dropmarker) { + this.popup.showPopup(this.dropmarker, -1, -1, "popup", + "bottomleft", "topleft"); + } + + + + this.picker.value = this.control.value; + + + + + diff --git a/extensions/xforms/resources/content/widgets-xul.xml b/extensions/xforms/resources/content/widgets-xul.xml index 028a069bf883..203a32136014 100644 --- a/extensions/xforms/resources/content/widgets-xul.xml +++ b/extensions/xforms/resources/content/widgets-xul.xml @@ -207,19 +207,25 @@ - - - - - - - + + + + + + + - - - + + + + + + + @@ -247,55 +253,14 @@ this.refreshInternal(aCurrentDay, aDaysRefreshOnly); - this.monthsList.value = this.month; + this.monthsLabel.value = + new Date(this.year, this.month - 1).toLocaleFormat("%B"); - this.yearsList.value = this.year; - if (!this.yearsList.selectedItem) - this.yearsList.label = this.year; + this.yearsLabel.value = this.year; - - - - - - - - - if (!this._monthsList) { - this._monthsList = this.ownerDocument. - getAnonymousElementByAttribute(this, "anonid", "months-list"); - } - return this._monthsList; - - - null - - - - if (!this._yearsList) { - this._yearsList = this.ownerDocument. - getAnonymousElementByAttribute(this, "anonid", "years-list"); - } - return this._yearsList; - - - null @@ -318,24 +283,73 @@ null + + + + if (!this._prevyearButton) { + this._prevyearButton = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "prevyear-btn"); + } + return this._prevyearButton; + + + null + + + + if (!this._nextyearButton) { + this._nextyearButton = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "nextyear-btn"); + } + return this._nextyearButton; + + + null + + + + if (!this._monthsLabel) { + this._monthsLabel = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "months-label"); + } + return this._monthsLabel; + + + null + + + + if (!this._yearsLabel) { + this._yearsLabel = this.ownerDocument. + getAnonymousElementByAttribute(this, "anonid", "years-label"); + } + return this._yearsLabel; + + + null var target = event.originalTarget; - if (target == this.prevmonthButton) { - this.processAction("prevMonth", null, true); - } else if (target == this.nextmonthButton) { - this.processAction("nextMonth", null, true); - } else if (target.parentNode.parentNode == this.monthsList) { - this.month = this.monthsList.value; - } else if (target.parentNode.parentNode == this.yearsList) { - this.year = this.yearsList.value; + switch (target) { + case this.prevmonthButton: + this.processAction("prevMonth", null, true); + break; + case this.nextmonthButton: + this.processAction("nextMonth", null, true); + break; + case this.prevyearButton: + this.year--; + break; + case this.nextyearButton: + this.year++; + break; } - this.year = this.yearsList.value; + this.year = this.yearsLabel.value; diff --git a/extensions/xforms/resources/content/xforms.css b/extensions/xforms/resources/content/xforms.css index 0e7ed62c0f00..e0278811b9d3 100755 --- a/extensions/xforms/resources/content/xforms.css +++ b/extensions/xforms/resources/content/xforms.css @@ -224,6 +224,20 @@ html|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|inp background-repeat: no-repeat !important; } +xul|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] xul|toolbarbutton[anonid="dropmarker"] { + min-width:27px; + min-height: 1.3em; + list-style-image: url('chrome://xforms/content/calendar.png'); +} + +xul|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] { + -moz-binding: url('chrome://xforms/content/input-xul.xml#xformswidget-input-date'); +} + +xul|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] xul|box[mozType|calendar] { + -moz-binding: url('chrome://xforms/content/widgets-xul.xml#calendar-full'); +} + /* input type="xsd:date", appearance="full" */ html|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#date"][appearance="full"] { -moz-binding: url('chrome://xforms/content/input-xhtml.xml#xformswidget-input-date-full'); @@ -232,10 +246,6 @@ html|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#date"][appearan xul|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#date"][appearance="full"] { -moz-binding: url('chrome://xforms/content/input-xul.xml#xformswidget-input-date-full'); } -xul|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#date"][appearance="full"] - xul|box[mozType|calendar] { - -moz-binding: url('chrome://xforms/content/widgets-xul.xml#calendar-full'); -} /* input type="xsd:gMonth" */ html|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#gMonth"] { diff --git a/extensions/xforms/resources/locale/en-US/xforms.dtd b/extensions/xforms/resources/locale/en-US/xforms.dtd index 2fa1ce126192..96e5ea018e18 100644 --- a/extensions/xforms/resources/locale/en-US/xforms.dtd +++ b/extensions/xforms/resources/locale/en-US/xforms.dtd @@ -65,3 +65,5 @@ + + diff --git a/extensions/xforms/resources/skin/widgets-xul.css b/extensions/xforms/resources/skin/widgets-xul.css index 834403c662c7..f8893e4f5a9d 100644 --- a/extensions/xforms/resources/skin/widgets-xul.css +++ b/extensions/xforms/resources/skin/widgets-xul.css @@ -61,8 +61,18 @@ box[mozType|calendar] toolbarbutton:focus { /* calendar-full styles */ -menulist[anonid="months-list"] { - margin-right: 0px; +.list { + -moz-box-pack: center; + -moz-box-align: center; + + border: 2px solid; + -moz-border-top-colors: ThreeDShadow ThreeDDarkShadow; + -moz-border-right-colors: ThreeDHighlight ThreeDLightShadow; + -moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow; + -moz-border-left-colors: ThreeDShadow ThreeDDarkShadow; + background-color: -moz-Field; + color: -moz-FieldText; + margin: 2px 4px; } .toolbarbutton-dn {