From 7fb8f162c5b3368ce784b20655957b2f33457b1f Mon Sep 17 00:00:00 2001 From: gracile-fr Date: Wed, 11 Mar 2015 18:28:30 +0100 Subject: [PATCH 01/10] Add localized locator labels Fixes #557 --- .../zotero/integration/addCitationDialog.js | 2 +- chrome/content/zotero/integration/quickFormat.js | 3 +-- chrome/content/zotero/tools/csledit.js | 2 +- chrome/locale/en-US/zotero/zotero.dtd | 3 --- chrome/locale/en-US/zotero/zotero.properties | 16 ++++++++++++++++ 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/integration/addCitationDialog.js b/chrome/content/zotero/integration/addCitationDialog.js index 34b5e0bfc..17ee4ef84 100644 --- a/chrome/content/zotero/integration/addCitationDialog.js +++ b/chrome/content/zotero/integration/addCitationDialog.js @@ -115,7 +115,7 @@ var Zotero_Citation_Dialog = new function () { var i = 0; for(var value in locators) { var locator = locators[value]; - var locatorLabel = locator[0].toUpperCase()+locator.substr(1); + var locatorLabel = Zotero.getString('citation.locator.'+locator.replace(/\s/g,'')); // add to list of labels var child = document.createElement("menuitem"); child.setAttribute("value", value); diff --git a/chrome/content/zotero/integration/quickFormat.js b/chrome/content/zotero/integration/quickFormat.js index f3c0962a1..af90a2cc2 100644 --- a/chrome/content/zotero/integration/quickFormat.js +++ b/chrome/content/zotero/integration/quickFormat.js @@ -79,8 +79,7 @@ var Zotero_QuickFormat = new function () { var menu = document.getElementById("locator-label"); var labelList = document.getElementById("locator-label-popup"); for each(var locator in locators) { - // TODO localize - var locatorLabel = locator[0].toUpperCase()+locator.substr(1); + var locatorLabel = Zotero.getString('citation.locator.'+locator.replace(/\s/g,'')); // add to list of labels var child = document.createElement("menuitem"); diff --git a/chrome/content/zotero/tools/csledit.js b/chrome/content/zotero/tools/csledit.js index 6a777b480..1bcbc6a91 100644 --- a/chrome/content/zotero/tools/csledit.js +++ b/chrome/content/zotero/tools/csledit.js @@ -64,7 +64,7 @@ var Zotero_CSL_Editor = new function() { var locators = Zotero.Cite.labels; for each(var type in locators) { var locator = type; - locator = locator[0].toUpperCase()+locator.substr(1); + locator = Zotero.getString('citation.locator.'+locator.replace(/\s/g,'')); pageList.appendItem(locator, type); } diff --git a/chrome/locale/en-US/zotero/zotero.dtd b/chrome/locale/en-US/zotero/zotero.dtd index 95aa70721..7a2ea98b2 100644 --- a/chrome/locale/en-US/zotero/zotero.dtd +++ b/chrome/locale/en-US/zotero/zotero.dtd @@ -187,9 +187,6 @@ - - - diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index 4e13f370d..3a85556b0 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -663,6 +663,22 @@ citation.showEditor = Show Editor… citation.hideEditor = Hide Editor… citation.citations = Citations citation.notes = Notes +citation.locator.page = Page +citation.locator.book = Book +citation.locator.chapter = Chapter +citation.locator.column = Column +citation.locator.figure = Figure +citation.locator.folio = Folio +citation.locator.issue = Issue +citation.locator.line = Line +citation.locator.note = Note +citation.locator.opus = Opus +citation.locator.paragraph = Paragraph +citation.locator.part = Part +citation.locator.section = Section +citation.locator.subverbo = Sub verbo +citation.locator.volume = Volume +citation.locator.verse = Verse report.title.default = Zotero Report report.parentItem = Parent Item: From a2b6df1014b130ff9d821ce4ecd97ee9c6194b0b Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 15 Apr 2015 16:03:47 -0400 Subject: [PATCH 02/10] Include both DB version numbers in "newer than SQL file" dialog --- chrome/content/zotero/xpcom/zotero.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 46014c27a..94a4bc804 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -610,12 +610,12 @@ Components.utils.import("resource://gre/modules/Services.jsm"); } catch (e) { if (e.toString().match('newer than SQL file')) { - let versions = e.toString().match(/\((\d+) < \d+\)/); + let versions = e.toString().match(/\((\d+) < (\d+)\)/); let kbURL = "https://www.zotero.org/support/kb/newer_db_version"; let msg = Zotero.getString('startupError.zoteroVersionIsOlder') + " " + Zotero.getString('startupError.zoteroVersionIsOlder.upgrade') + "\n\n" - + Zotero.getString('startupError.zoteroVersionIsOlder.current', Zotero.version) + "\n" - + (versions ? "DB: " + versions[1] + "\n\n" : "\n") + + Zotero.getString('startupError.zoteroVersionIsOlder.current', Zotero.version) + + (versions ? " (" + versions[1] + " < " + versions[2] + ")" : "") + "\n\n" + Zotero.getString('general.seeForMoreInformation', kbURL); Zotero.startupError = msg; _startupErrorHandler = function() { From 2566ca27e02d62dc5fa56ac6f72b129f53983988 Mon Sep 17 00:00:00 2001 From: Aurimas Vinckevicius Date: Sat, 2 May 2015 15:30:25 -0500 Subject: [PATCH 03/10] Don't report translator failures from tests --- test/runtests.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/runtests.sh b/test/runtests.sh index d62b31800..a115589b9 100755 --- a/test/runtests.sh +++ b/test/runtests.sh @@ -79,6 +79,7 @@ user_pref("extensions.zotero.debug.log", $DEBUG); user_pref("extensions.zotero.debug.time", $DEBUG); user_pref("extensions.zotero.firstRunGuidance", false); user_pref("extensions.zotero.firstRun2", false); +user_pref("extensions.zotero.reportTranslationFailure", false); EOF # -v flag on Windows makes Firefox process hang From 453e7bd0902907f830b93fb527aa7559fa766c23 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sat, 2 May 2015 19:00:42 -0400 Subject: [PATCH 04/10] Fix size of 2x icons in progress window --- chrome/content/zotero/xpcom/progressWindow.js | 1 + 1 file changed, 1 insertion(+) diff --git a/chrome/content/zotero/xpcom/progressWindow.js b/chrome/content/zotero/xpcom/progressWindow.js index 4ba17faa6..9bbea312f 100644 --- a/chrome/content/zotero/xpcom/progressWindow.js +++ b/chrome/content/zotero/xpcom/progressWindow.js @@ -291,6 +291,7 @@ Zotero.ProgressWindow = function(_window){ this._image.setAttribute("flex", 0); this._image.style.width = "16px"; this._image.style.backgroundRepeat = "no-repeat"; + this._image.style.backgroundSize = "16px"; this.setIcon(iconSrc); this._hbox = _progressWindow.document.createElement("hbox"); From 3587bb0f6b9f5fb97a0ba776964c29b1fdb0db97 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 29 Apr 2015 17:06:23 -0400 Subject: [PATCH 05/10] Fix error if a synced filename begins with a dot (".pdf") --- chrome/content/zotero/xpcom/storage.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/storage.js b/chrome/content/zotero/xpcom/storage.js index ac1940457..5979af532 100644 --- a/chrome/content/zotero/xpcom/storage.js +++ b/chrome/content/zotero/xpcom/storage.js @@ -1615,7 +1615,7 @@ Zotero.Sync.Storage = new function () { var fileName = entryName; } - if (fileName.indexOf('.') == 0) { + if (fileName.startsWith('.zotero')) { Zotero.debug("Skipping " + fileName); continue; } @@ -1760,7 +1760,7 @@ Zotero.Sync.Storage = new function () { var filesToDelete = []; var file; while (file = otherFiles.nextFile) { - if (file.leafName[0] == '.') { + if (file.leafName.startsWith('.zotero')) { continue; } @@ -1861,7 +1861,7 @@ Zotero.Sync.Storage = new function () { continue; } var fileName = file.getRelativeDescriptor(rootDir); - if (fileName.indexOf('.') == 0) { + if (fileName.startsWith('.zotero')) { Zotero.debug('Skipping file ' + fileName); continue; } From 45b3cd8a530d60c860b639a5fea849abaa897879 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 7 May 2015 13:41:13 -0400 Subject: [PATCH 06/10] Replace non-breaking spaces in tested lines in recognizePDF Fixes "PDF does not contain OCRed text" message for http://pdfserver.amlaw.com/nlj/NSA_ca2_20150507.pdf --- chrome/content/zotero/recognizePDF.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/recognizePDF.js b/chrome/content/zotero/recognizePDF.js index 819761caa..91941fb5f 100644 --- a/chrome/content/zotero/recognizePDF.js +++ b/chrome/content/zotero/recognizePDF.js @@ -593,7 +593,11 @@ var Zotero_RecognizePDF = new function() { const lineRe = /^[\s_]*([^\s]+(?: [^\s_]+)+)/; var cleanedLines = [], cleanedLineLengths = []; for(var i=0; i 3) { cleanedLines.push(m[1]); cleanedLineLengths.push(m[1].length); From 47ffa1188a1e21e231c3f5381ce2d9000b99b26e Mon Sep 17 00:00:00 2001 From: retorquere Date: Mon, 11 May 2015 20:26:50 +0200 Subject: [PATCH 07/10] export groups, unify library export --- chrome/content/zotero/fileInterface.js | 10 ++++- .../zotero/xpcom/translation/translate.js | 38 ++++++++++++------- .../xpcom/translation/translate_item.js | 6 +-- chrome/content/zotero/zoteroPane.js | 2 +- 4 files changed, 38 insertions(+), 18 deletions(-) diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index cbc7cb961..67dd69056 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -76,6 +76,10 @@ Zotero_File_Exporter.prototype.save = function() { translation.setCollection(this.collection); } else if(this.items) { translation.setItems(this.items); + } else if(this.libraryID === undefined) { + throw new Error('No export configured'); + } else { + translation.setLibraryID(this.libraryID); } translation.setLocation(fp.file); @@ -129,7 +133,11 @@ var Zotero_File_Interface = new function() { */ function exportFile() { var exporter = new Zotero_File_Exporter(); - exporter.name = Zotero.getString("pane.collections.library"); + exporter.libraryID = ZoteroPane_Local.getSelectedLibraryID(); + if (exporter.libraryID === false) { + throw new Error('No library selected'); + } + exporter.name = Zotero.Libraries.getName(exporter.libraryID); exporter.save(); } diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 88027e9ab..060d1d2f1 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -2110,17 +2110,23 @@ Zotero.Translate.Export.prototype.Sandbox = Zotero.Translate.Sandbox._inheritFro * @param {Zotero.Item[]} items */ Zotero.Translate.Export.prototype.setItems = function(items) { - this._items = items; - delete this._collection; + this._export = {type: 'items', items: items}; } /** - * Sets the collection to be exported (overrides setItems) + * Sets the group to be exported (overrides setItems/setCollection) + * @param {Zotero.Group[]} group + */ +Zotero.Translate.Export.prototype.setLibraryID = function(libraryID) { + this._export = {type: 'library', id: libraryID}; +} + +/** + * Sets the collection to be exported (overrides setItems/setGroup) * @param {Zotero.Collection[]} collection */ Zotero.Translate.Export.prototype.setCollection = function(collection) { - this._collection = collection; - delete this._items; + this._export = {type: 'collection', collection: collection}; } /** @@ -2182,15 +2188,21 @@ Zotero.Translate.Export.prototype._prepareTranslation = function() { this._itemGetter = new Zotero.Translate.ItemGetter(); var configOptions = this._translatorInfo.configOptions || {}, getCollections = configOptions.getCollections || false; - if(this._collection) { - this._itemGetter.setCollection(this._collection, getCollections); - delete this._collection; - } else if(this._items) { - this._itemGetter.setItems(this._items); - delete this._items; - } else { - this._itemGetter.setAll(getCollections); + switch (this._export.type) { + case 'collection': + this._itemGetter.setCollection(this._export.collection, getCollections); + break; + case 'items': + this._itemGetter.setItems(this._export.items); + break; + case 'library': + this._itemGetter.setAll(this._export.id, getCollections); + break; + default: + throw new Error('No export set up'); + break; } + delete this._export; // export file data, if requested if(this._displayOptions["exportFileData"]) { diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js index 89f263c92..616040b87 100644 --- a/chrome/content/zotero/xpcom/translation/translate_item.js +++ b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -786,11 +786,11 @@ Zotero.Translate.ItemGetter.prototype = { this.numItems = this._itemsLeft.length; }, - "setAll":function(getChildCollections) { - this._itemsLeft = Zotero.Items.getAll(true); + "setAll":function(libraryID, getChildCollections) { + this._itemsLeft = Zotero.Items.getAll(true, libraryID); if(getChildCollections) { - this._collectionsLeft = Zotero.getCollections(); + this._collectionsLeft = Zotero.getCollections(null, true, libraryID); } this.numItems = this._itemsLeft.length; diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 0b7a9b231..14edc7029 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -2173,7 +2173,7 @@ var ZoteroPane = new function() show = [m.emptyTrash]; } else if (itemGroup.isGroup()) { - show = [m.newCollection, m.newSavedSearch, m.sep1, m.showDuplicates, m.showUnfiled]; + show = [m.newCollection, m.newSavedSearch, m.sep1, m.showDuplicates, m.showUnfiled, m.sep2, m.exportFile]; } else if (itemGroup.isDuplicates() || itemGroup.isUnfiled()) { show = [ From bd8db988f3f6b7ac5f5eb8b1acc74952370d2c60 Mon Sep 17 00:00:00 2001 From: rmzelle Date: Thu, 14 May 2015 00:32:20 -0400 Subject: [PATCH 08/10] Add Edit button to proxy list --- .../zotero/preferences/preferences_firefox.xul | 11 ++++++++--- .../content/zotero/preferences/preferences_proxies.js | 9 +++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences_firefox.xul b/chrome/content/zotero/preferences/preferences_firefox.xul index 07dc62428..bfb1e50e0 100644 --- a/chrome/content/zotero/preferences/preferences_firefox.xul +++ b/chrome/content/zotero/preferences/preferences_firefox.xul @@ -23,7 +23,10 @@ ***** END LICENSE BLOCK ***** --> - + %preferencesDTD; + %zoteroDTD; +]> @@ -64,7 +67,7 @@ @@ -73,7 +76,9 @@ - + +