comparison app/view/orte/CreateForm.js @ 491:850ccfe5f3c4

Code style.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 31 Oct 2014 23:23:32 +0100
parents 446e99cfd425
children d07e5086a64b
comparison
equal deleted inserted replaced
490:446e99cfd425 491:850ccfe5f3c4
18 'Lada.view.widgets.Verwaltungseinheit', 18 'Lada.view.widgets.Verwaltungseinheit',
19 'Lada.view.orte.CreateOrt' 19 'Lada.view.orte.CreateOrt'
20 ], 20 ],
21 edit: false, 21 edit: false,
22 initComponent: function() { 22 initComponent: function() {
23 this.items = [ 23 this.items = [{
24 { 24 xtype: 'ortdetail',
25 xtype: 'ortdetail', 25 name: 'ortId',
26 name: 'ortId', 26 fieldLabel: 'Ort',
27 fieldLabel: 'Ort', 27 listeners: {
28 listeners: { 28 scope: this,
29 scope: this, 29 'change': function (field, newv, oldv, opts) {
30 'change': function (field, newv, oldv, opts) { 30 if (field.up('window')) {
31 if (field.up('window')) { 31 field.up('window').down('fieldset').show();
32 field.up('window').down('fieldset').show(); 32 }
33 } 33 var orte = Ext.getStore('StaOrte');
34 var orte = Ext.getStore('StaOrte'); 34 var ort = orte.getById(newv);
35 var ort = orte.getById(newv); 35 var fields = [
36 var fields = ['beschreibung', 'bezeichnung', 'hoeheLand', 36 'beschreibung',
37 'latitude', 'longitude', 'staatId', 'gemId']; 37 'bezeichnung',
38 'hoeheLand',
39 'latitude',
40 'longitude',
41 'staatId',
42 'gemId'
43 ];
38 44
39 // Load currently "selected" verwaltungseinheit. This 45 // Load currently "selected" verwaltungseinheit. This
40 // is needed as without having this record the field 46 // is needed as without having this record the field
41 // would only display the raw value (id) of the 47 // would only display the raw value (id) of the
42 // verwaltungseinheit. 48 // verwaltungseinheit.
43 var verw = Ext.getStore('StaVerwaltungseinheiten'); 49 var verw = Ext.getStore('StaVerwaltungseinheiten');
44 if (ort) { 50 if (ort) {
45 verw.load({ 51 verw.load({
46 id: ort.get('gemId') 52 id: ort.get('gemId')
47 }); 53 });
48 } 54 }
49 55
50 var form = this.getForm(); 56 var form = this.getForm();
51 if ( ort != undefined ) { 57 if ( ort != undefined ) {
52 for (var i = fields.length - 1; i >= 0; i--){ 58 for (var i = fields.length - 1; i >= 0; i--){
53 ffield = form.findField("ort_"+fields[i]); 59 ffield = form.findField("ort_"+fields[i]);
54 ffield.setValue(ort.get(fields[i])); 60 ffield.setValue(ort.get(fields[i]));
55 }
56 } 61 }
57 } 62 }
58 } 63 }
64 }
65 }, {
66 xtype: 'textfield',
67 name: 'ortsTyp',
68 maxLength: 1,
69 fieldLabel: 'Typ'
70 }, {
71 xtype: 'textareafield',
72 name: 'ortszusatztext',
73 maxLength: 100,
74 fieldLabel: 'Ortszusatz'
75 }, {
76 xtype: 'button',
77 name: 'newort',
78 text: 'Neuen Ort Anlegen',
79 hidden: this.edit,
80 action: 'newort'
81 }, {
82 xtype: 'fieldset',
83 title: 'Ortsangaben',
84 hidden: !this.edit,
85 defaults: {
86 labelWidth: 150
59 }, 87 },
60 { 88 items: [{
61 xtype: 'textfield', 89 xtype: 'textfield',
62 name: 'ortsTyp',
63 maxLength: 1,
64 fieldLabel: 'Typ'
65 },
66 {
67 xtype: 'textareafield',
68 name: 'ortszusatztext',
69 maxLength: 100, 90 maxLength: 100,
70 fieldLabel: 'Ortszusatz' 91 name: 'ort_beschreibung',
71 }, 92 fieldLabel: 'Beschreibung'
72 { 93 }, {
73 xtype: 'button', 94 xtype: 'textfield',
74 name: 'newort', 95 maxLength: 10,
75 text: 'Neuen Ort Anlegen', 96 name: 'ort_bezeichnung',
76 hidden: this.edit, 97 fieldLabel: 'Bezeichnung'
77 action: 'newort' 98 }, {
78 }, 99 xtype: 'staat',
79 { 100 name: 'ort_staatId',
80 xtype: 'fieldset', 101 fieldLabel: 'Staat'
81 title: 'Ortsangaben', 102 }, {
82 hidden: !this.edit, 103 xtype: 'verwaltungseinheiten',
83 defaults: { 104 name: 'ort_gemId',
84 labelWidth: 150 105 fieldLabel: 'Gemeinde'
85 }, 106 }, {
86 items: [ 107 xtype: 'numberfield',
87 { 108 name: 'ort_latitude',
88 xtype: 'textfield', 109 fieldLabel: 'Lat'
89 maxLength: 100, 110 }, {
90 name: 'ort_beschreibung', 111 xtype: 'numberfield',
91 fieldLabel: 'Beschreibung' 112 name: 'ort_longitude',
92 }, 113 fieldLabel: 'Lon'
93 { 114 }, {
94 xtype: 'textfield', 115 xtype: 'numberfield',
95 maxLength: 10, 116 name: 'ort_hoeheLand',
96 name: 'ort_bezeichnung', 117 fieldLabel: 'Höhe'
97 fieldLabel: 'Bezeichnung' 118 }]
98 }, 119 }];
99 { 120 this.callParent(arguments);
100 xtype: 'staat',
101 name: 'ort_staatId',
102 fieldLabel: 'Staat'
103 },
104 {
105 xtype: 'verwaltungseinheiten',
106 name: 'ort_gemId',
107 fieldLabel: 'Gemeinde'
108 },
109 {
110 xtype: 'numberfield',
111 name: 'ort_latitude',
112 fieldLabel: 'Lat'
113 },
114 {
115 xtype: 'numberfield',
116 name: 'ort_longitude',
117 fieldLabel: 'Lon'
118 },
119 {
120 xtype: 'numberfield',
121 name: 'ort_hoeheLand',
122 fieldLabel: 'Höhe'
123 }
124 ]
125 }
126 ];
127 this.callParent();
128 }, 121 },
122
129 updateOrtInfo: function(field, oldv, newv, opts) { 123 updateOrtInfo: function(field, oldv, newv, opts) {
130 console.log(field, oldv, newv, opts); 124 console.log(field, oldv, newv, opts);
131 } 125 }
132 }); 126 });

http://lada.wald.intevation.org