changeset 701:f0bc5387abcc

Added failure - Messages
author Dustin Demuth <dustin@intevation.de>
date Fri, 27 Mar 2015 09:38:13 +0100
parents 1e76aec72815
children 0c8e689f3bcb
files app/controller/form/Location.js app/controller/form/Messung.js app/controller/form/Ort.js app/controller/form/Probe.js app/controller/grid/MKommentar.js app/controller/grid/Messwert.js app/controller/grid/Ort.js app/controller/grid/PKommentar.js app/controller/grid/Probenzusatzwert.js app/controller/grid/Status.js resources/i18n/Lada_de-DE.properties
diffstat 11 files changed, 188 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/form/Location.js	Fri Mar 27 08:43:37 2015 +0100
+++ b/app/controller/form/Location.js	Fri Mar 27 09:38:13 2015 +0100
@@ -67,9 +67,15 @@
 
                     if(json.message){
                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('errmsgtitle')
-                            +' '+json.message,
+                            +' #'+json.message,
                             Lada.getApplication().bundle.getMsg(json.message));
+                    } else {
+                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
                     }
+                } else {
+                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                        Lada.getApplication().bundle.getMsg('err.msg.response.body'));
                 }
             }
         });
--- a/app/controller/form/Messung.js	Fri Mar 27 08:43:37 2015 +0100
+++ b/app/controller/form/Messung.js	Fri Mar 27 09:38:13 2015 +0100
@@ -62,10 +62,16 @@
                     }
 
                     if(json.message){
-                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('errmsgtitle')
-                            +' '+json.message,
+                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
+                            +' #'+json.message,
                             Lada.getApplication().bundle.getMsg(json.message));
+                    } else {
+                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
                     }
+                } else {
+                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                        Lada.getApplication().bundle.getMsg('err.msg.response.body'));
                 }
             }
         });
--- a/app/controller/form/Ort.js	Fri Mar 27 08:43:37 2015 +0100
+++ b/app/controller/form/Ort.js	Fri Mar 27 09:38:13 2015 +0100
@@ -58,9 +58,15 @@
 
                     if(json.message){
                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('errmsgtitle')
-                            +' '+json.message,
+                            +' #'+json.message,
                             Lada.getApplication().bundle.getMsg(json.message));
+                    } else {
+                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
                     }
+                } else {
+                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                        Lada.getApplication().bundle.getMsg('err.msg.response.body'));
                 }
             }
         });
--- a/app/controller/form/Probe.js	Fri Mar 27 08:43:37 2015 +0100
+++ b/app/controller/form/Probe.js	Fri Mar 27 09:38:13 2015 +0100
@@ -63,10 +63,16 @@
                     }
 
                     if(json.message){
-                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('errmsgtitle')
-                            +' '+json.message,
+                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
+                            +' #'+json.message,
                             Lada.getApplication().bundle.getMsg(json.message));
+                    } else {
+                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
                     }
+                } else {
+                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                        Lada.getApplication().bundle.getMsg('err.msg.response.body'));
                 }
             }
         });
--- a/app/controller/grid/MKommentar.js	Fri Mar 27 08:43:37 2015 +0100
+++ b/app/controller/grid/MKommentar.js	Fri Mar 27 09:38:13 2015 +0100
@@ -34,11 +34,14 @@
               var json = response.request.scope.reader.jsonData;
               if (json) {
                 if (json.message){
-                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('errmsgtitle')
-                        +' '+json.message,
+                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
+                        +' #'+json.message,
                         Lada.getApplication().bundle.getMsg(json.message));
-                    }
-                }
+                   } else {
+                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                   }
+              }
             }
         });
     },
@@ -66,8 +69,21 @@
                     success: function() {
                         button.up('window').initData();
                     },
