Mercurial > lada > lada-client
annotate app/controller/FilterResult.js @ 937:6739bfdb743e
LadaPrint enabled dynamic printing of tables.
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Wed, 30 Sep 2015 15:24:25 +0200 |
parents | e7270963947c |
children | fe85a4d23370 |
rev | line source |
---|---|
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 /** |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 * Controller for filter result grid. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.controller.FilterResult', { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.app.Controller', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 requires: [ |
754
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
15 'Lada.view.window.ProbeEdit', |
759
b7484c7da2d4
Unified the Messprogramm windows. Unfortunately the Roweditor of Messmethodengrid is broken in this commit. This is due to the fact that the Mmt store is noit autoloaded anymore
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
16 'Lada.view.window.Messprogramm' |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 ], |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
19 /** |
810
a5373ee662e2
Created a loading Animation for the Filterresultgrid
Dustin Demuth <dustin@intevation.de>
parents:
809
diff
changeset
|
20 * Initialize the Controller with listeners |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
21 */ |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 init: function() { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 this.control({ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 'filterresultgrid': { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 itemdblclick: this.editItem |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 }, |
754
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
27 'filterresultgrid toolbar button[action=addProbe]': { |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
28 click: this.addProbeItem |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 }, |
755
3637c453f67d
Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents:
754
diff
changeset
|
30 'filterresultgrid toolbar button[action=addMessprogramm]': { |
3637c453f67d
Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents:
754
diff
changeset
|
31 click: this.addMessprogrammItem |
3637c453f67d
Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents:
754
diff
changeset
|
32 }, |
860
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
33 'filterresultgrid toolbar button[action=genProbenFromMessprogramm]': { |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
34 click: this.genProbenFromMessprogramm |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
35 }, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 'filterresultgrid toolbar button[action=import]': { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 click: this.uploadFile |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 'filterresultgrid toolbar button[action=export]': { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 click: this.downloadFile |
923
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
41 }, |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
42 'filterresultgrid toolbar button[action=print]': { |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
43 click: this.printSelection |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 this.callParent(arguments); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
49 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
50 * This function is called after a Row in the |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
51 * {@link Lada.view.grid.FilterResult} |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
52 * was double-clicked. |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
53 * The function opens a {@link Lada.view.window.ProbeEdit} |
895 | 54 * or a {@link Lada.view.window.Messprogramm}. |
754
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
55 * To determine which window has to be opened, the function |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
56 * analyse the records modelname. |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
57 */ |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 editItem: function(grid, record) { |
754
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
59 var mname = record.store.model.modelName || ''; |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
60 var winname = ''; |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
61 |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
62 //Based upon the Model that was loaded, act differently |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
63 if (mname == 'Lada.model.ProbeList'){ |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
64 winname = 'Lada.view.window.ProbeEdit'; |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
65 } |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
66 else if (mname == 'Lada.model.MessprogrammList'){ |
759
b7484c7da2d4
Unified the Messprogramm windows. Unfortunately the Roweditor of Messmethodengrid is broken in this commit. This is due to the fact that the Mmt store is noit autoloaded anymore
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
67 winname = 'Lada.view.window.Messprogramm'; |
754
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
68 } |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
69 if (winname){ |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
70 var win = Ext.create(winname, { |
814
af54733a6d48
Fix for IE8 compatibility
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
71 record: record, |
af54733a6d48
Fix for IE8 compatibility
Dustin Demuth <dustin@intevation.de>
parents:
812
diff
changeset
|
72 style: 'z-index: -1;' //Fixes an Issue where windows could not be created in IE8 |
754
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
73 }); |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
74 win.show(); |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
75 win.initData(); |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
76 } |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
77 else { |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
78 console.log('The model is unknown.' |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
79 +'No window was configured to display the data.' |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
80 +'I retrieved a model named:' + mname |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
81 ); |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
82 } |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
83 }, |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
84 |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
85 /** |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
86 * This function opens a new window to create a Probe |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
87 * {@link Lada.view.window.ProbeCreate} |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
88 */ |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
89 addProbeItem: function() { |
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
90 var win = Ext.create('Lada.view.window.ProbeCreate'); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 win.show(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 win.initData(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
95 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
96 * This function opens a new window to create a Probe |
895 | 97 * {@link Lada.view.window.Messprogramm} |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
98 */ |
754
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
99 addMessprogrammItem: function() { |
759
b7484c7da2d4
Unified the Messprogramm windows. Unfortunately the Roweditor of Messmethodengrid is broken in this commit. This is due to the fact that the Mmt store is noit autoloaded anymore
Dustin Demuth <dustin@intevation.de>
parents:
755
diff
changeset
|
100 var win = Ext.create('Lada.view.window.Messprogramm'); |
755
3637c453f67d
Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents:
754
diff
changeset
|
101 win.show(); |
3637c453f67d
Enabled Creation of a Messprogramm, an empty Window is now shown. The save operation leads to a E 500
Dustin Demuth <dustin@intevation.de>
parents:
754
diff
changeset
|
102 win.initData(); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
105 /** |
860
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
106 * This button creates a window to generate Proben |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
107 * from a selected messprogramm. |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
108 */ |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
109 genProbenFromMessprogramm: function(button) { |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
110 var grid = button.up('grid'); |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
111 var selection = grid.getView().getSelectionModel().getSelection(); |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
112 var i18n = Lada.getApplication().bundle; |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
113 var proben = []; |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
114 for (var i = 0; i < selection.length; i++) { |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
115 proben.push(selection[i].get('id')); |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
116 } |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
117 var me = this; |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
118 |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
119 var winname = 'Lada.view.window.GenProbenFromMessprogramm'; |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
120 for (p in proben) { |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
121 grid.setLoading(true); |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
122 Ext.ClassManager.get('Lada.model.Messprogramm').load(proben[p], { |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
123 failure: function(record, action) { |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
124 me.setLoading(false); |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
125 // TODO |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
126 console.log('An unhandled Failure occured. See following Response and Record'); |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
127 console.log(action); |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
128 console.log(record); |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
129 }, |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
130 success: function(record, response) { |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
131 grid.setLoading(false); |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
132 |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
133 var win = Ext.create(winname, { |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
134 record: record, |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
135 parentWindow: null |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
136 }); |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
137 win.show(); |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
138 win.initData(); |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
139 }, |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
140 scope: this |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
141 }); |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
142 } |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
143 }, |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
144 |
03f39ddae596
Restructured Filterresultgrid button-dock, added button to generate Proben from a selection of messprogramme.
Dustin Demuth <dustin@intevation.de>
parents:
825
diff
changeset
|
145 /** |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
146 * This function opens a {@link Lada.view.window.FileUpload} |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
147 * window to upload a LAF-File |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
148 */ |
725
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
149 uploadFile: function() { |
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
150 var win = Ext.create('Lada.view.window.FileUpload', { |
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
151 title: 'Datenimport', |
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
152 modal: true |
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
153 }); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
154 |
725
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
155 win.show(); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
157 |
742
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
158 /** |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
159 * This function can be used to Download the items which |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
160 * were selected in the {@link Lada.view.grid.FilterResult} |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
161 * The Download does not work with Internet Explorers older than v.10 |
6e28ebbe1a73
added documentation for Form and Grid controllers
Dustin Demuth <dustin@intevation.de>
parents:
727
diff
changeset
|
162 */ |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 downloadFile: function(button) { |
725
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
164 var grid = button.up('grid'); |
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
165 var selection = grid.getView().getSelectionModel().getSelection(); |
754
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
166 var i18n = Lada.getApplication().bundle; |
725
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
167 var proben = []; |
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
168 for (var i = 0; i < selection.length; i++) { |
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
169 proben.push(selection[i].get('id')); |
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
170 } |
825
426829f27b02
fixed scope for reload
Dustin Demuth <dustin@intevation.de>
parents:
814
diff
changeset
|
171 var me = this; |
725
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
172 Ext.Ajax.request({ |
727
e002234d7da5
Corrected URL for lada-server in export and import
Dustin Demuth <dustin@intevation.de>
parents:
725
diff
changeset
|
173 url: 'lada-server/export/laf', |
725
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
174 jsonData: {'proben': proben}, |
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
175 success: function(response) { |
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
176 var content = response.responseText; |
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
177 var blob = new Blob([content],{type: 'text/plain'}); |
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
178 saveAs(blob, 'export.laf'); |
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
179 }, |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
180 failure: function(response) { |
920
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
181 /* |
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
182 SSO will send a 302 if the Client is not authenticated |
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
183 unfortunately this seems to be filtered by the browser. |
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
184 We assume that a 302 was send when the follwing statement |
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
185 is true. |
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
186 */ |
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
187 if (response.status == 0 && response.responseText === "") { |
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
188 Ext.MessageBox.confirm('Erneutes Login erforderlich', |
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
189 'Ihre Session ist abgelaufen.<br/>'+ |
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
190 'Für ein erneutes Login muss die Anwendung neu geladen werden.<br/>' + |
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
191 'Alle ungesicherten Daten gehen dabei verloren.<br/>' + |
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
192 'Soll die Anwendung jetzt neu geladen werden?', this.reload); |
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
193 } |
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
194 // further error handling |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
195 var json = Ext.JSON.decode(response.responseText); |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
196 if (json) { |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
197 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
198 formPanel.setMessages(json.errors, json.warnings); |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
199 } |
920
f220ba587c89
Adopted Client to SSO, detect a Sessiontimeout and reload the application
Dustin Demuth <dustin@intevation.de>
parents:
895
diff
changeset
|
200 if(json.message){ |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
201 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title') |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
202 +' #'+json.message, |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
203 Lada.getApplication().bundle.getMsg(json.message)); |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
204 } else { |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
205 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
206 i18n.getMsg('err.msg.laf.filecreatefailed')); |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
207 } |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
208 } else { |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
209 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
754
6b0d0e62f7d7
added Probenintervalle to a Messprogramm... there is still a lot of work needed. For instance for the slider element.
Dustin Demuth <dustin@intevation.de>
parents:
751
diff
changeset
|
210 i18n.getMsg('err.msg.laf.filecreatefailed')); |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
211 } |
725
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
212 } |
83c571b022f3
Added window for laf file upload and use filtergrid buttons to export or import.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
620
diff
changeset
|
213 }); |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
214 }, |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
215 |
923
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
216 /** |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
217 * Send the selection to a Printservice |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
218 */ |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
219 printSelection: function(button) { |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
220 var grid = button.up('grid'); |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
221 var selection = grid.getView().getSelectionModel().getSelection(); |
936
e7270963947c
LadaPrint Fixes an Issue where empty cells could not be printed bc NULL has no toString method
Dustin Demuth <dustin@intevation.de>
parents:
934
diff
changeset
|
222 console.log(selection); |
923
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
223 var i18n = Lada.getApplication().bundle; |
934
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
224 var me = this; |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
225 var columns = []; |
937
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
226 var columnNames = []; |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
227 var visibleColumns = {} |
934
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
228 var data = []; |
937
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
229 |
934
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
230 // Write the columns to an array |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
231 try { |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
232 for (key in selection[0].data) { |
937
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
233 // Do not write owner or readonly or id |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
234 if (["owner", "readonly", "id"].indexOf(key) == -1){ |
934
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
235 columns.push(key); |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
236 } |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
237 } |
937
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
238 } |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
239 catch (e) { |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
240 console.log(e); |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
241 } |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
242 |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
243 //Retrieve visible columns' id's and names. |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
244 try { |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
245 var grid = button.up('filterresultgrid'); |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
246 var cman = grid.columnManager; |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
247 var cols = cman.getColumns(); |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
248 for (key in cols) { |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
249 if (cols[key].dataIndex) { |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
250 visibleColumns[cols[key].dataIndex] = cols[key].text; |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
251 } |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
252 } |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
253 } |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
254 catch (e) { |
936
e7270963947c
LadaPrint Fixes an Issue where empty cells could not be printed bc NULL has no toString method
Dustin Demuth <dustin@intevation.de>
parents:
934
diff
changeset
|
255 console.log(e); |
923
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
256 } |
934
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
257 |
936
e7270963947c
LadaPrint Fixes an Issue where empty cells could not be printed bc NULL has no toString method
Dustin Demuth <dustin@intevation.de>
parents:
934
diff
changeset
|
258 |
934
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
259 // Retrieve Data from selection |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
260 try { |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
261 for (item in selection) { |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
262 var row = selection[item].data; |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
263 var out = []; |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
264 //Lookup every column and write to data array. |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
265 for (key in columns){ |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
266 var attr = columns[key]; |
937
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
267 //Only write data to output when the column is not hidden. |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
268 if (row[attr] != null && |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
269 visibleColumns[attr] != null) { |
936
e7270963947c
LadaPrint Fixes an Issue where empty cells could not be printed bc NULL has no toString method
Dustin Demuth <dustin@intevation.de>
parents:
934
diff
changeset
|
270 out.push(row[attr].toString()); |
e7270963947c
LadaPrint Fixes an Issue where empty cells could not be printed bc NULL has no toString method
Dustin Demuth <dustin@intevation.de>
parents:
934
diff
changeset
|
271 } |
937
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
272 else if (visibleColumns[attr] != null) { |
936
e7270963947c
LadaPrint Fixes an Issue where empty cells could not be printed bc NULL has no toString method
Dustin Demuth <dustin@intevation.de>
parents:
934
diff
changeset
|
273 out.push(''); |
e7270963947c
LadaPrint Fixes an Issue where empty cells could not be printed bc NULL has no toString method
Dustin Demuth <dustin@intevation.de>
parents:
934
diff
changeset
|
274 } |
934
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
275 } |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
276 data.push(out); |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
277 } |
937
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
278 } |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
279 catch (e){ |
936
e7270963947c
LadaPrint Fixes an Issue where empty cells could not be printed bc NULL has no toString method
Dustin Demuth <dustin@intevation.de>
parents:
934
diff
changeset
|
280 console.log(e); |
934
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
281 } |
937
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
282 |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
283 //Retrieve the names of the columns. |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
284 try { |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
285 var grid = button.up('filterresultgrid'); |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
286 var cman = grid.columnManager; |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
287 var cols = cman.getColumns(); |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
288 //Iterate columns and find column names for the key... |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
289 // This WILL run into bad behaviour when column-keys exist twice. |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
290 for (key in columns){ |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
291 for (k in cols){ |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
292 if (cols[k].dataIndex == columns[key]){ |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
293 columnNames.push(cols[k].text); |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
294 break; |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
295 } |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
296 } |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
297 } |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
298 } |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
299 catch (e) { |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
300 console.log(e); |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
301 } |
934
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
302 |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
303 var printData = { |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
304 'layout': 'A4 landscape', |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
305 'outputFormat': 'pdf', |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
306 'attributes': { |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
307 'title': 'Auszug aus LADA', |
937
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
308 'displayName': 'Proben', |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
309 'table': { |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
310 'columns': columnNames, |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
311 'data': data |
6739bfdb743e
LadaPrint enabled dynamic printing of tables.
Dustin Demuth <dustin@intevation.de>
parents:
936
diff
changeset
|
312 } |
934
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
313 } |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
314 } |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
315 |
923
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
316 Ext.Ajax.request({ |
934
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
317 url: 'lada-printer/buildreport.pdf', |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
318 //configure a proxy in apache conf! |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
319 jsonData: printData, |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
320 binary: true, |
923
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
321 success: function(response) { |
934
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
322 var content = response.responseBytes; |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
323 var filetype = response.getResponseHeader('Content-Type'); |
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
324 var blob = new Blob([content],{type: filetype}); |
923
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
325 saveAs(blob, 'lada-print.pdf'); |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
326 }, |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
327 failure: function(response) { |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
328 console.log('failure'); |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
329 // Error handling |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
330 // TODO |
934
3e3e737050b7
Added Print function to talk with mapfish
Dustin Demuth <dustin@intevation.de>
parents:
923
diff
changeset
|
331 //console.log(response.responseText) |
923
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
332 if (response.responseText) { |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
333 try { |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
334 var json = Ext.JSON.decode(response.responseText); |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
335 } |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
336 catch(e){ |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
337 console.log(e); |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
338 } |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
339 } |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
340 if (json) { |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
341 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
342 formPanel.setMessages(json.errors, json.warnings); |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
343 } |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
344 if(json.message){ |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
345 Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.generic.title') |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
346 +' #'+json.message, |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
347 Lada.getApplication().bundle.getMsg(json.message)); |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
348 } else { |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
349 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
350 i18n.getMsg('err.msg.print.noContact')); |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
351 } |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
352 } else { |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
353 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
354 i18n.getMsg('err.msg.print.noContact')); |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
355 } |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
356 } |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
357 }); |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
358 }, |
7cbbe0485d0d
Added a Print-button which sends a selection of proben to a service which still has to be specified.
Dustin Demuth <dustin@intevation.de>
parents:
920
diff
changeset
|
359 |
812
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
360 reload: function(btn) { |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
361 if (btn === 'yes') { |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
362 location.reload(); |
188a9faf96e0
Added Errorhandling for AJAX-Requests, especially Authentication Issues.
Dustin Demuth <dustin@intevation.de>
parents:
811
diff
changeset
|
363 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
364 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
365 }); |