zotero/chrome/content/zotero/errorReport.xhtml
Adomas Ven 6b819e259c
fx102: Cleans up scss files, removes shadow DOM use from CEs (#3051)
Removes a huge amount of excessive files and duplication for CE scss.
All CE css is now output in the single
zotero-react-client.css file.

Moving all CE styling into a single stylesheet required removing their
shadow DOMs. It is desirable anyway, since you want to
be able to style CEs from "outside", when embedding in different
contexts.

Shadow removal required some CE code changes to maintain
functionality.

Elements refactored:
- attachment-box (displayed when an attachment (like PDF) is selected in
the item tree)
- color-picker (in the tag color selector)
- guidance-panel (displayed on first run when editing authors for a book
section)
- item-box (info tab in the item pane)
- note-editor
- notes-box (note tab in the item pane)
- quick-search-textbox
- related-box (related tab in the item pane)
- tags-box (tags tab in the item pane)
- zoterosearch (advanced search condition builder form)
2023-04-01 01:37:55 -04:00

197 lines
No EOL
5.7 KiB
HTML

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://zotero/skin/errorReport.css" type="text/css"?>
<?xml-stylesheet href="chrome://zotero-platform/content/zotero.css"?>
<!DOCTYPE window SYSTEM "chrome://zotero/locale/zotero.dtd">
<window
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload="Zotero_Error_Report.init()">
<linkset>
<html:link rel="localization" href="toolkit/global/wizard.ftl"/>
</linkset>
<script src="chrome://global/content/customElements.js"/>
<wizard 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 errorData = data.errorData;
var extraData = data.extraData ? data.extraData : '';
var diagnosticInfo = false;
this.init = Zotero.Promise.coroutine(function* () {
// Allow Continue button to be populated
yield Zotero.Promise.delay(100);
var wizard = document.querySelector('wizard');
var continueButton = wizard.getButton('next');
continueButton.disabled = true;
diagnosticInfo = yield Zotero.getSystemInfo();
var errorDataText = errorData.length
? data.errorData.join('\n\n')
: Zotero.getString('errorReport.noErrorsLogged', Zotero.appName);
var logText = errorDataText + '\n\n'
+ (extraData !== '' ? extraData + '\n\n' : '')
+ diagnosticInfo;
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);
var pageSending = document.querySelector('wizardpage[pageid="report-sending"]');
pageSending.addEventListener('pageshow', () => Zotero_Error_Report.sendErrorReport());
});
this.sendErrorReport = Zotero.Promise.coroutine(function* () {
var wizard = document.querySelector('wizard');
var continueButton = wizard.getButton('next');
continueButton.disabled = true;
var parts = {
error: "true",
errorData: errorData.join('\n'),
extraData: extraData,
diagnostic: diagnosticInfo
};
var body = '';
for (var key in parts) {
body += key + '=' + encodeURIComponent(parts[key]) + '&';
}
body = body.substr(0, body.length - 1);
var req = yield Zotero.HTTP.request(
"POST",
ZOTERO_CONFIG.REPOSITORY_URL + "report",
{
body,
successCodes: false,
foreground: true
}
);
_sendErrorReportCallback(req);
});
function _sendErrorReportCallback(xmlhttp) {
var wizard = document.querySelector('wizard');
if (!wizard) {
return;
}
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
if (!xmlhttp.responseXML){
try {
if (xmlhttp.status>1000){
ps.alert(
null,
Zotero.getString('general.error'),
Zotero.getString('errorReport.noNetworkConnection')
);
}
else {
ps.alert(
null,
Zotero.getString('general.error'),
Zotero.getString('errorReport.invalidResponseRepository')
);
}
}
catch (e){
ps.alert(
null,
Zotero.getString('general.error'),
Zotero.getString('errorReport.repoCannotBeContacted')
);
}
wizard.rewind();
return;
}
var reported = xmlhttp.responseXML.getElementsByTagName('reported');
if (reported.length != 1) {
ps.alert(
null,
Zotero.getString('general.error'),
Zotero.getString('errorReport.invalidResponseRepository')
);
wizard.rewind();
return;
}
wizard.advance();
wizard.getButton('cancel').disabled = true;;
wizard.canRewind = false;
var reportID = reported[0].getAttribute('reportID');
document.getElementById('zotero-report-id').setAttribute('value', reportID);
document.getElementById('zotero-report-result').hidden = false;
}
}
]]>
</script>
<wizardpage
id="report-start"
pageid="report-start"
next="report-sending"
data-header-label-id="">
<description id="zotero-failure-message"/>
<html:textarea
id="zotero-error-message"
class="plain"
readonly="true"
multiline="true"
/>
<description id="zotero-advance-message"/>
</wizardpage>
<wizardpage
pageid="report-sending"
next="report-submitted"
onpageshow="Zotero_Error_Report.sendErrorReport()"
data-header-label-id="">
<description>&zotero.errorReport.submissionInProgress;</description>
</wizardpage>
<wizardpage
pageid="report-submitted"
data-header-label-id="">
<description>&zotero.errorReport.submitted;</description>
<description id="zotero-report-result" hidden="true">
&zotero.errorReport.reportID;
<html:input id="zotero-report-id" type="text" class="plain" readonly="true"/>
</description>
<description>&zotero.errorReport.postToForums;</description>
<description>&zotero.errorReport.notReviewed;</description>
</wizardpage>
</wizard>
</window>