Mercurial > lada > lada-client
annotate app/controller/grid/ProbeList.js @ 975:fb99332bb48e stammdatengrids
Severe changes concerning the Resultgrids.
- Intrduced "Stammdaten" which can be selected in the Mode Field on the left side,
- Added Stores and Models for the Stammdaten
- Removed the FilterResultgrid and replaced it with a model which uses inheritance.
Dynamic Grid Columns can now be derived from app/view/widget/DynamicGrid.js
For Proben and Messprogramme this is already done.
- There might be some REGRESSION concerning the buttons in the ProbeList and
MessprogrammeList grid, as those are not disabled properly.
This needs to be fixed in future commits.
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Wed, 02 Dec 2015 17:39:04 +0100 |
parents | |
children | 56470a075e6e |
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: [ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
15 'Lada.view.window.ProbeEdit', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
16 'Lada.view.window.GenProbenFromMessprogramm' |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
17 ], |
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 * Initialize the Controller with listeners |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
21 */ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
22 init: function() { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
23 this.control({ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
24 'probelistgrid': { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
25 itemdblclick: this.editItem |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
26 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
27 'probelistgrid toolbar button[action=addProbe]': { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
28 click: this.addProbeItem |
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=import]': { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
31 click: this.uploadFile |
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=export]': { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
34 click: this.downloadFile |
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=print]': { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
37 click: this.printSelection |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
38 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
39 }); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
40 this.callParent(arguments); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
41 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
42 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
43 /** |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
44 * This function is called after a Row in the |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
45 * {@link Lada.view.grid.ProbeList} |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
46 * was double-clicked. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
47 * The function opens a {@link Lada.view.window.ProbeEdit} |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
48 * or a {@link Lada.view.window.Messprogramm}. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
49 * To determine which window has to be opened, the function |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
50 * analyse the records modelname. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
51 */ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
52 editItem: function(grid, record) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
53 var winname = 'Lada.view.window.ProbeEdit'; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
54 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
55 var win = Ext.create(winname, { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
56 record: record, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
57 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
|
58 }); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
59 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
60 win.show(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
61 win.initData(); |
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 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
64 /** |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
65 * This function opens a new window to create a Probe |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
66 * {@link Lada.view.window.ProbeCreate} |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
67 */ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
68 addProbeItem: function() { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
69 var win = Ext.create('Lada.view.window.ProbeCreate'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
70 win.show(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
71 win.initData(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
72 }, |
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 /** |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
75 * This function opens a {@link Lada.view.window.FileUpload} |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
76 * window to upload a LAF-File |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
77 */ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
78 uploadFile: function() { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
79 var win = Ext.create('Lada.view.window.FileUpload', { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
80 title: 'Datenimport', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
81 modal: true |
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 win.show(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
85 }, |
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 /** |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
88 * This function can be used to Download the items which |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
89 * were selected in the {@link Lada.view.grid.ProbeList} |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
90 * 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
|
91 */ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
92 downloadFile: function(button) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
93 var grid = button.up('grid'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
94 var selection = grid.getView().getSelectionModel().getSelection(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
95 var i18n = Lada.getApplication().bundle; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
96 var proben = []; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
97 for (var i = 0; i < selection.length; i++) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
98 proben.push(selection[i].get('id')); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
99 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
100 var me = this; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
101 Ext.Ajax.request({ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
102 url: 'lada-server/export/laf', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
103 jsonData: {'proben': proben}, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
104 success: function(response) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
105 var content = response.responseText; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
106 var blob = new Blob([content],{type: 'text/plain'}); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
107 saveAs(blob, 'export.laf'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
108 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
109 failure: function(response) { |
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 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
|
112 unfortunately this seems to be filtered by the browser. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
113 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
|
114 is true. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
115 */ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
116 if (response.status == 0 && response.responseText === "") { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
117 Ext.MessageBox.confirm('Erneutes Login erforderlich', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
118 'Ihre Session ist abgelaufen.<br/>'+ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
119 '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
|
120 'Alle ungesicherten Daten gehen dabei verloren.<br/>' + |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
121 'Soll die Anwendung jetzt neu geladen werden?', this.reload); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
122 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
123 // further error handling |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
124 var json = Ext.JSON.decode(response.responseText); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
125 if (json) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
126 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
127 formPanel.setMessages(json.errors, json.warnings); |
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 if(json.message){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
130 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
|
131 +' #'+json.message, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
132 Lada.getApplication().bundle.getMsg(json.message)); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
133 } else { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
134 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
135 i18n.getMsg('err.msg.laf.filecreatefailed')); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
136 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
137 } else { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
138 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
139 i18n.getMsg('err.msg.laf.filecreatefailed')); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
140 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
141 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
142 }); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
143 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
144 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
145 /** |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
146 * Send the selection to a Printservice |
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 printSelection: function(button) { |
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 //disable Button and setLoading... |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
151 button.disable(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
152 button.setLoading(true); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
153 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
154 var grid = button.up('grid'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
155 var selection = grid.getView().getSelectionModel().getSelection(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
156 var i18n = Lada.getApplication().bundle; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
157 var me = this; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
158 var columns = []; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
159 var columnNames = []; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
160 var visibleColumns = []; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
161 var displayName = ''; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
162 var data = []; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
163 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
164 // Write the columns to an array |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
165 try { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
166 for (key in selection[0].data) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
167 // Do not write owner or readonly or id |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
168 if (["owner", "readonly", "id"].indexOf(key) == -1){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
169 columns.push(key); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
170 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
171 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
172 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
173 catch (e) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
174 console.log(e); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
175 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
176 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
177 //Retrieve visible columns' id's and names. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
178 // and set displayName |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
179 try { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
180 var grid = button.up('grid'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
181 var cman = grid.columnManager; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
182 var cols = cman.getColumns(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
183 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
184 displayName = grid.down('tbtext').text; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
185 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
186 for (key in cols) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
187 if (cols[key].dataIndex) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
188 visibleColumns[cols[key].dataIndex] = cols[key].text; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
189 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
190 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
191 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
192 catch (e) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
193 console.log(e); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
194 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
195 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
196 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
197 // Retrieve Data from selection |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
198 try { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
199 for (item in selection) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
200 var row = selection[item].data; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
201 var out = []; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
202 //Lookup every column and write to data array. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
203 for (key in columns){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
204 var attr = columns[key]; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
205 //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
|
206 if (row[attr] != null && |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
207 visibleColumns[attr] != null) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
208 out.push(row[attr].toString()); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
209 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
210 else if (visibleColumns[attr] != null) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
211 out.push(''); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
212 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
213 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
214 data.push(out); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
215 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
216 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
217 catch (e){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
218 console.log(e); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
219 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
220 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
221 //Retrieve the names of the columns. |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
222 try { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
223 var grid = button.up('grid'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
224 var cman = grid.columnManager; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
225 var cols = cman.getColumns(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
226 //Iterate columns and find column names for the key... |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
227 // 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
|
228 for (key in columns){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
229 for (k in cols){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
230 if (cols[k].dataIndex == columns[key]){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
231 columnNames.push(cols[k].text); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
232 break; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
233 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
234 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
235 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
236 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
237 catch (e) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
238 console.log(e); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
239 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
240 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
241 var printData = { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
242 'layout': 'A4 landscape', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
243 'outputFormat': 'pdf', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
244 'attributes': { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
245 'title': 'Auszug aus LADA', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
246 'displayName': displayName, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
247 'table': { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
248 'columns': columnNames, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
249 'data': data |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
250 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
251 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
252 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
253 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
254 Ext.Ajax.request({ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
255 url: 'lada-printer/buildreport.pdf', |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
256 //configure a proxy in apache conf! |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
257 jsonData: printData, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
258 binary: true, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
259 success: function(response) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
260 var content = response.responseBytes; |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
261 var filetype = response.getResponseHeader('Content-Type'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
262 var blob = new Blob([content],{type: filetype}); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
263 saveAs(blob, 'lada-print.pdf'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
264 button.enable(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
265 button.setLoading(false); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
266 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
267 failure: function(response) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
268 console.log('failure'); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
269 // Error handling |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
270 // TODO |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
271 //console.log(response.responseText) |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
272 button.enable(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
273 button.setLoading(false); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
274 if (response.responseText) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
275 try { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
276 var json = Ext.JSON.decode(response.responseText); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
277 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
278 catch(e){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
279 console.log(e); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
280 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
281 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
282 if (json) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
283 if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
284 formPanel.setMessages(json.errors, json.warnings); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
285 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
286 if(json.message){ |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
287 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
|
288 +' #'+json.message, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
289 Lada.getApplication().bundle.getMsg(json.message)); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
290 } else { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
291 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
292 i18n.getMsg('err.msg.print.noContact')); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
293 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
294 } else { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
295 Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'), |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
296 i18n.getMsg('err.msg.print.noContact')); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
297 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
298 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
299 }); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
300 }, |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
301 |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
302 reload: function(btn) { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
303 if (btn === 'yes') { |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
304 location.reload(); |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
305 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
306 } |
fb99332bb48e
Severe changes concerning the Resultgrids.
Dustin Demuth <dustin@intevation.de>
parents:
diff
changeset
|
307 }); |