-                    failure: function() {
-                        // TODO
+                    failure: function(request, response) {
+                        var json = response.request.scope.reader.jsonData;
+                        if (json) {
+                            if (json.message){
+                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title')
+                                    +' #'+json.message,
+                                    Lada.getApplication().bundle.getMsg(json.message));
+                            } else {
+                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
+                                    Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                            }
+                        } else {
+                            Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
+                                Lada.getApplication().bundle.getMsg('err.msg.response.body'));
+                        }
                     }
                 });
             }
--- a/app/controller/grid/Messwert.js	Fri Mar 27 08:43:37 2015 +0100
+++ b/app/controller/grid/Messwert.js	Fri Mar 27 09:38:13 2015 +0100
@@ -26,12 +26,25 @@
 
     gridSave: function(editor, context) {
         context.record.save({
-            success: function() {
+            success: function(request, response) {
                 context.grid.store.reload();
                 context.grid.up('window').initData();
             },
-            failure: function() {
-                // TODO
+            failure: function(request, response) {
+                var json = response.request.scope.reader.jsonData;
+                if (json) {
+                    if (json.message){
+                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
+                            +' #'+json.message,
+                            Lada.getApplication().bundle.getMsg(json.message));
+                    } else {
+                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                    }
+                } else {
+                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                        Lada.getApplication().bundle.getMsg('err.msg.response.body'));
+                }
             }
         });
     },
@@ -61,8 +74,21 @@
                         button.up('window').initData();
                         grid.initData();
                     },
-                    failure: function() {
-                        // TODO
+                    failure: function(request, response) {
+                        var json = response.request.scope.reader.jsonData;
+                        if (json) {
+                            if (json.message){
+                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title')
+                                    +' #'+json.message,
+                                    Lada.getApplication().bundle.getMsg(json.message));
+                            } else {
+                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
+                                    Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                            }
+                        } else {
+                            Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
+                                Lada.getApplication().bundle.getMsg('err.msg.response.body'));
+                        }
                     }
                 });
             }
--- a/app/controller/grid/Ort.js	Fri Mar 27 08:43:37 2015 +0100
+++ b/app/controller/grid/Ort.js	Fri Mar 27 09:38:13 2015 +0100
@@ -59,7 +59,21 @@
                     success: function() {
                         button.up('window').initData();
                     },
-                    failure: function() {
+                    failure: function(request, response) {
+                        var json = response.request.scope.reader.jsonData;
+                        if (json) {
+                            if (json.message){
+                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title')
+                                    +' #'+json.message,
+                                    Lada.getApplication().bundle.getMsg(json.message));
+                            } else {
+                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
+                                    Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                            }
+                        } else {
+                            Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
+                                Lada.getApplication().bundle.getMsg('err.msg.response.body'));
+                        }
                     }
                 });
             }
--- a/app/controller/grid/PKommentar.js	Fri Mar 27 08:43:37 2015 +0100
+++ b/app/controller/grid/PKommentar.js	Fri Mar 27 09:38:13 2015 +0100
@@ -12,7 +12,7 @@
     init: function() {
         this.control({
             'pkommentargrid': {
-                edit: this.edit,
+                edit: this.gridSave,
                 canceledit: this.cancelEdit
             },
             'pkommentargrid button[action=add]': {
@@ -24,14 +24,27 @@
         });
     },
 
-    edit: function(editor, context) {
+    gridSave: function(editor, context) {
         context.record.save({
             success: function() {
                 context.grid.store.reload();
                 context.grid.up('window').initData();
             },
-            failure: function() {
-                // TODO
+            failure: function(request, response) {
+                var json = response.request.scope.reader.jsonData;
+                if (json) {
+                    if (json.message){
+                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
+                            +' #'+json.message,
+                            Lada.getApplication().bundle.getMsg(json.message));
+                    } else {
+                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                    }
+                } else {
+                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                        Lada.getApplication().bundle.getMsg('err.msg.response.body'));
+                }
             }
         });
     },
@@ -59,8 +72,21 @@
                     success: function() {
                         button.up('window').initData();
                     },
-                    failure: function() {
-                        // TODO
+                    failure: function(request, response) {
+                        var json = response.request.scope.reader.jsonData;
+                        if (json) {
+                            if (json.message){
+                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title')
+                                    +' #'+json.message,
+                                    Lada.getApplication().bundle.getMsg(json.message));
+                            } else {
+                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
+                                    Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                            }
+                        } else {
+                            Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
+                                Lada.getApplication().bundle.getMsg('err.msg.response.body'));
+                        }
                     }
                 });
             }
