changeset 1393:7cf7a8dc7818

Parse timestamp using a mapping table to identify date fields.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 08 Mar 2017 16:00:48 +0100
parents e53e398df409
children 76ff6d084167
files app/view/window/AuditTrail.js
diffstat 1 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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>';

http://lada.wald.intevation.org