Mercurial > lada > lada-client
annotate app/controller/form/Ortserstellung.js @ 1348:26e0aec2eb31
corrected created coordinates in Stammdaten view from EPSG 3857 to EPSG 4326
author | Maximilian Krambach <mkrambach@intevation.de> |
---|---|
date | Mon, 06 Feb 2017 16:47:16 +0100 |
parents | d5e270fa91e4 |
children | e5235309d461 |
rev | line source |
---|---|
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
3 * |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
7 */ |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
8 |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
9 /* |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
10 * This is a controller for an Ortserstellung Form |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
11 */ |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.controller.form.Ortserstellung', { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.app.Controller', |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
14 |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
15 /** |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
16 * Initialize the Controller |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
17 */ |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
18 init: function() { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
19 this.control({ |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
20 'ortserstellungsform button[action=save]': { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
21 click: this.save |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
22 }, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
23 'ortserstellungsform button[action=revert]': { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
24 click: this.discard |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
25 }, |
1342
d5e270fa91e4
fix: Ortserstellung for Staaten and validity check triggers
Maximilian Krambach <mkrambach@intevation.de>
parents:
1339
diff
changeset
|
26 'ortserstellungsform staat combobox' : { |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
27 change: this.checkCommitEnabled |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
28 }, |
1342
d5e270fa91e4
fix: Ortserstellung for Staaten and validity check triggers
Maximilian Krambach <mkrambach@intevation.de>
parents:
1339
diff
changeset
|
29 'ortserstellungsform verwaltungseinheit combobox' : { |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
30 change: this.checkCommitEnabled |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
31 }, |
1342
d5e270fa91e4
fix: Ortserstellung for Staaten and validity check triggers
Maximilian Krambach <mkrambach@intevation.de>
parents:
1339
diff
changeset
|
32 'ortserstellungsform koordinatenart combobox': { |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
33 change: this.checkCommitEnabled |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
34 }, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
35 'ortserstellungsform numfield [name=koordXExtern]': { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
36 change: this.checkCommitEnabled |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
37 }, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
38 'ortserstellungsform numfield [name=koordYExtern]': { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
39 change: this.checkCommitEnabled |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
40 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
41 }); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
42 }, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
43 |
1339
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
44 save: function(button) { |
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
45 var me = button.up('panel'); |
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
46 var form = me.getForm(); |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
47 var record = form.getRecord(); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
48 var data = form.getFieldValues(true); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
49 for (var key in data) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
50 record.set(key, data[key]); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
51 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
52 record.set('id', null); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
53 record.set('netzbetreiberId', Lada.netzbetreiber[0]); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
54 record.save({ |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
55 success: function(newrecord, response) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
56 form.loadRecord(newrecord); |
1339
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
57 me.down('verwaltungseinheit').store.load( |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
58 { id:newrecord.get('gemId') }); |
1339
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
59 me.down('staat').store.load( |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
60 { id : newrecord.get('staat') }); |
1339
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
61 button.setDisabled(true); |
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
62 me.down('button[action=revert]').setDisabled(true); |
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
63 button.hide(); |
1342
d5e270fa91e4
fix: Ortserstellung for Staaten and validity check triggers
Maximilian Krambach <mkrambach@intevation.de>
parents:
1339
diff
changeset
|
64 var ozw = me.up('window').parentWindow; |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
65 var json = Ext.decode(response.response.responseText); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
66 if (json) { |
1339
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
67 me.clearMessages(); |
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
68 me.setMessages(json.errors, json.warnings); |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
69 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
70 ozw.ortstore.load({ |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
71 callback: function(records, operation, success) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
72 ozw.down('map').addLocations(ozw.ortstore); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
73 var osg = ozw.down('ortstammdatengrid'); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
74 osg.setStore(ozw.ortstore); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
75 var id = Ext.decode(response.response.responseText).data.id; |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
76 var record = osg.store.getById(id); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
77 var selmod = osg.getView().getSelectionModel(); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
78 selmod.select(record); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
79 var resulttext; |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
80 if (json) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
81 if (json.message == '201') { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
82 resulttext = 'Dieser Ort existiert bereits!'; |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
83 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
84 if (json.message == '200') { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
85 resulttext = 'Ort erfolgreich angelegt!'; |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
86 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
87 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
88 Ext.Msg.show({ |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
89 title: Lada.getApplication().bundle.getMsg('success'), |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
90 autoScroll: true, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
91 msg: resulttext, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
92 buttons: Ext.Msg.OK |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
93 }); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
94 }, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
95 scope: this |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
96 }); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
97 |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
98 }, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
99 failure: function(record, response) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
100 var json = Ext.decode(response.response.responseText); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
101 if (json) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
102 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
103 formPanel.setMessages(json.errors, json.warnings); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
104 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
105 if(json.message){ |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
106 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title') |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
107 +' #'+json.message, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
108 Lada.getApplication().bundle.getMsg(json.message)); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
109 } else { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
110 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
111 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
112 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
113 } else { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
114 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
115 Lada.getApplication().bundle.getMsg('err.msg.response.body')); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
116 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
117 me.setDisabled(true); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
118 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
119 }); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
120 }, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
121 |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
122 discard: function(button) { |
1339
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
123 button.up('panel').reset(); |
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
124 button.up('panel').down('button [action=save]').setDisabled(true); |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
125 }, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
126 |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
127 /** |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
128 * checks if the Messpunkt can be committed. |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
129 * Disables the save button if false |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
130 */ |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
131 checkCommitEnabled: function(field) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
132 var panel; |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
133 if (field.up('panel')) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
134 panel = field.up('panel').up('panel'); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
135 } else { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
136 panel = field; |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
137 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
138 var savebutton = panel.down('button[action=save]'); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
139 var form = panel.getForm(); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
140 if (form.isDirty()) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
141 panel.down('button[action=revert]').setDisabled(false); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
142 } else { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
143 panel.down('button[action=revert]').setDisabled(true); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
144 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
145 if (form.isValid()) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
146 //one of three conditions must apply, the first one depending |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
147 // on three fields |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
148 if ( |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
149 (form.findField('kdaId').getValue() |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
150 && form.findField('koordYExtern').getValue() |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
151 && form.findField('koordXExtern').getValue() |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
152 ) |
1342
d5e270fa91e4
fix: Ortserstellung for Staaten and validity check triggers
Maximilian Krambach <mkrambach@intevation.de>
parents:
1339
diff
changeset
|
153 || form.findField('gemId').getValue() !== null |
d5e270fa91e4
fix: Ortserstellung for Staaten and validity check triggers
Maximilian Krambach <mkrambach@intevation.de>
parents:
1339
diff
changeset
|
154 || form.findField('staatId').getValue() !== null |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
155 ) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
156 savebutton.setDisabled(false); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
157 } else { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
158 savebutton.setDisabled(true); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
159 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
160 } else { //form invalid |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
161 savebutton.setDisabled(true); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
162 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
163 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
164 }); |