From a86d6cd1ef7690a9fcf8e8b1471b2b253099eabc Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Fri, 27 Jan 2012 04:31:21 -0500 Subject: [PATCH 1/6] Allow editing bibliography when it contains items not present in the DB. --- .../integration/editBibliographyDialog.js | 2 +- chrome/content/zotero/xpcom/integration.js | 57 ++++++++++--------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/chrome/content/zotero/integration/editBibliographyDialog.js b/chrome/content/zotero/integration/editBibliographyDialog.js index 3f9d1e1370..ee32a3f39c 100644 --- a/chrome/content/zotero/integration/editBibliographyDialog.js +++ b/chrome/content/zotero/integration/editBibliographyDialog.js @@ -302,7 +302,7 @@ var Zotero_Bibliography_Dialog = new function () { */ function _loadItems() { var itemIDs = bibEditInterface.bibliography[0].entry_ids; - var items = Zotero.Items.get(itemIDs); + var items = [Zotero.Cite.getItem(itemID[0]) for each(itemID in itemIDs)]; // delete all existing items from list var itemList = document.getElementById("item-list"); diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 03e6160dac..492f42ec92 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -1579,7 +1579,7 @@ Zotero.Integration.Session = function(doc) { this.omittedItems = {}; this.embeddedItems = {}; this.embeddedZoteroItems = {}; - this.embeddedItemsByURI = {}; + this.embeddedZoteroItemsByURI = {}; this.customBibliographyText = {}; this.reselectedItems = {}; this.resetRequest(doc); @@ -1900,37 +1900,25 @@ Zotero.Integration.Session.prototype.lookupItems = function(citation, index) { } if(!zoteroItem) { - // check embedded items - if(citationItem.uris) { - var success = false; - for(var j=0, m=citationItem.uris.length; j Date: Fri, 27 Jan 2012 04:42:25 -0500 Subject: [PATCH 2/6] Don't show an error when trying to insert a bibliography after the set document preferences window has been shown but the style has not been changed --- chrome/content/zotero/xpcom/integration.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 492f42ec92..85f9a238ef 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -1613,9 +1613,9 @@ Zotero.Integration.Session.prototype.resetRequest = function(doc) { * @param data {Zotero.Integration.DocumentData} */ Zotero.Integration.Session.prototype.setData = function(data) { - var oldStyleID = (this.data && this.data.style.styleID ? this.data.style.styleID : false); + var oldStyle = (this.data && this.data.style ? this.data.style : false); this.data = data; - if(data.style.styleID && oldStyleID != data.style.styleID) { + if(!oldStyle || (data.style.styleID && oldStyle.styleID != data.style.styleID)) { this.styleID = data.style.styleID; try { var getStyle = Zotero.Styles.get(data.style.styleID); @@ -1631,6 +1631,8 @@ Zotero.Integration.Session.prototype.setData = function(data) { } return true; + } else { + data.style = oldStyle; } return false; } From 9457927a3e49afd17af4da200c9f1e1daa531ce7 Mon Sep 17 00:00:00 2001 From: Frank Date: Fri, 27 Jan 2012 16:05:36 +0800 Subject: [PATCH 3/6] Upgrade citeproc-js to version 1.0.269 --- chrome/content/zotero/xpcom/citeproc.js | 36 +++++++++++++------------ 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/chrome/content/zotero/xpcom/citeproc.js b/chrome/content/zotero/xpcom/citeproc.js index 7cdc4037e2..6eb0301799 100644 --- a/chrome/content/zotero/xpcom/citeproc.js +++ b/chrome/content/zotero/xpcom/citeproc.js @@ -1989,7 +1989,7 @@ CSL.DateParser = function () { }; CSL.Engine = function (sys, style, lang, forceLang) { var attrs, langspec, localexml, locale; - this.processor_version = "1.0.268"; + this.processor_version = "1.0.269"; this.csl_version = "1.0"; this.sys = sys; this.sys.xml = new CSL.System.Xml.Parsing(); @@ -6605,25 +6605,27 @@ CSL.evaluateLabel = function (node, state, Item, item) { } else { myterm = node.strings.term; } - var plural = 0; - if ("locator" === node.strings.term) { - if (item && item.locator) { - if (state.opt.development_extensions.locator_parsing_for_plurals) { - if (!state.tmp.shadow_numbers.locator) { - state.processNumber(false, item, "locator"); + var plural = node.strings.plural; + if ("number" !== typeof plural) { + if ("locator" === node.strings.term) { + if (item && item.locator) { + if (state.opt.development_extensions.locator_parsing_for_plurals) { + if (!state.tmp.shadow_numbers.locator) { + state.processNumber(false, item, "locator"); + } + plural = state.tmp.shadow_numbers.locator.plural; + } else { + plural = CSL.evaluateStringPluralism(item.locator); } - plural = state.tmp.shadow_numbers.locator.plural; - } else { - plural = CSL.evaluateStringPluralism(item.locator); } + } else if (["page", "page-first"].indexOf(node.variables[0]) > -1) { + plural = CSL.evaluateStringPluralism(Item[myterm]); + } else { + if (!state.tmp.shadow_numbers[myterm]) { + state.processNumber(false, Item, myterm); + } + plural = state.tmp.shadow_numbers[myterm].plural; } - } else if (["page", "page-first"].indexOf(node.variables[0]) > -1) { - plural = CSL.evaluateStringPluralism(Item[myterm]); - } else { - if (!state.tmp.shadow_numbers[myterm]) { - state.processNumber(false, Item, myterm); - } - plural = state.tmp.shadow_numbers[myterm].plural; } return CSL.castLabel(state, node, myterm, plural); }; From 0e1df8b8b4c7b5e88e7c0814a7b105aab6b0f67d Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Fri, 27 Jan 2012 05:54:24 -0500 Subject: [PATCH 4/6] Don't warn about corruption when Zotero Standalone is launched from zotero://fullscreen (does anyone use this?) --- chrome/content/zotero/standalone/standalone.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/standalone/standalone.js b/chrome/content/zotero/standalone/standalone.js index 9840af7789..6fac216219 100644 --- a/chrome/content/zotero/standalone/standalone.js +++ b/chrome/content/zotero/standalone/standalone.js @@ -42,7 +42,7 @@ const ZoteroStandalone = new function() { ZoteroPane.makeVisible(); // Run check for corrupt installation, where the wrong Gecko runtime is being used - if(Zotero.isMac) { + if(Zotero.isMac && Zotero.isStandalone) { var greDir = Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties) .get("GreD", Components.interfaces.nsIFile); @@ -65,7 +65,8 @@ const ZoteroStandalone = new function() { hs.store(handlerInfo); } - // Add add-on listeners (not yet hooked up)Services.obs.addObserver(gXPInstallObserver, "addon-install-disabled", false); + // Add add-on listeners (not yet hooked up) + Services.obs.addObserver(gXPInstallObserver, "addon-install-disabled", false); Services.obs.addObserver(gXPInstallObserver, "addon-install-started", false); Services.obs.addObserver(gXPInstallObserver, "addon-install-blocked", false); Services.obs.addObserver(gXPInstallObserver, "addon-install-failed", false); From 5f89402ce634869d2acaa7c4fa2a5629fcad320d Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Fri, 27 Jan 2012 05:59:03 -0500 Subject: [PATCH 5/6] Refuse to open preferences in connector mode and close preferences when Zotero Standalone is opened --- chrome/content/zotero/preferences/preferences.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/chrome/content/zotero/preferences/preferences.js b/chrome/content/zotero/preferences/preferences.js index 2ff53d7874..b796dcc4fe 100644 --- a/chrome/content/zotero/preferences/preferences.js +++ b/chrome/content/zotero/preferences/preferences.js @@ -74,6 +74,16 @@ var Zotero_Preferences = { function init() { + if(Zotero.isConnector) { + Zotero.activateStandalone(); + window.close(); + return; + } + + observerService.addObserver(function() { + if(Zotero.isConnector) window.close(); + }, "zotero-reloaded", false); + // Display the appropriate modifier keys for the platform var rows = document.getElementById('zotero-prefpane-keys').getElementsByTagName('row'); for (var i=0; i Date: Fri, 27 Jan 2012 15:37:02 -0500 Subject: [PATCH 6/6] Fix inserting first citation, broken by b526a7 --- chrome/content/zotero/xpcom/integration.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 85f9a238ef..c180649d4d 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -1615,7 +1615,7 @@ Zotero.Integration.Session.prototype.resetRequest = function(doc) { Zotero.Integration.Session.prototype.setData = function(data) { var oldStyle = (this.data && this.data.style ? this.data.style : false); this.data = data; - if(!oldStyle || (data.style.styleID && oldStyle.styleID != data.style.styleID)) { + if(data.style.styleID && (!oldStyle || oldStyle.styleID != data.style.styleID)) { this.styleID = data.style.styleID; try { var getStyle = Zotero.Styles.get(data.style.styleID); @@ -1631,7 +1631,7 @@ Zotero.Integration.Session.prototype.setData = function(data) { } return true; - } else { + } else if(oldStyle) { data.style = oldStyle; } return false;