changeset 1003:15d8c64049d1 stammdatengrids

Datensatzerzeuger now uses the server. Added i18n to confirmation messages
author Dustin Demuth <dustin@intevation.de>
date Fri, 15 Jan 2016 14:42:29 +0100
parents f73ca04d73a7
children 9ac03f461ab4 23bfcbdb4527
files app/controller/grid/Datensatzerzeuger.js app/controller/grid/MessprogrammKategorie.js app/controller/grid/Probenehmer.js app/model/DatensatzErzeuger.js app/model/MessprogrammKategorie.js app/model/Probenehmer.js app/store/DatensatzErzeuger.js app/view/grid/MessprogrammKategorie.js resources/i18n/Lada_de-DE.properties
diffstat 9 files changed, 68 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/app/controller/grid/Datensatzerzeuger.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/controller/grid/Datensatzerzeuger.js	Fri Jan 15 14:42:29 2016 +0100
@@ -40,7 +40,7 @@
      * On failure it displays a message
      */
     gridSave: function(editor, context) {
-        context.record.set('datum', new Date());
+        var i18n = Lada.getApplication().bundle;
         context.record.save({
             success: function(record, response) {
                 //Do Nothing
@@ -49,12 +49,12 @@
               var json = response.request.scope.reader.jsonData;
               if (json) {
                 if (json.message){
-                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
+                    Ext.Msg.alert(i18n.getMsg('err.msg.save.title')
                         +' #'+json.message,
-                        Lada.getApplication().bundle.getMsg(json.message));
+                        i18n.getMsg(json.message));
                    } else {
-                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
-                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                         Ext.Msg.alert(i18n.getMsg('err.msg.save.title'),
+                            i18n.getMsg('err.msg.generic.body'));
                    }
               }
             }
@@ -91,8 +91,11 @@
     remove: function(button) {
         var grid = button.up('grid');
         var selection = grid.getView().getSelectionModel().getSelection()[0];
+        var i18n = Lada.getApplication().bundle;
         //TODO: i18n
-        Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) {
+        Ext.MessageBox.confirm(i18n.getMsg('delete'),
+                                i18n.getMsg('confirmation.question'),
+                                function(btn) {
             if (btn === 'yes') {
                 selection.destroy({
                     success: function() {
@@ -102,16 +105,16 @@
                         var json = response.request.scope.reader.jsonData;
                         if (json) {
                             if (json.message){
-                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title')
+                                Ext.Msg.alert(i18n.getMsg('err.msg.delete.title')
                                     +' #'+json.message,
-                                    Lada.getApplication().bundle.getMsg(json.message));
+                                    i18n.getMsg(json.message));
                             } else {
-                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
-                                    Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                                Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
+                                    i18n.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'));
+                            Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
+                                i18n.getMsg('err.msg.response.body'));
                         }
                     }
                 });
--- a/app/controller/grid/MessprogrammKategorie.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/controller/grid/MessprogrammKategorie.js	Fri Jan 15 14:42:29 2016 +0100
@@ -40,6 +40,7 @@
      * On failure it displays a message
      */
     gridSave: function(editor, context) {
+        var i18n = Lada.getApplication().bundle;
         context.record.save({
             success: function(record, response) {
                 //Do Nothing
@@ -48,12 +49,12 @@
               var json = response.request.scope.reader.jsonData;
               if (json) {
                 if (json.message){
-                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
+                    Ext.Msg.alert(i18n.getMsg('err.msg.save.title')
                         +' #'+json.message,
-                        Lada.getApplication().bundle.getMsg(json.message));
+                        i18n.getMsg(json.message));
                    } else {
-                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
-                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                         Ext.Msg.alert(i18n.getMsg('err.msg.save.title'),
+                            i18n.getMsg('err.msg.generic.body'));
                    }
               }
             }
@@ -78,7 +79,7 @@
     add: function(button) {
         var record = Ext.create('Lada.model.MessprogrammKategorie');
         button.up('messprogrammkategoriegrid').store.insert(0, record);
-        button.up('probenehmergrid').rowEditing.startEdit(0, 1);
+        button.up('messprogrammkategoriegrid').rowEditing.startEdit(0, 1);
     },
 
     /**
@@ -90,8 +91,10 @@
     remove: function(button) {
         var grid = button.up('grid');
         var selection = grid.getView().getSelectionModel().getSelection()[0];
-        //TODO: i18n
-        Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) {
+        var i18n = Lada.getApplication().bundle;
+        Ext.MessageBox.confirm(i18n.getMsg('delete'),
+                                i18n.getMsg('confirmation.question'),
+                                function(btn) {
             if (btn === 'yes') {
                 selection.destroy({
                     success: function() {
@@ -101,16 +104,16 @@
                         var json = response.request.scope.reader.jsonData;
                         if (json) {
                             if (json.message){
-                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title')
+                                Ext.Msg.alert(i18n.getMsg('err.msg.delete.title')
                                     +' #'+json.message,
-                                    Lada.getApplication().bundle.getMsg(json.message));
+                                    i18n.getMsg(json.message));
                             } else {
-                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
-                                    Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                                Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
+                                    i18n.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'));
+                            Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
+                                i18n.getMsg('err.msg.response.body'));
                         }
                     }
                 });
--- a/app/controller/grid/Probenehmer.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/controller/grid/Probenehmer.js	Fri Jan 15 14:42:29 2016 +0100
@@ -40,6 +40,7 @@
      * On failure it displays a message
      */
     gridSave: function(editor, context) {
+        var i18n = Lada.getApplication().bundle;
         context.record.save({
             success: function(record, response) {
                 //Do Nothing
@@ -48,12 +49,12 @@
               var json = response.request.scope.reader.jsonData;
               if (json) {
                 if (json.message){
-                    Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title')
+                    Ext.Msg.alert(i18n.getMsg('err.msg.save.title')
                         +' #'+json.message,
-                        Lada.getApplication().bundle.getMsg(json.message));
+                        i18n.getMsg(json.message));
                    } else {
-                         Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.save.title'),
-                            Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                         Ext.Msg.alert(i18n.getMsg('err.msg.save.title'),
+                            i18n.getMsg('err.msg.generic.body'));
                    }
               }
             }
@@ -90,8 +91,10 @@
     remove: function(button) {
         var grid = button.up('grid');
         var selection = grid.getView().getSelectionModel().getSelection()[0];
-        //TODO: i18n
-        Ext.MessageBox.confirm('Löschen', 'Sind Sie sicher?', function(btn) {
+        var i18n = Lada.getApplication().bundle;
+        Ext.MessageBox.confirm(i18n.getMsg('delete'),
+                                i18n.getMsg('confirmation.question'),
+                                function(btn) {
             if (btn === 'yes') {
                 selection.destroy({
                     success: function() {
@@ -101,16 +104,16 @@
                         var json = response.request.scope.reader.jsonData;
                         if (json) {
                             if (json.message){
-                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title')
+                                Ext.Msg.alert(i18n.getMsg('err.msg.delete.title')
                                     +' #'+json.message,
-                                    Lada.getApplication().bundle.getMsg(json.message));
+                                    i18n.getMsg(json.message));
                             } else {
-                                Ext.Msg.alert(Lada.getApplication().bundle.getMsg('err.msg.delete.title'),
-                                    Lada.getApplication().bundle.getMsg('err.msg.generic.body'));
+                                Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
+                                    i18n.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'));
+                            Ext.Msg.alert(i18n.getMsg('err.msg.delete.title'),
+                                i18n.getMsg('err.msg.response.body'));
                         }
                     }
                 });
--- a/app/model/DatensatzErzeuger.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/model/DatensatzErzeuger.js	Fri Jan 15 14:42:29 2016 +0100
@@ -31,6 +31,7 @@
             }
             return new Date(v);
         }
+/*
     }, {
         name: 'treeModified',
         serialize: function(value) {
@@ -47,13 +48,14 @@
             }
             return value;
         }
+*/
     }],
 
     idProperty: 'id',
 
     proxy: {
-        type: 'memory',
-        //url: 'lada-server/rest/datensatzerzeuger',
+        type: 'rest',
+        url: 'lada-server/rest/datensatzerzeuger',
         reader: {
             type: 'json',
             root: 'data'
--- a/app/model/MessprogrammKategorie.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/model/MessprogrammKategorie.js	Fri Jan 15 14:42:29 2016 +0100
@@ -29,6 +29,7 @@
             }
             return new Date(v);
         }
+/*
     }, {
         name: 'treeModified',
         serialize: function(value) {
@@ -45,6 +46,7 @@
             }
             return value;
         }
+*/
     }],
 
     idProperty: 'id',
--- a/app/model/Probenehmer.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/model/Probenehmer.js	Fri Jan 15 14:42:29 2016 +0100
@@ -47,6 +47,7 @@
             }
             return new Date(v);
         }
+/*
     }, {
         name: 'treeModified',
         serialize: function(value) {
@@ -63,6 +64,7 @@
             }
             return value;
         }
+*/
     }],
 
     idProperty: 'id',
--- a/app/store/DatensatzErzeuger.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/store/DatensatzErzeuger.js	Fri Jan 15 14:42:29 2016 +0100
@@ -12,14 +12,4 @@
 Ext.define('Lada.store.DatensatzErzeuger', {
     extend: 'Ext.data.Store',
     model: 'Lada.model.DatensatzErzeuger',
-    data: {
-        data: {
-            id: 1,
-            netzbetreiberId: 'F',
-            daErzeugerId: 5,
-            mstId: '12020',
-            bezeichnung: 'ABCDÄ',
-            letzteAenderung: new Date()
-        }
-    }
 });
--- a/app/view/grid/MessprogrammKategorie.js	Wed Jan 13 14:50:28 2016 +0100
+++ b/app/view/grid/MessprogrammKategorie.js	Fri Jan 15 14:42:29 2016 +0100
@@ -46,6 +46,18 @@
                 xtype: 'tbtext',
                 id: 'tbtitle',
                 text: i18n.getMsg('mk.gridTitle')
+            },
+            '->',
+            {
+                text: i18n.getMsg('mk.button.add'),
+                icon: 'resources/img/list-add.png',
+                action: 'add',
+                disabled: true // disabled on startup, will be enabled by setStore
+            }, {
+                text: i18n.getMsg('mk.button.delete'),
+                icon: 'resources/img/list-remove.png',
+                action: 'delete',
+                disabled: true // disabled on startup, will be enabled by controller if necessary
             }]
         }];
 
--- a/resources/i18n/Lada_de-DE.properties	Wed Jan 13 14:50:28 2016 +0100
+++ b/resources/i18n/Lada_de-DE.properties	Fri Jan 15 14:42:29 2016 +0100
@@ -149,6 +149,8 @@
 
 undefined:Nicht definiert
 
+confirmation.question: Sind Sie sich sicher?
+
 ##
 # Msg:
 ##

http://lada.wald.intevation.org