Mercurial > lada > lada-client
annotate app/controller/form/Ortserstellung.js @ 1427:c22581d48040
In case a value is shown, separate it with a space.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 06 Apr 2017 16:17:20 +0200 |
parents | e95ac7584c2c |
children |
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 |
1352
e5235309d461
fixed validitycheck in Ortserstellung
Maximilian Krambach <mkrambach@intevation.de>
parents:
1342
diff
changeset
|
40 }, |
e5235309d461
fixed validitycheck in Ortserstellung
Maximilian Krambach <mkrambach@intevation.de>
parents:
1342
diff
changeset
|
41 'ortserstellungsform': { |
e5235309d461
fixed validitycheck in Ortserstellung
Maximilian Krambach <mkrambach@intevation.de>
parents:
1342
diff
changeset
|
42 validitychange: this.checkCommitEnabled, |
e5235309d461
fixed validitycheck in Ortserstellung
Maximilian Krambach <mkrambach@intevation.de>
parents:
1342
diff
changeset
|
43 dirtychange: this.checkCommitEnabled |
1377 | 44 } |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
45 }); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
46 }, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
47 |
1339
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
48 save: function(button) { |
1361
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
49 var me = this; |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
50 var formpanel = button.up('ortserstellungsform'); |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
51 var form = formpanel.getForm(); |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
52 var record = form.getRecord(); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
53 var data = form.getFieldValues(true); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
54 for (var key in data) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
55 record.set(key, data[key]); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
56 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
57 record.set('id', null); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
58 record.set('netzbetreiberId', Lada.netzbetreiber[0]); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
59 record.save({ |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
60 success: function(newrecord, response) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
61 form.loadRecord(newrecord); |
1361
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
62 formpanel.down('verwaltungseinheit').store.clearFilter(); |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
63 formpanel.down('staat').store.clearFilter(); |
1339
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
64 button.setDisabled(true); |
1361
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
65 formpanel.down('button[action=revert]').setDisabled(true); |
1339
1a2cd9bef6d7
messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents:
1337
diff
changeset
|
66 button.hide(); |
1361
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
67 var ozw = formpanel.up('panel').parentWindow; |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
68 var json = Ext.decode(response.response.responseText); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
69 if (json) { |
1361
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
70 formpanel.clearMessages(); |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
71 formpanel.setMessages(json.errors, json.warnings); |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
72 } |
1361
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
73 if (ozw.ortstore) { |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
74 ozw.ortstore.load({ |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
75 callback: function(records, operation, success) { |
1379
e95ac7584c2c
Only displaying own messpunkte in ortszuordnung after creation of new messpunkt
Maximilian Krambach <mkrambach@intevation.de>
parents:
1377
diff
changeset
|
76 ozw.ortstore.filter('netzbetreiberId', Lada.netzbetreiber[0]); |
1364
b58868c47f02
reintroduced filtered display of Stammdaten panel
Maximilian Krambach <mkrambach@intevation.de>
parents:
1361
diff
changeset
|
77 ozw.down('map').addLocations(ozw.ortstore); |
b58868c47f02
reintroduced filtered display of Stammdaten panel
Maximilian Krambach <mkrambach@intevation.de>
parents:
1361
diff
changeset
|
78 var osg = ozw.down('ortstammdatengrid'); |
b58868c47f02
reintroduced filtered display of Stammdaten panel
Maximilian Krambach <mkrambach@intevation.de>
parents:
1361
diff
changeset
|
79 osg.setStore(ozw.ortstore); |
b58868c47f02
reintroduced filtered display of Stammdaten panel
Maximilian Krambach <mkrambach@intevation.de>
parents:
1361
diff
changeset
|
80 me.afterSave(formpanel, json); |
1361
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
81 }, |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
82 scope: this |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
83 }); |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
84 } else { |
1364
b58868c47f02
reintroduced filtered display of Stammdaten panel
Maximilian Krambach <mkrambach@intevation.de>
parents:
1361
diff
changeset
|
85 var osgstore = ozw.down('ortstammdatengrid').getStore(); |
1379
e95ac7584c2c
Only displaying own messpunkte in ortszuordnung after creation of new messpunkt
Maximilian Krambach <mkrambach@intevation.de>
parents:
1377
diff
changeset
|
86 osgstore.load({ |
e95ac7584c2c
Only displaying own messpunkte in ortszuordnung after creation of new messpunkt
Maximilian Krambach <mkrambach@intevation.de>
parents:
1377
diff
changeset
|
87 callback: function() { |
e95ac7584c2c
Only displaying own messpunkte in ortszuordnung after creation of new messpunkt
Maximilian Krambach <mkrambach@intevation.de>
parents:
1377
diff
changeset
|
88 osgstore.filter('netzbetreiberId', Lada.netzbetreiber[0]); |
e95ac7584c2c
Only displaying own messpunkte in ortszuordnung after creation of new messpunkt
Maximilian Krambach <mkrambach@intevation.de>
parents:
1377
diff
changeset
|
89 } |
e95ac7584c2c
Only displaying own messpunkte in ortszuordnung after creation of new messpunkt
Maximilian Krambach <mkrambach@intevation.de>
parents:
1377
diff
changeset
|
90 }); |
1364
b58868c47f02
reintroduced filtered display of Stammdaten panel
Maximilian Krambach <mkrambach@intevation.de>
parents:
1361
diff
changeset
|
91 ozw.down('map').addLocations(osgstore); |
b58868c47f02
reintroduced filtered display of Stammdaten panel
Maximilian Krambach <mkrambach@intevation.de>
parents:
1361
diff
changeset
|
92 me.afterSave(formpanel, json); |
1361
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
93 } |
1337
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 failure: function(record, response) { |
1357
b96d98f0cb71
Fix handling of errors and warnings in Ortserstellung form.
Tom Gottfried <tom@intevation.de>
parents:
1355
diff
changeset
|
96 var json = response.request.scope.reader.jsonData; |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
97 if (json) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
98 if(json.message){ |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
99 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
|
100 +' #'+json.message, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
101 Lada.getApplication().bundle.getMsg(json.message)); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
102 } else { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
103 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
|
104 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
105 } |
1364
b58868c47f02
reintroduced filtered display of Stammdaten panel
Maximilian Krambach <mkrambach@intevation.de>
parents:
1361
diff
changeset
|
106 formpanel.clearMessages(); |
b58868c47f02
reintroduced filtered display of Stammdaten panel
Maximilian Krambach <mkrambach@intevation.de>
parents:
1361
diff
changeset
|
107 formpanel.setMessages(json.errors, json.warnings); |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
108 } else { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
109 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
|
110 Lada.getApplication().bundle.getMsg('err.msg.response.body')); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
111 } |
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 }); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
114 }, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
115 |
1361
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
116 /** |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
117 * Callbacks after a Ort has been saved and the store is reloaded |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
118 */ |
1364
b58868c47f02
reintroduced filtered display of Stammdaten panel
Maximilian Krambach <mkrambach@intevation.de>
parents:
1361
diff
changeset
|
119 afterSave: function(form, json) { |
1361
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
120 var ozw = form.up('panel').parentWindow; |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
121 var osg = ozw.down('ortstammdatengrid'); |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
122 var id = json.data.id; |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
123 var record = osg.store.getById(id); |
1364
b58868c47f02
reintroduced filtered display of Stammdaten panel
Maximilian Krambach <mkrambach@intevation.de>
parents:
1361
diff
changeset
|
124 if (record) { |
b58868c47f02
reintroduced filtered display of Stammdaten panel
Maximilian Krambach <mkrambach@intevation.de>
parents:
1361
diff
changeset
|
125 var selmod = osg.getView().getSelectionModel(); |
b58868c47f02
reintroduced filtered display of Stammdaten panel
Maximilian Krambach <mkrambach@intevation.de>
parents:
1361
diff
changeset
|
126 selmod.select(record); |
b58868c47f02
reintroduced filtered display of Stammdaten panel
Maximilian Krambach <mkrambach@intevation.de>
parents:
1361
diff
changeset
|
127 } |
1361
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
128 var resulttext; |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
129 if (json) { |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
130 if (json.message == '201') { |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
131 resulttext = 'Dieser Ort existiert bereits!'; |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
132 } |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
133 if (json.message == '200') { |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
134 resulttext = 'Ort erfolgreich angelegt!'; |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
135 } |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
136 } |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
137 Ext.Msg.show({ |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
138 title: Lada.getApplication().bundle.getMsg('success'), |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
139 autoScroll: true, |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
140 msg: resulttext, |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
141 buttons: Ext.Msg.OK |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
142 }); |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
143 }, |
5c2d6812d85a
Merge behaviour of Stammdaten panel and ortszuordnungs grid
Maximilian Krambach <mkrambach@intevation.de>
parents:
1360
diff
changeset
|
144 |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
145 discard: function(button) { |
1360
d1dce50fa9a6
Fix reset button in Ortserstellung form.
Tom Gottfried <tom@intevation.de>
parents:
1359
diff
changeset
|
146 button.up('panel').getForm().reset(); |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
147 }, |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
148 |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
149 /** |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
150 * checks if the Messpunkt can be committed. |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
151 * Disables the save button if false |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
152 */ |
1352
e5235309d461
fixed validitycheck in Ortserstellung
Maximilian Krambach <mkrambach@intevation.de>
parents:
1342
diff
changeset
|
153 checkCommitEnabled: function(callingEl) { |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
154 var panel; |
1352
e5235309d461
fixed validitycheck in Ortserstellung
Maximilian Krambach <mkrambach@intevation.de>
parents:
1342
diff
changeset
|
155 if (callingEl.up) { //called by a field in the form |
1354
02252ce0cf1e
Ortserstellung validator: fix reference to form
Maximilian Krambach <mkrambach@intevation.de>
parents:
1352
diff
changeset
|
156 panel = callingEl.up('ortserstellungsform'); |
1352
e5235309d461
fixed validitycheck in Ortserstellung
Maximilian Krambach <mkrambach@intevation.de>
parents:
1342
diff
changeset
|
157 } else { //called by the form |
e5235309d461
fixed validitycheck in Ortserstellung
Maximilian Krambach <mkrambach@intevation.de>
parents:
1342
diff
changeset
|
158 panel = callingEl.owner; |
1337
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 var savebutton = panel.down('button[action=save]'); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
161 var form = panel.getForm(); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
162 if (form.isDirty()) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
163 panel.down('button[action=revert]').setDisabled(false); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
164 } else { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
165 panel.down('button[action=revert]').setDisabled(true); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
166 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
167 if (form.isValid()) { |
1359
49efc1cc0eac
Remove trailing whitespace.
Tom Gottfried <tom@intevation.de>
parents:
1357
diff
changeset
|
168 //one of three conditions must apply, the first one depending |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
169 // on three fields |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
170 if ( |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
171 (form.findField('kdaId').getValue() |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
172 && form.findField('koordYExtern').getValue() |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
173 && form.findField('koordXExtern').getValue() |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
174 ) |
1342
d5e270fa91e4
fix: Ortserstellung for Staaten and validity check triggers
Maximilian Krambach <mkrambach@intevation.de>
parents:
1339
diff
changeset
|
175 || form.findField('gemId').getValue() !== null |
d5e270fa91e4
fix: Ortserstellung for Staaten and validity check triggers
Maximilian Krambach <mkrambach@intevation.de>
parents:
1339
diff
changeset
|
176 || form.findField('staatId').getValue() !== null |
1337
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
177 ) { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
178 savebutton.setDisabled(false); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
179 } else { |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
180 savebutton.setDisabled(true); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
181 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
182 } else { //form invalid |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
183 savebutton.setDisabled(true); |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
184 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
185 } |
7194964183f4
Ortserstellung controller separated from form
Maximilian Krambach <mkrambach@intevation.de>
parents:
diff
changeset
|
186 }); |