Ask for description when reporting metadata (#1488)
This commit is contained in:
parent
6450d39933
commit
00efd01aaf
3 changed files with 18 additions and 16 deletions
|
@ -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 filePath = attachment.getFilePath();
|
||||
if (!filePath || !await OS.File.exists(filePath)) {
|
||||
|
@ -197,7 +197,7 @@ Zotero.RecognizePDF = new function () {
|
|||
var json = await extractJSON(filePath, MAX_PAGES);
|
||||
var metadata = item.toJSON();
|
||||
|
||||
var data = { version, json, metadata };
|
||||
var data = { description, version, json, metadata };
|
||||
var uri = ZOTERO_CONFIG.RECOGNIZE_URL + 'report';
|
||||
return Zotero.HTTP.request(
|
||||
"POST",
|
||||
|
|
|
@ -4600,27 +4600,27 @@ var ZoteroPane = new function()
|
|||
|
||||
|
||||
this.reportMetadataForSelected = async function () {
|
||||
var success = false;
|
||||
var items = ZoteroPane.getSelectedItems();
|
||||
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);
|
||||
}
|
||||
}
|
||||
let items = ZoteroPane.getSelectedItems();
|
||||
if(!items.length) return;
|
||||
|
||||
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(
|
||||
window,
|
||||
Zotero.getString('general.submitted'),
|
||||
Zotero.getString('general.thanksForHelpingImprove', Zotero.clientName)
|
||||
);
|
||||
}
|
||||
else {
|
||||
catch (e) {
|
||||
Zotero.logError(e);
|
||||
Zotero.alert(
|
||||
window,
|
||||
Zotero.getString('general.error'),
|
||||
|
|
|
@ -68,6 +68,7 @@ general.clear = Clear
|
|||
general.processing = Processing
|
||||
general.submitted = Submitted
|
||||
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.waitUntilFinished = Please wait until it has finished.
|
||||
|
@ -1065,6 +1066,7 @@ recognizePDF.fileNotFound = File not found
|
|||
recognizePDF.error = An unexpected error occurred
|
||||
recognizePDF.recognizing.label = Retrieving Metadata…
|
||||
recognizePDF.complete.label = Metadata Retrieval Complete
|
||||
recognizePDF.reportMetadata = Report Incorrect Metadata
|
||||
|
||||
rtfScan.openTitle = Select a file to scan
|
||||
rtfScan.scanning.label = Scanning RTF Document…
|
||||
|
|
Loading…
Add table
Reference in a new issue