annotate app/view/form/Ortszuordnung.js @ 1379:e95ac7584c2c

Only displaying own messpunkte in ortszuordnung after creation of new messpunkt
author Maximilian Krambach <mkrambach@intevation.de>
date Tue, 14 Feb 2017 14:30:15 +0100
parents 9cac9eb1365f
children
rev   line source
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
3 *
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
7 */
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
8
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
9 /**
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
10 * Form to edit the Ortszuordnung of a Probe
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
11 */
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.form.Ortszuordnung', {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
13 extend: 'Ext.form.Panel',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
14 alias: 'widget.ortszuordnungform',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
15
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
16 requires: [
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
17 'Lada.view.form.OrtInfo',
1338
d2f06ce4d43a Use service and widget instead of local store for OrtszuordnungTyp.
Tom Gottfried <tom@intevation.de>
parents: 1335
diff changeset
18 'Lada.view.widget.OrtszuordnungTyp',
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
19 'Lada.view.widget.Verwaltungseinheit',
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 'Lada.view.widget.Staat'
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 ],
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
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
23 layout: 'fit',
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
24 margin: '5, 5, 0, 5',
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
25 border: 0,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
26
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
27 /**
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
28 * @cfg: the type of the record to be passed. Should be either 'probe' or 'mpr'.
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
29 * Variable naming of these differ slightly (see function initComponent and the
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
30 * two lada.data.model.ortszuordnung* )
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
31 */
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
32 type: null,
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
33
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
34 record: null,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
35
1022
6d33a84979e4 More work on the Ortszuordnung grid. Saving does not work yet
Dustin Demuth <dustin@intevation.de>
parents: 1021
diff changeset
36 trackResetOnLoad: true,
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
37
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
38 initComponent: function() {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
39 var i18n = Lada.getApplication().bundle;
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
40 var me = this;
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
41 this.items = [{
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
42 xtype: 'fieldset',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
43 title: i18n.getMsg('ortszuordnung.form.fset.title'),
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
44 layout: 'fit',
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
45 items: [{
1334
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
46 overflowY: 'auto',
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
47 border: 0,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
48 margin: '0, 0, 10, 0',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
49 dockedItems: [{
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
50 xtype: 'toolbar',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
51 dock: 'bottom',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
52 border: '0, 1, 1, 1',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
53 style: {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
54 borderBottom: '1px solid #b5b8c8 !important',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
55 borderLeft: '1px solid #b5b8c8 !important',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
56 borderRight: '1px solid #b5b8c8 !important'
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
57 },
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
58 items: [{
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
59 text: i18n.getMsg('ortszuordnung.form.setOrt'),
1178
3e9a37ca9ae9 Added Tooltips to Ortszuordnung Form
Dustin Demuth <dustin@intevation.de>
parents: 1147
diff changeset
60 tooltip: i18n.getMsg('ortszuordnung.form.setOrt.qtip'),
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
61 icon: 'resources/img/dialog-ok-apply.png',
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
62 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
63 enableToggle: true,
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
64 disabled: true
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
65 }, '->', {
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
66 text: i18n.getMsg('save'),
1178
3e9a37ca9ae9 Added Tooltips to Ortszuordnung Form
Dustin Demuth <dustin@intevation.de>
parents: 1147
diff changeset
67 tooltip: i18n.getMsg('save.qtip'),
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
68 icon: 'resources/img/dialog-ok-apply.png',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
69 action: 'save',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
70 disabled: true
1321
f1e348109ebb Updated style to fit the other windows style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1298
diff changeset
71 }, {
f1e348109ebb Updated style to fit the other windows style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1298
diff changeset
72 text: i18n.getMsg('discard'),
f1e348109ebb Updated style to fit the other windows style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1298
diff changeset
73 qtip: 'Änderungen verwerfen',
f1e348109ebb Updated style to fit the other windows style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1298
diff changeset
74 icon: 'resources/img/dialog-cancel.png',
f1e348109ebb Updated style to fit the other windows style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1298
diff changeset
75 action: 'revert',
1347
2fc8e2b3c456 fix ortszuordnung 'revert' if record is new ortszuordnung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1343
diff changeset
76 disabled: true
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
77 }]
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
78 }],
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
79 items: [{
1334
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
80 layout: 'hbox',
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
81 border: 0,
1334
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
82 margin: '0, 0, 10, 0',
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
83 items: [{
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
84 layout: 'vbox',
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
85 border: 0,
1340
15e4a3e42ad7 reenabled listeners and buttons on ortszuordnung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1339
diff changeset
86 flex: 1,
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
87 items: [{
1334
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
88 layout: 'vbox',
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
89 border: 0,
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
90 margin: '0, 20, 0, 0',
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
91 items: [{
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
92 xtype: 'tfield',
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
93 labelWidth: 125,
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
94 maxLength: 100,
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
95 name: 'ortszusatztext',
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
96 fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszusatztext')
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
97 }, {
1338
d2f06ce4d43a Use service and widget instead of local store for OrtszuordnungTyp.
Tom Gottfried <tom@intevation.de>
parents: 1335
diff changeset
98 xtype: 'ortszuordnungtyp',
1334
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
99 labelWidth: 125,
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
100 allowBlank: false,
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
101 editable: true,
1339
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1338
diff changeset
102 name: 'ortszuordnungTyp',
1334
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
103 disableKeyFilter: true,
1377
9cac9eb1365f fix sencha parse warnings
Michael Stanko <mstanko@bfs.de>
parents: 1350
diff changeset
104 fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszuordnungtyp')
1334
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
105 }, {
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
106 // this field is hidden because the user doesn't
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
107 // need to know the internal ortID
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
108 xtype: 'textfield',
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
109 allowBlank: false,
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
110 regex: /^[0-9]{1,45}$/,
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
111 submitValue: true,
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
112 hidden: true,
1339
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1338
diff changeset
113 name: 'ortId',
1334
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
114 listeners: {
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
115 change: me.changed
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
116 }
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
117 }]
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
118 },
1340
15e4a3e42ad7 reenabled listeners and buttons on ortszuordnung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1339
diff changeset
119 Ext.create('Lada.view.form.OrtInfo')
1334
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
120 ]
2c5d89886885 Fixed ortszuordnung window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1321
diff changeset
121 }]
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
122 }]
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
123 }]
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
124 }];
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
125 this.callParent(arguments);
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
126 },
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
127
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
128 setRecord: function(record) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
129 this.getForm().loadRecord(record);
1335
cba4e0b0e336 Fixed ort grid selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1334
diff changeset
130 this.record = record;
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
131 if (!record.get('readonly')) {
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
132 this.down('[action=setOrt]').enable();
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
133 this.setReadOnly(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
134 }
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
135 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
136 this.setReadOnly(true);
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
137 }
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
138 },
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
139
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
140 /**
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
141 * setOrt can be called from a CallbackFunction, ie select from a grid.
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
142 * it will set the ortId of this record
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
143 */
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
144 setOrt: function(row, selRecord, index, opts) {
1347
2fc8e2b3c456 fix ortszuordnung 'revert' if record is new ortszuordnung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1343
diff changeset
145 if (selRecord) {
2fc8e2b3c456 fix ortszuordnung 'revert' if record is new ortszuordnung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1343
diff changeset
146 var newOrtId = selRecord.get('id');
2fc8e2b3c456 fix ortszuordnung 'revert' if record is new ortszuordnung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1343
diff changeset
147 }
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
148 if (newOrtId) {
1341
2e8eba3918b1 OrtszuordnungMp fix
Maximilian Krambach <mkrambach@intevation.de>
parents: 1340
diff changeset
149 this.getForm().setValues({ortId: newOrtId});
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
150 this.setOrtInfo(selRecord);
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
151 }
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
152 },
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
153
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
154 setOrtInfo: function(ortrecord) {
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
155 var verwStore = Ext.StoreManager.get('verwaltungseinheiten');
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
156 var verw = verwStore.getById(ortrecord.get('gemId'));
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
157 var staatStore = Ext.StoreManager.get('staaten');
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
158 var staat = staatStore.getById(ortrecord.get('staatId'));
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
159 var ortinfo = this.down('ortinfo');
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
160 ortinfo.loadRecord(ortrecord);
1343
cd16b30dbc10 correct behaviour of 'reverting changes' in ortszuordnung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1341
diff changeset
161 if (verw !== null) {
cd16b30dbc10 correct behaviour of 'reverting changes' in ortszuordnung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1341
diff changeset
162 ortinfo.getForm().setValues({gemeinde: verw.get('bezeichnung')});
1350
ba106500af0b Ortrecord in Ortszuordnung failed if there is no Staat
Maximilian Krambach <mkrambach@intevation.de>
parents: 1347
diff changeset
163 } else {
ba106500af0b Ortrecord in Ortszuordnung failed if there is no Staat
Maximilian Krambach <mkrambach@intevation.de>
parents: 1347
diff changeset
164 ortinfo.getForm().setValues({gemeinde: ''});
ba106500af0b Ortrecord in Ortszuordnung failed if there is no Staat
Maximilian Krambach <mkrambach@intevation.de>
parents: 1347
diff changeset
165 }
ba106500af0b Ortrecord in Ortszuordnung failed if there is no Staat
Maximilian Krambach <mkrambach@intevation.de>
parents: 1347
diff changeset
166 if (staat !== null) {
ba106500af0b Ortrecord in Ortszuordnung failed if there is no Staat
Maximilian Krambach <mkrambach@intevation.de>
parents: 1347
diff changeset
167 ortinfo.getForm().setValues({staat: staat.get('staatIso')});
ba106500af0b Ortrecord in Ortszuordnung failed if there is no Staat
Maximilian Krambach <mkrambach@intevation.de>
parents: 1347
diff changeset
168 } else {
ba106500af0b Ortrecord in Ortszuordnung failed if there is no Staat
Maximilian Krambach <mkrambach@intevation.de>
parents: 1347
diff changeset
169 ortinfo.getForm().setValues({staat: ''});
1343
cd16b30dbc10 correct behaviour of 'reverting changes' in ortszuordnung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1341
diff changeset
170 }
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
171 },
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
172
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
173 setMessages: function(errors, warnings) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
174 var key;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
175 var element;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
176 var content;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
177 var i18n = Lada.getApplication().bundle;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
178 if (warnings) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
179 for (key in warnings) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
180 element = this.down('component[name=' + key + ']');
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
181 if (!element) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
182 continue;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
183 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
184 content = warnings[key];
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
185 var warnText = '';
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
186 for (var i = 0; i < content.length; i++) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
187 warnText += i18n.getMsg(content[i].toString()) + '\n';
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
188 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
189 element.showWarnings(warnText);
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
190 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
191 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
192 if (errors) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
193 for (key in errors) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
194 element = this.down('component[name=' + key + ']');
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
195 if (!element) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
196 continue;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
197 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
198 content = errors[key];
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
199 var errorText = '';
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
200 for (var i = 0; i < content.length; i++) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
201 errorText += i18n.getMsg(content[i].toString()) + '\n';
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
202 }
1295
171eacf989d8 Show error and warnings in new forms
Maximilian Krambach <mkrambach@intevation.de>
parents: 1291
diff changeset
203 element.showErrors(errorText);
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
204 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
205 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
206 },
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
207
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
208 clearMessages: function() {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
209 this.down('tfield[name=ortszusatztext]').clearWarningOrError();
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
210 },
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
211
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
212 setReadOnly: function(value) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
213 this.down('tfield[name=ortszusatztext]').setReadOnly(value);
1339
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1338
diff changeset
214 var fieldId = 'textfield[name=ortszuordnungTyp]';
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
215 this.down(fieldId).setReadOnly(value);
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
216 },
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
217
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
218 /**
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
219 * Helper to trigger the forms' validity check
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
220 */
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
221 changed: function(newValue, oldValue) {
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
222 var controller = Lada.app.getController(
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
223 'Lada.controller.form.Ortszuordnung');
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
224 var form = this.up('form').getForm();
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
225 controller.validityChange(form, form.isValid());
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
226 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
227 });
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
228

http://lada.wald.intevation.org