Mercurial > lada > lada-client
annotate app/controller/form/Location.js @ 803:1e7095533038
Removed console output from map
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Fri, 22 May 2015 13:16:06 +0200 |
parents | 6e28ebbe1a73 |
children | 2b7bcb778f0a |
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 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
9 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
10 * This is a Controller for a Location Form |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
11 */ |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.controller.form.Location', { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.app.Controller', |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
14 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
15 * Initialize the Controller with |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
16 * 5 listeners |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
17 */ |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 init: function() { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 this.control({ |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 'locationform button[action=save]': { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 click: this.save |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 }, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 'locationform button[action=discard]': { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 click: this.discard |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 }, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 'locationform': { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 dirtychange: this.dirtyForm |
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 'locationform numberfield[name=latitude]': { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 change: this.updateFeatureLatitude |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 }, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 'locationform numberfield[name=longitude]': { |
718
7f11b75e0188
Trailing Commas, editable: false for Umwelt und Messstelle widget
Dustin Demuth <dustin@intevation.de>
parents:
704
diff
changeset
|
33 change: this.updateFeatureLongitude |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 }); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 }, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
38 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
39 * The save function saves the content of the Location form. |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
40 * On success it will reload the Store, |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
41 * on failure, it will display an Errormessage |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
42 */ |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 save: function(button) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 var formPanel = button.up('form'); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 var data = formPanel.getForm().getFieldValues(true); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 for (var key in data) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 formPanel.getForm().getRecord().set(key, data[key]); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 formPanel.getForm().getRecord().save({ |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 success: function(record, response) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 var json = Ext.decode(response.response.responseText); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 if (json) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 button.setDisabled(true); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 button.up('toolbar').down('button[action=discard]') |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 .setDisabled(true); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 formPanel.clearMessages(); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 formPanel.setRecord(record); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 formPanel.setMessages(json.errors, json.warnings); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 button.up('window').down('map').locationRecord = null; |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 var orte = button.up('window').down('ortform combobox'); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 orte.store.reload({ |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 callback: function() { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 orte.setValue(record.data.id); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 }); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 }, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 failure: function(record, response) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 button.setDisabled(true); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 button.up('toolbar').down('button[action=discard]') |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 .setDisabled(true); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 formPanel.getForm().loadRecord(formPanel.getForm().getRecord()); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 var json = response.request.scope.reader.jsonData; |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 if (json) { |
695
d6ef146e1a9f
Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
75 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ |
d6ef146e1a9f
Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
76 formPanel.setMessages(json.errors, json.warnings); |
d6ef146e1a9f
Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
77 } |
d6ef146e1a9f
Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
78 |
d6ef146e1a9f
Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
79 if(json.message){ |
704
2d454bfef426
Further Failure Messages
Dustin Demuth <dustin@intevation.de>
parents:
701
diff
changeset
|
80 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title') |
701
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
81 +' #'+json.message, |
695
d6ef146e1a9f
Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
82 Lada.getApplication().bundle.getMsg(json.message)); |
701
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
83 } else { |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
84 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
85 Lada.getApplication().bundle.getMsg('err.msg.generic.body')); |
695
d6ef146e1a9f
Added simple handling for Failure-Messages
Dustin Demuth <dustin@intevation.de>
parents:
638
diff
changeset
|
86 } |
701
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
87 } else { |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
88 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'), |
f0bc5387abcc
Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents:
695
diff
changeset
|
89 Lada.getApplication().bundle.getMsg('err.msg.response.body')); |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 }); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 }, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
95 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
96 * The discard function resets the Location form |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
97 * to its original state. |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
98 */ |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 discard: function(button) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 var formPanel = button.up('form'); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 formPanel.getForm().loadRecord(formPanel.getForm().getRecord()); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 button.up('window').down('map').locationRecord = null; |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 }, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
105 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
106 * The dirtyForm function enables or disables the save and discard |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
107 * button which are present in the toolbar of the form. |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
108 * The Buttons are only active if the content of the form was altered |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
109 * (the form is dirty). |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
110 */ |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
111 dirtyForm: function(form, dirty) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 if (dirty) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
113 form.owner.down('button[action=save]').setDisabled(false); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 form.owner.down('button[action=discard]').setDisabled(false); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 else { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 form.owner.down('button[action=save]').setDisabled(true); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
118 form.owner.down('button[action=discard]').setDisabled(true); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
119 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
120 }, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
121 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
122 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
123 * This function updates the Latitude (heigth-value / y-value) of a feature |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
124 * (geospatial object). The feature can be a marker in the map |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
125 * @param {Ext.form.field.Field} field the Ext.field which was altered |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
126 * @param {} nValue the new Latitude as WGS84 in decimaldegrees |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
127 */ |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 updateFeatureLatitude: function(field, nValue) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 var layer = field.up('window').down('map').selectControl.layer; |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 var newLocation = field.up('window').down('map').locationRecord; |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
131 if (layer && layer.selectedFeatures[0] && newLocation) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
132 var feature = layer.getFeatureById(layer.selectedFeatures[0].id); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
133 feature.move(new OpenLayers.LonLat(feature.geometry.x, nValue)); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
134 layer.refresh(); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
136 }, |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
138 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
139 * This function updates the Longitude (right-value / x-value) of a feature |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
140 * (geospatial object). The feature can be a marker in the map |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
141 * @param {Ext.form.field.Field} field the Ext.field which was altered |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
142 * @param {} nValue the new Longitude as WGS84 in decimaldegrees |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
718
diff
changeset
|
143 */ |
638
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
144 updateFeatureLongitude: function(field, nValue) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 var layer = field.up('window').down('map').selectControl.layer; |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 var newLocation = field.up('window').down('map').locationRecord; |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 if (layer && layer.selectedFeatures[0] && newLocation) { |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
148 var feature = layer.getFeatureById(layer.selectedFeatures[0].id); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
149 feature.move(new OpenLayers.LonLat(nValue, feature.geometry.y)); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
150 layer.refresh(); |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 } |
d21048cbdbb3
Added controllers for map and location form and handle new locations.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
153 }); |