annotate app/view/orte/CreateForm.js @ 468:59f8a9a20e44

Added tag 1.0 for changeset fa2a7a37a248
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 14 Jan 2014 12:29:07 +0100
parents 12231f31c112
children debfcc7713e3
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',
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 432
diff changeset
10 'Lada.view.widgets.Verwaltungseinheit',
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 432
diff changeset
11 'Lada.view.orte.CreateOrt'
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
12 ],
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 432
diff changeset
13 edit: false,
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
14 initComponent: function() {
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
15 this.items = [
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
16 {
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
17 xtype: 'ortdetail',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
18 name: 'ortId',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
19 fieldLabel: 'Ort',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
20 listeners: {
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
21 scope: this,
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
22 'change': function (field, newv, oldv, opts) {
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 432
diff changeset
23 if (field.up('window')) {
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 432
diff changeset
24 field.up('window').down('fieldset').show();
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 432
diff changeset
25 }
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
26 var orte = Ext.getStore('Ortedetails');
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
27 var ort = orte.getById(newv);
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
28 var fields = ['beschreibung', 'bezeichnung', 'hoeheLand',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
29 'latitude', 'longitude', 'staatId', 'gemId'];
429
608a1784a8ac Load currently "selected" verwaltungseinheit when changing the selection.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 347
diff changeset
30
608a1784a8ac Load currently "selected" verwaltungseinheit when changing the selection.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 347
diff changeset
31 // Load currently "selected" verwaltungseinheit. This
608a1784a8ac Load currently "selected" verwaltungseinheit when changing the selection.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 347
diff changeset
32 // is needed as without having this record the field
608a1784a8ac Load currently "selected" verwaltungseinheit when changing the selection.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 347
diff changeset
33 // would only display the raw value (id) of the
608a1784a8ac Load currently "selected" verwaltungseinheit when changing the selection.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 347
diff changeset
34 // verwaltungseinheit.
608a1784a8ac Load currently "selected" verwaltungseinheit when changing the selection.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 347
diff changeset
35 var verw = Ext.getStore('Verwaltungseinheiten');
432
f4185f2d1a7c Only load verwaltungseinheit if there is a selected ort.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 430
diff changeset
36 if (ort) {
f4185f2d1a7c Only load verwaltungseinheit if there is a selected ort.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 430
diff changeset
37 verw.load({
f4185f2d1a7c Only load verwaltungseinheit if there is a selected ort.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 430
diff changeset
38 id: ort.get('gemId')
f4185f2d1a7c Only load verwaltungseinheit if there is a selected ort.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 430
diff changeset
39 });
f4185f2d1a7c Only load verwaltungseinheit if there is a selected ort.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 430
diff changeset
40 }
429
608a1784a8ac Load currently "selected" verwaltungseinheit when changing the selection.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 347
diff changeset
41
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
42 var form = this.getForm();
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
43 if ( ort != undefined ) {
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
44 for (var i = fields.length - 1; i >= 0; i--){
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
45 ffield = form.findField("ort_"+fields[i]);
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
46 ffield.setValue(ort.get(fields[i]));
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
47 }
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 }
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
51 },
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
52 {
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
53 xtype: 'textfield',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
54 name: 'ortsTyp',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
55 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
56 fieldLabel: 'Typ'
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
57 },
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
58 {
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
59 xtype: 'textareafield',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
60 name: 'ortszusatztext',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
61 maxLength: 100,
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
62 fieldLabel: 'Ortszusatz'
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
63 },
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
64 {
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 432
diff changeset
65 xtype: 'button',
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 432
diff changeset
66 name: 'newort',
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 432
diff changeset
67 text: 'Neuen Ort Anlegen',
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 432
diff changeset
68 hidden: this.edit,
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 432
diff changeset
69 action: 'newort'
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 432
diff changeset
70 },
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 432
diff changeset
71 {
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
72 xtype: 'fieldset',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
73 title: 'Ortsangaben',
447
12231f31c112 Apply new workflow in orte dialog.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 432
diff changeset
74 hidden: !this.edit,
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
75 defaults: {
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
76 labelWidth: 150
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 items: [
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
79 {
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
80 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
81 maxLength: 100,
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
82 name: 'ort_beschreibung',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
83 fieldLabel: 'Beschreibung'
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
84 },
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
85 {
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
86 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
87 maxLength: 10,
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
88 name: 'ort_bezeichnung',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
89 fieldLabel: 'Bezeichnung'
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
90 },
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
91 {
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
92 xtype: 'staat',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
93 name: 'ort_staatId',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
94 fieldLabel: 'Staat'
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
95 },
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
96 {
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
97 xtype: 'verwaltungseinheiten',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
98 name: 'ort_gemId',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
99 fieldLabel: 'Gemeinde'
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
100 },
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
101 {
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
102 xtype: 'numberfield',
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
103 name: 'ort_latitude',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
104 fieldLabel: 'Lat'
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
105 },
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
106 {
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
107 xtype: 'numberfield',
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
108 name: 'ort_longitude',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
109 fieldLabel: 'Lon'
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
110 },
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
111 {
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
112 xtype: 'numberfield',
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
113 name: 'ort_hoeheLand',
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
114 fieldLabel: 'Höhe'
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
115 }
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
116 ]
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
117 }
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
118 ];
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
119 this.callParent();
149
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
120 },
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
121 updateOrtInfo: function(field, oldv, newv, opts) {
26ac4c99f8c4 Added Orte.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 109
diff changeset
122 console.log(field, oldv, newv, opts);
109
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
123 }
2308094f5a8c Added forms to add Orte
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
124 });

http://lada.wald.intevation.org