annotate app/view/window/ImportResponse.js @ 1353:39dbdfa00c91

Do not allow arbitrary input for Koordinatenart.
author Tom Gottfried <tom@intevation.de>
date Tue, 07 Feb 2017 16:06:08 +0100
parents 1ed5ec9326e6
children ee21d0e1b998
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) {
1239
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
90 if (errors.parser) {
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
91 out.push('Die Probe(n) konnten nicht erfolgreich ' +
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
92 'importiert werden.');
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
93 }
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
94 else {
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
95 out.push(numErrors + ' Probe(n) konnten nicht ' +
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
96 'erfolgreich importiert werden.');
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
97 }
1219
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 out.push('<br/>');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
100 }
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
101 if (numWarnings > 0) {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
102 out.push('Bei ' + numWarnings + ' Probe(n) traten Warnungen auf. ');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
103 out.push('<br/>');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
104 out.push('<br/>');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
105 }
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
106 if (numErrors > 0 || numWarnings > 0) {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
107 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
108 out.push('<br/>');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
109 }
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
110 else {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
111 out.push('Die Proben wurden importiert.');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
112 out.push('<br/>');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
113 }
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
114 }
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
115 return out.join('');
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 },
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117
890
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 729
diff changeset
118 /**
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 729
diff changeset
119 * Parse the Response
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 729
diff changeset
120 * @param data the payload of the response
def27cdd0dfa Added Documentation to Windows
Dustin Demuth <dustin@intevation.de>
parents: 729
diff changeset
121 */
1236
cfc24d2ae268 Fix error handling in ImportResponse window.
Tom Gottfried <tom@intevation.de>
parents: 1226
diff changeset
122 parseResponse: function(data) {
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
123 var errors = data.data.errors;
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 var warnings = data.data.warnings;
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125 var out = [];
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126 // 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
127 // empty)
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
128
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 var numErrors;
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 var numWarnings;
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
131 if (!Ext.isObject(errors)) {
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 numErrors = 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 numErrors = Object.keys(errors).length;
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
136 }
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
137 if (!Ext.isObject(warnings)) {
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
138 numWarnings = 0;
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 numWarnings = Object.keys(warnings).length;
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 }
1236
cfc24d2ae268 Fix error handling in ImportResponse window.
Tom Gottfried <tom@intevation.de>
parents: 1226
diff changeset
143 if (!data.success) {
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 out.push('Der Import der Datei ' + this.fileName +
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 ' war nicht erfolgreich. Der Importvorgang konnte ' +
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 'aufgrund eines Fehlers im Server nicht beendet werden.');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
148 else {
1223
4c443efd5587 Added html tags for more valid html in download file.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1222
diff changeset
149 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
150 '<head><meta charset="utf-8"></head><body>');
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 if (numErrors > 0) {
1239
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
152 out.push('Folgende Fehler traten beim Import auf:');
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 out.push('<br/>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 out.push('<ol>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
155 var msgs;
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156 for (var key in errors) {
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157 msgs = errors[key];
1239
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
158 if (key !== 'parser') {
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
159 out.push('<li>Probe: ' + key);
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
160 }
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
161 out.push('<ol>');
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
162 validation = []
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
163 validation.push('Validierungsfehler: ');
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
164 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
165 if (msgs[i].key === 'validation') {
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
166 validation.push('<ol>');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
167 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
168 validation.push('</ol>');
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 else {
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
171 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
172 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
173 }
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
174 if (validation.length > 1) {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
175 out.push('<li>')
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
176 out.push(validation.join(''));
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
177 out.push('</li>')
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
178 }
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 out.push('</ol>');
1239
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
180 if (key !== 'parser') {
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
181 out.push('</li>');
1ed5ec9326e6 Report parser errors separately.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1236
diff changeset
182 }
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184 out.push('</ol>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
185 out.push('<br/>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187 if (numWarnings > 0) {
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
188 out.push('<br/>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 out.push('Bei folgenden Proben traten Warnungen auf:');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190 out.push('<br/>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
191 out.push('<ol>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192 for (key in warnings) {
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
193 out.push('<li>' + key);
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 msgs = warnings[key];
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
195 out.push('<ol>');
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
196 validation = []
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
197 validation.push('Validierungswarnungen: ');
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 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
199 if (msgs[i].key === 'validation') {
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
200 validation.push('<ol>');
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
201 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
202 validation.push('</ol>');
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
203 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
204 else {
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
205 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
206 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
207 }
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
208 if (validation.length > 1) {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
209 out.push('<li>')
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
210 out.push(validation.join(''));
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
211 out.push('</li>')
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
212 }
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
213 out.push('</ol>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
214 out.push('</li>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
215 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
216 out.push('</ol>');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
217 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
218 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
219 out.push('</body></html>')
1219
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
220 if (numWarnings > 0 || numErrors > 0) {
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
221 this.down('button[name=download]').enable();
746915a63a11 Updated import response window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 890
diff changeset
222 }
729
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
223 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
224 return out.join('');
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
225 }
7eb8ef8e68ca Added window to display importer messages.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
226 });

http://lada.wald.intevation.org