Mercurial > lada > lada-client
annotate app/view/window/ImportResponse.js @ 1219:746915a63a11
Updated import response window.
* Show only a summary of errors and warnings
* Prepare response for html fiel download
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 26 Oct 2016 16:49:26 +0200 |
parents | def27cdd0dfa |
children | 4e62bc6e7250 |
rev | line source |
---|---|
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /** |
890
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
729
diff
changeset
|
2 * This Window is shown, when Proben could be imported from a LAF file |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 */ |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 Ext.define('Lada.view.window.ImportResponse', { |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 extend: 'Ext.window.Window', |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 alias: 'widget.importresponse', |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 data: null, |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 message: null, |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 fileName: '', |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 layout: 'fit', |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 /** |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 * @private |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 * Initialize the view. |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 */ |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 initComponent: function() { |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 var me = this; |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 var html; |
1219
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
20 var download; |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
21 var i18n = Lada.getApplication().bundle; |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 if (me.data && me.message) { |
1219
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
23 html = me.parseShortResponse(me.message, me.data); |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 this.bodyStyle = {background: '#fff'}; |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 me.items = [{ |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 xtype: 'panel', |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 html: html, |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 margin: 10, |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 border: false |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 }]; |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 |
1219
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
33 me.buttons = [{ |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
34 text: i18n.getMsg('close'), |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
35 scope: this, |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
36 name: 'close', |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
37 handler: this.close |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
38 }, { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
39 text: i18n.getMsg('download'), |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
40 name: 'download', |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
41 disabled: true, |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
42 handler: function() { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
43 var blob = new Blob([download],{type: 'text/html'}); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
44 saveAs(blob, 'report.html'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
45 } |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
46 }]; |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 this.callParent(arguments); |
1219
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
48 download = me.parseResponse(me.message, me.data); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
49 }, |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
50 |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
51 /** |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
52 * Parse the response and create a summary of the result |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
53 * @param msg |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
54 * @param data |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
55 */ |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
56 parseShortResponse: function(msg, data) { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
57 data = Ext.JSON.decode(data); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
58 var errors = data.data.errors; |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
59 var warnings = data.data.warnings; |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
60 var out = []; |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
61 // There is a entry for each imported proben in the errors dict (might be |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
62 // empty) |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
63 |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
64 var numErrors; |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
65 var numWarnings; |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
66 if (!Ext.isObject(errors)) { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
67 numErrors = 0; |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
68 } |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
69 else { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
70 numErrors = Object.keys(errors).length; |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
71 } |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
72 if (!Ext.isObject(warnings)) { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
73 numWarnings = 0; |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
74 } |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
75 else { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
76 numWarnings = Object.keys(warnings).length; |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
77 } |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
78 if (msg !== '200') { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
79 out.push('Der Import der Datei ' + this.fileName + |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
80 ' war nicht erfolgreich. Der Importvorgang konnte ' + |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
81 'aufgrund eines Fehlers im Server nicht beendet werden.'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
82 } |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
83 else { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
84 if (numErrors > 0) { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
85 out.push(numErrors + ' Probe(n) konnten nicht erfolgreich ' + |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
86 'importiert werden.'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
87 out.push('<br/>'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
88 out.push('<br/>'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
89 } |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
90 if (numWarnings > 0) { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
91 out.push('Bei ' + numWarnings + ' Probe(n) traten Warnungen auf. '); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
92 out.push('<br/>'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
93 out.push('<br/>'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
94 } |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
95 if (numErrors > 0 || numWarnings > 0) { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
96 out.push('Der ausführliche Bericht steht als Download bereit.'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
97 out.push('<br/>'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
98 } |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
99 else { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
100 out.push('Die Proben wurden importiert.'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
101 out.push('<br/>'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
102 } |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
103 } |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
104 return out.join(''); |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 }, |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 |
890
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
729
diff
changeset
|
107 /** |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
729
diff
changeset
|
108 * Parse the Response |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
729
diff
changeset
|
109 * @param msg the Lada-Erro-Code |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
729
diff
changeset
|
110 * @param data the payload of the response |
def27cdd0dfa
Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents:
729
diff
changeset
|
111 */ |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 parseResponse: function(msg, data) { |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
113 console.log(Ext.JSON.decode(data)); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 data = Ext.JSON.decode(data); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 var errors = data.data.errors; |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 var warnings = data.data.warnings; |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 var out = []; |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
118 // There is a entry for each imported proben in the errors dict (might be |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
119 // empty) |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
120 |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
121 var numErrors; |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
122 var numWarnings; |
1219
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
123 if (!Ext.isObject(errors)) { |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
124 numErrors = 0; |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
125 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
126 else { |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
127 numErrors = Object.keys(errors).length; |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 } |
1219
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
129 if (!Ext.isObject(warnings)) { |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 numWarnings = 0; |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
131 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
132 else { |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
133 numWarnings = Object.keys(warnings).length; |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
134 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 if (msg !== '200') { |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
136 out.push('Der Import der Datei ' + this.fileName + |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 ' war nicht erfolgreich. Der Importvorgang konnte ' + |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 'aufgrund eines Fehlers im Server nicht beendet werden.'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
139 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
140 else { |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
141 if (numErrors > 0) { |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 out.push('Folgende Proben konnten nicht erfolgreich ' + |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 'importiert werden:'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
144 out.push('<br/>'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 out.push('<ol>'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 var msgs; |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 for (var key in errors) { |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
148 out.push('<li>Probe: ' + key); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
149 msgs = errors[key]; |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
150 out.push('<ol>'); |
1219
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
151 validation = [] |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
152 validation.push('Validierungsfehler: '); |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
153 for (var i = msgs.length - 1; i >= 0; i--) { |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
154 if (msgs[i].key === 'validation') { |
1219
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
155 validation.push('<ol>'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
156 validation.push(Lada.getApplication().bundle.getMsg(msgs[i].value) + ' (' + Lada.getApplication().bundle.getMsg(msgs[i].code.toString()) + ')'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
157 validation.push('</ol>'); |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 else { |
1219
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
160 out.push('<li>' + msgs[i].key + ' (' + Lada.getApplication().bundle.getMsg(msgs[i].code.toString())+'): '+msgs[i].value+'</li>') |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
162 } |
1219
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
163 if (validation.length > 1) { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
164 out.push('<li>') |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
165 out.push(validation.join('')); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
166 out.push('</li>') |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
167 } |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 out.push('</ol>'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 out.push('</li>'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
170 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 out.push('</ol>'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 out.push('<br/>'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
174 if (numWarnings > 0) { |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 out.push('<br/>'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 out.push('Bei folgenden Proben traten Warnungen auf:'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 out.push('<br/>'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
178 out.push('<ol>'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 for (key in warnings) { |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 out.push('<li>' + key); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 msgs = warnings[key]; |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 out.push('<ol>'); |
1219
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
183 validation = [] |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
184 validation.push('Validierungswarnungen: '); |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 for (var i = msgs.length - 1; i >= 0; i--) { |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
186 if (msgs[i].key === 'validation') { |
1219
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
187 validation.push('<ol>'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
188 validation.push(Lada.getApplication().bundle.getMsg(msgs[i].value) + ' (' + Lada.getApplication().bundle.getMsg(msgs[i].code.toString()) + ')'); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
189 validation.push('</ol>'); |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 else { |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
192 out.push('<li>' + msgs[i].key + ' (' + Lada.getApplication().bundle.getMsg(msgs[i].code.toString())+'): '+msgs[i].value+'</li>') |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
193 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
194 } |
1219
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
195 if (validation.length > 1) { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
196 out.push('<li>') |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
197 out.push(validation.join('')); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
198 out.push('</li>') |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
199 } |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
200 out.push('</ol>'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
201 out.push('</li>'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
202 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
203 out.push('</ol>'); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
204 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
205 out.push('<br/>'); |
1219
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
206 if (numWarnings > 0 || numErrors > 0) { |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
207 this.down('button[name=download]').enable(); |
746915a63a11
Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
890
diff
changeset
|
208 } |
729
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
209 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
210 console.log(out.join('')); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
211 return out.join(''); |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
212 } |
7eb8ef8e68ca
Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
213 }); |