summaryrefslogtreecommitdiff
path: root/js/dojo-1.6/dijit/form/TimeTextBox.js
diff options
context:
space:
mode:
authorTristan Zur <tzur@web.web.ccwn.org>2014-03-27 22:27:47 +0100
committerTristan Zur <tzur@web.web.ccwn.org>2014-03-27 22:27:47 +0100
commitb62676ca5d3d6f6ba3f019ea3f99722e165a98d8 (patch)
tree86722cb80f07d4569f90088eeaea2fc2f6e2ef94 /js/dojo-1.6/dijit/form/TimeTextBox.js
Initial commit of intern.ccwn.org contentsHEADmaster
Diffstat (limited to 'js/dojo-1.6/dijit/form/TimeTextBox.js')
-rw-r--r--js/dojo-1.6/dijit/form/TimeTextBox.js88
1 files changed, 88 insertions, 0 deletions
diff --git a/js/dojo-1.6/dijit/form/TimeTextBox.js b/js/dojo-1.6/dijit/form/TimeTextBox.js
new file mode 100644
index 0000000..68bf21e
--- /dev/null
+++ b/js/dojo-1.6/dijit/form/TimeTextBox.js
@@ -0,0 +1,88 @@
+/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dijit.form.TimeTextBox"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dijit.form.TimeTextBox"] = true;
+dojo.provide("dijit.form.TimeTextBox");
+dojo.require("dijit._TimePicker");
+dojo.require("dijit.form._DateTimeTextBox");
+
+
+
+/*=====
+dojo.declare(
+ "dijit.form.TimeTextBox.__Constraints",
+ [dijit.form._DateTimeTextBox.__Constraints, dijit._TimePicker.__Constraints]
+);
+=====*/
+
+dojo.declare(
+ "dijit.form.TimeTextBox",
+ dijit.form._DateTimeTextBox,
+ {
+ // summary:
+ // A validating, serializable, range-bound time text box with a drop down time picker
+
+ baseClass: "dijitTextBox dijitComboBox dijitTimeTextBox",
+ popupClass: "dijit._TimePicker",
+ _selector: "time",
+
+/*=====
+ // constraints: dijit.form.TimeTextBox.__Constraints
+ constraints:{},
+=====*/
+
+ // value: Date
+ // The value of this widget as a JavaScript Date object. Note that the date portion implies time zone and daylight savings rules.
+ //
+ // Example:
+ // | new dijit.form.TimeTextBox({value: dojo.date.stamp.fromISOString("T12:59:59", new Date())})
+ //
+ // When passed to the parser in markup, must be specified according to locale-independent
+ // `dojo.date.stamp.fromISOString` format.
+ //
+ // Example:
+ // | <input dojotype='dijit.form.TimeTextBox' value='T12:34:00'>
+ value: new Date(""), // value.toString()="NaN"
+ //FIXME: in markup, you have no control over daylight savings
+
+ _onKey: function(evt){
+ this.inherited(arguments);
+
+ // If the user has backspaced or typed some numbers, then filter the result list
+ // by what they typed. Maybe there's a better way to detect this, like _handleOnChange()?
+ switch(evt.keyCode){
+ case dojo.keys.ENTER:
+ case dojo.keys.TAB:
+ case dojo.keys.ESCAPE:
+ case dojo.keys.DOWN_ARROW:
+ case dojo.keys.UP_ARROW:
+ // these keys have special meaning
+ break;
+ default:
+ // setTimeout() because the keystroke hasn't yet appeared in the <input>,
+ // so the get('displayedValue') call below won't give the result we want.
+ setTimeout(dojo.hitch(this, function(){
+ // set this.filterString to the filter to apply to the drop down list;
+ // it will be used in openDropDown()
+ var val = this.get('displayedValue');
+ this.filterString = (val && !this.parse(val, this.constraints)) ? val.toLowerCase() : "";
+
+ // close the drop down and reopen it, in order to filter the items shown in the list
+ // and also since the drop down may need to be repositioned if the number of list items has changed
+ // and it's being displayed above the <input>
+ if(this._opened){
+ this.closeDropDown();
+ }
+ this.openDropDown();
+ }), 0);
+ }
+ }
+ }
+);
+
+}