WW-1644 DateTimerPicker problems when type="time". Inherit from Dojo's DropDownTimePicker, the name cannot be "TimePicker" or Dojo gets really confused

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@510352 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Musachy Barroso
2007-02-22 02:34:13 +00:00
parent b54ee12653
commit 2a60666d63
4 changed files with 38 additions and 2 deletions
@@ -0,0 +1,35 @@
//If we use "TimePicker" for the name, Dojo get's confused and breaks
//TODO remove this file on nect Dojo release
dojo.provide("struts.widget.StrutsTimePicker");
dojo.require("dojo.widget.DropdownTimePicker");
dojo.widget.defineWidget(
"struts.widget.StrutsTimePicker",
dojo.widget.DropdownTimePicker, {
widgetType : "TimePicker",
inputName: "",
name: "",
postCreate: function() {
struts.widget.StrutsTimePicker.superclass.postCreate.apply(this, arguments);
if(this.value.toLowerCase() == "today") {
this.value = dojo.date.toRfc3339(new Date());
}
this.inputNode.name = this.name;
this.valueNode.name = this.inputName;
},
onSetTime: function() {
struts.widget.StrutsTimePicker.superclass.onSetTime.apply(this, arguments);
if(this.timePicker.selectedTime.anyTime){
this.valueNode.value = "";
} else {
this.valueNode.value = dojo.date.toRfc3339(this.timePicker.time);
}
}
});
@@ -3,6 +3,6 @@ dojo.kwCompoundRequire({
"struts.widget.BindDiv",
"struts.widget.BindAnchor",
"struts.widget.ComboBox",
"struts.widget.DatePicker"]
"struts.widget.StrutsTimePicker"]
});
dojo.provide("struts.widget.*");
@@ -9,5 +9,6 @@ dojo.require("struts.widget.Bind");
dojo.require("struts.widget.BindDiv");
dojo.require("struts.widget.BindAnchor");
dojo.require("struts.widget.ComboBox");
dojo.require("struts.widget.StrutsTimePicker")
dojo.require("dojo.widget.Editor2");
dojo.hostenv.writeIncludes(); // not needed, but allows the Venkman debugger to work with the includes
@@ -5,7 +5,7 @@
<#if parameters.type?if_exists == "date">
dojoType="dropdowndatepicker"<#rt/>
<#else>
dojoType="dropdowntimepicker"<#rt/>
dojoType="struts:StrutsTimePicker"<#rt/>
</#if>
<#if parameters.id?if_exists != "">
id="${parameters.id?html}"<#rt/>