Mercurial > lada > lada-client
comparison app/controller/Proben.js @ 397:c5188d71ef87 0.4
Fixed import report dialog.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Fri, 30 Aug 2013 13:57:39 +0200 |
parents | 91193c49c2bb |
children | 4fdc09ebf21d |
comparison
equal
deleted
inserted
replaced
396:a7e9664091f4 | 397:c5188d71ef87 |
---|---|
4 | 4 |
5 function buildImportReport(filename, msg, errors, warnings) { | 5 function buildImportReport(filename, msg, errors, warnings) { |
6 var out = Array(); | 6 var out = Array(); |
7 if (msg != 200) { | 7 if (msg != 200) { |
8 out.push("Der Import der Datei " + filename + " war nicht erfolgreich."); | 8 out.push("Der Import der Datei " + filename + " war nicht erfolgreich."); |
9 out.push("Bei dem Import sind folgende Fehler und Warnungen aufgetreten"); | |
10 out.push("<br/>"); | |
11 out.push("<strong>Fehler:</strong>"); | |
12 out.push("<br/>"); | |
13 if (errors) { | |
14 out.push("<ol>"); | |
15 for (var key in errors) { | |
16 out.push("<li>"+key) | |
17 var msgs = errors[key]; | |
18 out.push("<ol>"); | |
19 for (var i = msgs.length - 1; i >= 0; i--){ | |
20 out.push("<li>"+msgs[i].key+" ("+msgs[i].code+"): "+msgs[i].value+"</li>") | |
21 }; | |
22 out.push("</ol>"); | |
23 out.push("</li>"); | |
24 } | |
25 out.push("</ol>"); | |
26 } else { | |
27 out.push("Keine Fehler"); | |
28 out.push("<br/>"); | |
29 } | |
30 out.push("<strong>Warnungen:</strong>"); | |
31 out.push("<br/>"); | |
32 if (warnings) { | |
33 out.push("<ol>"); | |
34 for (var key in warnings) { | |
35 out.push("<li>"+key) | |
36 var msgs = warnings[key]; | |
37 out.push("<ol>"); | |
38 for (var i = msgs.length - 1; i >= 0; i--){ | |
39 out.push("<li>"+msgs[i].key+" ("+msgs[i].code+"): "+msgs[i].value+"</li>") | |
40 }; | |
41 out.push("</ol>"); | |
42 out.push("</li>"); | |
43 } | |
44 out.push("</ol>"); | |
45 } else { | |
46 out.push("Keine Warnungen"); | |
47 out.push("<br/>"); | |
48 } | |
49 } else { | 9 } else { |
50 out.push("Der Import der Datei " + filename + " war erfolgreich."); | 10 out.push("Der Import der Datei " + filename + " war erfolgreich."); |
11 } | |
12 out.push("Bei dem Import sind folgende Fehler und Warnungen aufgetreten"); | |
13 out.push("<br/>"); | |
14 out.push("<strong>Fehler:</strong>"); | |
15 out.push("<br/>"); | |
16 if (errors) { | |
17 out.push("<ol>"); | |
18 for (var key in errors) { | |
19 out.push("<li>"+key) | |
20 var msgs = errors[key]; | |
21 out.push("<ol>"); | |
22 for (var i = msgs.length - 1; i >= 0; i--){ | |
23 out.push("<li>"+msgs[i].key+" ("+msgs[i].code+"): "+msgs[i].value+"</li>") | |
24 }; | |
25 out.push("</ol>"); | |
26 out.push("</li>"); | |
27 } | |
28 out.push("</ol>"); | |
29 } else { | |
30 out.push("Keine Fehler"); | |
31 out.push("<br/>"); | |
32 } | |
33 out.push("<strong>Warnungen:</strong>"); | |
34 out.push("<br/>"); | |
35 if (warnings) { | |
36 out.push("<ol>"); | |
37 for (var key in warnings) { | |
38 out.push("<li>"+key) | |
39 var msgs = warnings[key]; | |
40 out.push("<ol>"); | |
41 for (var i = msgs.length - 1; i >= 0; i--){ | |
42 out.push("<li>"+msgs[i].key+" ("+msgs[i].code+"): "+msgs[i].value+"</li>") | |
43 }; | |
44 out.push("</ol>"); | |
45 out.push("</li>"); | |
46 } | |
47 out.push("</ol>"); | |
48 } else { | |
49 out.push("Keine Warnungen"); | |
50 out.push("<br/>"); | |
51 } | 51 } |
52 return out.join(""); | 52 return out.join(""); |
53 } | 53 } |
54 | 54 |
55 Ext.define('Lada.controller.Proben', { | 55 Ext.define('Lada.controller.Proben', { |
127 url: 'server/rest/import/laf', | 127 url: 'server/rest/import/laf', |
128 waitMsg: 'Importiere...', | 128 waitMsg: 'Importiere...', |
129 // TODO: Handle the response correct. o must must contain the | 129 // TODO: Handle the response correct. o must must contain the |
130 // filename (None) <2013-08-13 16:17> | 130 // filename (None) <2013-08-13 16:17> |
131 success: function(fp, resp) { | 131 success: function(fp, resp) { |
132 var filename = resp.result.data[2].filename; | 132 var errors = resp.result.data.errors; |
133 Ext.Msg.alert('Erfolg! ', 'Die Datei "' + filename + '" wurde erfolgreich importiert.'); | 133 var warnings = resp.result.data.warnings; |
134 var filename = resp.result.data.filename; | |
135 var message = resp.result.message; | |
136 var dialogbody = buildImportReport(filename, message, errors, warnings) | |
137 var filename = resp.result.data.filename; | |
138 Ext.Msg.alert('Erfolg', dialogbody); | |
134 win.close(); | 139 win.close(); |
135 }, | 140 }, |
136 failure: function(fp, resp) { | 141 failure: function(fp, resp) { |
137 var errors = resp.result.data.errors; | 142 var errors = resp.result.data.errors; |
138 var warnings = resp.result.data.warnings; | 143 var warnings = resp.result.data.warnings; |