Mercurial > lada > lada-client
annotate app/view/window/AuditTrail.js @ 1398:b92aef19cff9
Do not set a default value for messzeitpunkt in messung.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 16 Mar 2017 14:44:04 +0100 |
parents | 7cf7a8dc7818 |
children | d1f6aa80758f |
rev | line source |
---|---|
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 /** |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 * Window with information about history of probe/messung objects.. |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 */ |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.view.window.AuditTrail', { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.window.Window', |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 layout: 'fit', |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 width: 300, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 height: 300, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 type: null, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 objectId: null, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 |
1393
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
24 dateItems: [ |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
25 "probeentnahme_beginn", |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
26 "probeentnahme_ende", |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
27 "solldatum_beginn", |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
28 "solldatum_ende", |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
29 "messzeitpunkt", |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
30 "datum" |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
31 ], |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
32 |
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 /** |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 * This function initialises the Window |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 */ |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 initComponent: function() { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 var me = this; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 var i18n = Lada.getApplication().bundle; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 me.on({ |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 show: function() { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 me.initData(); |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 }); |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 me.title = i18n.getMsg("audit.title"); |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 me.buttons = [{ |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 text: i18n.getMsg('close'), |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 scope: me, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 handler: me.close |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 }]; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 me.items = [{ |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 border: 0, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 //autoscroll: true, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 overflowY: 'auto', |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 items: [{ |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 border: 0, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 name: 'auditcontainer' |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 }] |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 }]; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 me.callParent(arguments); |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 }, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 initData: function() { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 if (this.type === null || this.objectId === null) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 return; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 Ext.Ajax.request({ |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 url: 'lada-server/rest/audit/' + this.type + '/' + this.objectId, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 method: 'GET', |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 scope: this, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 success: this.loadSuccess, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 failure: this.loadFailure |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 }); |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 }, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 loadSuccess: function(response) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 var json = Ext.decode(response.responseText); |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 var container = this.down('panel[name=auditcontainer]'); |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 if (this.type === 'probe') { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 var html = this.createHtmlProbe(json); |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 container.update(html); |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 else if (this.type === 'messung') { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 container.update(this.createHtmlMessung(json)); |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 }, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 createHtmlProbe: function(json) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 var i18n = Lada.getApplication().bundle; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 var html = '<p><strong>Probe: ' + json.data.identifier + '</strong><br></p>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 var audit = json.data.audit; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 if (audit.length === 0) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 html += '<p>Keine Änderungen</p>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 else { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 for (var i = 0; i < audit.length; i++) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 html += '<p style="margin-bottom:0"><b>' + i18n.getMsg('date') + ': ' + |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 (Ext.Date.format(new Date(audit[i].timestamp), 'd.m.Y H:i')) + '</b>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 if (!Ext.isObject(audit[i].identifier)) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 if (audit[i].type !== 'probe') { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 html += '<br>' + i18n.getMsg(audit[i].type) + ': '; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 html += audit[i].identifier; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 else { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 html += '<br>' + i18n.getMsg('messung') + ': ' + |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 audit[i].identifier.messung + ' -> ' + |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 i18n.getMsg(audit[i].type) + ': ' + |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 audit[i].identifier.identifier; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
111 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 } |
1392
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
113 if (audit[i].action === 'I') { |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
114 html += '<br>angelegt<br><div style="margin-left:2em;">' |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
115 } |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
116 else { |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
117 html += '<br>geändert in<br><div style="margin-left:2em;">' |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
118 } |
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
119 for (var key in audit[i].changedFields) { |
1393
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
120 var value = ''; |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
121 if (Ext.Array.contains(this.dateItems, key)) { |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
122 value = Ext.Date.format(new Date(audit[i].changedFields[key]), 'd.m.Y H:i'); |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
123 } |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
124 else { |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
125 value = audit[i].changedFields[key]; |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
126 } |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
127 html += '' + i18n.getMsg(key) + ': ' + |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
128 value + '<br>'; |
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 html += '</div>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
131 html += '</p>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
132 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
133 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
134 return html; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 }, |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
136 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 createHtmlMessung: function(json) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 var i18n = Lada.getApplication().bundle; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
139 var html = '<p><strong>Messung: ' + json.data.identifier + '</strong><br></p>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
140 var audit = json.data.audit; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
141 if (audit.length === 0) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 html += '<p>Keine Änderungen</p>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
144 else { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 for (var i = 0; i < audit.length; i++) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 html += '<p style="margin-bottom:0"><b>' + i18n.getMsg('date') + ': ' + |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 (Ext.Date.format(new Date(audit[i].timestamp), 'd.m.Y H:i')) + '</b>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
148 if (audit[i].type !== 'messung') { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
149 html += '<br>' + i18n.getMsg(audit[i].type) + ': '; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
150 html += audit[i].identifier; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 } |
1392
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
152 if (audit[i].action === 'I') { |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
153 html += '<br>angelegt<br><div style="margin-left:2em;">' |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
154 } |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
155 else { |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
156 html += '<br>geändert in<br><div style="margin-left:2em;">' |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
157 } |
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 for (var key in audit[i].changedFields) { |
1393
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
159 var value = ''; |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
160 if (Ext.Array.contains(this.dateItems, key)) { |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
161 value = Ext.Date.format(new Date(audit[i].changedFields[key]), 'd.m.Y H:i'); |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
162 } |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
163 else { |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
164 value = audit[i].changedFields[key]; |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
165 } |
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 html += '' + i18n.getMsg(key) + ': ' + |
1393
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
167 value + '<br>'; |
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 html += '</div>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
170 html += '</p>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 return html; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
174 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 }); |