Mercurial > lada > lada-client
annotate app/view/widget/base/DateTimePicker.js @ 658:bf15bfea2fca
ComboBoxes sind nun per default nicht mehr editierbar. Das Betriftt auch die Filter-ComboBoxes
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Thu, 19 Mar 2015 10:43:02 +0100 |
parents | 195a253e9842 |
children | c34e65346572 |
rev | line source |
---|---|
649
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 Ext.define('Lada.view.widget.base.DateTimePicker', { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 extend: 'Ext.picker.Date', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 alias: 'widget.datetimepicker', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 requires: [ |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 'Ext.picker.Date', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 'Ext.form.field.Number' |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 ], |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 todayText: 'Jetzt', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 renderTpl: [ |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 '<div id="{id}-innerEl" role="grid">', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 '<div role="presentation" class="{baseCls}-header">', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 // the href attribute is required for the :hover selector to work in IE6/7/quirks |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 '<a id="{id}-prevEl" class="{baseCls}-prev {baseCls}-arrow" href="#" role="button" title="{prevText}" hidefocus="on" ></a>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 '<div class="{baseCls}-month" id="{id}-middleBtnEl">{%this.renderMonthBtn(values, out)%}</div>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 // the href attribute is required for the :hover selector to work in IE6/7/quirks |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 '<a id="{id}-nextEl" class="{baseCls}-next {baseCls}-arrow" href="#" role="button" title="{nextText}" hidefocus="on" ></a>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 '</div>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 '<table id="{id}-eventEl" class="{baseCls}-inner" cellspacing="0" role="grid">', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 '<thead role="presentation"><tr role="row">', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 '<tpl for="dayNames">', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 '<th role="columnheader" class="{parent.baseCls}-column-header" title="{.}">', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 '<div class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 '</th>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 '</tpl>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 '</tr></thead>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 '<tbody role="presentation"><tr role="row">', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 '<tpl for="days">', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 '{#:this.isEndOfWeek}', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 '<td role="gridcell" id="{[Ext.id()]}">', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 // the href attribute is required for the :hover selector to work in IE6/7/quirks |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 '<a role="presentation" hidefocus="on" class="{parent.baseCls}-date" href="#"></a>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 '</td>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 '</tpl>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 '</tr></tbody>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 '</table>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 '<div id="{id}-timeEl" role="presentation" class="{baseCls}-footer">', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 '<table cellspacing="0">', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 '<colgroup><col width="70"><col width="40"><col width="40"></colgroup>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 '<tr>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 '<td>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 '<div id="{id}-timeLabelEl" role="presentation">{%this.renderTimeLabel(values, out)%}</div>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 '</td><td>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 '<div id="{id}-timeHourEl" role="presentation">{%this.renderTimeHour(values, out)%}</div>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 '</td><td>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 '<div id="{id}-timeMinuteEl" role="presentation">{%this.renderTimeMinute(values, out)%}</div>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 '</td>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 '</tr>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 '</table>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 '<table cellspacing="0">', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 '<colgroup width="75"></colgroup>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 '<tr>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 '<td>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 '<div id="{id}-footerNowEl" role="presentation">{%this.renderTodayBtn(values, out)%}</div>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 '</td><td>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 '<div id="{id}-footerAcceptEl" role="presentation">{%this.renderAcceptBtn(values, out)%}</div>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 '</td>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 '</tr>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 '</table>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 '</div>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 '</div>', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 firstInitial: function(value) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 return Ext.picker.Date.prototype.getDayInitial(value); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 isEndOfWeek: function(value) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 // convert from 1 based index to 0 based |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 // by decrementing value once. |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 value--; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 var end = value % 7 === 0 && value !== 0; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 return end ? '</tr><tr role="row">' : ''; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 renderTodayBtn: function(values, out) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 renderMonthBtn: function(values, out) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 renderTimeLabel: function(values, out) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 Ext.DomHelper.generateMarkup(values.$comp.timeLabel.getRenderTree(), out); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 renderTimeHour: function(values, out) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 Ext.DomHelper.generateMarkup(values.$comp.hourField.getRenderTree(), out); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 renderTimeMinute: function(values, out) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 Ext.DomHelper.generateMarkup(values.$comp.minuteField.getRenderTree(), out); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 renderAcceptBtn: function(values, out) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 Ext.DomHelper.generateMarkup(values.$comp.acceptBtn.getRenderTree(), out); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 ], |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 beforeRender: function () { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 var me = this; |
651
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
97 me.hourField = new Ext.form.field.Spinner({ |
649
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 ownerCt: me, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 ownerLayout: me.getComponentLayout(), |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 value: 0, |
655
195a253e9842
Fixed bug in datetimepicker: Allways insert leading zero; do not allow values
Raimund Renkert <raimund.renkert@intevation.de>
parents:
651
diff
changeset
|
101 maxValue: 23, |
651
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
102 onSpinUp: function() { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
103 var value = parseInt(this.getValue()); |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
104 if (value === 23) { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
105 return; |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
106 } |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
107 var newValue = value + 1; |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
108 if (newValue < 10) { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
109 this.setValue('0' + newValue); |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
110 } |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
111 else { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
112 this.setValue(newValue); |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
113 } |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
114 }, |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
115 onSpinDown: function() { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
116 var value = parseInt(this.getValue()); |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
117 if (value === 0) { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
118 return; |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
119 } |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
120 var newValue = value - 1; |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
121 if (newValue < 10) { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
122 this.setValue('0' + newValue); |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
123 } |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
124 else { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
125 this.setValue(newValue); |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
126 } |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
127 }, |
649
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 listeners: { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 change: me.changeTimeValue, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 scope: me |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
131 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
132 }); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
133 |
651
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
134 me.minuteField = new Ext.form.field.Spinner({ |
649
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 ownerCt: me, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
136 ownerLayout: me.getComponentLayout(), |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 value: 0, |
655
195a253e9842
Fixed bug in datetimepicker: Allways insert leading zero; do not allow values
Raimund Renkert <raimund.renkert@intevation.de>
parents:
651
diff
changeset
|
138 maxValue: 59, |
651
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
139 onSpinUp: function() { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
140 var value = parseInt(this.getValue()); |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
141 if (value === 59) { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
142 return; |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
143 } |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
144 var newValue = value + 1; |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
145 if (newValue < 10) { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
146 this.setValue('0' + newValue); |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
147 } |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
148 else { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
149 this.setValue(newValue); |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
150 } |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
151 }, |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
152 onSpinDown: function() { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
153 var value = parseInt(this.getValue()); |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
154 if (value === 0) { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
155 return; |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
156 } |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
157 var newValue = value - 1; |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
158 if (newValue < 10) { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
159 this.setValue('0' + newValue); |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
160 } |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
161 else { |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
162 this.setValue(newValue); |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
163 } |
f4fef1d3a2ce
Changed numberfield to spinner in datepicker to allow leading zeros.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
649
diff
changeset
|
164 }, |
649
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 listeners: { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 change: me.changeTimeValue, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
167 scope: me |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 }); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
170 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 me.timeLabel = new Ext.form.Label({ |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 ownerCt: me, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 ownerLayout: me.getComponentLayout(), |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
174 text: 'Zeit' |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 }); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 me.acceptBtn = new Ext.button.Button({ |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 ownerCt: me, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
178 ownerLayout: me.getComponentLayout(), |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 text: 'Ãœbernehmen', |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 handler: me.acceptDate, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 scope: me |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 }); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 me.callParent(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
186 finishRenderChildren: function() { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
187 var me = this; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
188 me.callParent(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
189 me.timeLabel.finishRender(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 me.hourField.finishRender(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 me.minuteField.finishRender(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
192 me.acceptBtn.finishRender(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
193 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
194 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
195 showTimePicker: function() { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
196 var me = this; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
197 var el = me.el; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
198 Ext.defer(function() { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
199 var xPos = el.getX(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
200 var yPos = el.getY() + el.getHeight(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
201 me.timePicker.setHeight(30); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
202 me.timePicker.setWidth(el.getWidth()); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
203 me.timePicker.setPosition(xPos, yPos); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
204 me.timePicker.show(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
205 },1); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
206 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
207 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
208 beforeDestroy: function() { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
209 var me = this; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
210 if (me.rendered) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
211 Ext.destroy( |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
212 me.minuteField, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
213 me.hourField |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
214 ); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
215 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
216 me.callParent(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
217 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
218 |
655
195a253e9842
Fixed bug in datetimepicker: Allways insert leading zero; do not allow values
Raimund Renkert <raimund.renkert@intevation.de>
parents:
651
diff
changeset
|
219 changeTimeValue: function (field, nValue) { |
195a253e9842
Fixed bug in datetimepicker: Allways insert leading zero; do not allow values
Raimund Renkert <raimund.renkert@intevation.de>
parents:
651
diff
changeset
|
220 var value = parseInt(nValue); |
195a253e9842
Fixed bug in datetimepicker: Allways insert leading zero; do not allow values
Raimund Renkert <raimund.renkert@intevation.de>
parents:
651
diff
changeset
|
221 if (value > field.maxValue) { |
195a253e9842
Fixed bug in datetimepicker: Allways insert leading zero; do not allow values
Raimund Renkert <raimund.renkert@intevation.de>
parents:
651
diff
changeset
|
222 field.setValue(field.maxValue); |
195a253e9842
Fixed bug in datetimepicker: Allways insert leading zero; do not allow values
Raimund Renkert <raimund.renkert@intevation.de>
parents:
651
diff
changeset
|
223 } |
195a253e9842
Fixed bug in datetimepicker: Allways insert leading zero; do not allow values
Raimund Renkert <raimund.renkert@intevation.de>
parents:
651
diff
changeset
|
224 else if (value < 10 && (nValue.indexOf('0') !== 0 || nValue.length < 2)) { |
195a253e9842
Fixed bug in datetimepicker: Allways insert leading zero; do not allow values
Raimund Renkert <raimund.renkert@intevation.de>
parents:
651
diff
changeset
|
225 field.setValue('0' + nValue); |
195a253e9842
Fixed bug in datetimepicker: Allways insert leading zero; do not allow values
Raimund Renkert <raimund.renkert@intevation.de>
parents:
651
diff
changeset
|
226 } |
649
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
227 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
228 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
229 setValue: function(value) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
230 value.setSeconds(0); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
231 this.value = new Date(value); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
232 return this.update(this.value); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
233 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
234 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
235 selectToday: function() { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
236 var me = this; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
237 var btn = me.todayBtn; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
238 var handler = me.handler; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
239 var auxDate = new Date(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
240 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
241 if (btn && !btn.disabled) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
242 me.pickerField.setValue(new Date(auxDate.setSeconds(0))); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
243 me.setValue(new Date(auxDate.setSeconds(0))); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
244 if (handler) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
245 handler.call(me.scope || me, me, me.value); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
246 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
247 me.onSelect(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
248 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
249 return me; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
250 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
251 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
252 acceptDate: function() { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
253 var me = this; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
254 var hourSet = me.hourField.getValue(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
255 var minuteSet = me.minuteField.getValue(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
256 var currentDate = me.value; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
257 currentDate.setHours(hourSet); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
258 currentDate.setMinutes(minuteSet); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
259 me.setValue(currentDate); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
260 me.fireEvent('select', me, currentDate); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
261 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
262 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
263 handleDateClick: function(e, t) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
264 var me = this; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
265 var handler = me.handler; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
266 var hourSet = me.hourField.getValue(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
267 var minuteSet = me.minuteField.getValue(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
268 var auxDate = new Date(t.dateValue); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
269 e.stopEvent(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
270 if (!me.disabled && |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
271 t.dateValue && |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
272 !Ext.fly(t.parentNode).hasCls(me.disabledCellCls) |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
273 ) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
274 me.doCancelFocus = me.focusOnSelect === false; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
275 auxDate.setHours(hourSet, minuteSet, 0); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
276 me.setValue(new Date(auxDate)); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
277 delete me.doCancelFocus; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
278 if (handler) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
279 handler.call(me.scope || me, me, me.value); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
280 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
281 // event handling is turned off on hide |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
282 // when we are using the picker in a field |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
283 // therefore onSelect comes AFTER the select |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
284 // event. |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
285 me.onSelect(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
286 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
287 }, |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
288 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
289 selectedUpdate: function(date) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
290 var me = this; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
291 var dateOnly = Ext.Date.clearTime(date, true); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
292 var t = dateOnly.getTime(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
293 var currentDate = (me.pickerField && me.pickerField.getValue()) || new Date(); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
294 var cells = me.cells; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
295 var cls = me.selectedCls; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
296 var cellItems = cells.elements; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
297 var c; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
298 var cLen = cellItems.length; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
299 var cell; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
300 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
301 cells.removeCls(cls); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
302 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
303 for (c = 0; c < cLen; c++) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
304 cell = Ext.fly(cellItems[c]); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
305 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
306 if (cell.dom.firstChild.dateValue == t) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
307 me.fireEvent('highlightitem', me, cell); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
308 cell.addCls(cls); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
309 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
310 if (me.isVisible() && !me.doCancelFocus) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
311 Ext.fly(cell.dom.firstChild).focus(50); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
312 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
313 |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
314 break; |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
315 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
316 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
317 if (currentDate) { |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
318 me.hourField.setValue(currentDate.getHours()); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
319 me.minuteField.setValue(currentDate.getMinutes()); |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
320 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
321 } |
1f51b6020f8c
Added new DateTimeFields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
322 }); |