diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index d420829b47..a3c72cf948 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -1132,10 +1132,10 @@ Zotero.Attachments = new function(){ directory: tmpDir, libraryID: item.libraryID, filename: OS.Path.basename(tmpFile), + title: _getPDFTitleFromVersion(props.articleVersion), url, contentType: 'application/pdf', - parentItemID: item.id, - articleVersion: props.articleVersion + parentItemID: item.id }); } else { @@ -1153,6 +1153,29 @@ Zotero.Attachments = new function(){ }; + function _getPDFTitleFromVersion(version) { + var str; + + switch (version) { + case 'acceptedVersion': + case 'accepted': + str = 'acceptedVersion'; + break; + + case 'submittedVersion': + case 'submitted': + str = 'submittedVersion'; + break; + + // 'publishedVersion' or unspecified + default: + str = 'fullText'; + } + + return Zotero.getString('attachment.' + str); + } + + /** * Try to download a file from a list of URLs, keeping the first one that succeeds * diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index 174a5d5925..5f1bb678d6 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -599,6 +599,10 @@ findPDF.openAccessPDF = Open-Access PDF findPDF.pdfWithMethod = PDF (%S) findPDF.noPDFsFound = No PDFs found +attachment.fullText = Full Text +attachment.acceptedVersion = Accepted Version +attachment.submittedVersion = Submitted Version + db.dbCorrupted = The Zotero database '%S' appears to have become corrupted. db.dbCorrupted.restart = Please restart %S to attempt an automatic restore from the last backup. db.dbCorruptedNoBackup = The Zotero database '%S' appears to have become corrupted, and no automatic backup is available.\n\nA new database has been created. The damaged file was saved to your Zotero data directory. diff --git a/test/tests/server_connectorTest.js b/test/tests/server_connectorTest.js index a698562e3a..b9b6a15835 100644 --- a/test/tests/server_connectorTest.js +++ b/test/tests/server_connectorTest.js @@ -588,7 +588,7 @@ describe("Connector Server", function () { assert.lengthOf(ids, 1); item = Zotero.Items.get(ids[0]); assert.isTrue(item.isImportedAttachment()); - assert.equal(item.getField('title'), 'Title.pdf'); + assert.equal(item.getField('title'), Zotero.getString('attachment.submittedVersion')); }); @@ -742,7 +742,7 @@ describe("Connector Server", function () { assert.lengthOf(ids, 1); item = Zotero.Items.get(ids[0]); assert.isTrue(item.isImportedAttachment()); - assert.equal(item.getField('title'), 'Title.pdf'); + assert.equal(item.getField('title'), Zotero.getString('attachment.submittedVersion')); }); }); });