annotate app/view/window/OrtEdit.js @ 614:04e380ce4d73

Load locations as layer on the map, set selections based on the selected 'ort'.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 13 Mar 2015 16:27:33 +0100
parents 2b2d284bd6e4
children 71e8b84d7829
rev   line source
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 /*
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Window to edit a Messung
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.window.OrtEdit', {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.window.Window',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.ortedit',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 requires: [
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 'Lada.view.panel.Map',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 'Lada.view.form.Ort',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 'Lada.view.form.Location'
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 ],
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 collapsible: true,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 maximizable: true,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 autoshow: true,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 layout: 'border',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 record: null,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 initComponent: function() {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 if (this.record === null) {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 Ext.Msg.alert('Kein valider Ort ausgewählt!');
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 this.callParent(arguments);
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 return;
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 }
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 this.title = 'Ort';
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 this.buttons = [{
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 text: 'Schließen',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 scope: this,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 handler: this.close
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 }];
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 this.width = 900;
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 this.height = 515;
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 this.bodyStyle = {background: '#fff'};
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 this.items = [{
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 region: 'west',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 border: 0,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 layout: 'vbox',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 items: [{
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 xtype: 'ortform',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 margin: 5,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 recordId: this.record.get('id')
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 }, {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 xtype: 'locationform',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 margin: 5,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 recordId: this.record.get('id')
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 }]
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 }, {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 xtype: 'fset',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 bodyStyle: {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 background: '#fff'
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 layout: 'border',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 name: 'mapfield',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 title: 'Karte',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 region: 'center',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 padding: '5, 5',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 margin: 5,
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 items: [{
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 xtype: 'map',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 region: 'center',
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 layout: 'border',
614
04e380ce4d73 Load locations as layer on the map, set selections based on the selected 'ort'.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 606
diff changeset
73 record: this.record,
606
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 bodyStyle: {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 background: '#fff'
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 name: 'map'
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 }]
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 }];
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 this.callParent(arguments);
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 initData: function() {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 this.down('ortform').setRecord(this.record);
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 Ext.ClassManager.get('Lada.model.Location').load(this.record.get('ort'), {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 failure: function(record, action) {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 // TODO
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 success: function(record, response) {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 this.down('locationform').setRecord(record);
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 this.down('locationform').setReadOnly(true);
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 scope: this
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 });
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 setMessages: function(errors, warnings) {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 //todo this is a stub
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 },
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 clearMessages: function() {
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 //todo this is a stub
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 }
2b2d284bd6e4 Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 });

http://lada.wald.intevation.org