changeset 1026:360884265471

merged error text
author Dustin Demuth <dustin@intevation.de>
date Fri, 12 Feb 2016 16:34:28 +0100
parents 2329acae1705 (diff) 181621463d01 (current diff)
children 859e2e9859cd
files
diffstat 1 files changed, 36 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/grid/Status.js	Thu Feb 11 12:10:53 2016 +0100
+++ b/app/controller/grid/Status.js	Fri Feb 12 16:34:28 2016 +0100
@@ -41,7 +41,26 @@
      gridSave: function(editor, context) {
         context.record.set('sdatum', new Date());
         context.record.save({
-            success: function() {
+            success: function(response) {
+                var i18n = Lada.getApplication().bundle;
+                var json = Ext.JSON.decode(response.responseText);
+
+                if(json) {
+                    if (!json.success) {
+                        if(json.message){
+                            Ext.Msg.alert(i18n.getMsg('err.msg.generic.title')
+                                +' #'+json.message,
+                                i18n.getMsg(json.message));
+                        } else {
+                            Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'),
+                                i18n.getMsg('err.msg.generic.body'));
+                        }
+                    } else {
+                        Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'),
+                        i18n.getMsg('err.msg.generic.body'));
+                    }
+                }
+
                 context.grid.initData();
                 var win = context.grid.up('window');
                 win.initData();
@@ -170,6 +189,22 @@
             jsonData: record.getData(),
             method: 'POST',
             success: function(response) {
+                var i18n = Lada.getApplication().bundle;
+                var json = Ext.JSON.decode(response.responseText);
+
+                if(json) {
+                    if (!json.success) {
+                        if(json.message){
+                            Ext.Msg.alert(i18n.getMsg('err.msg.generic.title')
+                                +' #'+json.message,
+                                i18n.getMsg(json.message));
+                        } else {
+                            Ext.Msg.alert(i18n.getMsg('err.msg.generic.title'),
+                                i18n.getMsg('err.msg.generic.body'));
+                        }
+                    }
+                }
+
                 button.up('window').initData();
                 button.up('grid').initData();
             },
@@ -178,9 +213,6 @@
                 var i18n = Lada.getApplication().bundle;
                 var json = Ext.JSON.decode(response.responseText);
                 if (json) {
-                    if(json.errors.totalCount > 0 || json.warnings.totalCount > 0){
-                        formPanel.setMessages(json.errors, json.warnings);
-                    }
                     if(json.message){
                         Ext.Msg.alert(i18n.getMsg('err.msg.generic.title')
                             +' #'+json.message,

http://lada.wald.intevation.org