Mercurial > lada > lada-client
annotate app/view/window/MessprogrammOrt.js @ 1147:1cf5280bbc45
Fix regex and validate more expressively and stringently.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 27 May 2016 18:07:44 +0200 |
parents | def27cdd0dfa |
children | 0a47e8af9006 |
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 |
890
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
32 /** |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
33 * This function initialises the Window |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
34 */ |
797
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
35 initComponent: function() { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
36 var i18n = Lada.getApplication().bundle; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
37 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
38 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
|
39 this.buttons = [{ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
40 text: i18n.getMsg('apply'), |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
41 scope: this, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
42 handler: this.apply |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
43 }, { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
44 text: i18n.getMsg('cancel'), |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
45 scope: this, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
46 handler: function() { |
818
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
47 this.close(); |
797
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
48 this.parentWindow.down('messprogrammform') |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
49 .ortWindow = null; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
50 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
51 }]; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
52 this.width = 900; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
53 this.height = 515; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
54 this.bodyStyle = {background: '#fff'}; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
55 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
56 // 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
|
57 this.on({ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
58 activate: function(){ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
59 this.getEl().removeCls('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 deactivate: function(){ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
62 this.getEl().addCls('window-inactive'); |
818
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
63 }, |
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
64 close: function () { |
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
65 this.parentWindow.down('messprogrammform') |
097d4edc2f00
Genprobenwindow can only be created once, also fixed messprogrammortewindow 'close with x and can not reopen' bug
Dustin Demuth <dustin@intevation.de>
parents:
797
diff
changeset
|
66 .ortWindow = null; |
797
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
67 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
68 }); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
69 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
70 this.items = [{ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
71 region: 'west', |
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 layout: 'vbox', |
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: 'fieldset', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
76 title: i18n.getMsg('ortId'), |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
77 margin: 5, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
78 items: [{ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
79 border: 0, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
80 margin: '0, 0, 10, 0', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
81 items: [{ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
82 xtype: 'location', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
83 fieldLabel: i18n.getMsg('ortId'), |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
84 labelWidth: 80, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
85 width: 280, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
86 forceSelection: true, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
87 name: 'ortId', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
88 listeners: {//Update MapPanel etc... |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
89 select: this.updateDetails |
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 }] |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
93 }, { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
94 xtype: 'locationform', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
95 margin: 5, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
96 recordId: this.record.get('ortId') |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
97 }] |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
98 }, { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
99 xtype: 'fset', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
100 bodyStyle: { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
101 background: '#fff' |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
102 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
103 layout: 'border', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
104 name: 'mapfield', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
105 title: 'Karte', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
106 region: 'center', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
107 padding: '5, 5', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
108 margin: 5, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
109 items: [{ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
110 xtype: 'map', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
111 region: 'center', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
112 layout: 'border', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
113 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
|
114 bodyStyle: { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
115 background: '#fff' |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
116 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
117 name: 'map', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
118 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
|
119 featureselected: this.selectedFeature |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
120 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
121 }] |
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 this.callParent(arguments); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
124 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
125 |
890
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
126 /** |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
127 * Initialise the Data of this Window. |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
128 */ |
797
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
129 initData: function() { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
130 //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
|
131 var ortId = this.record.get('ortId'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
132 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
133 if (ortId) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
134 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
|
135 failure: function(record, action) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
136 // TODO |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
137 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
138 success: function(record, response) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
139 var me = this; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
140 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
|
141 Ext.Msg.show({ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
142 title: 'Messprogramm nicht aktuell!', |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
143 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
|
144 buttons: Ext.Msg.OKCANCEL, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
145 icon: Ext.Msg.WARNING, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
146 closable: false, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
147 fn: function(button) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
148 if (button === 'ok') { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
149 me.close(); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
150 me.parentWindow.initData(); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
151 me.parentWindow.down('messprogrammform') |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
152 .ortWindow = null; |
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 else { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
155 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
|
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 }); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
159 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
160 this.record = record; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
161 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
162 scope: this |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
163 }); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
164 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
165 }, |
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 /** |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
168 * @private |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
169 * 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
|
170 */ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
171 afterRender: function(){ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
172 this.superclass.afterRender.apply(this, arguments); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
173 var map = this.down('map'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
174 if (this.record.get('ortId')) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
175 map.selectFeature(this.record.get('ortId')); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
176 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
177 else { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
178 map.map.zoomToMaxExtent(); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
179 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
180 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
181 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
182 /** |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
183 * 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
|
184 */ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
185 selectedFeature: function(context, args) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
186 var feature = args[0]; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
187 if (feature.attributes.id && |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
188 feature.attributes.id !== '') { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
189 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
|
190 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
|
191 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
|
192 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
|
193 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
194 else { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
195 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
|
196 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
|
197 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
198 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
199 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
200 /** |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
201 * 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
|
202 * 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
|
203 * 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
|
204 * |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
205 * 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
|
206 */ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
207 updateDetails: function(combobox, record) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
208 var win = combobox.up('window'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
209 var details = win.down('locationform'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
210 //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
|
211 var id = combobox.getValue(); |
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 if (details) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
214 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
|
215 win.down('locationform').setRecord(toLoad); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
216 win.down('map').selectFeature(id); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
217 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
218 }, |
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 * 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
|
222 */ |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
223 apply: function(button) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
224 var win = button.up('window'); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
225 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
|
226 if (this.parentWindow) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
227 this.parentWindow.down('messprogrammform').down('location') |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
228 .down('combobox').setValue(ortId); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
229 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
230 |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
231 this.parentWindow.down('messprogrammform') |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
232 .ortWindow = null; |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
233 this.close(); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
234 }, |
890
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
235 |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
236 /** |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
237 * Instructs the fields / forms listed in this method to set a message. |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
238 * @param errors These Errors shall be shown |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
239 * @param warnings These Warning shall be shown |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
240 */ |
797
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
241 setMessages: function(errors, warnings) { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
242 //todo this is a stub |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
243 }, |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
244 |
890
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
245 /** |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
246 * Instructs the fields / forms listed in this method to clear their messages. |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
818
diff
changeset
|
247 */ |
797
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
248 clearMessages: function() { |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
249 //todo this is a stub |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
250 } |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
251 }); |
b8fd43021c29
Added a Window to alter Orte of a Messprogramm
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
252 |