changeset 695:d6ef146e1a9f

Added simple handling for Failure-Messages
author Dustin Demuth <dustin@intevation.de>
date Thu, 26 Mar 2015 16:24:13 +0100
parents a0df1a8dff24
children b0f1dcdf981d
files app/controller/form/Location.js app/controller/form/Messung.js app/controller/form/Ort.js
diffstat 3 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/form/Location.js	Thu Mar 26 16:02:38 2015 +0100
+++ b/app/controller/form/Location.js	Thu Mar 26 16:24:13 2015 +0100
@@ -61,7 +61,15 @@
                 formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
                 var json = response.request.scope.reader.jsonData;
                 if (json) {
-                    formPanel.setMessages(json.errors, json.warnings);
+                    if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
+                        formPanel.setMessages(json.errors, json.warnings);
+                    }
+
+                    if(json.message){
+                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('errmsgtitle')
+                            +' '+json.message,
+                            Lada.getApplication().bundle.getMsg(json.message));
+                    }
                 }
             }
         });
--- a/app/controller/form/Messung.js	Thu Mar 26 16:02:38 2015 +0100
+++ b/app/controller/form/Messung.js	Thu Mar 26 16:24:13 2015 +0100
@@ -62,7 +62,9 @@
                     }
 
                     if(json.message){
-                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('errmsgtitle'), Lada.getApplication().bundle.getMsg(json.message));
+                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('errmsgtitle')
+                            +' '+json.message,
+                            Lada.getApplication().bundle.getMsg(json.message));
                     }
                 }
             }
--- a/app/controller/form/Ort.js	Thu Mar 26 16:02:38 2015 +0100
+++ b/app/controller/form/Ort.js	Thu Mar 26 16:24:13 2015 +0100
@@ -52,7 +52,15 @@
                 formPanel.getForm().loadRecord(formPanel.getForm().getRecord());
                 var json = response.request.scope.reader.jsonData;
                 if (json) {
-                    formPanel.setMessages(json.errors, json.warnings);
+                    if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
+                        formPanel.setMessages(json.errors, json.warnings);
+                    }
+
+                    if(json.message){
+                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('errmsgtitle')
+                            +' '+json.message,
+                            Lada.getApplication().bundle.getMsg(json.message));
+                    }
                 }
             }
         });

http://lada.wald.intevation.org