annotate app/view/window/ImportResponse.js @ 1236:cfc24d2ae268

Fix error handling in ImportResponse window.
author Tom Gottfried <tom@intevation.de>
date Mon, 31 Oct 2016 13:54:00 +0100
parents 531db469779f
children 1ed5ec9326e6
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;
1236
cfc24d2ae268 Fix error handling in ImportResponse window.
Tom Gottfried <tom@intevation.de>
parents: 1226
diff changeset
22 var data = Ext.JSON.decode(me.data, true);
cfc24d2ae268 Fix error handling in ImportResponse window.
Tom Gottfried <tom@intevation.de>
parents: 1226
diff changeset
23 if (data) {
cfc24d2ae268 Fix error handling in ImportResponse window.
Tom Gottfried <tom@intevation.de>
parents: 1226
diff changeset
24 html = me.parseShortResponse(data);
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 }
1222
4e62bc6e7250 Fixed parsing of empty data and require the import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1219
diff changeset
26 else {
4e62bc6e7250 Fixed parsing of empty data and require the import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1219
diff changeset
27 html = 'Der Import der Datei ' + this.fileName +
4e62bc6e7250 Fixed parsing of empty data and require the import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1219
diff changeset
28 ' war nicht erfolgreich.';
4e62bc6e7250 Fixed parsing of empty data and require the import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1219
diff changeset
29 }
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 this.bodyStyle = {background: '#fff'};
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 me.items = [{
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 xtype: 'panel',
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 html: html,
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 margin: 10,
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 border: false
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 }];
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
38 me.buttons = [{
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
39 text: i18n.getMsg('close'),
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
40 scope: this,
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
41 name: 'close',
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
42 handler: this.close
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
43 }, {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
44 text: i18n.getMsg('download'),
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
45 name: 'download',
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
46 disabled: true,
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
47 handler: function() {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
48 var blob = new Blob([download],{type: 'text/html'});
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
49 saveAs(blob, 'report.html');
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 }];
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 this.callParent(arguments);
1236
cfc24d2ae268 Fix error handling in ImportResponse window.
Tom Gottfried <tom@intevation.de>
parents: 1226
diff changeset
53 if (data) {
cfc24d2ae268 Fix error handling in ImportResponse window.
Tom Gottfried <tom@intevation.de>
parents: 1226
diff changeset
54 download = me.parseResponse(data);
1222
4e62bc6e7250 Fixed parsing of empty data and require the import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1219
diff changeset
55 }
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
56 },
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
57
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
58 /**
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
59 * 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
60 * @param data
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
61 */
1236
cfc24d2ae268 Fix error handling in ImportResponse window.
Tom Gottfried <tom@intevation.de>
parents: 1226
diff changeset
62 parseShortResponse: function(data) {
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
63 var errors = data.data.errors;
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
64 var warnings = data.data.warnings;
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
65 var out = [];
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
66 // 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
67 // empty)
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 var numErrors;
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
70 var numWarnings;
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
71 if (!Ext.isObject(errors)) {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
72 numErrors = 0;
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
73 }
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
74 else {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
75 numErrors = Object.keys(errors).length;
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
76 }
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
77 if (!Ext.isObject(warnings)) {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
78 numWarnings = 0;
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
79 }
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
80 else {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
81 numWarnings = Object.keys(warnings).length;
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
82 }
1236
cfc24d2ae268 Fix error handling in ImportResponse window.
Tom Gottfried <tom@intevation.de>
parents: 1226
diff changeset
83 if (!data.success) {
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
84 out.push('Der Import der Datei ' + this.fileName +
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
85 ' war nicht erfolgreich. Der Importvorgang konnte ' +
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
86 'aufgrund eines Fehlers im Server nicht beendet werden.');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
87 }
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
88 else {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
89 if (numErrors > 0) {
1226
531db469779f Put message more precisely.
Tom Gottfried <tom@intevation.de>
parents: 1223
diff changeset
90 out.push(numErrors + ' Probe(n) konnten nicht vollständig '
531db469779f Put message more precisely.
Tom Gottfried <tom@intevation.de>
parents: 1223
diff changeset
91 + 'erfolgreich importiert werden.');
1219
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 (numWarnings > 0) {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
96 out.push('Bei ' + numWarnings + ' Probe(n) traten Warnungen auf. ');
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 out.push('<br/>');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
99 }
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
100 if (numErrors > 0 || numWarnings > 0) {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
101 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
102 out.push('<br/>');
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 else {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
105 out.push('Die Proben wurden importiert.');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
106 out.push('<br/>');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
107 }
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
108 }
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
109 return out.join('');
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 },
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 729
diff changeset
112 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 729
diff changeset
113 * Parse the Response
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 729
diff changeset
114 * @param data the payload of the response
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 729
diff changeset
115 */
1236
cfc24d2ae268 Fix error handling in ImportResponse window.
Tom Gottfried <tom@intevation.de>
parents: 1226
diff changeset
116 parseResponse: function(data) {
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 var errors = data.data.errors;
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 var warnings = data.data.warnings;
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 var out = [];
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 // 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
121 // empty)
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
123 var numErrors;
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 var numWarnings;
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
125 if (!Ext.isObject(errors)) {
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126 numErrors = 0;
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
128 else {
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 numErrors = Object.keys(errors).length;
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 }
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
131 if (!Ext.isObject(warnings)) {
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 numWarnings = 0;
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
134 else {
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
135 numWarnings = Object.keys(warnings).length;
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
136 }
1236
cfc24d2ae268 Fix error handling in ImportResponse window.
Tom Gottfried <tom@intevation.de>
parents: 1226
diff changeset
137 if (!data.success) {
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
138 out.push('Der Import der Datei ' + this.fileName +
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139 ' war nicht erfolgreich. Der Importvorgang konnte ' +
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
140 'aufgrund eines Fehlers im Server nicht beendet werden.');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 else {
1223
4c443efd5587 Added html tags for more valid html in download file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1222
diff changeset
143 out.push('<!DOCTYPE html>' +
4c443efd5587 Added html tags for more valid html in download file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1222
diff changeset
144 '<head><meta charset="utf-8"></head><body>');
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 if (numErrors > 0) {
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 out.push('Folgende Proben konnten nicht erfolgreich ' +
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147 'importiert werden:');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
148 out.push('<br/>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
149 out.push('<ol>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 var msgs;
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 for (var key in errors) {
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 out.push('<li>Probe: ' + key);
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 msgs = errors[key];
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 out.push('<ol>');
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
155 validation = []
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
156 validation.push('Validierungsfehler: ');
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157 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
158 if (msgs[i].key === 'validation') {
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
159 validation.push('<ol>');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
160 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
161 validation.push('</ol>');
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163 else {
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
164 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
165 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 }
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
167 if (validation.length > 1) {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
168 out.push('<li>')
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
169 out.push(validation.join(''));
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
170 out.push('</li>')
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
171 }
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
172 out.push('</ol>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173 out.push('</li>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175 out.push('</ol>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
176 out.push('<br/>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
177 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
178 if (numWarnings > 0) {
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 out.push('<br/>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 out.push('Bei folgenden Proben traten Warnungen auf:');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
181 out.push('<br/>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
182 out.push('<ol>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 for (key in warnings) {
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184 out.push('<li>' + key);
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
185 msgs = warnings[key];
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 out.push('<ol>');
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
187 validation = []
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
188 validation.push('Validierungswarnungen: ');
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 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
190 if (msgs[i].key === 'validation') {
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
191 validation.push('<ol>');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
192 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
193 validation.push('</ol>');
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195 else {
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
196 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
197 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 }
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
199 if (validation.length > 1) {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
200 out.push('<li>')
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
201 out.push(validation.join(''));
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
202 out.push('</li>')
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
203 }
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
204 out.push('</ol>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
205 out.push('</li>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
206 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
207 out.push('</ol>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
208 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
209 out.push('<br/>');
1223
4c443efd5587 Added html tags for more valid html in download file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1222
diff changeset
210 out.push('</body></html>')
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
211 if (numWarnings > 0 || numErrors > 0) {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
212 this.down('button[name=download]').enable();
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
213 }
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
214 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
215 return out.join('');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
216 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
217 });

http://lada.wald.intevation.org