[Lada-commits] [PATCH 2 of 2] merged

Wald Commits scm-commit at wald.intevation.org
Fri Jul 10 18:24:54 CEST 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1436545484 -7200
# Node ID 77e68fae377288e075e78cb1b0f4de78f84fcc67
# Parent  40f0450799ec3ad76141ea653146be9e8632095e
# Parent  1830ed929367924bab5f496361632083388dc1c6
merged.

diff -r 40f0450799ec -r 77e68fae3772 app/controller/FilterResult.js
--- a/app/controller/FilterResult.js	Fri Jul 10 18:24:18 2015 +0200
+++ b/app/controller/FilterResult.js	Fri Jul 10 18:24:44 2015 +0200
@@ -34,6 +34,9 @@
             'filterresultgrid toolbar button[action=addMessprogramm]': {
                 click: this.addMessprogrammItem
             },
+            'filterresultgrid toolbar button[action=genProbenFromMessprogramm]': {
+                click: this.genProbenFromMessprogramm
+            },
             'filterresultgrid toolbar button[action=import]': {
                 click: this.uploadFile
             },
@@ -101,6 +104,46 @@
     },
 
     /**
+     * This button creates a window to generate Proben
+     * from a selected messprogramm.
+     */
+    genProbenFromMessprogramm: function(button) {
+        var grid = button.up('grid');
+        var selection = grid.getView().getSelectionModel().getSelection();
+        var i18n = Lada.getApplication().bundle;
+        var proben = [];
+        for (var i = 0; i < selection.length; i++) {
+            proben.push(selection[i].get('id'));
+        }
+        var me = this;
+
+        var winname = 'Lada.view.window.GenProbenFromMessprogramm';
+        for (p in proben) {
+            grid.setLoading(true);
+            Ext.ClassManager.get('Lada.model.Messprogramm').load(proben[p], {
+                failure: function(record, action) {
+                    me.setLoading(false);
+                    // TODO
+                    console.log('An unhandled Failure occured. See following Response and Record');
+                    console.log(action);
+                    console.log(record);
+                    },
+                success: function(record, response) {
+                    grid.setLoading(false);
+
+                    var win = Ext.create(winname, {
+                        record: record,
+                        parentWindow: null
+                    });
+                    win.show();
+                    win.initData();
+                },
+                scope: this
+            });
+        }
+    },
+
+    /**
      * This function opens a {@link Lada.view.window.FileUpload}
      * window to upload a LAF-File
      */
diff -r 40f0450799ec -r 77e68fae3772 app/view/grid/FilterResult.js
--- a/app/view/grid/FilterResult.js	Fri Jul 10 18:24:18 2015 +0200
+++ b/app/view/grid/FilterResult.js	Fri Jul 10 18:24:44 2015 +0200
@@ -42,13 +42,6 @@
                 action: 'addProbe',
                 disabled: false
             }, {
-                text: 'Messprogramm erstellen',
-                icon: 'resources/img/list-add.png',
-                action: 'addMessprogramm',
-                disabled: true
-            },
-            '-',
-            {
                 text: 'Proben Importieren',
                 icon: 'resources/img/svn-commit.png',
                 action: 'import',
@@ -58,8 +51,19 @@
                 icon: 'resources/img/svn-update.png',
                 action: 'export',
                 disabled: true
-            }
-            ]
+            },
+            '-',
+            {
+                text: 'Messprogramm erstellen',
+                icon: 'resources/img/list-add.png',
+                action: 'addMessprogramm',
+                disabled: true
+            }, {
+                text: 'Proben generieren',
+                icon: 'resources/img/view-time-schedule-insert.png',
+                action: 'genProbenFromMessprogramm',
+                disabled: true
+            }]
         }];
         this.columns = [];
         this.callParent(arguments);
@@ -94,6 +98,7 @@
         if (store.model.modelName == 'Lada.model.ProbeList'){
             t.setText(i18n.getMsg('probelist'));
             this.down('button[action=addMessprogramm]').disable();
+            this.down('button[action=genProbenFromMessprogramm]').disable();
             this.down('button[action=addProbe]').enable();
             this.down('button[action=import]').enable();
             this.down('button[action=export]').enable();
@@ -101,6 +106,7 @@
         else if (store.model.modelName == 'Lada.model.MessprogrammList') {
             t.setText(i18n.getMsg('probeplanning'));
             this.down('button[action=addMessprogramm]').enable();
+            this.down('button[action=genProbenFromMessprogramm]').enable();
             this.down('button[action=addProbe]').disable();
             this.down('button[action=import]').disable();
             this.down('button[action=export]').disable();
diff -r 40f0450799ec -r 77e68fae3772 app/view/window/GenProbenFromMessprogramm.js
--- a/app/view/window/GenProbenFromMessprogramm.js	Fri Jul 10 18:24:18 2015 +0200
+++ b/app/view/window/GenProbenFromMessprogramm.js	Fri Jul 10 18:24:44 2015 +0200
@@ -125,7 +125,9 @@
                 this.getEl().addCls('window-inactive');
             },
             close: function () {
-                this.parentWindow.probenWindow = null;
+                if (this.parentWindow) {
+                    this.parentWindow.probenWindow = null;
+                }
             }
         });
 
diff -r 40f0450799ec -r 77e68fae3772 resources/img/view-time-schedule-insert.png
Binary file resources/img/view-time-schedule-insert.png has changed


More information about the Lada-commits mailing list