annotate app/controller/grid/Ortszuordnung.js @ 1284:faecbb446a04

Ortserstellung: new Messpunkt from map, clone or form functional, still needs error handling and layout
author Maximilian Krambach <mkrambach@intevation.de>
date Tue, 24 Jan 2017 12:58:26 +0100
parents 291df0037835
children e317ba349204
rev   line source
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
cf328526b5bb Moved controller into subfolders.
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: 701
diff changeset
9 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
10 * This is a controller for a grid of Orte
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
11 */
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
12 Ext.define('Lada.controller.grid.Ortszuordnung', {
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.app.Controller',
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14
602
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
15 requires: [
1279
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
16 'Lada.view.window.Ortszuordnung',
1284
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
17 'Lada.view.window.Ortserstellung'
602
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
18 ],
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
19
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
20 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
21 * Inhitialize the controller
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
22 * It has 3 listeners
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
23 */
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 init: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 this.control({
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
26 'ortszuordnunggrid': {
602
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
27 itemdblclick: this.open
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 },
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
29 'ortszuordnunggrid button[action=add]': {
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 click: this.add
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 },
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
32 'ortszuordnunggrid button[action=delete]': {
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 click: this.remove
1279
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
34 },
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
35 'ortszuordnungwindow toolbar button[action=createort]':{
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
36 click: this.createort
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
37 },
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
38 'ortszuordnungwindow toolbar button[action=frommap]':{
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
39 click: this.frommap
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
40 },
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
41 'ortszuordnungwindow toolbar button[action=clone]':{
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
42 click: this.cloneort
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 });
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
47 /**
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents: 1012
diff changeset
48 * When open is called, a {@link Lada.view.window.Ortszuordnung}
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
49 * is created which allows to edit the Orte
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
50 */
602
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
51 open: function(grid, record) {
690
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 644
diff changeset
52 var probe = grid.up('window').record;
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents: 1012
diff changeset
53 var win = Ext.create('Lada.view.window.Ortszuordnung', {
690
e88381fb3bdb Use treeModiefied timestamp to determine if working with 'old' objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 644
diff changeset
54 parentWindow: grid.up('window'),
1279
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
55 probe: probe,
1028
2e7adc19b4fe Do not copy the Record to the Ortszuordnungwin
Dustin Demuth <dustin@intevation.de>
parents: 1022
diff changeset
56 record: record,
644
71e8b84d7829 Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 643
diff changeset
57 grid: grid
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 });
602
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
59 win.show();
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
60 win.initData();
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
63 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
64 * This function adds a new row to add an Ort
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
65 */
643
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
66 add: function(button) {
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
67 var probe = button.up('window').record;
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents: 1012
diff changeset
68 var win = Ext.create('Lada.view.window.Ortszuordnung', {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents: 1012
diff changeset
69 parentWindow: button.up('window'),
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents: 1012
diff changeset
70 probe: probe,
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents: 1012
diff changeset
71 record: null,
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
72 grid: button.up('ortszuordnung')
643
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
73 });
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
74 win.show();
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
75 win.initData();
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
78 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
79 * A Ort-row can be removed from the grid with the remove
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
80 * function. It asks the user for confirmation
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
81 * If the removal was confirmed, it reloads the parent window on success,
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
82 * on failure, an error message is shown.
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
83 */
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 remove: function(button) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 var grid = button.up('grid');
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 var selection = grid.getView().getSelectionModel().getSelection()[0];
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
87 var i18n = Lada.getApplication().bundle;
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
88 Ext.MessageBox.confirm(i18n.getMsg('delete'), i18n.getMsg('confirmation.question'),
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
89 function(btn) {
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
90 if (btn === 'yes') {
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 selection.destroy({
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 success: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 button.up('window').initData();
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 },
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
95 failure: function(request, response) {
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
96 var i18n = Lada.getApplication().bundle;
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
97 var json = response.request.scope.reader.jsonData;
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
98 if (json) {
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
99 if (json.message){
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
100 Ext.Msg.alert(i18n.getMsg('err.msg.delete.title')
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
101 +' #'+json.message,
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
102 i18n.getMsg(json.message));
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
103 } else {
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
104 Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
105 i18n.getMsg('err.msg.generic.body'));
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
106 }
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
107 } else {
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
108 Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
109 i18n.getMsg('err.msg.response.body'));
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
110 }
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 });
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 });
826
2362f8ab1e9f disable remove button after a item is deleted from grid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
115 grid.down('button[action=delete]').disable();
1279
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
116 },
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
117
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
118 /**
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
119 * Opens the form for a new Messpunkt
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
120 */
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
121 createort: function() {
1284
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
122 Ext.create('Lada.view.window.Ortserstellung',{
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
123 parentWindow: button.up('ortszuordnungwindow')
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
124 }).show();
1279
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
125 },
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
126
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
127 /**
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
128 *
1284
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
129 * Creates an event listener for a map click
1279
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
130 */
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
131 frommap: function(button) {
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
132 var map = button.up('ortszuordnungwindow').down('map');
1284
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
133 var me = this;
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
134 map.map.events.register('click', button, me.newOrtfromMapClick);
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
135 // TODO visual feedback that map click is active.
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
136 // TODO Deactivate event listener if button is destroyed
1279
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
137 },
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
138
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
139 /**
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
140 * Opens the form for a new Messpunkt, with all values prefilled from the currently
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
141 * selected item
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
142 */
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
143 cloneort: function(button) {
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
144 var grid = button.up('ortszuordnungwindow').down('ortstammdatengrid').getView();
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
145 var selected = grid.getSelectionModel().getSelection()[0];
1284
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
146 Ext.create('Lada.view.window.Ortserstellung', {
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
147 record: Ext.create('Lada.model.Ort', selected.data),
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
148 parentWindow: button.up('ortszuordnungwindow')
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
149 }).show();
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
150 },
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
151
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
152 /**
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
153 * Gets the clicked map's coordinates and opens a new Messpunkt window with coordinates prefilled
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
154 */
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
155 newOrtfromMapClick: function(evt) {
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
156 var me = this; //this = button(action:frommap)
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
157 var map = this.up('ortszuordnungwindow').down('map').map;
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
158 var lonlat = map.getLonLatFromViewPortPx(evt.xy).transform(new OpenLayers.Projection('EPSG:3857'),
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
159 new OpenLayers.Projection('EPSG:4326'));
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
160 var controller = Lada.app.getController('Lada.controller.grid.Ortszuordnung');
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
161 map.events.unregister('click', this, controller.newOrtfromMapClick);
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
162 Ext.create('Lada.view.window.Ortserstellung', {
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
163 record: Ext.create('Lada.model.Ort',{
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
164 koordXExtern: lonlat.lon,
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
165 koordYExtern: lonlat.lat,
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
166 kdaId : 4
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
167 }),
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
168 parentWindow: this.up('ortszuordnungwindow')
1279
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
169 }).show();
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171 });

http://lada.wald.intevation.org