annotate app/view/window/Ortszuordnung.js @ 1216:75e5caebd392

Adapt version name.
author Tom Gottfried <tom@intevation.de>
date Fri, 14 Oct 2016 16:06:21 +0200
parents a3a715417540
children a792eecf1614
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 * Window to create/edit the Ort / Probe Relation
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.window.Ortszuordnung', {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
13 extend: 'Ext.window.Window',
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
14 alias: 'widget.ortszuordnungwindow',
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 requires: [
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 'Lada.view.form.Ortszuordnung',
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.panel.Ort'
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
19 ],
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
20
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
21 collapsible: true,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
22 maximizable: true,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
23 autoshow: 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
24 layout: 'vbox',
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
25 constrain: true,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
26
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
27 probe: null,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
28 parentWindow: null,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
29 record: null,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
30 grid: null,
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 /**
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
33 * This function initialises the Window
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
34 */
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
35 initComponent: function() {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
36 var i18n = Lada.getApplication().bundle;
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 this.title = i18n.getMsg('ortszuordnung.window.title');
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
39
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
40 if (this.record && this.probe) {
1021
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
41 // A record be edited
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
42 this.title = i18n.getMsg('ortszuordnung.window.title')
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
43 + ' '
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
44 + i18n.getMsg('ortszuordnung.window.title2')
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
45 + ' '
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
46 + i18n.getMsg('probe')
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
47 + ' '
1138
a3a715417540 Fixed typo in datafield getter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1134
diff changeset
48 + this.probe.get('hauptprobenNr')
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
49 + ' '
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
50 + i18n.getMsg('edit');
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
51 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
52 else if (this.probe) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
53 // A new record will be created
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
54 this.title = i18n.getMsg('ortszuordnung.window.title')
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
55 + ' '
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
56 + i18n.getMsg('ortszuordnung.window.title2')
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
57 + ' '
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
58 + i18n.getMsg('probe')
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
59 + ' '
1138
a3a715417540 Fixed typo in datafield getter.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1134
diff changeset
60 + this.probe.get('hauptprobenNr')
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
61 + ' '
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
62 + i18n.getMsg('create');
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
63 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
64
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
65 this.buttons = [{
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
66 text: i18n.getMsg('close'),
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
67 scope: this,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
68 handler: this.close
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
69 }];
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
70 this.width = 900;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
71 this.height = 515;
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
72 this.bodyStyle = {background: '#fff'};
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
73
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
74 // add listeners to change the window appearence when it becomes inactive
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
75 this.on({
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
76 activate: function(){
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
77 this.getEl().removeCls('window-inactive');
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 deactivate: function(){
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
80 this.getEl().addCls('window-inactive');
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
81 }
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
82 });
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
83
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
84 this.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
85 xtype: 'ortszuordnungform',
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
86 layout: 'fit',
1049
1bd4c0709bd6 Working version of selectable 'ort' in map and grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1021
diff changeset
87 width: '100%',
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
88 margin: 5
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
89 }, {
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
90 xtype: 'ortpanel',
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
91 flex: 1,
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
92 toolbarPos: 'bottom',
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
93 margin: 5
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
94 }];
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
95 this.callParent(arguments);
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
96 },
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
97
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
98 /**
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
99 * Initialise the Data of this Window
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
100 */
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
101 initData: function() {
1134
f1d21e6a7449 Fixed adding new ortszuortnung for probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1133
diff changeset
102 if (!this.record) {
f1d21e6a7449 Fixed adding new ortszuortnung for probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1133
diff changeset
103 this.record = Ext.create('Lada.model.Ortszuordnung');
f1d21e6a7449 Fixed adding new ortszuortnung for probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1133
diff changeset
104 if (!this.record.get('letzteAenderung')) {
f1d21e6a7449 Fixed adding new ortszuortnung for probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1133
diff changeset
105 this.record.data.letzteAenderung = new Date();
f1d21e6a7449 Fixed adding new ortszuortnung for probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1133
diff changeset
106 }
f1d21e6a7449 Fixed adding new ortszuortnung for probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1133
diff changeset
107 this.record.set('probeId', this.probe.get('id'));
f1d21e6a7449 Fixed adding new ortszuortnung for probe objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1133
diff changeset
108 }
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
109 this.down('ortszuordnungform').setRecord(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
110 this.down('ortpanel').setStore();
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
111 },
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
112
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
113 /**
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
114 * @private
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
115 * Override to display and update the map view in the panel.
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
116 */
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
117 afterRender: function(){
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
118 this.superclass.afterRender.apply(this, arguments);
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
119 var map = this.down('ortpanel').down('map');
1df6b6210b42 WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents: 1013
diff changeset
120 map.map.zoomToMaxExtent();
1013
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
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
123 /**
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
124 * Instructs the fields / forms listed in this method to set a message.
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
125 * @param errors These Errors shall be shown
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
126 * @param warnings These Warning shall be shown
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 setMessages: function(errors, warnings) {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
129 //todo this is a stub
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
130 },
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
131
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
132 /**
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
133 * Instructs the fields / forms listed in this method to clear their messages.
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
134 */
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
135 clearMessages: function() {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents:
diff changeset
136 //todo this is a stub
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

http://lada.wald.intevation.org