annotate app/controller/grid/Ortszuordnung.js @ 1318:cc90b8050887

code style.
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 03 Feb 2017 13:18:12 +0100
parents 8ace34d9352a
children 6edab3ee2198
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',
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
17 'Lada.view.window.Ortserstellung',
1287
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
18 'Lada.view.window.OrtFilter'
602
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
19 ],
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
20
1287
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
21 resultPanel: null,
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
22 searchField: null,
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
23
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
24 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
25 * Inhitialize the controller
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
26 * It has 3 listeners
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
27 */
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 init: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 this.control({
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
30 'ortszuordnunggrid': {
602
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
31 itemdblclick: this.open
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 },
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
33 'ortszuordnunggrid button[action=add]': {
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 click: this.add
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 },
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
36 'ortszuordnunggrid button[action=delete]': {
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 click: this.remove
1279
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
38 },
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
39 'ortszuordnungwindow toolbar button[action=createort]':{
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
40 click: this.createort
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
41 },
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
42 'ortszuordnungwindow toolbar button[action=frommap]':{
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
43 click: this.frommap
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
44 },
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
45 'ortszuordnungwindow toolbar button[action=clone]':{
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
46 click: this.cloneort
1287
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
47 },
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
48 'ortszuordnungwindow toolbar textfield[name=search]': {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
49 keyup: this.search
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
50 },
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
51 'ortfilterwindow grid[name=messpunkte]': {
1305
3754111e365a Changed selection in ort filter from dblclick to click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1304
diff changeset
52 itemclick: this.selectedMesspunkt
1287
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
53 },
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
54 'ortfilterwindow grid[name=verwaltungseinheiten]': {
1305
3754111e365a Changed selection in ort filter from dblclick to click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1304
diff changeset
55 itemclick: this.selectedVerwaltungseinheit
1287
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
56 },
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
57 'ortfilterwindow grid[name=staaten]': {
1305
3754111e365a Changed selection in ort filter from dblclick to click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1304
diff changeset
58 itemclick: this.selectedStaat
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 });
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 /**
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents: 1012
diff changeset
64 * When open is called, a {@link Lada.view.window.Ortszuordnung}
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
65 * is created which allows to edit the Orte. record is an ortszuordnung
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
66 * or ortzuordnungMp
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
67 */
602
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
68 open: function(grid, record) {
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
69 var parent = grid.up('window').record;
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
70 // parent is either probe or messprogramm.
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
71 var parentisMp = false;
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
72 if (parent.data.hauptprobenNr === undefined) {
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
73 parentisMp = true;
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
74 }
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents: 1012
diff changeset
75 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
76 parentWindow: grid.up('window'),
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
77 probe: parentisMp ? null: parent,
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
78 messprogramm: parentisMp ? parent: null,
1028
2e7adc19b4fe Do not copy the Record to the Ortszuordnungwin
Dustin Demuth <dustin@intevation.de>
parents: 1022
diff changeset
79 record: record,
644
71e8b84d7829 Reload grids on messung or ort changed/added.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 643
diff changeset
80 grid: grid
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 });
602
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
82 win.show();
e1ab24758392 Updated the ort grid controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 587
diff changeset
83 win.initData();
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
86 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
87 * 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
88 */
643
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
89 add: function(button) {
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
90 var parent = button.up('window').record;
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
91 var parentisMp = false;
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
92 if (parent.data.hauptprobenNr === undefined) {
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
93 parentisMp = true;
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
94 }
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents: 1012
diff changeset
95 var win = Ext.create('Lada.view.window.Ortszuordnung', {
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents: 1012
diff changeset
96 parentWindow: button.up('window'),
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
97 probe: parentisMp ? null: parent,
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
98 messprogramm: parentisMp ? parent: null,
1013
75ce503ab296 Added a Ortszuordnungwindow and Form
Dustin Demuth <dustin@intevation.de>
parents: 1012
diff changeset
99 record: null,
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
100 grid: button.up('ortszuordnung')
643
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
101 });
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
102 win.show();
477379250512 Open the ort create window on button click.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 602
diff changeset
103 win.initData();
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 },
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105
742
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
106 /**
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
107 * 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
108 * function. It asks the user for confirmation
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
109 * 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
110 * on failure, an error message is shown.
6e28ebbe1a73 added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents: 701
diff changeset
111 */
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 remove: function(button) {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 var grid = button.up('grid');
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 var selection = grid.getView().getSelectionModel().getSelection()[0];
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
115 var i18n = Lada.getApplication().bundle;
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
116 Ext.MessageBox.confirm(i18n.getMsg('delete'), i18n.getMsg('confirmation.question'),
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
117 function(btn) {
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
118 if (btn === 'yes') {
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 selection.destroy({
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 success: function() {
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 button.up('window').initData();
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 },
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
123 failure: function(request, response) {
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
124 var i18n = Lada.getApplication().bundle;
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
125 var json = response.request.scope.reader.jsonData;
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
126 if (json) {
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
127 if (json.message){
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
128 Ext.Msg.alert(i18n.getMsg('err.msg.delete.title')
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
129 +' #'+json.message,
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
130 i18n.getMsg(json.message));
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
131 } else {
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
132 Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
133 i18n.getMsg('err.msg.generic.body'));
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
134 }
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
135 } else {
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
136 Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 826
diff changeset
137 i18n.getMsg('err.msg.response.body'));
701
f0bc5387abcc Added failure - Messages
Dustin Demuth <dustin@intevation.de>
parents: 690
diff changeset
138 }
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
140 });
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 });
826
2362f8ab1e9f disable remove button after a item is deleted from grid
Dustin Demuth <dustin@intevation.de>
parents: 742
diff changeset
143 grid.down('button[action=delete]').disable();
1279
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
144 },
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
145
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
146 /**
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
147 * Opens the form for a new Messpunkt
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
148 */
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
149 createort: function(button) {
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
150 Ext.create('Lada.view.window.Ortserstellung',{
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
151 parentWindow: button.up('ortszuordnungwindow')
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
152 }).show();
1279
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
153 },
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
154
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
155 /**
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
156 *
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
157 * 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
158 */
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
159 frommap: function(button) {
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
160 var map = button.up('ortszuordnungwindow').down('map');
1291
e9f812528324 ortszuordnung form changes
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
161 map.getEl().setStyle('cursor', 'crosshair');
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
162 var me = this;
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
163 map.map.events.register('click', button, me.newOrtfromMapClick);
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
164 // 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
165 },
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
166
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
167 /**
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
168 * 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
169 * selected item
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
170 */
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
171 cloneort: function(button) {
291df0037835 Ortszuordnung window: create, change and display (wip)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1051
diff changeset
172 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
173 var selected = grid.getSelectionModel().getSelection()[0];
1309
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
174 var newRecord = Ext.create('Lada.model.Ort', selected.data);
1314
8ace34d9352a changed behaviour of ortserstellung window on save; fix update (form)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1309
diff changeset
175 newRecord.set('ortId', null);
8ace34d9352a changed behaviour of ortserstellung window on save; fix update (form)
Maximilian Krambach <mkrambach@intevation.de>
parents: 1309
diff changeset
176 newRecord.set('id', null);
1309
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
177 Ext.create('Lada.view.window.Ortserstellung', {
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
178 record: newRecord,
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
179 parentWindow: button.up('ortszuordnungwindow')
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
180 }).show();
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
181 },
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
182
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
183 /**
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
184 * Gets the clicked map's coordinates and opens a new Messpunkt window with coordinates prefilled
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
185 */
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
186 newOrtfromMapClick: function(evt) {
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
187 var me = this; //this = button(action:frommap)
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
188 var map = this.up('ortszuordnungwindow').down('map').map;
1291
e9f812528324 ortszuordnung form changes
Maximilian Krambach <mkrambach@intevation.de>
parents: 1289
diff changeset
189 this.up('ortszuordnungwindow').down('map').getEl().setStyle('cursor', 'auto');
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
190 var lonlat = map.getLonLatFromViewPortPx(evt.xy).transform(new OpenLayers.Projection('EPSG:3857'),
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
191 new OpenLayers.Projection('EPSG:4326'));
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
192 var controller = Lada.app.getController('Lada.controller.grid.Ortszuordnung');
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
193 map.events.unregister('click', this, controller.newOrtfromMapClick);
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
194 Ext.create('Lada.view.window.Ortserstellung', {
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
195 record: Ext.create('Lada.model.Ort',{
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
196 koordXExtern: lonlat.lon,
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
197 koordYExtern: lonlat.lat,
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
198 kdaId : 4
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
199 }),
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
200 parentWindow: this.up('ortszuordnungwindow')
1284
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
201 }).show();
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
202 },
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
203
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
204 /**
1287
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
205 * Search triggered by textfield key event.
1284
faecbb446a04 Ortserstellung: new Messpunkt from map, clone or form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1279
diff changeset
206 */
1287
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
207 search: function(field, evt, opts) {
1304
9f15a932a525 Fixed ort filter close actions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
208 if (evt.getKey() === 27) {
9f15a932a525 Fixed ort filter close actions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
209 if (this.resultPanel.isVisible()) {
9f15a932a525 Fixed ort filter close actions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
210 this.resultPanel.close();
9f15a932a525 Fixed ort filter close actions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
211 return;
9f15a932a525 Fixed ort filter close actions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
212 }
9f15a932a525 Fixed ort filter close actions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
213 else {
9f15a932a525 Fixed ort filter close actions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
214 field.up('window').close();
9f15a932a525 Fixed ort filter close actions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
215 return;
9f15a932a525 Fixed ort filter close actions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
216 }
9f15a932a525 Fixed ort filter close actions.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
217 }
1287
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
218 this.searchField = field;
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
219 if ((evt.getKey() == 13 || evt.getKey() == 8) && field.getValue() && field.getValue().length > 0) {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
220 this.execSearch(field, field.getValue());
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
221 }
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
222 if (field.getValue().length === 0) {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
223 this.resultPanel.hide();
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
224 return;
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
225 }
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
226 if (field.getValue().length < 3) {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
227 return;
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
228 }
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
229 this.execSearch(field, field.getValue());
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
230 },
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
231
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
232 /*
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
233 * Execute search in stores (ort, verwaltungseinheit and staat) and
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
234 * display the resultset.
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
235 */
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
236 execSearch: function(field, filter) {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
237 // Filter stores
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
238 var messpunkte = Ext.data.StoreManager.get('orte');
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
239 var verwaltungseinheiten = Ext.data.StoreManager.get('verwaltungseinheiten');
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
240 var staaten = Ext.data.StoreManager.get('staaten');
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
241 messpunkte.clearFilter(true);
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
242 verwaltungseinheiten.clearFilter(true);
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
243 staaten.clearFilter(true);
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
244 messpunkte.filter({filterFn: function(item) {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
245 if (item.get('ortId').indexOf(filter) > -1) {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
246 return true;
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
247 }
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
248 if (item.get('kurztext').indexOf(filter) > -1) {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
249 return true;
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
250 }
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
251 if (item.get('langtext').indexOf(filter) > -1) {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
252 return true;
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
253 }
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
254 if (item.get('berichtstext') &&
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
255 item.get('berichtstext').indexOf(filter) > -1) {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
256 return true;
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
257 }
1309
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
258 if (item.get('gemId') &&
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
259 item.get('gemId').indexOf(filter) > -1) {
1287
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
260 return true;
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
261 }
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
262 }});
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
263 verwaltungseinheiten.filter('bezeichnung', filter);
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
264 staaten.filter('staat', filter);
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
265
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
266 if (!this.resultPanel) {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
267 this.resultPanel = Ext.create('Lada.view.window.OrtFilter', {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
268 x: 500,
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
269 y: 500,
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
270 alwaysOnTop: true,
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
271 parentWindow: this
1287
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
272 });
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
273 }
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
274 this.resultPanel.show();
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
275 this.resultPanel.updateGrids(messpunkte, verwaltungseinheiten, staaten);
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
276 this.resultPanel.reposition(field.getX() + field.getLabelWidth(), field.getY());
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
277 field.focus();
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
278 },
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
279
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
280 selectedMesspunkt: function(grid, record) {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
281 var win = grid.up('window');
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
282 win.hide();
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
283 this.searchField.reset();
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
284 var grid = this.searchField.up('panel').down('ortstammdatengrid');
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
285 grid.getSelectionModel().select(record);
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
286 grid.getView().focusRow(record);
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
287 },
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
288
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
289 selectedVerwaltungseinheit: function(grid, record) {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
290 var win = grid.up('window');
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
291 var panel = this.searchField.up('panel').up('window');
1287
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
292 win.hide();
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
293 this.searchField.reset();
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
294 Ext.create('Lada.view.window.Ortserstellung', {
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
295 record: Ext.create('Lada.model.Ort', {
1309
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
296 gemId: record.get('id'),
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
297 ortId: record.get('id'),
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
298 kurztext: record.get('bezeichnung'),
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
299 langtext: record.get('bezeichnung'),
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
300 berichtstext: record.get('bezeichnung')
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
301 }),
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
302 parentWindow: panel
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
303 }).show();
1287
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
304 },
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
305
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
306 selectedStaat: function(grid, record) {
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
307 var win = grid.up('window');
e317ba349204 Added search for orte, verwaltungseinheiten and staaten.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1284
diff changeset
308 win.hide();
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
309 this.searchField.reset();
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
310 Ext.create('Lada.view.window.Ortserstellung', {
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
311 record: Ext.create('Lada.model.Ort', {
1309
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
312 staatId: record.get('id'),
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
313 ortId: 'Staat_' + record.get('staatIso'),
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
314 kurztext: record.get('staat'),
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
315 langtext: record.get('staat'),
1bcc3a62e909 insert and preset OrtId field on Orterstellung
Maximilian Krambach <mkrambach@intevation.de>
parents: 1305
diff changeset
316 berichtstext: record.get('staat')
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
317 }),
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1288
diff changeset
318 parentWindow: win
1288
08085b7d1d0b Ortszuordnung: Search, new orte, display and validity check
Maximilian Krambach <mkrambach@intevation.de>
parents: 1287
diff changeset
319 }).show();
587
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
320 }
cf328526b5bb Moved controller into subfolders.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
321 });

http://lada.wald.intevation.org