Mercurial > lada > lada-client
annotate app/view/orte/CreateForm.js @ 347:1536fb5c81b7
Added documentation
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Tue, 13 Aug 2013 11:23:51 +0200 |
parents | d6d74718a102 |
children | 608a1784a8ac |
rev | line source |
---|---|
347
1536fb5c81b7
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
278
diff
changeset
|
1 /* |
1536fb5c81b7
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
278
diff
changeset
|
2 * Formular to create and edit a Ort |
1536fb5c81b7
Added documentation
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
278
diff
changeset
|
3 */ |
109
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
4 Ext.define('Lada.view.orte.CreateForm', { |
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
5 extend: 'Lada.view.widgets.LadaForm', |
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
6 model: 'Lada.model.Ort', |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
7 requires: [ |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
8 'Lada.view.widgets.Ortdetail', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
9 'Lada.view.widgets.Staat', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
10 'Lada.view.widgets.Verwaltungseinheit' |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
11 ], |
109
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
12 initComponent: function() { |
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
13 this.items = [ |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
14 { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
15 xtype: 'ortdetail', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
16 name: 'ortId', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
17 fieldLabel: 'Ort', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
18 listeners: { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
19 scope: this, |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
20 'change': function (field, newv, oldv, opts) { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
21 console.log(field, oldv, newv, opts); |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
22 var orte = Ext.getStore('Ortedetails'); |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
23 var ort = orte.getById(newv); |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
24 var fields = ['beschreibung', 'bezeichnung', 'hoeheLand', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
25 'latitude', 'longitude', 'staatId', 'gemId']; |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
26 var form = this.getForm(); |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
27 if ( ort != undefined ) { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
28 console.log('Found ort'); |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
29 for (var i = fields.length - 1; i >= 0; i--){ |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
30 ffield = form.findField("ort_"+fields[i]); |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
31 ffield.setValue(ort.get(fields[i])); |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
32 } |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
33 } |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
34 } |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
35 } |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
36 }, |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
37 { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
38 xtype: 'textfield', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
39 name: 'ortsTyp', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
40 maxLength: 1, |
154
16ba7e2465fd
Implemented creating and editing new l_ort. Created editing orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
149
diff
changeset
|
41 fieldLabel: 'Typ' |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
42 }, |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
43 { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
44 xtype: 'textareafield', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
45 name: 'ortszusatztext', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
46 maxLength: 100, |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
47 fieldLabel: 'Ortszusatz' |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
48 }, |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
49 { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
50 xtype: 'fieldset', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
51 title: 'Ortsangaben', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
52 defaults: { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
53 labelWidth: 150 |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
54 }, |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
55 items: [ |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
56 { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
57 xtype: 'textfield', |
278
d6d74718a102
Clientseitige Überprüfung der Datenfelder hinzugefügt: Nutzung von "numberfields" bei Zahlenwerten, maxLength, min/maxValue
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
154
diff
changeset
|
58 maxLength: 100, |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
59 name: 'ort_beschreibung', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
60 fieldLabel: 'Beschreibung' |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
61 }, |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
62 { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
63 xtype: 'textfield', |
278
d6d74718a102
Clientseitige Überprüfung der Datenfelder hinzugefügt: Nutzung von "numberfields" bei Zahlenwerten, maxLength, min/maxValue
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
154
diff
changeset
|
64 maxLength: 10, |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
65 name: 'ort_bezeichnung', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
66 fieldLabel: 'Bezeichnung' |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
67 }, |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
68 { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
69 xtype: 'staat', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
70 name: 'ort_staatId', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
71 fieldLabel: 'Staat' |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
72 }, |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
73 { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
74 xtype: 'verwaltungseinheiten', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
75 name: 'ort_gemId', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
76 fieldLabel: 'Gemeinde' |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
77 }, |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
78 { |
278
d6d74718a102
Clientseitige Überprüfung der Datenfelder hinzugefügt: Nutzung von "numberfields" bei Zahlenwerten, maxLength, min/maxValue
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
154
diff
changeset
|
79 xtype: 'numberfield', |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
80 name: 'ort_latitude', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
81 fieldLabel: 'Lat' |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
82 }, |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
83 { |
278
d6d74718a102
Clientseitige Überprüfung der Datenfelder hinzugefügt: Nutzung von "numberfields" bei Zahlenwerten, maxLength, min/maxValue
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
154
diff
changeset
|
84 xtype: 'numberfield', |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
85 name: 'ort_longitude', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
86 fieldLabel: 'Lon' |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
87 }, |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
88 { |
278
d6d74718a102
Clientseitige Überprüfung der Datenfelder hinzugefügt: Nutzung von "numberfields" bei Zahlenwerten, maxLength, min/maxValue
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
154
diff
changeset
|
89 xtype: 'numberfield', |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
90 name: 'ort_hoeheLand', |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
91 fieldLabel: 'Höhe' |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
92 } |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
93 ] |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
94 } |
109
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
95 ]; |
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
96 this.callParent(); |
149
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
97 }, |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
98 updateOrtInfo: function(field, oldv, newv, opts) { |
26ac4c99f8c4
Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
109
diff
changeset
|
99 console.log(field, oldv, newv, opts); |
109
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
100 } |
2308094f5a8c
Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
101 }); |