annotate app/view/form/Ortszuordnung.js @ 1288:08085b7d1d0b

Ortszuordnung: Search, new orte, display and validity check
author Maximilian Krambach <mkrambach@intevation.de>
date Fri, 27 Jan 2017 13:25:14 +0100
parents a792eecf1614
children bfdc00c24baf
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
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
16 model: 'Lada.model.Ortszuordnung',
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
17
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 requires: [
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
19 '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
20 '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
21 '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
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
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
24 layout: 'fit',
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
25 margin: '5, 5, 0, 5',
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
26 border: 0,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
27
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
28 record: null,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
29
1022
6d33a84979e4 More work on the Ortszuordnung grid. Saving does not work yet
Dustin Demuth <dustin@intevation.de>
parents: 1021
diff changeset
30 trackResetOnLoad: true,
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
31
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
32 initComponent: function() {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
33 var i18n = Lada.getApplication().bundle;
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
34 var me = this;
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
35 this.items = [{
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
36 xtype: 'fieldset',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
37 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
38 layout: 'fit',
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
39 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
40 layout: 'hbox',
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
41 border: 0,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
42 margin: '0, 0, 10, 0',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
43 dockedItems: [{
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
44 xtype: 'toolbar',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
45 dock: 'bottom',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
46 border: '0, 1, 1, 1',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
47 style: {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
48 borderBottom: '1px solid #b5b8c8 !important',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
49 borderLeft: '1px solid #b5b8c8 !important',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
50 borderRight: '1px solid #b5b8c8 !important'
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
51 },
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 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
53 text: i18n.getMsg('ortszuordnung.form.setOrt'),
1178
3e9a37ca9ae9 Added Tooltips to Ortszuordnung Form
Dustin Demuth <dustin@intevation.de>
parents: 1147
diff changeset
54 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
55 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
56 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
57 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
58 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
59 }, '->', {
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
60 text: i18n.getMsg('save'),
1178
3e9a37ca9ae9 Added Tooltips to Ortszuordnung Form
Dustin Demuth <dustin@intevation.de>
parents: 1147
diff changeset
61 tooltip: i18n.getMsg('save.qtip'),
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
62 icon: 'resources/img/dialog-ok-apply.png',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
63 action: 'save',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
64 disabled: true
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
65 }, {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
66 text: i18n.getMsg('discard'),
1178
3e9a37ca9ae9 Added Tooltips to Ortszuordnung Form
Dustin Demuth <dustin@intevation.de>
parents: 1147
diff changeset
67 tooltip: i18n.getMsg('discard.qtip'),
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
68 icon: 'resources/img/dialog-cancel.png',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
69 action: 'discard',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
70 disabled: true
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
71 }]
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
72 }],
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
73 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
74 layout: 'vbox',
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
75 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
76 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
77 items: [{
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
78 layout: 'vbox',
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
79 border: 0,
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
80 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
81 items: [{
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
82 xtype: 'tfield',
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
83 labelWidth: 125,
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
84 maxLength: 100,
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
85 name: 'ortszusatztext',
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
86 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
87 }, {
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
88 xtype: 'textfield',
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: 1,
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
91 allowBlank: false,
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
92 regex: /[UEZA]{1}/,
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
93 activeError: 'U, E, Z oder A eingeben',
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
94 name: 'ortszuordnungTyp',
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
95 fieldLabel: i18n.getMsg('ortszuordnung.form.field.ortszuordnungtyp'),
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
96
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
97 }, {
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
98 // 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
99 // need to know the internal ortID
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
100 xtype: 'textfield',
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
101 // fieldLabel: i18n.getMsg('orte.ortid'),
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
102 allowBlank: false,
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
103 regex: /^[0-9]{1,45}$/,
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
104 submitValue: true,
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
105 hidden: true,
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
106 name: 'ortId',
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
107 listeners: {
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
108 change: me.changedOrt
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
109 }
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1178
diff changeset
110 }]
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
111 },
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
112 Ext.create('Lada.view.form.OrtInfo', {
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
113 record: me.record
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
114 })
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
115 ]
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
116 }]
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
117 }]
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
118 }];
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
119 this.callParent(arguments);
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
120 },
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
121
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
122 setRecord: function(record) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
123 this.getForm().loadRecord(record);
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
124 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
125 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
126 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
127 }
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 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
129 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
130 }
1022
6d33a84979e4 More work on the Ortszuordnung grid. Saving does not work yet
Dustin Demuth <dustin@intevation.de>
parents: 1021
diff changeset
131 var ortId = this.getRecord().get('ortId');
6d33a84979e4 More work on the Ortszuordnung grid. Saving does not work yet
Dustin Demuth <dustin@intevation.de>
parents: 1021
diff changeset
132 this.refreshOrt(ortId);
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
133 },
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
1022
6d33a84979e4 More work on the Ortszuordnung grid. Saving does not work yet
Dustin Demuth <dustin@intevation.de>
parents: 1021
diff changeset
135 refreshOrt: function(ortId) {
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
136 var orteStore = Ext.StoreManager.get('orte');
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 var ort = orteStore.getById(ortId);
1134
f1d21e6a7449 Fixed adding new ortszuortnung for probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1051
diff changeset
138 if (!ort) {
f1d21e6a7449 Fixed adding new ortszuortnung for probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1051
diff changeset
139 return;
f1d21e6a7449 Fixed adding new ortszuortnung for probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1051
diff changeset
140 }
1049
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1022
diff changeset
141 var verwStore = Ext.StoreManager.get('verwaltungseinheiten');
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 var verw = verwStore.getById(ort.get('gemId'));
1049
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1022
diff changeset
143 var staatStore = Ext.StoreManager.get('staaten');
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
144 var staat = staatStore.getById(ort.get('staatId'));
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
145 var ortinfo = this.down('ortinfo')
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
146 ortinfo.loadRecord(ort);
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
147 ortinfo.getForm().setValues({
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 gemeinde: verw.get('bezeichnung'),
1049
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1022
diff changeset
149 staat: staat.get('staatIso'),
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1022
diff changeset
150 lon: ort.get('longitude'),
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1022
diff changeset
151 lat: ort.get('latitude')
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
152 });
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
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 /**
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 * 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
157 * 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
158 */
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
159 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
160 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
161 var r = this.getRecord();
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
162 if (newOrtId) {
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 if (newOrtId != r.get('ortId')) {
1051
981339d774b8 merged stammdatengrids to default.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1049
diff changeset
164 r.set('ortId', newOrtId);
981339d774b8 merged stammdatengrids to default.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1049
diff changeset
165 this.getForm().setValues({ortId: newOrtId});
1022
6d33a84979e4 More work on the Ortszuordnung grid. Saving does not work yet
Dustin Demuth <dustin@intevation.de>
parents: 1021
diff changeset
166 this.refreshOrt(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
167 }
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
168 }
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
169 },
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
170
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
171 setMessages: function(errors, warnings) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
172 var key;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
173 var element;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
174 var content;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
175 var i18n = Lada.getApplication().bundle;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
176 if (warnings) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
177 for (key in warnings) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
178 element = this.down('component[name=' + key + ']');
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
179 if (!element) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
180 continue;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
181 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
182 content = warnings[key];
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
183 var warnText = '';
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
184 for (var i = 0; i < content.length; i++) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
185 warnText += i18n.getMsg(content[i].toString()) + '\n';
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
186 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
187 element.showWarnings(warnText);
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 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
190 if (errors) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
191 for (key in errors) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
192 element = this.down('component[name=' + key + ']');
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
193 if (!element) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
194 continue;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
195 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
196 content = errors[key];
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
197 var errorText = '';
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
198 for (var i = 0; i < content.length; i++) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
199 errorText += i18n.getMsg(content[i].toString()) + '\n';
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
200 }
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
201 element.markInvalid(errorText);
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
202 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
203 }
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 clearMessages: function() {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
207 this.down('tfield[name=ortszusatztext]').clearWarningOrError();
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
208 },
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
209
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
210 setReadOnly: function(value) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
211 this.down('tfield[name=ortszusatztext]').setReadOnly(value);
1147
1cf5280bbc45 Fix regex and validate more expressively and stringently.
Tom Gottfried <tom@intevation.de>
parents: 1144
diff changeset
212 this.down('textfield[name=ortszuordnungTyp]').setReadOnly(value);
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
213 },
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
214
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
215 /**
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
216 * Helper to trigger the forms' validity check on change of ortID
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 changedOrt: function() {
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
219 var controller = Lada.app.getController(
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
220 'Lada.controller.form.Ortszuordnung');
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
221 var form = this.up('form').getForm();
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
222 controller.validityChange(form, form.isValid());
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
223
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
224 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
225 });
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
226

http://lada.wald.intevation.org