Mercurial > lada > lada-client
annotate app/controller/Map.js @ 1256:f961f94495c8
Remove erroneous error handling.
This code seems to expect any LADA validation results coming along
with an HTTP status not indicating success, which should not happen.
Instead, Ext.JSON.decode() failed because of the non-JSON responseText
resulting from other errors.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 18 Nov 2016 19:46:15 +0100 |
parents | 6e28ebbe1a73 |
children |
rev | line source |
---|---|
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 /** |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
10 * This is a controller for a Map. |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
11 * Maps are used in the Ortsangaben of a Probe. |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 */ |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 Ext.define('Lada.controller.Map', { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 extend: 'Ext.app.Controller', |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 requires: [ |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 ], |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
19 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
20 * Initialize the Controller |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
21 * It has only one listener. |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
22 */ |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 init: function() { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 this.control({ |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 'maptoolbar button[action=add]': { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 click: this.addLocation |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 }); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 this.callParent(arguments); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 }, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
32 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
33 * addLocation is a function which can be |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
34 * used to add an location to create a new Location |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
35 * with the help of the map. |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
36 * The function uses {@link Lada.view.panel.Map#activateDraw} |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
37 */ |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 addLocation: function(button) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 var mapPanel = button.up('map'); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 var details = button.up('window').down('locationform'); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 var newLocation = Ext.create('Lada.model.Location'); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 details.setRecord(newLocation); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 details.setReadOnly(false); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 mapPanel.activateDraw(newLocation); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 }); |