Mercurial > lada > lada-client
annotate app/view/window/AuditTrail.js @ 1406:d1f6aa80758f
Audit-trail: Handle response with error message.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 22 Mar 2017 15:01:35 +0100 |
parents | 7cf7a8dc7818 |
children | 2195fd3946e4 |
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) { |
1406
d1f6aa80758f
Audit-trail: Handle response with error message.
Tom Gottfried <tom@intevation.de>
parents:
1393
diff
changeset
|
78 var i18n = Lada.getApplication().bundle; |
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 var json = Ext.decode(response.responseText); |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 var container = this.down('panel[name=auditcontainer]'); |
1406
d1f6aa80758f
Audit-trail: Handle response with error message.
Tom Gottfried <tom@intevation.de>
parents:
1393
diff
changeset
|
81 if (!json.success) { |
d1f6aa80758f
Audit-trail: Handle response with error message.
Tom Gottfried <tom@intevation.de>
parents:
1393
diff
changeset
|
82 var html = '<p><strong>' + i18n.getMsg(json.message.toString()) |
d1f6aa80758f
Audit-trail: Handle response with error message.
Tom Gottfried <tom@intevation.de>
parents:
1393
diff
changeset
|
83 + '</strong></p>'; |
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 container.update(html); |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 } |
1406
d1f6aa80758f
Audit-trail: Handle response with error message.
Tom Gottfried <tom@intevation.de>
parents:
1393
diff
changeset
|
86 else { |
d1f6aa80758f
Audit-trail: Handle response with error message.
Tom Gottfried <tom@intevation.de>
parents:
1393
diff
changeset
|
87 if (this.type === 'probe') { |
d1f6aa80758f
Audit-trail: Handle response with error message.
Tom Gottfried <tom@intevation.de>
parents:
1393
diff
changeset
|
88 var html = this.createHtmlProbe(json); |
d1f6aa80758f
Audit-trail: Handle response with error message.
Tom Gottfried <tom@intevation.de>
parents:
1393
diff
changeset
|
89 container.update(html); |
d1f6aa80758f
Audit-trail: Handle response with error message.
Tom Gottfried <tom@intevation.de>
parents:
1393
diff
changeset
|
90 } |
d1f6aa80758f
Audit-trail: Handle response with error message.
Tom Gottfried <tom@intevation.de>
parents:
1393
diff
changeset
|
91 else if (this.type === 'messung') { |
d1f6aa80758f
Audit-trail: Handle response with error message.
Tom Gottfried <tom@intevation.de>
parents:
1393
diff
changeset
|
92 container.update(this.createHtmlMessung(json)); |
d1f6aa80758f
Audit-trail: Handle response with error message.
Tom Gottfried <tom@intevation.de>
parents:
1393
diff
changeset
|
93 } |
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 } |
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 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 createHtmlProbe: function(json) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 var i18n = Lada.getApplication().bundle; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 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
|
100 var audit = json.data.audit; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 if (audit.length === 0) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 html += '<p>Keine Änderungen</p>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 else { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 for (var i = 0; i < audit.length; i++) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 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
|
107 (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
|
108 if (!Ext.isObject(audit[i].identifier)) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 if (audit[i].type !== 'probe') { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 html += '<br>' + i18n.getMsg(audit[i].type) + ': '; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
111 html += audit[i].identifier; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
113 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 else { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 html += '<br>' + i18n.getMsg('messung') + ': ' + |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 audit[i].identifier.messung + ' -> ' + |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 i18n.getMsg(audit[i].type) + ': ' + |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
118 audit[i].identifier.identifier; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
119 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
120 } |
1392
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
121 if (audit[i].action === 'I') { |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
122 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
|
123 } |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
124 else { |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
125 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
|
126 } |
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
127 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
|
128 var value = ''; |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
129 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
|
130 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
|
131 } |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
132 else { |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
133 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
|
134 } |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
135 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
|
136 value + '<br>'; |
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 html += '</div>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
139 html += '</p>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
140 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
141 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 return html; |
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 |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 createHtmlMessung: function(json) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 var i18n = Lada.getApplication().bundle; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 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
|
148 var audit = json.data.audit; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
149 if (audit.length === 0) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
150 html += '<p>Keine Änderungen</p>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 else { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
153 for (var i = 0; i < audit.length; i++) { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
154 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
|
155 (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
|
156 if (audit[i].type !== 'messung') { |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
157 html += '<br>' + i18n.getMsg(audit[i].type) + ': '; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 html += audit[i].identifier; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 } |
1392
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
160 if (audit[i].action === 'I') { |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
161 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
|
162 } |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
163 else { |
e53e398df409
Updated audit trail window and i18n strings.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1386
diff
changeset
|
164 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
|
165 } |
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 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
|
167 var value = ''; |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
168 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
|
169 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
|
170 } |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
171 else { |
7cf7a8dc7818
Parse timestamp using a mapping table to identify date fields.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1392
diff
changeset
|
172 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
|
173 } |
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
174 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
|
175 value + '<br>'; |
1386
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 html += '</div>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
178 html += '</p>'; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 return html; |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 } |
7e9a6f0e55b3
Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 }); |