Mercurial > lada > lada-client
annotate app/view/widgets/Datetime.js @ 543:ce188e2fab06
Added custom textfield to shwo errors and warnings.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 18 Dec 2014 15:03:51 +0100 |
parents | 0a948bb99b60 |
children |
rev | line source |
---|---|
472
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
352
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
352
diff
changeset
|
2 * Software engineering by Intevation GmbH |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
352
diff
changeset
|
3 * |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
352
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
352
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
472
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
352
diff
changeset
|
7 */ |
debfcc7713e3
Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
352
diff
changeset
|
8 |
352
5fbcbf330839
Added documenation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
275
diff
changeset
|
9 /** |
5fbcbf330839
Added documenation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
275
diff
changeset
|
10 * Datetimepicker with german date format. |
5fbcbf330839
Added documenation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
275
diff
changeset
|
11 */ |
497
7c0653e8d9f7
Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
490
diff
changeset
|
12 Ext.define('Lada.view.widgets.Datetime', { |
542
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
13 extend: 'Ext.panel.Panel', |
490
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
14 alias: 'widget.datetime', |
542
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
15 |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
16 layout: 'hbox', |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
17 |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
18 border: 0, |
490
446e99cfd425
Updated views and controllers using the new model and stores.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
472
diff
changeset
|
19 |
31
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 initComponent: function() { |
542
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
21 var dateField = Ext.create('Ext.ux.form.DateTimeField', { |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
22 format: 'd.m.Y', |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
23 emptyText: 'Wählen Sie einen Zeitpunkt', |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
24 fieldLabel: this.fieldLabel, |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
25 margin: this.fieldMargin, |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
26 labelWidth: this.labelWidth, |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
27 flex: 1, |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
28 name: this.name, |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
29 listeners: this.listeners |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
30 }); |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
31 this.items = [{ |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
32 xtype: 'image', |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
33 name: 'warnImg', |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
34 src: 'gfx/icon-warning.gif', |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
35 margin: '2, 5, 2, 5', |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
36 width: 16, |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
37 height: 16, |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
38 hidden: true |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
39 }, { |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
40 xtype: 'image', |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
41 name: 'errorImg', |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
42 src: 'gfx/icon-error.gif', |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
43 margin: '2, 5, 2, 5', |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
44 width: 16, |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
45 height: 16, |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
46 hidden: true |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
47 }, dateField]; |
31
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
48 this.callParent(arguments); |
542
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
49 }, |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
50 |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
51 showWarnings: function(warnings) { |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
52 var img = this.down('image[name=warnImg]'); |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
53 Ext.create('Ext.tip.ToolTip', { |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
54 target: img.getEl(), |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
55 html: warnings |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
56 }); |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
57 img.show(); |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
58 }, |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
59 |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
60 showErrors: function(errors) { |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
61 var img = this.down('image[name=errorImg]'); |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
62 Ext.create('Ext.tip.ToolTip', { |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
63 target: img.getEl(), |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
64 html: errors |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
65 }); |
0a948bb99b60
Added error and warning handling to date time field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
497
diff
changeset
|
66 img.show(); |
31
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
67 } |
897e3100c6da
Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
68 }); |