[Lada-commits] [PATCH] Added a Window and Buttons to generate Proben from a Messprogramm

Wald Commits scm-commit at wald.intevation.org
Fri May 8 11:38:19 CEST 2015


# HG changeset patch
# User Dustin Demuth <dustin at intevation.de>
# Date 1431077880 -7200
# Node ID 2e7e1a8bf79f382a8773b6e0de20474309cf8263
# Parent  b7484c7da2d40f8441c3973d858f0d7156f4ae30
Added a Window and Buttons to generate Proben from a Messprogramm

diff -r b7484c7da2d4 -r 2e7e1a8bf79f app/view/window/GenProbenFromMessprogramm.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/window/GenProbenFromMessprogramm.js	Fri May 08 11:38:00 2015 +0200
@@ -0,0 +1,114 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
+
+/*
+ * Window to generate Proben from a Messprogramm
+ */
+Ext.define('Lada.view.window.GenProbenFromMessprogramm', {
+    extend: 'Ext.window.Window',
+    alias: 'widget.genpfm',
+
+    collapsible: true,
+    maximizable: true,
+    autoShow: true,
+    autoScroll: true,
+    layout: 'fit',
+    constrain: true,
+
+    record: null,
+
+    initComponent: function() {
+        var i18n = Lada.getApplication().bundle;
+
+        this.title = i18n.getMsg('gpfm.window.title');
+        var me = this;
+        this.buttons = [{
+            text: i18n.getMsg('cancel'),
+            scope: this,
+            handler: this.close
+        }, {
+            text: i18n.getMsg('generateproben'),
+            handler: function() {
+                var jsondata = {
+                    id: me.record.id,
+                    start: me.down('datetime [name=start]').getValue(),
+                    end: me.down('datetime [name=end]').getValue()
+                };
+
+
+                Ext.Ajax.request({
+                    url: '/lada-server/probe/messprogramm',
+                    method: 'POST',
+                    headers: {
+                        'X-OPENID-PARAMS': Lada.openIDParams
+                    },
+                    jsonData: jsondata,
+                    success: function(form, action) {
+                        Ext.Msg.alert('Success', action.result.msg);
+                    },
+                    failure: function(form, action) {
+                        Ext.Msg.alert('Failed', action.result.msg);
+                    }
+                });
+            }
+        }];
+        this.width = 400;
+        this.height = 300;
+
+        // add listeners to change the window appearence when it becomes inactive
+        this.on({
+            activate: function(){
+                this.getEl().removeCls('window-inactive');
+            },
+            deactivate: function(){
+                this.getEl().addCls('window-inactive');
+            }
+        });
+
+        // InitialConfig is the config object passed to the constructor on
+        // creation of this window. We need to pass it throuh to the form as
+        // we need the "Id" param to load the correct item.
+        this.items = [{
+            border: 0,
+            autoScroll: true,
+            items: [{
+                xtype: 'text',
+                text: i18n.getMsg('nameofmessprogramm')+ ' '
+            }, {
+                xtype: 'text',
+                text: this.record.get('name')
+            }, {
+                xtype: 'text',
+                text: ' ' + i18n.getMsg('messprogtimeperiod')
+            }, {
+                xtype: 'datetime',
+                fieldLabel: i18n.getMsg('from'),
+                labelWidth: 90,
+                name: 'start',
+                format: 'd.m.Y H:i',
+                period: 'start'
+            }, {
+                xtype: 'datetime',
+                fieldLabel: i18n.getMsg('to'),
+                labelWidth: 90,
+                name: 'end',
+                format: 'd.m.Y H:i',
+                period: 'end'
+            }]
+        }];
+        this.callParent(arguments);
+    },
+
+    /**
+     * Init
+     */
+    initData: function() {
+        var i18n = Lada.getApplication().bundle;
+        me = this;
+    },
+});
diff -r b7484c7da2d4 -r 2e7e1a8bf79f app/view/window/Messprogramm.js
--- a/app/view/window/Messprogramm.js	Thu May 07 10:55:44 2015 +0200
+++ b/app/view/window/Messprogramm.js	Fri May 08 11:38:00 2015 +0200
@@ -38,6 +38,20 @@
         }
 
         this.buttons = [{
+            text: i18n.getMsg('generateproben'),
+            scope: this,
+            disabled: this.record? false : true, //disable button if no record is set.
+            handler: function() {
+                var winname = 'Lada.view.window.GenProbenFromMessprogramm';
+                var win = Ext.create(winname, {
+                    record: this.record
+                });
+                win.show();
+                win.initData();
+            }
+        },
+        '->',
+        {
             text: i18n.getMsg('close'),
             scope: this,
             handler: this.close
diff -r b7484c7da2d4 -r 2e7e1a8bf79f resources/i18n/Lada_de-DE.properties
--- a/resources/i18n/Lada_de-DE.properties	Thu May 07 10:55:44 2015 +0200
+++ b/resources/i18n/Lada_de-DE.properties	Fri May 08 11:38:00 2015 +0200
@@ -58,6 +58,8 @@
 probeKommentar:Probe Kommentar
 messmethode:Messmethode
 nuklide:Nuklide
+from:Von
+to:Bis
 
 emptytext.probenintervall:Wählen Sie ein Probenintervall
 emptytext.datenbasis:Wahlen Sie eine Datenbasis
@@ -78,6 +80,7 @@
 
 messprogramm.window.edit.title:Messprogramm bearbeiten
 messprogramm.window.create.title:Messprogramm erstellen
+gpfm.window.title:Proben aus Messprogramm erzeugen
 messprogramm.form.fieldset.title:Messprogramm
 mmtmessprogramm.form.fieldset.title:Messmethode & Nuklide
 
@@ -87,10 +90,14 @@
 edit:bearbeiten
 create:erstellen
 close:Schließen
+cancel:Abbrechen
 save:Speichern
 save.qtip:Daten Speichern
 discard:Verwerfen
 discard.qtip:Änderungen verwerfen
+generateproben:Proben aus Messprogramm erzeugen
+nameofmessprogramm:Erzeuge Proben aus dem Messprogramm
+messprogtimeperiod:für den Zeitraum
 
 ##
 # Msg:


More information about the Lada-commits mailing list