forked from zotero/zotero
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errorReport.xul
96 lines (78 loc) · 3.36 KB
/
errorReport.xul
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
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/errorReport.css" type="text/css"?>
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
<wizard xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="zotero-error-report" title="&zotero.errorReport.title;"
width="550" height="450">
<script>
<![CDATA[
Components.utils.import("resource://zotero/config.js");
var Zotero_Error_Report = new function() {
var obj = window.arguments[0].wrappedJSObject;
var Zotero = obj.Zotero;
var data = obj.data;
var msg = data.msg;
var diagnosticInfo = false;
this.init = Zotero.Promise.coroutine(function* () {
var wizard = document.getElementById('zotero-error-report');
var continueButton = wizard.getButton('next');
continueButton.disabled = true;
diagnosticInfo = yield Zotero.getSystemInfo();
var errorData = Zotero.Errors.getErrors();
var errorDataText = errorData.length
? errorData.join('\n\n')
: Zotero.getString('errorReport.noErrorsLogged', Zotero.appName);
var logText = diagnosticInfo + '\n\n' + errorDataText;
if (document.getElementById('zotero-failure-message').hasChildNodes()) {
var textNode = document.getElementById('zotero-failure-message').firstChild;
document.getElementById('zotero-failure-message').removeChild(textNode);
}
document.getElementById('zotero-failure-message').appendChild(document.createTextNode(msg));
document.getElementById('zotero-error-message').value = logText;
continueButton.disabled = false;
continueButton.focus();
var str = Zotero.getString(
'errorReport.advanceMessage', continueButton.getAttribute('label')
);
document.getElementById('zotero-advance-message').setAttribute('value', str);
});
this.sendErrorReport = Zotero.Promise.coroutine(function* () {
var wizard = document.getElementById('zotero-error-report');
var continueButton = wizard.getButton('next');
continueButton.disabled = true;
var reportID;
try {
reportID = yield Zotero.Errors.submitToZotero();
} catch (e) {
ps.alert(null, Zotero.getString('general.error'), e.message);
wizard.rewind();
return;
}
wizard.advance();
wizard.getButton('cancel').disabled = true;
wizard.canRewind = false;
document.getElementById('zotero-report-id').setAttribute('value', reportID);
document.getElementById('zotero-report-result').hidden = false;
});
}
]]>
</script>
<wizardpage onpageshow="Zotero_Error_Report.init()" label=" ">
<description id="zotero-failure-message"/>
<textbox id="zotero-error-message" class="plain" readonly="true" multiline="true" flex="1"/>
<description id="zotero-advance-message"/>
</wizardpage>
<wizardpage onpageshow="Zotero_Error_Report.sendErrorReport()" label=" ">
<description>&zotero.errorReport.submissionInProgress;</description>
</wizardpage>
<wizardpage label=" ">
<description>&zotero.errorReport.submitted;</description>
<description id="zotero-report-result" hidden="true">
&zotero.errorReport.reportID;
<textbox id="zotero-report-id" class="plain" readonly="true"/>
</description>
<description>&zotero.errorReport.postToForums;</description>
<description>&zotero.errorReport.notReviewed;</description>
</wizardpage>
</wizard>