Mercurial > lada > lada-client
annotate app/controller/grid/ProbeList.js @ 1430:24424aaa7dc5
Use development SNAPSHOT-server.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 07 Apr 2017 11:02:47 +0200 |
parents | 69ebd572fe5c |
children |
rev | line source |
---|---|
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
3 * |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
7 */ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
8 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
9 /** |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
10 * Controller for the ProbeList result grid. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
11 */ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.controller.grid.ProbeList', { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.app.Controller', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
14 requires: [ |
1227
848b50a4a4eb
Add missing requirements.
Tom Gottfried <tom@intevation.de>
parents:
1164
diff
changeset
|
15 'Lada.view.window.FileUpload', |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
16 'Lada.view.window.ProbeEdit', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
17 'Lada.view.window.GenProbenFromMessprogramm' |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
18 ], |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
19 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
20 /** |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
21 * Initialize the Controller with listeners |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
22 */ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
23 init: function() { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
24 this.control({ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
25 'probelistgrid': { |
977
56470a075e6e
Added methods to the controllers to disable/enable buttons in the toolbar when rows are (de)selected
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
26 itemdblclick: this.editItem, |
56470a075e6e
Added methods to the controllers to disable/enable buttons in the toolbar when rows are (de)selected
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
27 select: this.activateButtons, |
56470a075e6e
Added methods to the controllers to disable/enable buttons in the toolbar when rows are (de)selected
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
28 deselect: this.deactivateButtons |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
29 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
30 'probelistgrid toolbar button[action=addProbe]': { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
31 click: this.addProbeItem |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
32 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
33 'probelistgrid toolbar button[action=import]': { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
34 click: this.uploadFile |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
35 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
36 'probelistgrid toolbar button[action=export]': { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
37 click: this.downloadFile |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
38 }, |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
39 'probelistgrid toolbar button[action=printSheet]': { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
40 click: { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
41 fn: this.printSelection, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
42 mode: 'printsheet' |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
43 } |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
44 }, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
45 'probelistgrid toolbar button[action=printExtract]': { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
46 click: { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
47 fn: this.printSelection, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
48 mode: 'printextract' |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
49 } |
1111
a73726bba79c
Use custom row expander in probe list grid to display messung grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1082
diff
changeset
|
50 }, |
a73726bba79c
Use custom row expander in probe list grid to display messung grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1082
diff
changeset
|
51 'probelistgrid gridview': { |
a73726bba79c
Use custom row expander in probe list grid to display messung grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1082
diff
changeset
|
52 expandbody: this.expandBody, |
a73726bba79c
Use custom row expander in probe list grid to display messung grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1082
diff
changeset
|
53 collapsebody: this.collapseBody |
1400
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
54 }, |
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
55 'probelistgrid pagingtoolbar': { |
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
56 change: this.pageChange |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
57 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
58 }); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
59 this.callParent(arguments); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
60 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
61 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
62 /** |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
63 * This function is called after a Row in the |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
64 * {@link Lada.view.grid.ProbeList} |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
65 * was double-clicked. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
66 * The function opens a {@link Lada.view.window.ProbeEdit} |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
67 * or a {@link Lada.view.window.Messprogramm}. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
68 * To determine which window has to be opened, the function |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
69 * analyse the records modelname. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
70 */ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
71 editItem: function(grid, record) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
72 var winname = 'Lada.view.window.ProbeEdit'; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
73 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
74 var win = Ext.create(winname, { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
75 record: record, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
76 style: 'z-index: -1;' //Fixes an Issue where windows could not be created in IE8 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
77 }); |
1164
f43635937581
Open Probe always on the left side of the window and Messung on the right side
Evi Huber <ehuber@bfs.de>
parents:
1111
diff
changeset
|
78 win.setPosition(30); |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
79 win.show(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
80 win.initData(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
81 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
82 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
83 /** |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
84 * This function opens a new window to create a Probe |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
85 * {@link Lada.view.window.ProbeCreate} |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
86 */ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
87 addProbeItem: function() { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
88 var win = Ext.create('Lada.view.window.ProbeCreate'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
89 win.show(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
90 win.initData(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
91 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
92 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
93 /** |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
94 * This function opens a {@link Lada.view.window.FileUpload} |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
95 * window to upload a LAF-File |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
96 */ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
97 uploadFile: function() { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
98 var win = Ext.create('Lada.view.window.FileUpload', { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
99 title: 'Datenimport', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
100 modal: true |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
101 }); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
102 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
103 win.show(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
104 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
105 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
106 /** |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
107 * This function can be used to Download the items which |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
108 * were selected in the {@link Lada.view.grid.ProbeList} |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
109 * The Download does not work with Internet Explorers older than v.10 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
110 */ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
111 downloadFile: function(button) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
112 var grid = button.up('grid'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
113 var selection = grid.getView().getSelectionModel().getSelection(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
114 var i18n = Lada.getApplication().bundle; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
115 var proben = []; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
116 for (var i = 0; i < selection.length; i++) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
117 proben.push(selection[i].get('id')); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
118 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
119 var me = this; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
120 Ext.Ajax.request({ |
999 | 121 url: 'lada-server/data/export/laf', |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
122 jsonData: {'proben': proben}, |
1246
a7dc14e3b976
Increased timeout for probe export request.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1244
diff
changeset
|
123 timeout: 2 * 60 * 1000, |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
124 success: function(response) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
125 var content = response.responseText; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
126 var blob = new Blob([content],{type: 'text/plain'}); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
127 saveAs(blob, 'export.laf'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
128 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
129 failure: function(response) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
130 /* |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
131 SSO will send a 302 if the Client is not authenticated |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
132 unfortunately this seems to be filtered by the browser. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
133 We assume that a 302 was send when the follwing statement |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
134 is true. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
135 */ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
136 if (response.status == 0 && response.responseText === "") { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
137 Ext.MessageBox.confirm('Erneutes Login erforderlich', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
138 'Ihre Session ist abgelaufen.<br/>'+ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
139 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' + |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
140 'Alle ungesicherten Daten gehen dabei verloren.<br/>' + |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
141 'Soll die Anwendung jetzt neu geladen werden?', this.reload); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
142 } else { |
1256
f961f94495c8
Remove erroneous error handling.
Tom Gottfried <tom@intevation.de>
parents:
1246
diff
changeset
|
143 // further error handling |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
144 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
145 i18n.getMsg('err.msg.laf.filecreatefailed')); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
146 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
147 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
148 }); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
149 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
150 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
151 /** |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
152 * Send the selection to a Printservice |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
153 */ |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
154 printSelection: function(button, e, eOpts) { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
155 switch (eOpts.mode) { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
156 case "printextract" : |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
157 var printData = this.createExtractData(button); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
158 this.printpdf(printData, 'lada_print', 'lada-print.pdf', button); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
159 break; |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
160 case "printsheet" : |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
161 // The Data is loaded from the server again, so we need |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
162 // to be a little bit asynchronous here... |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
163 callback = function(response) { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
164 var data = response.responseText; |
1261
d19170280a23
added client code to wrap objects into arrays
Dustin Demuth <dustin@intevation.de>
parents:
1256
diff
changeset
|
165 data = this.prepareData(data); // Wraps all messstellen and deskriptoren objects into an array |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
166 var printData = '{"layout": "A4 portrait", "outputFormat": "pdf",' |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
167 + '"attributes": { "proben": ' + data |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
168 + '}}'; |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
169 this.printpdf(printData, 'lada_erfassungsbogen', |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
170 'lada-erfassungsbogen.pdf', button); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
171 } |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
172 |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
173 this.createSheetData(button, callback, this); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
174 break; |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
175 } |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
176 }, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
177 |
1261
d19170280a23
added client code to wrap objects into arrays
Dustin Demuth <dustin@intevation.de>
parents:
1256
diff
changeset
|
178 prepareData: function(data) { |
d19170280a23
added client code to wrap objects into arrays
Dustin Demuth <dustin@intevation.de>
parents:
1256
diff
changeset
|
179 // Copy data |
d19170280a23
added client code to wrap objects into arrays
Dustin Demuth <dustin@intevation.de>
parents:
1256
diff
changeset
|
180 prep = JSON.parse(data); |
d19170280a23
added client code to wrap objects into arrays
Dustin Demuth <dustin@intevation.de>
parents:
1256
diff
changeset
|
181 data = JSON.parse(data); |
d19170280a23
added client code to wrap objects into arrays
Dustin Demuth <dustin@intevation.de>
parents:
1256
diff
changeset
|
182 // ensure data and prep are equal, not sure |
d19170280a23
added client code to wrap objects into arrays
Dustin Demuth <dustin@intevation.de>
parents:
1256
diff
changeset
|
183 // if json.parse changes order of things |
1262
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
184 |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
185 emptyMessstelle = { |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
186 "id": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
187 "amtskennung": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
188 "beschreibung": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
189 "messStelle": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
190 "mstTyp": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
191 "netzbetreiberId":null |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
192 }; |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
193 |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
194 emptyDeskriptor = { |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
195 "s0": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
196 "s1": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
197 "s2": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
198 "s3": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
199 "s4": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
200 "s5": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
201 "s6": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
202 "s7": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
203 "s8": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
204 "s9": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
205 "s10": null, |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
206 "s11": null |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
207 }; |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
208 |
1266
c4059495a346
Flatten the JSON-data in order to prozess Orte
Dustin Demuth <dustin@intevation.de>
parents:
1262
diff
changeset
|
209 for (var i in data) { |
1261
d19170280a23
added client code to wrap objects into arrays
Dustin Demuth <dustin@intevation.de>
parents:
1256
diff
changeset
|
210 probe = data[i]; |
d19170280a23
added client code to wrap objects into arrays
Dustin Demuth <dustin@intevation.de>
parents:
1256
diff
changeset
|
211 deskriptoren = probe.deskriptoren; |
d19170280a23
added client code to wrap objects into arrays
Dustin Demuth <dustin@intevation.de>
parents:
1256
diff
changeset
|
212 messstelle = probe.messstelle; |
1267 | 213 labormessstelle = probe.labormessstelle; |
1266
c4059495a346
Flatten the JSON-data in order to prozess Orte
Dustin Demuth <dustin@intevation.de>
parents:
1262
diff
changeset
|
214 ortszuordnung = probe.ortszuordnung; |
1272
208254152ac0
Printing: calcualte NWG < sign in the client.
Dustin Demuth <dustin@intevation.de>
parents:
1267
diff
changeset
|
215 zusatzwerte = probe.zusatzwerte; |
1266
c4059495a346
Flatten the JSON-data in order to prozess Orte
Dustin Demuth <dustin@intevation.de>
parents:
1262
diff
changeset
|
216 |
1262
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
217 if (messstelle != null) { |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
218 prep[i].messstelle = []; |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
219 prep[i].messstelle[0] = messstelle; |
1267 | 220 prep[i]['messstelle.messStelle'] = messstelle.messStelle; |
1262
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
221 } |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
222 else { |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
223 prep[i].messstelle = []; |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
224 prep[i].messstelle[0] = emptyMessstelle; |
1267 | 225 prep[i]['messstelle.messStelle'] = ''; |
226 } | |
227 | |
228 if (labormessstelle != null) { | |
229 prep[i]['labormessstelle.messStelle'] = labormessstelle.messStelle; | |
230 } | |
231 else { | |
232 prep[i]['labormessstelle.messStelle'] = ''; | |
1262
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
233 } |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
234 |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
235 if (deskriptoren != null) { |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
236 prep[i].deskriptoren = []; |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
237 prep[i].deskriptoren[0] = deskriptoren; |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
238 } |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
239 else { |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
240 prep[i].deskriptoren = []; |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
241 prep[i].deskriptoren[0] = emptyDeskriptor; |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
242 } |
1266
c4059495a346
Flatten the JSON-data in order to prozess Orte
Dustin Demuth <dustin@intevation.de>
parents:
1262
diff
changeset
|
243 |
1272
208254152ac0
Printing: calcualte NWG < sign in the client.
Dustin Demuth <dustin@intevation.de>
parents:
1267
diff
changeset
|
244 // See: app/view/grid/Probenzusatzwert.js |
208254152ac0
Printing: calcualte NWG < sign in the client.
Dustin Demuth <dustin@intevation.de>
parents:
1267
diff
changeset
|
245 // Calculate NWG < symbol , as this is NOT done by the server |
208254152ac0
Printing: calcualte NWG < sign in the client.
Dustin Demuth <dustin@intevation.de>
parents:
1267
diff
changeset
|
246 for (z in zusatzwerte){ |
208254152ac0
Printing: calcualte NWG < sign in the client.
Dustin Demuth <dustin@intevation.de>
parents:
1267
diff
changeset
|
247 var nwg = zusatzwerte[z]['nwgZuMesswert']; |
208254152ac0
Printing: calcualte NWG < sign in the client.
Dustin Demuth <dustin@intevation.de>
parents:
1267
diff
changeset
|
248 var mw = zusatzwerte[z]['messwertPzs']; |
208254152ac0
Printing: calcualte NWG < sign in the client.
Dustin Demuth <dustin@intevation.de>
parents:
1267
diff
changeset
|
249 if ( mw < nwg) { |
208254152ac0
Printing: calcualte NWG < sign in the client.
Dustin Demuth <dustin@intevation.de>
parents:
1267
diff
changeset
|
250 prep[i].zusatzwerte[z]['messwertNwg'] = '<'; |
208254152ac0
Printing: calcualte NWG < sign in the client.
Dustin Demuth <dustin@intevation.de>
parents:
1267
diff
changeset
|
251 } |
208254152ac0
Printing: calcualte NWG < sign in the client.
Dustin Demuth <dustin@intevation.de>
parents:
1267
diff
changeset
|
252 else { |
208254152ac0
Printing: calcualte NWG < sign in the client.
Dustin Demuth <dustin@intevation.de>
parents:
1267
diff
changeset
|
253 prep[i].zusatzwerte[z]['messwertNwg'] = null; |
208254152ac0
Printing: calcualte NWG < sign in the client.
Dustin Demuth <dustin@intevation.de>
parents:
1267
diff
changeset
|
254 } |
208254152ac0
Printing: calcualte NWG < sign in the client.
Dustin Demuth <dustin@intevation.de>
parents:
1267
diff
changeset
|
255 } |
1266
c4059495a346
Flatten the JSON-data in order to prozess Orte
Dustin Demuth <dustin@intevation.de>
parents:
1262
diff
changeset
|
256 |
c4059495a346
Flatten the JSON-data in order to prozess Orte
Dustin Demuth <dustin@intevation.de>
parents:
1262
diff
changeset
|
257 // Flatten the Ortszuodnung Array |
c4059495a346
Flatten the JSON-data in order to prozess Orte
Dustin Demuth <dustin@intevation.de>
parents:
1262
diff
changeset
|
258 for (var o in ortszuordnung) { |
c4059495a346
Flatten the JSON-data in order to prozess Orte
Dustin Demuth <dustin@intevation.de>
parents:
1262
diff
changeset
|
259 oz = ortszuordnung[o]; |
c4059495a346
Flatten the JSON-data in order to prozess Orte
Dustin Demuth <dustin@intevation.de>
parents:
1262
diff
changeset
|
260 for (var e in oz.ort) { |
c4059495a346
Flatten the JSON-data in order to prozess Orte
Dustin Demuth <dustin@intevation.de>
parents:
1262
diff
changeset
|
261 prep[i].ortszuordnung[o]['ort']=null; |
c4059495a346
Flatten the JSON-data in order to prozess Orte
Dustin Demuth <dustin@intevation.de>
parents:
1262
diff
changeset
|
262 prep[i].ortszuordnung[o]['ort.'+e]=oz.ort[e]; |
c4059495a346
Flatten the JSON-data in order to prozess Orte
Dustin Demuth <dustin@intevation.de>
parents:
1262
diff
changeset
|
263 } |
c4059495a346
Flatten the JSON-data in order to prozess Orte
Dustin Demuth <dustin@intevation.de>
parents:
1262
diff
changeset
|
264 } |
1261
d19170280a23
added client code to wrap objects into arrays
Dustin Demuth <dustin@intevation.de>
parents:
1256
diff
changeset
|
265 } |
1266
c4059495a346
Flatten the JSON-data in order to prozess Orte
Dustin Demuth <dustin@intevation.de>
parents:
1262
diff
changeset
|
266 |
1261
d19170280a23
added client code to wrap objects into arrays
Dustin Demuth <dustin@intevation.de>
parents:
1256
diff
changeset
|
267 return JSON.stringify(prep); |
d19170280a23
added client code to wrap objects into arrays
Dustin Demuth <dustin@intevation.de>
parents:
1256
diff
changeset
|
268 }, |
d19170280a23
added client code to wrap objects into arrays
Dustin Demuth <dustin@intevation.de>
parents:
1256
diff
changeset
|
269 |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
270 /** |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
271 * Toggles the buttons in the toolbar |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
272 **/ |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
273 activateButtons: function(rowModel, record) { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
274 var grid = rowModel.view.up('grid'); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
275 this.buttonToggle(true, grid); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
276 }, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
277 |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
278 /** |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
279 * Toggles the buttons in the toolbar |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
280 **/ |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
281 deactivateButtons: function(rowModel, record) { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
282 var grid = rowModel.view.up('grid'); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
283 // Only disable buttons when nothing is selected |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
284 if (rowModel.selected.items == 0) { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
285 this.buttonToggle(false, grid); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
286 } |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
287 }, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
288 |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
289 /** |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
290 * Enables/Disables a set of buttons |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
291 **/ |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
292 buttonToggle: function(enabled, grid) { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
293 if (!enabled) { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
294 grid.down('button[action=export]').disable(); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
295 grid.down('button[action=printExtract]').disable(); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
296 grid.down('button[action=printSheet]').disable(); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
297 } |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
298 else { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
299 grid.down('button[action=export]').enable(); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
300 grid.down('button[action=printExtract]').enable(); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
301 grid.down('button[action=printSheet]').enable(); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
302 } |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
303 }, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
304 |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
305 reload: function(btn) { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
306 if (btn === 'yes') { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
307 location.reload(); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
308 } |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
309 }, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
310 |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
311 expandBody: function(rowNode, record, expandRow) { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
312 // var row = Ext.get('probe-row-' + record.get('id')); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
313 // var messungGrid = Ext.create('Lada.view.grid.Messung', { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
314 // recordId: record.get('id'), |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
315 // bottomBar: false, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
316 // rowLines: true |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
317 // }); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
318 // row.swallowEvent(['click', 'mousedown', 'mouseup', 'dblclick'], true); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
319 // messungGrid.render(row); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
320 }, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
321 |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
322 collapseBody: function(rowNode, record, expandRow) { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
323 // var element = Ext.get('probe-row-' + record.get('id')).down('div'); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
324 // element.destroy(); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
325 }, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
326 |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
327 /** |
1262
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
328 * Returns a Json-Object which contains the data which has |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
329 * to be printed. |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
330 * The parameter printFunctionCallback will be called once the ajax-request |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
331 * starting the json-export was evaluated |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
332 **/ |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
333 createSheetData: function(button, printFunctionCallback, cbscope){ |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
334 //disable Button and setLoading... |
1262
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
335 button.disable(); |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
336 button.setLoading(true); |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
337 |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
338 |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
339 // get Selected Items. |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
340 var grid = button.up('grid'); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
341 var selection = grid.getView().getSelectionModel().getSelection(); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
342 var i18n = Lada.getApplication().bundle; |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
343 var me = this; |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
344 var ids = []; |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
345 |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
346 for (item in selection) { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
347 ids.push(selection[item].data['id']); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
348 } |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
349 |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
350 //basically, thats the same as the downloadFile |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
351 // code does. |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
352 var data = '{ "proben": ['+ids.toString()+'] }'; |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
353 |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
354 Ext.Ajax.request({ |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
355 url: 'lada-server/data/export/json', |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
356 jsonData: data, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
357 binary: false, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
358 scope: cbscope, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
359 success: printFunctionCallback, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
360 failure: function(response) { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
361 console.log('failure'); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
362 // Error handling |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
363 button.enable(); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
364 button.setLoading(false); |
1262
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
365 if (response.responseText) { |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
366 try { |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
367 var json = Ext.JSON.decode(response.responseText); |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
368 } |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
369 catch(e){ |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
370 console.log(e); |
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
371 } |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
372 } |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
373 if (json) { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
374 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
375 formPanel.setMessages(json.errors, json.warnings); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
376 } |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
377 if(json.message){ |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
378 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title') |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
379 +' #'+json.message, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
380 Lada.getApplication().bundle.getMsg(json.message)); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
381 } else { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
382 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
1262
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
383 i18n.getMsg('err.msg.response.body')); |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
384 } |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
385 } else { |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
386 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
1262
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
387 i18n.getMsg('err.msg.response.body')); |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
388 } |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
389 return null; |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
390 } |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
391 }); |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
392 }, |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
393 |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
394 /** |
1262
52ecf67e9e80
Fixes an Issue when the Probe which has to be printed does not contain deskriptoren
Dustin Demuth <dustin@intevation.de>
parents:
1261
diff
changeset
|
395 * Returns a Json-Object which contains the data which has |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
396 * to be printed. |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
397 **/ |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
398 createExtractData: function(button){ |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
399 //disable Button and setLoading... |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
400 button.disable(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
401 button.setLoading(true); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
402 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
403 var grid = button.up('grid'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
404 var selection = grid.getView().getSelectionModel().getSelection(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
405 var i18n = Lada.getApplication().bundle; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
406 var me = this; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
407 var columns = []; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
408 var columnNames = []; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
409 var visibleColumns = []; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
410 var displayName = ''; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
411 var data = []; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
412 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
413 // Write the columns to an array |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
414 try { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
415 for (key in selection[0].data) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
416 // Do not write owner or readonly or id |
1082
dbd435256f77
Open status edit window and send status objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
999
diff
changeset
|
417 if (["owner", "readonly", "id", "probeId"].indexOf(key) == -1){ |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
418 columns.push(key); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
419 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
420 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
421 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
422 catch (e) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
423 console.log(e); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
424 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
425 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
426 //Retrieve visible columns' id's and names. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
427 // and set displayName |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
428 try { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
429 var grid = button.up('grid'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
430 var cman = grid.columnManager; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
431 var cols = cman.getColumns(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
432 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
433 displayName = grid.down('tbtext').text; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
434 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
435 for (key in cols) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
436 if (cols[key].dataIndex) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
437 visibleColumns[cols[key].dataIndex] = cols[key].text; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
438 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
439 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
440 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
441 catch (e) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
442 console.log(e); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
443 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
444 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
445 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
446 // Retrieve Data from selection |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
447 try { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
448 for (item in selection) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
449 var row = selection[item].data; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
450 var out = []; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
451 //Lookup every column and write to data array. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
452 for (key in columns){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
453 var attr = columns[key]; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
454 //Only write data to output when the column is not hidden. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
455 if (row[attr] != null && |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
456 visibleColumns[attr] != null) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
457 out.push(row[attr].toString()); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
458 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
459 else if (visibleColumns[attr] != null) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
460 out.push(''); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
461 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
462 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
463 data.push(out); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
464 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
465 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
466 catch (e){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
467 console.log(e); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
468 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
469 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
470 //Retrieve the names of the columns. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
471 try { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
472 var grid = button.up('grid'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
473 var cman = grid.columnManager; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
474 var cols = cman.getColumns(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
475 //Iterate columns and find column names for the key... |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
476 // This WILL run into bad behaviour when column-keys exist twice. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
477 for (key in columns){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
478 for (k in cols){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
479 if (cols[k].dataIndex == columns[key]){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
480 columnNames.push(cols[k].text); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
481 break; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
482 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
483 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
484 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
485 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
486 catch (e) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
487 console.log(e); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
488 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
489 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
490 var printData = { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
491 'layout': 'A4 landscape', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
492 'outputFormat': 'pdf', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
493 'attributes': { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
494 'title': 'Auszug aus LADA', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
495 'displayName': displayName, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
496 'table': { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
497 'columns': columnNames, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
498 'data': data |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
499 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
500 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
501 } |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
502 return printData; |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
503 }, |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
504 |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
505 /** |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
506 * this function uses an AJAX request in order to |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
507 * send the data to the endpoint of the mapfish-print |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
508 */ |
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
509 printpdf: function(data, endpoint, filename, button){ |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
510 Ext.Ajax.request({ |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
511 url: 'lada-printer/'+endpoint+'/buildreport.pdf', |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
512 //configure a proxy in apache conf! |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
513 jsonData: data, |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
514 binary: true, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
515 success: function(response) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
516 var content = response.responseBytes; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
517 var filetype = response.getResponseHeader('Content-Type'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
518 var blob = new Blob([content],{type: filetype}); |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
519 saveAs(blob, filename); |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
520 button.enable(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
521 button.setLoading(false); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
522 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
523 failure: function(response) { |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
524 var i18n = Lada.getApplication().bundle; |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
525 console.log('failure'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
526 // Error handling |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
527 button.enable(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
528 button.setLoading(false); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
529 if (response.responseText) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
530 try { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
531 var json = Ext.JSON.decode(response.responseText); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
532 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
533 catch(e){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
534 console.log(e); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
535 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
536 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
537 if (json) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
538 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
539 formPanel.setMessages(json.errors, json.warnings); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
540 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
541 if(json.message){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
542 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title') |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
543 +' #'+json.message, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
544 Lada.getApplication().bundle.getMsg(json.message)); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
545 } else { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
546 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
547 i18n.getMsg('err.msg.print.noContact')); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
548 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
549 } else { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
550 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
551 i18n.getMsg('err.msg.print.noContact')); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
552 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
553 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
554 }); |
1400
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
555 }, |
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
556 |
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
557 pageChange: function(toolbar) { |
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
558 var grid = toolbar.up('grid'); |
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
559 var store = grid.getStore(); |
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
560 var rowExpander = grid.plugins[0] |
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
561 var nodes = rowExpander.view.getNodes(); |
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
562 for (var i = 0; i < nodes.length; i++) { |
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
563 var node = Ext.fly(nodes[i]); |
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
564 if (node.hasCls(rowExpander.rowCollapsedCls) === false) { |
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
565 rowExpander.toggleRow(i, store.getAt(i)); |
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
566 } |
69ebd572fe5c
Collapse rows on page change in probe and messung filter grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1272
diff
changeset
|
567 } |
1244
d391f055022e
WIP Added Erfassungsbogen-Druck
Dustin Demuth <dustin@intevation.de>
parents:
1227
diff
changeset
|
568 } |
977
56470a075e6e
Added methods to the controllers to disable/enable buttons in the toolbar when rows are (de)selected
Dustin Demuth <dustin@intevation.de>
parents:
975
diff
changeset
|
569 |
975
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
570 }); |