annotate app/view/orte/CreateOrt.js @ 450:e228fecd1577

Set lon/lat coordinates when selecting a verwaltungseinheit.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 05 Dec 2013 17:18:45 +0100
parents b3e806045a5a
children debfcc7713e3
rev   line source
446
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /**
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 *
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 */
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 Ext.define('Lada.view.orte.CreateOrt', {
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 extend: 'Ext.window.Window',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 alias: 'widget.createortdetail',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 title: 'Neuer Ort',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /**
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * @private
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 * Initialize the view.
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 */
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 initComponent: function() {
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 var me = this;
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 var form = Ext.create('Ext.form.Panel', {
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 items: [{
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 xtype: 'textfield',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 maxLength: 100,
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 name: 'ort_beschreibung',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 fieldLabel: 'Beschreibung'
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 },
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 {
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 xtype: 'staat',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 name: 'ort_staatId',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 fieldLabel: 'Staat'
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 },
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 {
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 xtype: 'verwaltungseinheiten',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 name: 'ort_gemId',
450
e228fecd1577 Set lon/lat coordinates when selecting a verwaltungseinheit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 446
diff changeset
31 fieldLabel: 'Gemeinde',
e228fecd1577 Set lon/lat coordinates when selecting a verwaltungseinheit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 446
diff changeset
32 listeners: {
e228fecd1577 Set lon/lat coordinates when selecting a verwaltungseinheit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 446
diff changeset
33 'select': {
e228fecd1577 Set lon/lat coordinates when selecting a verwaltungseinheit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 446
diff changeset
34 scope: me,
e228fecd1577 Set lon/lat coordinates when selecting a verwaltungseinheit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 446
diff changeset
35 fn: function(field, newValue, oldValue) {
e228fecd1577 Set lon/lat coordinates when selecting a verwaltungseinheit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 446
diff changeset
36 var lon = field.up('window').down(
e228fecd1577 Set lon/lat coordinates when selecting a verwaltungseinheit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 446
diff changeset
37 'numberfield[name=ort_longitude]');
e228fecd1577 Set lon/lat coordinates when selecting a verwaltungseinheit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 446
diff changeset
38 var lat = field.up('window').down(
e228fecd1577 Set lon/lat coordinates when selecting a verwaltungseinheit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 446
diff changeset
39 'numberfield[name=ort_latitude]');
e228fecd1577 Set lon/lat coordinates when selecting a verwaltungseinheit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 446
diff changeset
40 lon.setValue(newValue[0].data.longitude);
e228fecd1577 Set lon/lat coordinates when selecting a verwaltungseinheit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 446
diff changeset
41 lat.setValue(newValue[0].data.latitude);
e228fecd1577 Set lon/lat coordinates when selecting a verwaltungseinheit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 446
diff changeset
42 }
e228fecd1577 Set lon/lat coordinates when selecting a verwaltungseinheit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 446
diff changeset
43 }
e228fecd1577 Set lon/lat coordinates when selecting a verwaltungseinheit.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 446
diff changeset
44 }
446
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 },
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 {
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 xtype: 'numberfield',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 name: 'ort_latitude',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 fieldLabel: 'Lat'
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 },
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 {
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 xtype: 'numberfield',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 name: 'ort_longitude',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 fieldLabel: 'Lon'
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 },
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 {
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 xtype: 'numberfield',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 name: 'ort_hoeheLand',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 fieldLabel: 'Höhe'
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 }]
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 });
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 me.items = [form];
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 this.buttons = [
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 {
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 text: 'Speichern',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 scope: form,
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 action: 'save'
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 },
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 {
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 text: 'Abbrechen',
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 scope: this,
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 handler: this.close
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 }
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 ];
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 this.callParent(arguments);
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 }
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 });
b3e806045a5a New view to create ort details.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79

http://lada.wald.intevation.org