Mercurial > lada > lada-client
annotate app/controller/form/Ortszuordnung.js @ 1021:1df6b6210b42 stammdatengrids
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Thu, 04 Feb 2016 16:31:46 +0100 |
parents | 75ce503ab296 |
children | 6d33a84979e4 |
rev | line source |
---|---|
603
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
704
diff
changeset
|
9 /* |
1013
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
10 * This is a controller for an Ortszuordnung Form |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
704
diff
changeset
|
11 */ |
1013
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
12 Ext.define('Lada.controller.form.Ortszuordnung', { |
603
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.app.Controller', |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
704
diff
changeset
|
15 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
704
diff
changeset
|
16 * Initialize the Controller with 4 listeners |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
704
diff
changeset
|
17 */ |
603
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 init: function() { |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 this.control({ |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
20 'ortszuordnungform button[action=setOrt]': { |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
21 toggle: this.pickOrt |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
22 }, |
1013
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
23 'ortszuordnungform button[action=save]': { |
603
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 click: this.save |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 }, |
1013
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
26 'ortszuordnungform button[action=discard]': { |
603
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 click: this.discard |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 }, |
1013
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
29 'ortszuordnungform': { |
603
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 dirtychange: this.dirtyForm |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 } |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 }); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 }, |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
704
diff
changeset
|
35 /** |
972
24b5684d74d7
Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
36 * The save function saves the content of the Ort form. |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
704
diff
changeset
|
37 * On success it will reload the Store, |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
704
diff
changeset
|
38 * on failure, it will display an Errormessage |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
704
diff
changeset
|
39 */ |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
704
diff
changeset
|
40 save: function(button) { |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
41 |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
42 //try to disable ortPickerButton: |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
43 try { |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
44 var ob = this.up('form').down('ortszuordnungform button[action=setOrt]'); |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
45 if (ob.pressed) { |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
46 ob.toggle(false); |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
47 } |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
48 } |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
49 catch (e) { |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
50 } |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
51 |
1013
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
52 var formPanel = button.up('ortszuordnungform'); |
603
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 var data = formPanel.getForm().getFieldValues(true); |
1013
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
54 var i18n = Lada.getApplication().bundle; |
603
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 for (var key in data) { |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 formPanel.getForm().getRecord().set(key, data[key]); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 } |
972
24b5684d74d7
Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
58 if (!formPanel.getForm().getRecord().get('letzteAenderung')) { |
24b5684d74d7
Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
59 formPanel.getForm().getRecord().data.letzteAenderung = new Date(); |
24b5684d74d7
Set letzteAenderung in a Bunch of controllers.
Dustin Demuth <dustin@intevation.de>
parents:
742
diff
changeset
|
60 } |
603
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 formPanel.getForm().getRecord().save({ |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 success: function(record, response) { |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 var json = Ext.decode(response.response.responseText); |
641
5b5bba1d8e6a
Load and update the correct orte form.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
615
diff
changeset
|
64 if (json) { |
603
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 button.setDisabled(true); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 button.up('toolbar').down('button[action=discard]') |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 .setDisabled(true); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 formPanel.clearMessages(); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 formPanel.setRecord(record); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 formPanel.setMessages(json.errors, json.warnings); |
644
71e8b84d7829
Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
641
diff
changeset
|
71 formPanel.up('window').grid.store.reload(); |
603
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 } |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 }, |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 failure: function(record, response) { |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 button.setDisabled(true); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 button.up('toolbar').down('button[action=discard]') |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 .setDisabled(true); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 formPanel.getForm().loadRecord(formPanel.getForm().getRecord()); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 var json = response.request.scope.reader.jsonData; |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 if (json) { |
695
d6ef146e1a9f
Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents:
644
diff
changeset
|
81 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ |
d6ef146e1a9f
Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents:
644
diff
changeset
|
82 formPanel.setMessages(json.errors, json.warnings); |
d6ef146e1a9f
Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents:
644
diff
changeset
|
83 } |
d6ef146e1a9f
Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents:
644
diff
changeset
|
84 |
d6ef146e1a9f
Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents:
644
diff
changeset
|
85 if(json.message){ |
1013
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
86 Ext.Msg.alert(i18n.getMsg('err.msg.save.title') |
701
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
87 +' #'+json.message, |
1013
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
88 i18n.getMsg(json.message)); |
701
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
89 } else { |
1013
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
90 Ext.Msg.alert(i18n.getMsg('err.msg.save.title'), |
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
91 i18n.getMsg('err.msg.generic.body')); |
695
d6ef146e1a9f
Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents:
644
diff
changeset
|
92 } |
701
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
93 } else { |
1013
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
94 Ext.Msg.alert(i18n.getMsg('err.msg.save.title'), |
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
95 i18n.getMsg('err.msg.response.body')); |
603
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 } |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 } |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 }); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 }, |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 |
1013
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
101 /** |
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
102 * The discard function resets the Location form |
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
103 * to its original state. |
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
104 */ |
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
105 discard: function(button) { |
603
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 var formPanel = button.up('form'); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 formPanel.getForm().loadRecord(formPanel.getForm().getRecord()); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 }, |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 |
1013
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
110 /** |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
111 * When the button is Active, a Record can be selected. |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
112 * If the Record was selected from a grid this function |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
113 * sets the ortzuordnung. |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
114 * TODO: Check if the selected Record is a ORT |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
115 * TODO: Enable picking from Maps |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
116 */ |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
117 pickOrt: function(button, pressed, opts) { |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
118 var i18n = Lada.getApplication().bundle; |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
119 var oForm = button.up('form'); |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
120 var osg = button.up('window').down('ortstammdatengrid'); |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
121 if (button.pressed) { |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
122 button.setText(i18n.getMsg('ortszuordnung.form.setOrt.pressed')); |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
123 osg.addListener('select',oForm.setOrt, oForm); |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
124 } |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
125 else { |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
126 button.setText(i18n.getMsg('ortszuordnung.form.setOrt')); |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
127 osg.removeListener('select',oForm.setOrt, oForm); |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
128 } |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
129 }, |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
130 |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
131 |
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1013
diff
changeset
|
132 /** |
1013
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
133 * The dirtyForm function enables or disables the save and discard |
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
134 * button which are present in the toolbar of the form. |
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
135 * The Buttons are only active if the content of the form was altered |
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
136 * (the form is dirty). |
75ce503ab296
Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
972
diff
changeset
|
137 */ |
603
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 dirtyForm: function(form, dirty) { |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
139 if (dirty) { |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
140 form.owner.down('button[action=save]').setDisabled(false); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
141 form.owner.down('button[action=discard]').setDisabled(false); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 } |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 else { |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
144 form.owner.down('button[action=save]').setDisabled(true); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 form.owner.down('button[action=discard]').setDisabled(true); |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 } |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 } |
9d0113bc2f70
Added ort form and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
148 }); |