changeset 1412:dc90e2997071

Merged branch release-2.5 into default.
author Tom Gottfried <tom@intevation.de>
date Mon, 27 Mar 2017 16:50:00 +0200
parents 50b04a7bee16 (diff) e749d09fafca (current diff)
children fc0ec9cde3aa
files app.js app/model/Messung.js app/view/form/Probe.js custom-vhosts.conf
diffstat 12 files changed, 295 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/app.js	Mon Mar 27 09:56:17 2017 +0200
+++ b/app.js	Mon Mar 27 16:50:00 2017 +0200
@@ -89,7 +89,7 @@
         Lada.logintime = '';
         Lada.mst = [];
         Lada.netzbetreiber = [];
-        Lada.clientVersion = '2.5.1';
+        Lada.clientVersion = '2.6-SNAPSHOT';
         Lada.serverVersion = '';
 
         var queryString = document.location.href.split('?')[1];
--- a/app/controller/form/Messung.js	Mon Mar 27 09:56:17 2017 +0200
+++ b/app/controller/form/Messung.js	Mon Mar 27 16:50:00 2017 +0200
@@ -24,6 +24,9 @@
             'messungform button[action=discard]': {
                 click: this.discard
             },
+            'messungform button[action=audit]': {
+                click: this.showAuditTrail
+            },
             'messungform': {
                 dirtychange: this.dirtyForm
             }
@@ -135,5 +138,14 @@
                 form.owner.up('window').enableChildren();
             }
         }
+    },
+
+    showAuditTrail: function(button) {
+        Ext.create('Lada.view.window.AuditTrail', {
+            autoShow: true,
+            closeAction: 'destroy',
+            type: 'messung',
+            objectId: button.up('form').recordId
+        });
     }
 });
