This repository has been archived by the owner on Jan 27, 2021. It is now read-only.
/
AdminServiceCenterSupportDataCollector.tt
410 lines (377 loc) · 20.6 KB
/
AdminServiceCenterSupportDataCollector.tt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# --
# Copyright (C) 2001-2018 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
<div class="MainBox ARIARoleMain AdminServiceCenter LayoutFixedSidebar SidebarFirst">
<h1>[% Translate("Service Center") | html %] » [% Translate("Support Data Management") | html %]</h1>
<div class="SidebarColumn">
<div class="WidgetSimple">
<div class="Header">
<h2>[% Translate("Note") | html %]</h2>
</div>
<div class="Content">
<ul class="ActionList">
[% RenderBlockStart("NoteRegisteredSending") %]
[% IF Config("Frontend::Module").AdminRegistration %]
<li>
<p class="FieldExplanation">[% Translate("This data is sent to OTRS Group on a regular basis. To stop sending this data please update your system registration.") | html %]</p>
<a href="[% Env("Baselink") %]Action=AdminRegistration;Subaction=Edit" class="CallForAction">
<span>[% Translate("System Registration") | html %]</span>
</a>
</li>
<li class="Separated">
<a href="[% Env("Baselink") %]Action=AdminRegistration;Subaction=SentDataOverview" class="CallForAction">
<span><i class="fa fa-cloud-upload"></i> [% Translate("Show transmitted data") | html %]</span>
</a>
</li>
[% END %]
<li>
<p class="FieldExplanation">[% Translate("You can manually trigger the Support Data sending by pressing this button:") | html %]</p>
<a class="CallForAction LittleSpacingTop" id="SendUpdate" name="SendUpdate" >
<span>[% Translate("Send Update") | html %]</span>
</a>
</li>
[% WRAPPER JSOnDocumentComplete %]
<script type="text/javascript">//<![CDATA[
$('#SendUpdate').bind('click', function (Event) {
var TextClass = '';
Core.UI.Dialog.ShowContentDialog('<div class="Spacing Center"><span class="AJAXLoader W33pc" title=[% Translate("Sending Update...") | JSON %]></span></div>',[% Translate("Sending Update...") | JSON %], '10px', 'Center', true, undefined, true);
Core.AJAX.FunctionCall(Core.Config.Get('CGIHandle'), 'Action=[% Env("Action") %];Subaction=SendUpdate;', function (Response) {
// if the waiting dialog was canceled,
// do not show the search dialog as well
if (!$('.Dialog:visible').length) {
return;
}
var ResponseMessage = [% Translate("Support Data information was successfully sent.") | JSON %];
if ( Response === 0) {
ResponseMessage = [% Translate("Was not possible to send Support Data information.") | JSON %];
TextClass = 'Error';
}
Core.UI.Dialog.ShowContentDialog(
'<div class="Spacing Center SendUpdateResultDialog"><span class="W50pc ' + TextClass + '" title="' + ResponseMessage + '">' + ResponseMessage + '</span></div>', [% Translate("Update Result") | JSON %],
'10px',
'Center',
true,
[
{
Label: [% Translate("Close") | JSON %],
Class: 'Primary',
Function: function () {
Core.UI.Dialog.CloseDialog($('.SendUpdateResultDialog'));
}
},
],
true
);
});
Event.preventDefault();
Event.stopPropagation();
return false;
});
//]]></script>
[% END %]
[% RenderBlockEnd("NoteRegisteredSending") %]
[% RenderBlockStart("NoteNotRegisteredNotSending") %]
[% IF Config("Frontend::Module").AdminRegistration %]
<li>
<p class="FieldExplanation">
[% Translate("Currently this data is only shown in this system.") | html %]
[% Translate("It is highly recommended to send this data to OTRS Group in order to get better support.") | html %]
<br/>
[% Translate("To enable data sending, please register your system with OTRS Group or update your system registration information (make sure to activate the 'send support data' option.)") | html %]
</p>
<a href="[% Env("Baselink") %]Action=AdminRegistration" class="CallForAction">
<span>[% Translate("System Registration") | html %]</span>
</a>
</li>
[% END %]
[% RenderBlockEnd("NoteNotRegisteredNotSending") %]
<li>
<p class="FieldExplanation">[% Translate("A support bundle (including: system registration information, support data, a list of installed packages and all locally modified source code files) can be generated by pressing this button:") | html %]</p>
<a class="CallForAction LittleSpacingTop" id="GenerateSupportBundle" name="GenerateSupportBundle" >
<span>[% Translate("Generate Support Bundle") | html %]</span>
</a>
</li>
[% WRAPPER JSOnDocumentComplete %]
<script type="text/javascript">//<![CDATA[
$('#GenerateSupportBundle').bind('click', function (Event) {
var TextClass = '';
Core.UI.Dialog.ShowContentDialog('<div class="Spacing Center LoadingSupportBundleDialog"><span class="AJAXLoader W75pc" title=[% Translate("Generating...") | JSON %]></span></div>',[% Translate("Generating...") | JSON %], '10px', 'Center', true, undefined, true);
Core.AJAX.FunctionCall(Core.Config.Get('CGIHandle'), 'Action=[% Env("Action") %];Subaction=GenerateSupportBundle;', function (Response) {
// if the waiting dialog was canceled,
// do not show the option dialog as well
if (!$('.Dialog:visible').length) {
return;
}
Core.UI.Dialog.CloseDialog($('.LoadingSupportBundleDialog'));
if ( !Response.Success ) {
var ResponseMessage = [% Translate("It was not possible to generate the Support Bundle.") | JSON %],
TextClass = 'Error';
Core.UI.Dialog.ShowContentDialog(
'<div class="Spacing Center NoSupportBunle"><span class="W50pc ' + TextClass + '" title="' + ResponseMessage + '">' + ResponseMessage + '</span></div>', [% Translate("Generate Result") | JSON %],
'10px',
'Center',
true,
[
{
Label: [% Translate("Close") | JSON %],
Class: 'Primary',
Function: function () {
Core.UI.Dialog.CloseDialog($('.NoSupportBunle'));
}
},
],
true
);
}
else {
Core.UI.Dialog.ShowContentDialog(
$('#SupportBundleOptionsDialogContainer'), [% Translate("Support Bundle") | JSON %],
'10px',
'Center',
true,
[
{
Label: [% Translate("Close") | JSON %],
Class: 'Primary',
Function: function () {
Core.UI.Dialog.CloseDialog($('#SupportBundleOptionsDialog'));
}
},
],
true
);
// if the support bundle is bigger than 10 MB do not show send option
if (parseInt(Response.Filesize,10)>10) {
$('.SupportBundleSendFieldSet').addClass('Hidden');
$('.NoSupportBundleSendMessage').removeClass('Hidden');
$('.SizeMessage').removeClass('Hidden');
}
// if the sender addres is invalid it is set to empty string, send option should not be shown
else if ($('#Sender').val() === '') {
$('.SupportBundleSendFieldSet').addClass('Hidden');
$('.NoSupportBundleSendMessage').removeClass('Hidden');
$('.EmailMessage').removeClass('Hidden');
}
// otherwise show full email option
else {
$('#SendSupportBundle').bind('click', function (Event) {
$('#SendingAJAXLoader').addClass('AJAXLoader');
$('#SendSupportBundle').prop('disabled', true);
$('#DownloadSupportBundle').prop('disabled', true);
Core.AJAX.FunctionCall(Core.Config.Get('CGIHandle'), 'Action=[% Env("Action") %];Subaction=SendSupportBundle;Filename=' + Response.Filename + ';RandomID=' + Response.RandomID, function (SendResponse) {
if (!SendResponse || !SendResponse.Success) {
alert([% Translate("The mail could not be sent") | JSON %]);
}
Core.UI.Dialog.CloseDialog($('#SupportBundleOptionsDialog'));
});
});
}
$('#DownloadSupportBundle').bind('click', function (Event) {
window.location.href = '[% Env("Baselink") %]Action=[% Env("Action") %];Subaction=DownloadSupportBundle;Filename=' + Response.Filename + ';RandomID=' + Response.RandomID + ';ChallengeToken=' + Core.Config.Get('ChallengeToken');
Core.UI.Dialog.CloseDialog($('#SupportBundleOptionsDialog'));
});
}
});
Event.preventDefault();
Event.stopPropagation();
return false;
});
//]]></script>
[% END %]
</ul>
</div>
</div>
</div>
<div id="SupportBundleOptionsDialogContainer" class="Hidden">
<div class="Spacing SupportBundleOptionsDialog" id="SupportBundleOptionsDialog">
<span class="W50pc" title=""></span>
<h2>[% Translate("The support bundle has been generated.") | html %]</h3>
<div class="FieldExplanation">
[% Translate("Please choose one of the following options.") | html %]
</div>
<div class="Spacing"></div>
<fieldset class="TableLike NoSupportBundleSendMessage Hidden">
<legend>[% Translate("Send by Email") | html %]</legend>
<div class="FieldExplanation SizeMessage Hidden">
[% Translate("The support bundle is too large to send it by email, this option has been disabled.") | html %]
</div>
<div class="FieldExplanation EmailMessage Hidden">
[% Translate("The email address for this user is invalid, this option has been disabled.") | html %]
</div>
<div class="Spacing"></div>
</fieldset>
<fieldset class="TableLike SupportBundleSendFieldSet">
<legend>[% Translate("Send by Email") | html %]</legend>
<label for="Name">[% Translate("Name") | html %]:</label>
<div class="Field">
<input type="text" id="Name" name="Name" value="[% Data.SenderName | html %]" class="W50pc" readonly="readonly" />
</div>
<div class="Clear"></div>
<label for="Sender">[% Translate("Email") | html %]:</label>
<div class="Field">
<input type="text" id="Sender" name="Sender" value="[% Data.SenderAddress | html %]" class="W50pc" readonly="readonly" />
</div>
<div class="Clear"></div>
<div class="Field">
<button value="SendByEmail" id="SendSupportBundle">[% Translate("Send") | html %]</button>
<span id="SendingAJAXLoader" class="Hidden" title="[% Translate("Sending") | html %]"></span>
<div class="FieldExplanation">
[% Translate("The support bundle will be sent to OTRS Group via email automatically.") | html %]
</div>
</div>
</fieldset>
<fieldset class="TableLike">
<legend>[% Translate("Download File") | html %]</legend>
<div class="Field">
<button value="DownLoad" id="DownloadSupportBundle">[% Translate("Download") | html %]</button>
<div class="FieldExplanation">
[% Translate("A file containing the support bundle will be downloaded to the local system. Please save the file and send it to the OTRS Group, using an alternate method.") | html %]
</div>
</div>
</fieldset>
</div>
</div>
[% RenderBlockStart("SupportDataCollectionFailed") %]
<div class="ContentColumn">
<h2>[% Translate("Support Data") | html %]</h2>
<div class="WidgetSimple">
<div class="Header">
</div>
<div class="Content">
<p>[% Translate("Error: Support data could not be collected (%s).", Data.ErrorMessage) | html %]</p>
</div>
</div>
</div>
[% RenderBlockEnd("SupportDataCollectionFailed") %]
[% RenderBlockStart("SupportData") %]
<div class="ContentColumn">
[% RenderBlockStart("SupportDataGroup") %]
<div class="WidgetSimple">
<div class="Header">
<div class="WidgetAction Toggle">
<a href="#" title="[% Translate("Show or hide the content") | html %]"><i class="fa fa-caret-right"></i><i class="fa fa-caret-down"></i></a>
</div>
<h2>[% Translate(Data.Group) | html %]</h2>
</div>
<div class="Content">
<ul class="CheckResults">
[% RenderBlockStart("SupportDataRow") %]
<li class="CheckResult[% Data.StatusName | html %]">
[% RenderBlockStart("SupportDataEntryTable") %]
<h3 class="Heading">
<span title="[% Translate(Data.StatusName) | html %]" class="Flag Small [% Data.StatusName | html %]">
<span>[% Data.StatusName | html %]</span>
</span>
[% Translate(Data.Label) | html %]
</h3>
[% RenderBlockStart("SupportDataEntryTableDetails") %]
<div class="SupportDataTableScrollbar">
<table class="DataTable SupportDataTable">
<thead>
[% FOR Label IN Data.Labels %]
<th>[% Translate(Label) %]</th>
[% END %]
</thead>
<tbody>
[% FOR Entry IN Data.Value %]
<tr>
[% FOR Identifier IN Data.Identifiers %]
<td>[% Entry.$Identifier %]</td>
[% END %]
</tr>
[% END %]
</tbody>
</table>
</div>
[% RenderBlockEnd("SupportDataEntryTableDetails") %]
[% RenderBlockEnd("SupportDataEntryTable") %]
[% RenderBlockStart("SupportDataEntry") %]
<h3 class="Heading">
<span title="[% Translate(Data.StatusName) | html %]" class="Flag Small [% Data.StatusName | html %]">
<span>[% Data.StatusName | html %]</span>
</span>
[% Translate(Data.Label) | html %]
[% RenderBlockStart("SupportDataEntryValueSingleLine") %]
<span class="Value">([% Data.Value | html %])</span>
[% RenderBlockEnd("SupportDataEntryValueSingleLine") %]
</h3>
<p class="SpacingTopSmall">[% Translate(Data.Message) | html %]</p>
[% RenderBlockStart("SupportDataEntryValueMultiLine") %]
<textarea rows="5" cols="80" readonly="readonly" class="Value">[% Data.Value | html %]</textarea>
[% RenderBlockEnd("SupportDataEntryValueMultiLine") %]
[% RenderBlockEnd("SupportDataEntry") %]
[% RenderBlockStart("SupportDataSubGroup") %]
<h3 class="Heading">
<span title="[% Translate(Data.StatusName) | html %]" class="Flag Small [% Data.StatusName | html %]">
<span>[% Data.StatusName | html %]</span>
</span>
[% Translate(Data.SubGroup) | html %]
</h3>
<table class="DataTable">
<tbody>
[% RenderBlockStart("SupportDataSubEntry") %]
<tr>
<td class="Status">
<span title="[% Translate(Data.StatusName) | html %]" class="Flag Small [% Data.StatusName | html %]">
<span>[% Data.StatusName | html %]</span>
</span>
</td>
<td class="ItemLabel">[% Translate(Data.Label) | html %]</td>
<td>[% Data.Value | html %]</td>
<td>
[% RenderBlockStart("SupportDataSubEntryMessage") %]
<a href="#" class="ShowItemMessage"><i class="fa fa-info-sign"></i> [% Translate("Details") | html %]</a>
<div class="Hidden">
<p class="DialogMessage">[% Translate(Data.Message) | html %]</p>
</div>
[% RenderBlockEnd("SupportDataSubEntryMessage") %]
</td>
</tr>
[% RenderBlockEnd("SupportDataSubEntry") %]
</tbody>
</table>
[% RenderBlockEnd("SupportDataSubGroup") %]
</li>
[% RenderBlockEnd("SupportDataRow") %]
</ul>
</div>
</div>
[% RenderBlockEnd("SupportDataGroup") %]
</div>
[% RenderBlockEnd("SupportData") %]
<div class="Clear"></div>
</div>
[% WRAPPER JSOnDocumentComplete %]
<script type="text/javascript">//<![CDATA[
$('.ShowItemMessage').bind('click', function() {
Core.UI.Dialog.ShowContentDialog($(this).next('.Hidden').html(), $(this).closest('tr').find('.ItemLabel').text(), '200px', 'Center');
return false;
});
$('.DataTable').each(function() {
if ($(this).find('.Flag.Problem').length) {
$(this).prev('h3').find('.Flag').addClass('Problem');
return true;
}
if ($(this).find('.Flag.Warning').length) {
$(this).prev('h3').find('.Flag').addClass('Warning');
return true;
}
if ($(this).find('.Flag.OK').length) {
$(this).prev('h3').find('.Flag').addClass('OK');
return true;
}
if ($(this).find('.Flag.Information').length) {
$(this).prev('h3').find('.Flag').addClass('Information');
return true;
}
if ($(this).find('.Flag.Unknown').length) {
$(this).prev('h3').find('.Flag').addClass('Unknown');
return true;
}
});
//]]></script>
[% END %]