Mercurial > lada > lada-client
annotate app/view/window/OrtEdit.js @ 686:14ac75f80ba1
Forgot to commit the controller for commit 684
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Wed, 25 Mar 2015 15:20:45 +0100 |
parents | 71e8b84d7829 |
children | 6a6d1b02a1a3 |
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, |
644
71e8b84d7829
Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
614
diff
changeset
|
28 grid: null, |
606
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 initComponent: function() { |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 if (this.record === null) { |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 Ext.Msg.alert('Kein valider Ort ausgewählt!'); |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 this.callParent(arguments); |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 return; |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 } |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 this.title = 'Ort'; |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 this.buttons = [{ |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 text: 'Schließen', |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 scope: this, |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 handler: this.close |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 }]; |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 this.width = 900; |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 this.height = 515; |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 this.bodyStyle = {background: '#fff'}; |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 this.items = [{ |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 region: 'west', |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 border: 0, |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 layout: 'vbox', |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 items: [{ |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 xtype: 'ortform', |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 margin: 5, |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 recordId: this.record.get('id') |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 }, { |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 xtype: 'locationform', |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 margin: 5, |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 recordId: this.record.get('id') |
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 }, { |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 xtype: 'fset', |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 bodyStyle: { |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 background: '#fff' |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 }, |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 layout: 'border', |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 name: 'mapfield', |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 title: 'Karte', |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 region: 'center', |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 padding: '5, 5', |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 margin: 5, |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 items: [{ |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 xtype: 'map', |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 region: 'center', |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 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
|
74 record: this.record, |
606
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 bodyStyle: { |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 background: '#fff' |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 }, |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 name: 'map' |
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 }]; |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 this.callParent(arguments); |
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 |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 initData: function() { |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 this.down('ortform').setRecord(this.record); |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 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
|
87 failure: function(record, action) { |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 // TODO |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 }, |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 success: function(record, response) { |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 this.down('locationform').setRecord(record); |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 this.down('locationform').setReadOnly(true); |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 }, |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 scope: this |
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 |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 setMessages: function(errors, warnings) { |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 //todo this is a stub |
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 |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 clearMessages: function() { |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 //todo this is a stub |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 } |
2b2d284bd6e4
Added ort edit window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 }); |