[Lada-commits] [PATCH] Parse timestamp using a mapping table to identify date fields

Wald Commits scm-commit at wald.intevation.org
Wed Mar 8 16:00:53 CET 2017


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1488985248 -3600
# Node ID 7cf7a8dc7818c7b44ebfb92973ae274d091af4be
# Parent  e53e398df409aa6cb1422cd073e26e575728551f
Parse timestamp using a mapping table to identify date fields.

diff -r e53e398df409 -r 7cf7a8dc7818 app/view/window/AuditTrail.js
--- a/app/view/window/AuditTrail.js	Wed Mar 08 09:45:01 2017 +0100
+++ b/app/view/window/AuditTrail.js	Wed Mar 08 16:00:48 2017 +0100
@@ -21,6 +21,15 @@
 
     objectId: null,
 
+    dateItems: [
+        "probeentnahme_beginn",
+        "probeentnahme_ende",
+        "solldatum_beginn",
+        "solldatum_ende",
+        "messzeitpunkt",
+        "datum"
+    ],
+
 
     /**
      * This function initialises the Window
@@ -108,9 +117,15 @@
                     html += '<br>geändert in<br><div style="margin-left:2em;">'
                 }
                 for (var key in audit[i].changedFields) {
-                    var val = audit[i].changedFields[key] === 'null' ? '' :
-                        audit[i].changedFields[key];
-                    html += '' + i18n.getMsg(key) + ': ' + val + '<br>';
+                    var value = '';
+                    if (Ext.Array.contains(this.dateItems, key)) {
+                        value = Ext.Date.format(new Date(audit[i].changedFields[key]), 'd.m.Y H:i');
+                    }
+                    else {
+                        value = audit[i].changedFields[key];
+                    }
+                    html += '' + i18n.getMsg(key) + ': ' +
+                        value + '<br>';
                 }
                 html += '</div>';
                 html += '</p>';
@@ -141,8 +156,15 @@
                     html += '<br>geändert in<br><div style="margin-left:2em;">'
                 }
                 for (var key in audit[i].changedFields) {
+                    var value = '';
+                    if (Ext.Array.contains(this.dateItems, key)) {
+                        value = Ext.Date.format(new Date(audit[i].changedFields[key]), 'd.m.Y H:i');
+                    }
+                    else {
+                        value = audit[i].changedFields[key];
+                    }
                     html += '' + i18n.getMsg(key) + ': ' +
-                        audit[i].changedFields[key] + '<br>';
+                        value + '<br>';
                 }
                 html += '</div>';
                 html += '</p>';


More information about the Lada-commits mailing list