annotate app/view/window/AuditTrail.js @ 1407:2195fd3946e4

Reduce code duplication.
author Tom Gottfried <tom@intevation.de>
date Wed, 22 Mar 2017 16:12:11 +0100
parents d1f6aa80758f
children 86c6b6c01246
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 }
1407
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
121 html += this.createHtmlChangedFields(audit[i]);
1386
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 }
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
123 }
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 return html;
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125 },
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 createHtmlMessung: function(json) {
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
128 var i18n = Lada.getApplication().bundle;
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
129 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
130 var audit = json.data.audit;
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
131 if (audit.length === 0) {
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 html += '<p>Keine Ă„nderungen</p>';
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 else {
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
135 for (var i = 0; i < audit.length; i++) {
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
136 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
137 (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
138 if (audit[i].type !== 'messung') {
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139 html += '<br>' + i18n.getMsg(audit[i].type) + ': ';
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
140 html += audit[i].identifier;
7e9a6f0e55b3 Added UI for audit trail.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 }
1407
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
142 html += this.createHtmlChangedFields(audit[i]);
1386
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 return html;
1407
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
146 },
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
147
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
148 createHtmlChangedFields: function(audit) {
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
149 var i18n = Lada.getApplication().bundle;
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
150 html = '<br>' + i18n.getMsg(audit.action)
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
151 + '<br><div style="margin-left:2em;">';
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
152
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
153 for (var key in audit.changedFields) {
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
154 var value = '';
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
155 if (Ext.Array.contains(this.dateItems, key)) {
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
156 value = Ext.Date.format(new Date(audit.changedFields[key]),
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
157 'd.m.Y H:i');
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
158 }
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
159 else {
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
160 value = audit.changedFields[key];
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
161 }
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
162 html += '' + i18n.getMsg(key) + ': ' +
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
163 value + '<br>';
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
164 }
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
165 html += '</div>';
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
166 html += '</p>';
2195fd3946e4 Reduce code duplication.
Tom Gottfried <tom@intevation.de>
parents: 1406
diff changeset
167 return html;
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 });

http://lada.wald.intevation.org