--- a/app/controller/form/Probe.js	Mon Mar 27 09:56:17 2017 +0200
+++ b/app/controller/form/Probe.js	Mon Mar 27 16:50:00 2017 +0200
@@ -12,6 +12,10 @@
 Ext.define('Lada.controller.form.Probe', {
     extend: 'Ext.app.Controller',
 
+    requires: [
+        'Lada.view.window.AuditTrail'
+    ],
+
     /**
      * Initialize the Controller
      * It has 4 listeners
@@ -24,6 +28,9 @@
             'probeform button[action=discard]': {
                 click: this.discard
             },
+            'probeform button[action=audit]': {
+                click: this.showAuditTrail
+            },
             'probeform': {
                 dirtychange: this.dirtyForm
             },
@@ -304,6 +311,14 @@
         for (var i = field.layer + 1; i < 12; i++) {
             allS[i].clearValue();
         }
+    },
+
+    showAuditTrail: function(button) {
+        Ext.create('Lada.view.window.AuditTrail', {
+            autoShow: true,
+            closeAction: 'destroy',
+            type: 'probe',
+            objectId: button.up('form').recordId
+        });
     }
-
 });
--- a/app/view/form/Messung.js	Mon Mar 27 09:56:17 2017 +0200
+++ b/app/view/form/Messung.js	Mon Mar 27 16:50:00 2017 +0200
@@ -55,6 +55,12 @@
                         borderRight: '1px solid #b5b8c8 !important'
                     },
                     items: ['->', {
+                        text: i18n.getMsg('audittrail'),
+                        qtip: i18n.getMsg('qtip.audit'),
+                        icon: 'resources/img/distribute-vertical-center.png',
+                        action: 'audit',
+                        disabled: this.recordId === null
+                    }, {
                         text: 'Speichern',
                         qtip: 'Daten speichern',
                         icon: 'resources/img/dialog-ok-apply.png',
--- a/app/view/form/Probe.js	Mon Mar 27 09:56:17 2017 +0200
+++ b/app/view/form/Probe.js	Mon Mar 27 16:50:00 2017 +0200
@@ -60,6 +60,12 @@
                         borderRight: '1px solid #b5b8c8 !important'
                     },
                     items: ['->', {
+                        text: i18n.getMsg('audittrail'),
+                        qtip: i18n.getMsg('qtip.audit'),
+                        icon: 'resources/img/distribute-vertical-center.png',
+                        action: 'audit',
+                        disabled: this.recordId === null
+                    }, {
                         text: 'Speichern',
                         qtip: 'Daten speichern',
                         icon: 'resources/img/dialog-ok-apply.png',
--- a/app/view/grid/Ortszuordnung.js	Mon Mar 27 09:56:17 2017 +0200
+++ b/app/view/grid/Ortszuordnung.js	Mon Mar 27 16:50:00 2017 +0200
@@ -184,12 +184,18 @@
         var modelname;
         if (this.isMessprogramm) {
             this.store = Ext.create('Lada.store.OrtszuordnungMp');
-            this.store.load({
-                params: {
-                    messprogrammId: this.recordId
-                }});
-            modelname = 'Lada.model.Messprogramm';
-        } else {
+            if (this.recordId) {
+                this.store.load({
+                    params: {
+                        messprogrammId: this.recordId
+                    }});
+                modelname = 'Lada.model.Messprogramm';
+            }
+            else {
+                return;
+            }
+        }
+        else {
             modelname = 'Lada.model.Probe';
             this.store = Ext.create('Lada.store.Ortszuordnung');
             this.store.load({
--- a/app/view/grid/PKommentar.js	Mon Mar 27 09:56:17 2017 +0200
+++ b/app/view/grid/PKommentar.js	Mon Mar 27 16:50:00 2017 +0200
@@ -19,7 +19,7 @@
     ],
 
     maxHeight: 350,
-    emptyText: 'Keine Kommentaregefunden.',
+    emptyText: 'Keine Kommentare gefunden.',
     minHeight: 110,
     viewConfig: {
         deferEmptyText: false
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/view/window/AuditTrail.js	Mon Mar 27 16:50:00 2017 +0200
@@ -0,0 +1,178 @@
+/* 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 with information about history of probe/messung objects..
+ */
+Ext.define('Lada.view.window.AuditTrail', {
+    extend: 'Ext.window.Window',
+
+    layout: 'fit',
+
+    width: 300,
+    height: 300,
+
+    type: null,
+
+    objectId: null,
+
+    dateItems: [
+        "probeentnahme_beginn",
+        "probeentnahme_ende",
+        "solldatum_beginn",
+        "solldatum_ende",
+        "messzeitpunkt",
+        "datum"
+    ],
+
+
+    /**
+     * This function initialises the Window
+     */
+    initComponent: function() {
+        var me = this;
+        var i18n = Lada.getApplication().bundle;
+        me.on({
+            show: function() {
+                me.initData();
+            }
+        });
+
+        me.title = i18n.getMsg("audit.title");
+        me.buttons = [{
+            text: i18n.getMsg('close'),
+            scope: me,
+            handler: me.close
+        }];
+        me.items = [{
+            border: 0,
+            //autoscroll: true,
+            overflowY: 'auto',
+            items: [{
+                border: 0,
+                name: 'auditcontainer'
+            }]
+        }];
+        me.callParent(arguments);
+    },
+
+    initData: function() {
+        if (this.type === null || this.objectId === null) {
+            return;
+        }
+        Ext.Ajax.request({
+            url: 'lada-server/rest/audit/' + this.type + '/' + this.objectId,
+            method: 'GET',
+            scope: this,
+            success: this.loadSuccess,
+            failure: this.loadFailure
+        });
+    },
+
+    loadSuccess: function(response) {
+        var i18n = Lada.getApplication().bundle;
+        var json = Ext.decode(response.responseText);
+        var container = this.down('panel[name=auditcontainer]');
+        if (!json.success) {
+            var html = '<p><strong>' + i18n.getMsg(json.message.toString())
+                + '</strong></p>';
+            container.update(html);
+        }
+        else {
+            if (this.type === 'probe') {
+                var html = this.createHtmlProbe(json);
+                container.update(html);
+            }
+            else if (this.type === 'messung') {
+                container.update(this.createHtmlMessung(json));
+            }
+        }
+    },
+
+    createHtmlProbe: function(json) {
+        var i18n = Lada.getApplication().bundle;
+        var html = '<p><strong>Probe: ' + json.data.identifier + '</strong><br></p>';
+        var audit = json.data.audit;
+        if (audit.length === 0) {
+            html += '<p>Keine Änderungen</p>';
+        }
+        else {
+            for (var i = 0; i < audit.length; i++) {
+                html += '<p style="margin-bottom:0"><b>' + i18n.getMsg('date') + ': ' +
+                (Ext.Date.format(new Date(audit[i].timestamp), 'd.m.Y H:i')) + '</b>';
+                if (!Ext.isObject(audit[i].identifier)) {
+                    if (audit[i].type !== 'probe') {
+                        html += '<br>' + i18n.getMsg(audit[i].type) + ': ';
+                        html += audit[i].identifier;
+                    }
+                }
+                else {
+                    html += '<br>' + i18n.getMsg('messung') + ': ' +
+                        audit[i].identifier.messung + ' -> ' +
+                        i18n.getMsg(audit[i].type) + ': ' +
+                        audit[i].identifier.identifier;
+
+                }
+                html += this.createHtmlChangedFields(audit[i]);
+            }
+        }
+        return html;
+    },
+
+    createHtmlMessung: function(json) {
+        var i18n = Lada.getApplication().bundle;
+        var html = '<p><strong>Messung: ' + json.data.identifier + '</strong><br></p>';
+        var audit = json.data.audit;
+        if (audit.length === 0) {
+            html += '<p>Keine Änderungen</p>';
+        }
+        else {
+            for (var i = 0; i < audit.length; i++) {
+                html += '<p style="margin-bottom:0"><b>' + i18n.getMsg('date') + ': ' +
+                (Ext.Date.format(new Date(audit[i].timestamp), 'd.m.Y H:i')) + '</b>';
+                if (audit[i].type !== 'messung') {
+                    html += '<br>' + i18n.getMsg(audit[i].type) + ': ';
+                    html += audit[i].identifier;
+                }
+                html += this.createHtmlChangedFields(audit[i]);
+            }
+        }
+        return html;
+    },
+
+    createHtmlChangedFields: function(audit) {
+        var i18n = Lada.getApplication().bundle;
+        html = '<br>' + i18n.getMsg(audit.action)
+            + '<br><div style="margin-left:2em;">';
+
+        for (var key in audit.changedFields) {
+            var value = '';
+            if (Ext.Array.contains(this.dateItems, key)) {
+                value = Ext.Date.format(new Date(audit.changedFields[key]),
+                                        'd.m.Y H:i');
+            }
+            else {
+                value = audit.changedFields[key];
+            }
+            if (value === null) {
+                value = i18n.getMsg('noValue');
+            }
+            else if (value === true) {
+                value = i18n.getMsg('true');
+            }
+            else if (value === false) {
+                value = i18n.getMsg('false');
+            }
+            html += '' + i18n.getMsg(key) + ': ' +
+                value + '<br>';
+        }
+        html += '</div>';
+        html += '</p>';
+        return html;
+    }
+});
--- a/build.sh	Mon Mar 27 09:56:17 2017 +0200
+++ b/build.sh	Mon Mar 27 16:50:00 2017 +0200
@@ -1,11 +1,12 @@
 
-SENCHAPATH=~/bin/Sencha/Cmd/4.0.5.87/sencha
+#Fallback: SENCHAPATH=~/bin/Sencha/Cmd/4.0.5.87/sencha
+if [ -z $SENCHAPATH ]; then SENCHAPATH="~/bin/Sencha/Cmd/4.0.5.87/"; fi
 VNUMBER=$(grep Lada.clientVersion app.js | cut -d '=' -f 2 | cut -d "'" -f 2)
 VERSION=lada-client-$VNUMBER
 
 # Minify
 echo "Minifying...."
-$SENCHAPATH --sdk-path extjs compile \
+$SENCHAPATH/sencha --sdk-path extjs compile \
     --classpath=app,resources/lib/ext/upload,resources/lib/ext/i18n,resources/lib/ext/grid,resources/lib/ext/util page \
     -yui -i index.html -o $VERSION/index.html
 
--- a/custom-vhosts.conf	Mon Mar 27 09:56:17 2017 +0200
+++ b/custom-vhosts.conf	Mon Mar 27 16:50:00 2017 +0200
@@ -21,7 +21,7 @@
 Listen 83
 Listen 84
 
-Define LADA_SERVER_VERSION 2.5
+Define LADA_SERVER_VERSION 2.6-SNAPSHOT
 
 <VirtualHost *:80>
     ServerAdmin webmaster@localhost
--- a/resources/i18n/Lada_de-DE.properties	Mon Mar 27 09:56:17 2017 +0200
+++ b/resources/i18n/Lada_de-DE.properties	Mon Mar 27 16:50:00 2017 +0200
@@ -106,6 +106,21 @@
 messzeitpunkt: Messzeitpunkt
 messgroesse: Messgröße
 pflichtmessgroesse: Pflichtmessgröße
+audittrail:Verlauf
+date:Datum
+messwert:Messwert
+messdauer:Messdauer
+probenart_id:Probenart
+probe_nehmer_id:Probenehmer
+id_alt:Id
+mpl_id:Messprogramm-Land
+ba_id:Messregime
+geplant:Geplant
+meh_id:Messeinheit
+messgroesse_id:Messgröße
+pzs_id:PZW
+nwg_zu_messwert:Nachweisgrenze
+zusatzwert:Zusatzwert
 
 emptytext.probenintervall:Wählen Sie ein Probenintervall
 emptytext.datenbasis:Wählen Sie eine Datenbasis
@@ -141,6 +156,7 @@
 messprogrammort.button.title:Ort angeben
 about.window.title:Über
 about.button.title:Über
+audit.title:Verlauf
 
 about.window.text.login:Sie sind angemeldet mit der Kennung:
 about.window.text.roles:Sie sind Mitglied der folgenden Gruppen:
@@ -360,3 +376,46 @@
 # Action
 ##
 open:öffnen
+
+##
+# Audit-Trail
+##
+ort_id:Ort-ID
+ortszuordnung_typ: Ortszuordnungstyp
+ortszuordnung:Ortszuordnung
+ortszusatztext: Ortszusatztext
+hauptproben_nr:Hauptprobennummer
+nebenproben_nr:Nebenprobennr.
+grenzwertueberschreitung:Grenzwertüberschreitung
+media:Medium
+media_desk:Deskriptoren
+umw_id:Umweltbereich
+fertig:Fertig
+text:Text
+datum:Datum
+zusatz_wert:Zusatzwert
+kommentar_m:Messungskommentar
+kommentar_p:Probenkommentar
+mmt_id:Messmethode
+messwert_nwg:Nachweisgrenze
+messzeitpunkt:Messzeitpunkt
+messwert_pzs:Messwert
+messfehler:Messfehler
+status:Status
+probe_id:Proben-ID
+solldatum_beginn:Solldatum(Beginn)
+solldatum_ende:Solldatum(Ende)
+mpr_id:mpr-ID
+probe_nehmer_id:Probennehmer-ID
+erzeuger_id:Erzeuger-ID
+mittelungsdauer:Mittelungsdauer
+mst_id:Messstelle
+labor_mst_id: Labor/Messtelle
+datenbasis_id: Datenbasis
+probeentnahme_beginn:Probenentnahme(Beginn)
+probeentnahme_ende:Probenentnahme(Ende)
+noValue:(kein Wert)
+true:ja
+false:nein
+I:angelegt
+U:geändert in
Binary file resources/img/distribute-vertical-center.png has changed

http://lada.wald.intevation.org