changeset 382:91193c49c2bb

Make the error dialog look better.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Thu, 29 Aug 2013 10:28:58 +0200
parents 9bc080ecdbc9
children fe8d6e1b08ff
files app/controller/Proben.js
diffstat 1 files changed, 21 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/Proben.js	Tue Aug 27 10:40:14 2013 +0200
+++ b/app/controller/Proben.js	Thu Aug 29 10:28:58 2013 +0200
@@ -13,7 +13,14 @@
         if (errors) {
             out.push("<ol>");
             for (var key in errors) {
-                out.push("<li>"+key+"</li>");
+                out.push("<li>"+key)
+                var msgs = errors[key];
+                out.push("<ol>");
+                for (var i = msgs.length - 1; i >= 0; i--){
+                    out.push("<li>"+msgs[i].key+" ("+msgs[i].code+"): "+msgs[i].value+"</li>")
+                };
+                out.push("</ol>");
+                out.push("</li>");
             }
             out.push("</ol>");
         } else {
@@ -25,7 +32,14 @@
         if (warnings) {
             out.push("<ol>");
             for (var key in warnings) {
-                out.push("<li>"+key+"</li>");
+                out.push("<li>"+key)
+                var msgs = warnings[key];
+                out.push("<ol>");
+                for (var i = msgs.length - 1; i >= 0; i--){
+                    out.push("<li>"+msgs[i].key+" ("+msgs[i].code+"): "+msgs[i].value+"</li>")
+                };
+                out.push("</ol>");
+                out.push("</li>");
             }
             out.push("</ol>");
         } else {
@@ -120,11 +134,11 @@
                     win.close();
                 },
                 failure: function(fp, resp) {
-                    var errors = resp.result.data[0];
-                    var warnings = resp.result.data[1];
-                    var filename = resp.result.data[2].filename;
-                    var message = resp.message;
-                    var dialogbody = buildImportReport(filename, message, errors.parser, warnings)
+                    var errors = resp.result.data.errors;
+                    var warnings = resp.result.data.warnings;
+                    var filename = resp.result.data.filename;
+                    var message = resp.result.message;
+                    var dialogbody = buildImportReport(filename, message, errors, warnings)
                     Ext.Msg.alert('Fehler', dialogbody);
                     win.close();
                 }

http://lada.wald.intevation.org