annotate app/view/form/Ortszuordnung.js @ 1293:16a80ca16732

map feature visibility, selection and grid layout messpunkt layer is now visible per default when in editing mode on selection in map, the form is updated ortszuordnung buttons should not render over grid anymore
author Maximilian Krambach <mkrambach@intevation.de>
date Wed, 01 Feb 2017 19:38:06 +0100
parents e9f812528324
children 171eacf989d8
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',
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
18 '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
19 '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
20 ],
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 layout: 'fit',
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
23 margin: '5, 5, 0, 5',
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
24 border: 0,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
25
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
26 /**
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
27 * @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
28 * 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
29 * two lada.data.model.ortszuordnung* )
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
30 */
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
31 type: null,
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
32
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
33 record: null,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
34
1022
6d33a84979e4 More work on the Ortszuordnung grid. Saving does not work yet
Dustin Demuth <dustin@intevation.de>
parents: 1021
diff changeset
35 trackResetOnLoad: true,
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
36
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
37 initComponent: function() {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
38 var i18n = Lada.getApplication().bundle;
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
39 var me = this;
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
40 if (this.type == 'probe') {
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
41 this.ortIdName = 'ortId';
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
42 this.typName = 'ortszuordnungTyp';
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
43 } else if (this.type == 'mpr') {
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
44 this.ortIdName = 'ort';
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
45 this.typName = 'ortsTyp';
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
46 }
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
47 this.items = [{
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
48 xtype: 'fieldset',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
49 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
50 layout: 'fit',
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
51 items: [{
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
52 layout: 'hbox',
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
53 border: 0,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
54 margin: '0, 0, 10, 0',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
55 dockedItems: [{
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
56 xtype: 'toolbar',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
57 dock: 'bottom',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
58 border: '0, 1, 1, 1',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
59 style: {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
60 borderBottom: '1px solid #b5b8c8 !important',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
61 borderLeft: '1px solid #b5b8c8 !important',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
62 borderRight: '1px solid #b5b8c8 !important'
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
63 },
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
64 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
65 text: i18n.getMsg('ortszuordnung.form.setOrt'),
1178
3e9a37ca9ae9 Added Tooltips to Ortszuordnung Form
Dustin Demuth <dustin@intevation.de>
parents: 1147
diff changeset
66 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
67 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
68 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
69 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
70 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
71 }, '->', {
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
72 text: i18n.getMsg('save'),
1178
3e9a37ca9ae9 Added Tooltips to Ortszuordnung Form
Dustin Demuth <dustin@intevation.de>
parents: 1147
diff changeset
73 tooltip: i18n.getMsg('save.qtip'),
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
74 icon: 'resources/img/dialog-ok-apply.png',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
75 action: 'save',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
76 disabled: true
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: [{
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
80 layout: 'vbox',
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
81 autoscroll: true,
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
82 border: 0,
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,
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
86 margin: '0, 20, 0, 0',
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
87 items: [{
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
88 xtype: 'tfield',
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
89 labelWidth: 125,
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
90 maxLength: 100,
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
91 name: 'ortszusatztext',
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
92 fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszusatztext')
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
93 }, {
1290
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
94 xtype: 'cbox',
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
95 labelWidth: 125,
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
96 maxLength: 1,
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
97 allowBlank: false,
1290
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
98 editable: true,
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
99 name: this.typName,
1290
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
100 disableKeyFilter: true,
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
101 fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszuordnungtyp'),
1290
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
102 store: Ext.create('Ext.data.Store', {
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
103 fields: ['value', 'label'],
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
104 //TODO: Meaning of the letters should be added
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
105 data : [
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
106 {'value':'U', 'label':'U'},
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
107 {'value':'E', 'label':'E'},
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
108 {'value':'Z', 'label':'Z'},
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
109 {'value':'A', 'label':'A'}
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
110 ]
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
111 }),
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
112 displayField: 'label',
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
113 valueField: 'value',
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
114 emptyText: 'Bitte geben Sie einen Ortszuordnungstyp ein',
d17501b967f2 combobox ortszuordnungstyp
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
115 queryMode: 'local'
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
116 }, {
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
117 // this field is hidden because the user doesn't
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
118 // need to know the internal ortID
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
119 xtype: 'textfield',
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
120 // fieldLabel: i18n.getMsg('orte.ortid'),
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
121 allowBlank: false,
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
122 regex: /^[0-9]{1,45}$/,
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
123 submitValue: true,
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
124 hidden: true,
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
125 name: this.ortIdName,
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
126 listeners: {
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
127 change: me.changed
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
128 }
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
129 }]
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
130 },
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
131 Ext.create('Lada.view.form.OrtInfo')
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
132 ]
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
133 }]
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
134 }]
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
135 }];
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
136 this.callParent(arguments);
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
137 },
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
138
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
139 setRecord: function(record) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
140 this.getForm().loadRecord(record);
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
141 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
142 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
143 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
144 }
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
145 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
146 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
147 }
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 },
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
149
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
150 /**
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 * 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
152 * 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
153 */
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
154 setOrt: function(row, selRecord, index, 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
155 var newOrtId = selRecord.get('id');
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
156 if (newOrtId) {
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
157 if (this.type == 'probe') {
1051
981339d774b8 merged stammdatengrids to default.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1049
diff changeset
158 this.getForm().setValues({ortId: newOrtId});
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
159 } else {
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
160 this.getForm().setValues({ort: newOrtId});
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
161 }
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
162 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
163 }
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
164 },
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
165
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
166 setOrtInfo: function(ortrecord) {
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
167 var verwStore = Ext.StoreManager.get('verwaltungseinheiten');
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
168 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
169 var staatStore = Ext.StoreManager.get('staaten');
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
170 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
171 var ortinfo = this.down('ortinfo');
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
172 ortinfo.loadRecord(ortrecord);
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
173 ortinfo.getForm().setValues({
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
174 gemeinde: verw.get('bezeichnung'),
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
175 staat: staat.get('staatIso'),
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
176 lon: ortrecord.get('longitude'),
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
177 lat: ortrecord.get('latitude')
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
178 });
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
179 },
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
180
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
181 setMessages: function(errors, warnings) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
182 var key;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
183 var element;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
184 var content;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
185 var i18n = Lada.getApplication().bundle;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
186 if (warnings) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
187 for (key in warnings) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
188 element = this.down('component[name=' + key + ']');
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
189 if (!element) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
190 continue;
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 content = warnings[key];
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
193 var warnText = '';
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
194 for (var i = 0; i < content.length; i++) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
195 warnText += i18n.getMsg(content[i].toString()) + '\n';
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
196 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
197 element.showWarnings(warnText);
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
198 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
199 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
200 if (errors) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
201 for (key in errors) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
202 element = this.down('component[name=' + key + ']');
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
203 if (!element) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
204 continue;
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 content = errors[key];
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
207 var errorText = '';
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
208 for (var i = 0; i < content.length; i++) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
209 errorText += i18n.getMsg(content[i].toString()) + '\n';
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
210 }
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
211 element.markInvalid(errorText);
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
212 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
213 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
214 },
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
215
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
216 clearMessages: function() {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
217 this.down('tfield[name=ortszusatztext]').clearWarningOrError();
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
218 },
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
219
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
220 setReadOnly: function(value) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
221 this.down('tfield[name=ortszusatztext]').setReadOnly(value);
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
222 var fieldId = 'textfield[name=' + this.typName +']';
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
223 this.down(fieldId).setReadOnly(value);
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
224 },
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
225
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
226 /**
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
227 * 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
228 */
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
229 changed: function(newValue, oldValue) {
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
230 var controller = Lada.app.getController(
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
231 'Lada.controller.form.Ortszuordnung');
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
232 var form = this.up('form').getForm();
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
233 var fields = form.getFields().items;
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
234 controller.validityChange(form, form.isValid());
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
235 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
236 });
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
237

http://lada.wald.intevation.org