annotate app/view/window/ImportResponse.js @ 1223:4c443efd5587

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

http://lada.wald.intevation.org