--- a/app/controller/grid/Probenzusatzwert.js	Fri Mar 27 08:43:37 2015 +0100
+++ b/app/controller/grid/Probenzusatzwert.js	Fri Mar 27 09:38:13 2015 +0100
@@ -34,10 +34,16 @@
                 var json = response.request.scope.reader.jsonData;
                 if (json) {
                     if (json.message){
-                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('errmsgtitle')
-                            +' '+json.message,
+                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
+                            +' #'+json.message,
                             Lada.getApplication().bundle.getMsg(json.message));
+                    } else {
+                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
                     }
+                } else {
+                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                        Lada.getApplication().bundle.getMsg('err.msg.response.body'));
                 }
             }
         });
@@ -68,8 +74,21 @@
                         button.up('window').initData();
                         grid.initData();
                     },
-                    failure: function() {
-                        // TODO
+                    failure: function(request, response) {
+                        var json = response.request.scope.reader.jsonData;
+                        if (json) {
+                            if (json.message){
+                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title')
+                                    +' #'+json.message,
+                                    Lada.getApplication().bundle.getMsg(json.message));
+                            } else {
+                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
+                                    Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                            }
+                        } else {
+                            Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
+                                Lada.getApplication().bundle.getMsg('err.msg.response.body'));
+                        }
                     }
                 });
             }
--- a/app/controller/grid/Status.js	Fri Mar 27 08:43:37 2015 +0100
+++ b/app/controller/grid/Status.js	Fri Mar 27 09:38:13 2015 +0100
@@ -30,8 +30,21 @@
                 context.grid.initData();
                 context.grid.up('window').initData();
             },
-            failure: function() {
-                // TODO
+            failure: function(request, response) {
+                var json = response.request.scope.reader.jsonData;
+                if (json) {
+                    if (json.message){
+                        Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
+                            +' #'+json.message,
+                            Lada.getApplication().bundle.getMsg(json.message));
+                    } else {
+                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                    }
+                } else {
+                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
+                        Lada.getApplication().bundle.getMsg('err.msg.response.body'));
+                }
             }
         });
     },
@@ -61,8 +74,21 @@
                         button.up('window').initData();
                         grid.initData();
                     },
-                    failure: function() {
-                        // TODO
+                    failure: function(request, response) {
+                        var json = response.request.scope.reader.jsonData;
+                        if (json) {
+                            if (json.message){
+                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title')
+                                    +' #'+json.message,
+                                    Lada.getApplication().bundle.getMsg(json.message));
+                            } else {
+                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
+                                    Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                            }
+                        } else {
+                            Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
+                                Lada.getApplication().bundle.getMsg('err.msg.response.body'));
+                        }
                     }
                 });
             }
--- a/resources/i18n/Lada_de-DE.properties	Fri Mar 27 08:43:37 2015 +0100
+++ b/resources/i18n/Lada_de-DE.properties	Fri Mar 27 09:38:13 2015 +0100
@@ -36,4 +36,8 @@
 ##
 # Msg:
 ##
-errmsgtitle: Fehler
+err.msg.save.title: Fehler beim Speichern
+err.msg.delete.title: Fehler beim Löschen
+err.msg.generic.title: Fehler
+err.msg.generic.body: Ein Fehler ist aufgetreten. Dieser konnte nicht näher erfasst werden.
+err.msg.response.body: Die Antwort des Servers konnte nicht ausgewertet werden.

http://lada.wald.intevation.org