annotate app/controller/Sql.js @ 535:60c5c796a57e

Don't edit 'Status' field This is read from the Status entries belonging to the probe
author Roland Geider <roland.geider@intevation.de>
date Wed, 17 Dec 2014 14:57:03 +0100
parents 9545adcfceeb
children
rev   line source
472
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 431
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 431
diff changeset
2 * Software engineering by Intevation GmbH
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 431
diff changeset
3 *
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 431
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 431
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
472
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 431
diff changeset
7 */
debfcc7713e3 Added license header to each file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 431
diff changeset
8
294
92b475303806 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 253
diff changeset
9 /**
92b475303806 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 253
diff changeset
10 * Controller for the Search
92b475303806 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 253
diff changeset
11 * This controller handles all logic related to the search
92b475303806 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 253
diff changeset
12 */
6
8e79bda4d55b Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
13 Ext.define('Lada.controller.Sql', {
8e79bda4d55b Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
14 extend: 'Ext.app.Controller',
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
15
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
16 requires: [
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
17 'Lada.view.widgets.Mst',
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
18 'Lada.view.widgets.Uwb',
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
19 'Lada.view.widgets.Datetime',
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
20 'Lada.view.About'
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
21 ],
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
22
8
e4fcb4ddd782 Moved stored SQL into its own file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 6
diff changeset
23 stores: [
235
78134e20e62d Added new model and store for Queries.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 147
diff changeset
24 'Proben', // List of found Proben
374
832e3c8f9191 Implemented dynamic ProbelList model. The model will get initialized by the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 370
diff changeset
25 'ProbenList', // List of found Proben
386
00bf2d4f3bd1 Added about dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 378
diff changeset
26 'Queries',
422
f9bb1ecf6462 Removed trailing commas.
Raimund Renkert <rrenkert@intevation.de>
parents: 413
diff changeset
27 'Info'
8
e4fcb4ddd782 Moved stored SQL into its own file.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 6
diff changeset
28 ],
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
29
6
8e79bda4d55b Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
30 init: function() {
8e79bda4d55b Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
31 this.control({
8e79bda4d55b Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
32 // CSS like selector to select element in the viewport. See
8e79bda4d55b Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
33 // ComponentQuery documentation for more details.
31
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
34 '#search': {
6
8e79bda4d55b Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
35 // Map Doubleclick on rows of the probenlist.
28
4d60b9ebce15 Renamed sql modul into search. Further display The query selection as Combobox
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 25
diff changeset
36 select: this.selectSql
31
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
37 },
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
38 '#SearchBtn': {
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
39 // Map click event on Button.
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
40 click: this.search
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
41 },
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
42 '#ResetBtn': {
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
43 // Map click event on Button.
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
44 click: this.reset
386
00bf2d4f3bd1 Added about dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 378
diff changeset
45 },
00bf2d4f3bd1 Added about dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 378
diff changeset
46 '#AboutBtn': {
00bf2d4f3bd1 Added about dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 378
diff changeset
47 // Map click event on Button.
00bf2d4f3bd1 Added about dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 378
diff changeset
48 click: this.about
6
8e79bda4d55b Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
49 }
8e79bda4d55b Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
50 });
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
51 this.callParent(arguments);
6
8e79bda4d55b Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
52 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
53
294
92b475303806 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 253
diff changeset
54 /**
92b475303806 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 253
diff changeset
55 * Function called when the user selects a SQL query in the dropdownlist.
92b475303806 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 253
diff changeset
56 * The function will hide/display additional element related to the
92b475303806 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 253
diff changeset
57 * selected search query
92b475303806 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 253
diff changeset
58 */
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
59 selectSql: function(element, record) {
241
4ca858026191 If the user selects a search query add call setupColumns method to dynamically
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 235
diff changeset
60 var result = Ext.getCmp('result');
246
c5d7fae5997a Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 241
diff changeset
61 var filters = Ext.getCmp('queryfilters');
527
9545adcfceeb Removed sql statement and added column header to query selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 520
diff changeset
62 var columns = Ext.getCmp('results');
252
1bce2d59b7e9 Update description and sql statement when chosing another query
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 251
diff changeset
63 var sqldesc = Ext.getCmp('sqldesc');
31
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
64 var buttons = Ext.getCmp('SearchBtnPanel');
253
424f18da3c64 Fixed variable name
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 252
diff changeset
65 var displayFields = record[0].data.results;
246
c5d7fae5997a Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 241
diff changeset
66 var filterFields = record[0].data.filters;
253
424f18da3c64 Fixed variable name
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 252
diff changeset
67
31
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
68 this.reset();
246
c5d7fae5997a Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 241
diff changeset
69
527
9545adcfceeb Removed sql statement and added column header to query selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 520
diff changeset
70 columnString = [];
9545adcfceeb Removed sql statement and added column header to query selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 520
diff changeset
71 for (var i = 0; i < displayFields.length; i++) {
9545adcfceeb Removed sql statement and added column header to query selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 520
diff changeset
72 columnString.push(displayFields[i].header);
9545adcfceeb Removed sql statement and added column header to query selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 520
diff changeset
73 }
9545adcfceeb Removed sql statement and added column header to query selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 520
diff changeset
74 columns.setValue(columnString.join(', '));
252
1bce2d59b7e9 Update description and sql statement when chosing another query
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 251
diff changeset
75 sqldesc.setValue(record[0].data.description);
1bce2d59b7e9 Update description and sql statement when chosing another query
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 251
diff changeset
76
246
c5d7fae5997a Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 241
diff changeset
77 // Setup Columns of the probenlist
413
e1af66012ef0 Reverse displayFields Array before configuring the columns of the result list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 403
diff changeset
78 displayFields.reverse();
241
4ca858026191 If the user selects a search query add call setupColumns method to dynamically
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 235
diff changeset
79 result.setupColumns(displayFields);
246
c5d7fae5997a Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 241
diff changeset
80
369
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
81 // Setup Filters of the probenlist
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
82 //
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
83 // Allowed types are
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
84 // * text
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
85 // * number
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
86 // * datetime
375
1327dd6ec246 Added more search filters.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 374
diff changeset
87 // * bool
369
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
88 // * listmst
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
89 // * listumw
375
1327dd6ec246 Added more search filters.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 374
diff changeset
90 // * listver
1327dd6ec246 Added more search filters.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 374
diff changeset
91 // * listdbasis
1327dd6ec246 Added more search filters.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 374
diff changeset
92 // * listnetz
369
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
93 //
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
94 // Iterate over all configured filters and add filters dynamically
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
95 //
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
96 // 1. Empty filters
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
97 filters.removeAll();
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
98 var hide = true;
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
99 // 2. Iterate over all configured filters
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
100 var j;
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
101 for (j = 0; j < filterFields.length; j++) {
369
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
102 var type = filterFields[j].type;
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
103 var name = filterFields[j].dataIndex;
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
104 var label = filterFields[j].label;
418
957a4a9fd260 Enabled multiselect for query filter. (Used as example in final workshop)
Raimund Renkert <rrenkert@intevation.de>
parents: 413
diff changeset
105 var multi = filterFields[j].multiSelect;
369
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
106 var field = null;
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
107 if (type === 'text') {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
108 field = Ext.create('Ext.form.field.Text', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
109 name: name,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
110 fieldLabel: label
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
111 });
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
112 }
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
113 else if (type === 'number') {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
114 field = Ext.create('Ext.form.field.Number', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
115 name: name,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
116 fieldLabel: label
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
117 });
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
118 }
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
119 else if (type === 'datetime') {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
120 field = Ext.create('Lada.view.widgets.Datetime', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
121 name: name,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
122 fieldLabel: label
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
123 });
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
124 }
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
125 else if (type === 'bool') {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
126 field = Ext.create('Lada.view.widgets.Testdatensatz', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
127 name: name,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
128 fieldLabel: label,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
129 emptyText: ''
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
130 });
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
131 }
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
132 else if (type === 'listmst') {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
133 field = Ext.create('Lada.view.widgets.Mst', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
134 name: name,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
135 fieldLabel: label,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
136 multiSelect: multi
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
137 });
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
138 }
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
139 else if (type === 'listumw') {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
140 field = Ext.create('Lada.view.widgets.Uwb', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
141 name: name,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
142 fieldLabel: label,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
143 multiSelect: multi
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
144 });
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
145 }
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
146 else if (type === 'listdbasis') {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
147 field = Ext.create('Lada.view.widgets.Datenbasis', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
148 name: name,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
149 fieldLabel: label,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
150 multiSelect: multi
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
151 });
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
152 }
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
153 else if (type === 'listver') {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
154 field = Ext.create('Lada.view.widgets.Verwaltungseinheit', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
155 name: name,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
156 fieldLabel: label,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
157 multiSelect: multi
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
158 });
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
159 }
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
160 else if (type === 'listnetz') {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
161 field = Ext.create('Lada.view.widgets.Netzbetreiber', {
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
162 name: name,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
163 fieldLabel: label,
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
164 multiSelect: multi
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
165 });
366
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 365
diff changeset
166 }
369
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
167 if (field) {
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
168 filters.add(field);
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
169 filters.show();
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
170 hide = false;
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
171 }
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
172 }
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
173 if (hide) {
246
c5d7fae5997a Change logic how to show and hide the search filters. Now we iterate over the
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 241
diff changeset
174 filters.hide();
369
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
175 }
31
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
176 buttons.show();
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
177 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
178
294
92b475303806 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 253
diff changeset
179 /**
92b475303806 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 253
diff changeset
180 * Function is called when the user clicks the search button. The function
92b475303806 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 253
diff changeset
181 * will perform a search to the server on refreshes the result list.
92b475303806 Inherit from Base controller
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 253
diff changeset
182 */
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
183 search: function() {
31
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
184 var result = Ext.getCmp('result');
369
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
185 var filters = Ext.getCmp('queryfilters');
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
186 var search = Ext.getCmp('search');
36
2a67e062519b Implemted search. When user clicks on the search buttons parameters are
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 35
diff changeset
187
2a67e062519b Implemted search. When user clicks on the search buttons parameters are
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 35
diff changeset
188 // Get search parameters:
2a67e062519b Implemted search. When user clicks on the search buttons parameters are
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 35
diff changeset
189 var searchParams = {};
369
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
190 searchParams['qid'] = search.getValue();
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
191 for (var i = filters.items.length - 1; i >= 0; i--) {
369
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
192 var filter = filters.items.items[i];
cebed9ef8293 Dynamically add configured search filters. Send needed values to the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 366
diff changeset
193 var value = filter.getValue();
378
d001e88affde Fixed building searchparams support empty selection in multiselect.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 375
diff changeset
194 if (value instanceof Array) {
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
195 value = value.join(',');
378
d001e88affde Fixed building searchparams support empty selection in multiselect.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 375
diff changeset
196 }
d001e88affde Fixed building searchparams support empty selection in multiselect.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 375
diff changeset
197 searchParams[filter.getName()] = value;
36
2a67e062519b Implemted search. When user clicks on the search buttons parameters are
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 35
diff changeset
198 }
2a67e062519b Implemted search. When user clicks on the search buttons parameters are
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 35
diff changeset
199 result.getStore().load({
2a67e062519b Implemted search. When user clicks on the search buttons parameters are
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 35
diff changeset
200 params: searchParams
2a67e062519b Implemted search. When user clicks on the search buttons parameters are
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 35
diff changeset
201 });
25
f964a50bfe57 Restructured the application. Fixed layouts etc.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 17
diff changeset
202 result.show();
31
897e3100c6da Changed logic of the Probenauswahl. Now logic works like the BFS version.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 28
diff changeset
203 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
204
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
205 reset: function() {
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
206 // var buttons = Ext.getCmp('SearchBtnPanel');
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
207 // var result = Ext.getCmp('result');
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
208 // for (var i = 0; i < queries.length; ++i) {
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
209 // var toHide = Ext.getCmp(queries[i]);
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
210 // toHide.hide();
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
211 // }
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
212 // result.hide();
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
213 // buttons.hide();
386
00bf2d4f3bd1 Added about dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 378
diff changeset
214 },
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
215
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
216 about: function() {
386
00bf2d4f3bd1 Added about dialog.
Torsten Irländer <torsten.irlaender@intevation.de>
parents: 378
diff changeset
217 var info = this.getInfoStore();
500
ad7f574b382a Fixed some js related issues (unused vars, arrays, etc.) and code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 499
diff changeset
218 Ext.widget('about', {
491
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
219 info: info
850ccfe5f3c4 Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 472
diff changeset
220 });
6
8e79bda4d55b Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
221 }
8e79bda4d55b Added a list to select predefined SQL Statement for the Proben list.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff changeset
222 });

http://lada.wald.intevation.org