Ask for description when reporting metadata (#1488)
This commit is contained in:
parent
6450d39933
commit
00efd01aaf
|
@ -186,7 +186,7 @@ Zotero.RecognizePDF = new function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
this.report = async function (item) {
|
this.report = async function (item, description) {
|
||||||
var attachment = Zotero.Items.get(item.getAttachments()[0]);
|
var attachment = Zotero.Items.get(item.getAttachments()[0]);
|
||||||
var filePath = attachment.getFilePath();
|
var filePath = attachment.getFilePath();
|
||||||
if (!filePath || !await OS.File.exists(filePath)) {
|
if (!filePath || !await OS.File.exists(filePath)) {
|
||||||
|
@ -197,7 +197,7 @@ Zotero.RecognizePDF = new function () {
|
||||||
var json = await extractJSON(filePath, MAX_PAGES);
|
var json = await extractJSON(filePath, MAX_PAGES);
|
||||||
var metadata = item.toJSON();
|
var metadata = item.toJSON();
|
||||||
|
|
||||||
var data = { version, json, metadata };
|
var data = { description, version, json, metadata };
|
||||||
var uri = ZOTERO_CONFIG.RECOGNIZE_URL + 'report';
|
var uri = ZOTERO_CONFIG.RECOGNIZE_URL + 'report';
|
||||||
return Zotero.HTTP.request(
|
return Zotero.HTTP.request(
|
||||||
"POST",
|
"POST",
|
||||||
|
|
|
@ -4600,27 +4600,27 @@ var ZoteroPane = new function()
|
||||||
|
|
||||||
|
|
||||||
this.reportMetadataForSelected = async function () {
|
this.reportMetadataForSelected = async function () {
|
||||||
var success = false;
|
let items = ZoteroPane.getSelectedItems();
|
||||||
var items = ZoteroPane.getSelectedItems();
|
if(!items.length) return;
|
||||||
for (let item of items) {
|
|
||||||
try {
|
|
||||||
await Zotero.RecognizePDF.report(item);
|
|
||||||
// If at least one report was submitted, show as success
|
|
||||||
success = true;
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
Zotero.logError(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (success) {
|
let input = {value: ''};
|
||||||
|
Services.prompt.prompt(
|
||||||
|
null,
|
||||||
|
Zotero.getString('recognizePDF.reportMetadata'),
|
||||||
|
Zotero.getString('general.describeProblem'),
|
||||||
|
input, null, {}
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await Zotero.RecognizePDF.report(items[0], input.value);
|
||||||
Zotero.alert(
|
Zotero.alert(
|
||||||
window,
|
window,
|
||||||
Zotero.getString('general.submitted'),
|
Zotero.getString('general.submitted'),
|
||||||
Zotero.getString('general.thanksForHelpingImprove', Zotero.clientName)
|
Zotero.getString('general.thanksForHelpingImprove', Zotero.clientName)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
catch (e) {
|
||||||
|
Zotero.logError(e);
|
||||||
Zotero.alert(
|
Zotero.alert(
|
||||||
window,
|
window,
|
||||||
Zotero.getString('general.error'),
|
Zotero.getString('general.error'),
|
||||||
|
|
|
@ -68,6 +68,7 @@ general.clear = Clear
|
||||||
general.processing = Processing
|
general.processing = Processing
|
||||||
general.submitted = Submitted
|
general.submitted = Submitted
|
||||||
general.thanksForHelpingImprove = Thanks for helping to improve %S!
|
general.thanksForHelpingImprove = Thanks for helping to improve %S!
|
||||||
|
general.describeProblem = Briefly describe the problem:
|
||||||
|
|
||||||
general.operationInProgress = A Zotero operation is currently in progress.
|
general.operationInProgress = A Zotero operation is currently in progress.
|
||||||
general.operationInProgress.waitUntilFinished = Please wait until it has finished.
|
general.operationInProgress.waitUntilFinished = Please wait until it has finished.
|
||||||
|
@ -1065,6 +1066,7 @@ recognizePDF.fileNotFound = File not found
|
||||||
recognizePDF.error = An unexpected error occurred
|
recognizePDF.error = An unexpected error occurred
|
||||||
recognizePDF.recognizing.label = Retrieving Metadata…
|
recognizePDF.recognizing.label = Retrieving Metadata…
|
||||||
recognizePDF.complete.label = Metadata Retrieval Complete
|
recognizePDF.complete.label = Metadata Retrieval Complete
|
||||||
|
recognizePDF.reportMetadata = Report Incorrect Metadata
|
||||||
|
|
||||||
rtfScan.openTitle = Select a file to scan
|
rtfScan.openTitle = Select a file to scan
|
||||||
rtfScan.scanning.label = Scanning RTF Document…
|
rtfScan.scanning.label = Scanning RTF Document…
|
||||||
|
|
Loading…
Reference in New Issue
Block a user