Mercurial > lada > lada-client
annotate app/view/window/MessprogrammOrt.js @ 801:646779690e20
moved code to request the server version to app.js
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Fri, 22 May 2015 12:34:14 +0200 |
parents | b8fd43021c29 |
children | 097d4edc2f00 |
rev | line source |
---|---|
797
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
3 * |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
7 */ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
8 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
9 /** |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
10 * Window to add a Ort to a Messprogramm |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
11 */ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.view.window.MessprogrammOrt', { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.window.Window', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
14 alias: 'widget.messprogrammort', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
15 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
16 requires: [ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
17 'Lada.model.Ort', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
18 'Lada.view.panel.Map', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
19 'Lada.view.widget.Location', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
20 'Lada.view.form.Location' |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
21 ], |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
22 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
23 collapsible: true, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
24 maximizable: true, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
25 autoshow: true, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
26 layout: 'border', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
27 constrain: true, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
28 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
29 parentWindow: null, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
30 record: null, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
31 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
32 initComponent: function() { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
33 var i18n = Lada.getApplication().bundle; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
34 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
35 this.title = i18n.getMsg('messprogrammort.window.title'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
36 this.buttons = [{ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
37 text: i18n.getMsg('apply'), |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
38 scope: this, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
39 handler: this.apply |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
40 }, { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
41 text: i18n.getMsg('cancel'), |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
42 scope: this, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
43 handler: function() { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
44 this.close() |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
45 this.parentWindow.down('messprogrammform') |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
46 .ortWindow = null; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
47 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
48 }]; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
49 this.width = 900; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
50 this.height = 515; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
51 this.bodyStyle = {background: '#fff'}; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
52 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
53 // add listeners to change the window appearence when it becomes inactive |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
54 this.on({ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
55 activate: function(){ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
56 this.getEl().removeCls('window-inactive'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
57 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
58 deactivate: function(){ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
59 this.getEl().addCls('window-inactive'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
60 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
61 }); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
62 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
63 this.items = [{ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
64 region: 'west', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
65 border: 0, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
66 layout: 'vbox', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
67 items: [{ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
68 xtype: 'fieldset', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
69 title: i18n.getMsg('ortId'), |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
70 margin: 5, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
71 items: [{ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
72 border: 0, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
73 margin: '0, 0, 10, 0', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
74 items: [{ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
75 xtype: 'location', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
76 fieldLabel: i18n.getMsg('ortId'), |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
77 labelWidth: 80, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
78 width: 280, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
79 forceSelection: true, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
80 name: 'ortId', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
81 listeners: {//Update MapPanel etc... |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
82 select: this.updateDetails |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
83 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
84 }] |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
85 }] |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
86 }, { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
87 xtype: 'locationform', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
88 margin: 5, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
89 recordId: this.record.get('ortId') |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
90 }] |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
91 }, { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
92 xtype: 'fset', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
93 bodyStyle: { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
94 background: '#fff' |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
95 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
96 layout: 'border', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
97 name: 'mapfield', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
98 title: 'Karte', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
99 region: 'center', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
100 padding: '5, 5', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
101 margin: 5, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
102 items: [{ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
103 xtype: 'map', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
104 region: 'center', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
105 layout: 'border', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
106 record: this.record.get('ortId') ? this.record : null, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
107 bodyStyle: { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
108 background: '#fff' |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
109 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
110 name: 'map', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
111 listeners: { //A listener which listens to the mappanels featureselected event |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
112 featureselected: this.selectedFeature |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
113 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
114 }] |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
115 }]; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
116 this.callParent(arguments); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
117 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
118 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
119 initData: function() { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
120 //Only do this if an OrtId exists... |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
121 var ortId = this.record.get('ortId'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
122 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
123 if (ortId) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
124 Ext.ClassManager.get('Lada.model.Ort').load(ortId, { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
125 failure: function(record, action) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
126 // TODO |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
127 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
128 success: function(record, response) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
129 var me = this; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
130 if (record.get('treeModified') < record.get('parentModified')) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
131 Ext.Msg.show({ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
132 title: 'Messprogramm nicht aktuell!', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
133 msg: 'Das zugehörige Messprogramm wurde verändert.\nMöchten Sie zu dem Messprogramm zurückkehren und neu laden?\nOhne das erneute Laden des Messprogrammes wird das Speichern des Ortes nicht möglich sein.', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
134 buttons: Ext.Msg.OKCANCEL, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
135 icon: Ext.Msg.WARNING, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
136 closable: false, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
137 fn: function(button) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
138 if (button === 'ok') { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
139 me.close(); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
140 me.parentWindow.initData(); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
141 me.parentWindow.down('messprogrammform') |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
142 .ortWindow = null; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
143 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
144 else { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
145 me.record.set('treeModified', me.probe.get('treeModified')); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
146 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
147 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
148 }); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
149 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
150 this.record = record; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
151 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
152 scope: this |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
153 }); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
154 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
155 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
156 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
157 /** |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
158 * @private |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
159 * Override to display and update the map view in the panel. |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
160 */ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
161 afterRender: function(){ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
162 this.superclass.afterRender.apply(this, arguments); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
163 var map = this.down('map'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
164 if (this.record.get('ortId')) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
165 map.selectFeature(this.record.get('ortId')); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
166 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
167 else { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
168 map.map.zoomToMaxExtent(); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
169 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
170 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
171 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
172 /** |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
173 * This function is used by the MapPanel, when a Feature was selected |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
174 */ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
175 selectedFeature: function(context, args) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
176 var feature = args[0]; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
177 if (feature.attributes.id && |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
178 feature.attributes.id !== '') { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
179 var record = Ext.data.StoreManager.get('locations').getById(feature.attributes.id); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
180 context.up('window').down('locationform').setRecord(record); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
181 context.up('window').down('locationform').setReadOnly(true); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
182 context.up('window').down('location').down('combobox').setValue(record.id); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
183 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
184 else { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
185 context.up('window').down('locationform').setRecord(this.locationRecord); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
186 context.up('window').down('locationform').setReadOnly(false); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
187 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
188 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
189 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
190 /** |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
191 * updateDetails is used when a value is selected within the location combobox |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
192 * When this function is called, the map element within the window |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
193 * which is embedding this form is updated. |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
194 * |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
195 * Mostly the same as in Lada.controlle.form.Ort |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
196 */ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
197 updateDetails: function(combobox, record) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
198 var win = combobox.up('window'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
199 var details = win.down('locationform'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
200 //var id = record[0].get('id'); // We are interested in the cbox... |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
201 var id = combobox.getValue(); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
202 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
203 if (details) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
204 var toLoad = Ext.data.StoreManager.get('locations').getById(id); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
205 win.down('locationform').setRecord(toLoad); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
206 win.down('map').selectFeature(id); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
207 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
208 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
209 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
210 /** |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
211 * Write the selected ortId into the record, and update the MessprogrammWindow. |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
212 */ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
213 apply: function(button) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
214 var win = button.up('window'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
215 var ortId = win.down('location').down('combobox').value; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
216 if (this.parentWindow) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
217 this.parentWindow.down('messprogrammform').down('location') |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
218 .down('combobox').setValue(ortId); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
219 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
220 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
221 this.parentWindow.down('messprogrammform') |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
222 .ortWindow = null; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
223 this.close(); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
224 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
225 setMessages: function(errors, warnings) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
226 //todo this is a stub |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
227 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
228 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
229 clearMessages: function() { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
230 //todo this is a stub |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
231 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
232 }); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
233 |