125 lines
4 KiB
XML
125 lines
4 KiB
XML
<?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">
|
|
|
|
<!-- TODO: localize -->
|
|
<wizard xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
id="zotero-error-report" title="Zotero Error Report">
|
|
|
|
<script>
|
|
<![CDATA[
|
|
var Zotero_Error_Report = new function() {
|
|
this.init = init;
|
|
this.sendErrorReport = sendErrorReport;
|
|
|
|
var obj = window.arguments[0].wrappedJSObject;
|
|
var Zotero = obj.Zotero;
|
|
var data = obj.data;
|
|
var msg = data.msg;
|
|
var e = data.e;
|
|
var extraData = data.extraData ? data.extraData : '';
|
|
|
|
function init() {
|
|
var wizard = document.getElementById('zotero-error-report');
|
|
|
|
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 = e;
|
|
|
|
var continueButtonName = wizard.getButton('next').getAttribute('label');
|
|
var str = Zotero.getString('errorReport.advanceMessage', continueButtonName);
|
|
document.getElementById('zotero-advance-message').setAttribute('value', str);
|
|
}
|
|
|
|
function sendErrorReport() {
|
|
var wizard = document.getElementById('zotero-error-report');
|
|
var continueButtonName = wizard.getButton('next').disabled = true;
|
|
|
|
Zotero.getSystemInfo(function(info) {
|
|
var parts = {
|
|
error: "true",
|
|
errorData: Zotero.getErrors(true).join('\n'),
|
|
extraData: extraData,
|
|
diagnostic: info
|
|
};
|
|
|
|
var body = '';
|
|
for (var key in parts) {
|
|
body += key + '=' + encodeURIComponent(parts[key]) + '&';
|
|
}
|
|
body = body.substr(0, body.length - 1);
|
|
Zotero.HTTP.doPost("https://repo.zotero.org/repo/report", body,
|
|
_sendErrorReportCallback);
|
|
});
|
|
}
|
|
|
|
|
|
function _sendErrorReportCallback(xmlhttp) {
|
|
var wizard = document.getElementById('zotero-error-report');
|
|
if (!wizard) {
|
|
return;
|
|
}
|
|
|
|
if (!xmlhttp.responseXML){
|
|
try {
|
|
if (xmlhttp.status>1000){
|
|
alert('No network connection');
|
|
}
|
|
else {
|
|
alert('Invalid response from repository');
|
|
}
|
|
}
|
|
catch (e){
|
|
alert('Repository cannot be contacted');
|
|
}
|
|
|
|
wizard.rewind();
|
|
return;
|
|
}
|
|
|
|
|
|
var reported = xmlhttp.responseXML.getElementsByTagName('reported');
|
|
if (reported.length != 1) {
|
|
alert('Invalid response from repository');
|
|
wizard.rewind();
|
|
return;
|
|
}
|
|
|
|
wizard.advance();
|
|
wizard.getButton('cancel').setAttribute('disabled', true);
|
|
wizard.canRewind = false;
|
|
var reportID = reported[0].getAttribute('reportID');
|
|
document.getElementById('zotero-report-id').setAttribute('value', reportID);
|
|
document.getElementById('zotero-report-result').setAttribute('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" rows="6"/>
|
|
<description id="zotero-unrelated-message">&zotero.general.note; &zotero.errorReport.unrelatedMessages;</description>
|
|
<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>
|