diff --git a/chrome/content/zotero/xpcom/csl.js b/chrome/content/zotero/xpcom/csl.js index d7f194711..76bedc9fb 100644 --- a/chrome/content/zotero/xpcom/csl.js +++ b/chrome/content/zotero/xpcom/csl.js @@ -1685,7 +1685,6 @@ Zotero.CSL.Item = function(item) { } this.id = this.zoteroItem.id; - this.key = this.zoteroItem.key; // don't return URL or accessed information for journal articles if a // pages field exists @@ -2179,7 +2178,6 @@ Zotero.CSL.ItemSet = function(items, csl) { this.items = []; this.itemsById = {}; - this.itemsByKey = {}; // add items this.add(items); @@ -2223,25 +2221,6 @@ Zotero.CSL.ItemSet.prototype.getItemsByIds = function(ids) { return items; } -/** - * Gets CSL.Item objects from an item set using their keys - * - * @param {Array} keys An array of keys - * @return {Array} items An array whose indexes correspond to those of keys, whose values are either - * the CSL.Item objects or false - **/ -Zotero.CSL.ItemSet.prototype.getItemsByKeys = function(keys) { - var items = []; - for each(var key in keys) { - if(this.itemsByKey[key] != undefined) { - items.push(this.itemsByKey[key]); - } else { - items.push(false); - } - } - return items; -} - /* * Adds items to the given item set; must be passed either CSL.Item * objects or objects that may be wrapped as CSL.Item objects @@ -2259,7 +2238,6 @@ Zotero.CSL.ItemSet.prototype.add = function(items) { newItem.setProperty("index", this.items.length); this.itemsById[newItem.id] = newItem; - this.itemsByKey[newItem.key] = newItem; this.items.push(newItem); newItems.push(newItem); } @@ -2279,9 +2257,10 @@ Zotero.CSL.ItemSet.prototype.remove = function(items) { } else { var item = this.itemsById[items[i]]; } - this.itemsById[item.id] = undefined; - this.itemsByKey[item.key] = undefined; - this.items.splice(this.items.indexOf(item), 1); + if(item) { + this.itemsById[item.id] = undefined; + this.items.splice(this.items.indexOf(item), 1); + } } } diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 4b1e8f1a9..11cf05985 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -15,7 +15,7 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License.s + limitations under the License. ***** END LICENSE BLOCK ***** */ @@ -552,7 +552,16 @@ Zotero.Integration.Request.prototype.reselectItem = function() { 'chrome,modal,centerscreen,resizable=yes' + (Zotero.isWin ? ',popup' : ''), io, true); if(io.dataOut && io.dataOut.length) { - this._session.reselectItem[this.body.reselectItem.@id] = io.dataOut[0]; + var id = this.body.reselectItem.@id.toString(); + if(id) { + this._session.reselectItem[id] = io.dataOut[0]; + this._session.updateItemIDs[io.dataOut[0]] = true; + // add to other URIs, if other URIs exist + if(this._session.missingURIs[id]) { + this._session.uriMap.add(io.dataOut[0], this._session.missingURIs[id].concat(this._session.uriMap.getURIsForItemID(io.dataOut[0]))); + this._session.missingURIs[id] = undefined; + } + } } } @@ -843,6 +852,7 @@ Zotero.Integration.Session = function() { */ Zotero.Integration.Session.prototype.setStyle = function(styleID, prefs) { this.prefs = prefs; + this.missingURIs = new Object(); if(styleID) { this.styleID = styleID; try { @@ -868,6 +878,7 @@ Zotero.Integration.Session.prototype.setStyle = function(styleID, prefs) { Zotero.Integration.Session.prototype.resetRequest = function() { this.citationsByItemID = new Object(); this.citationsByIndex = new Array(); + this.uriMap = new Zotero.Integration.URIMap(this); this.haveMissing = false; this.regenerateAll = false; @@ -896,17 +907,17 @@ Zotero.Integration.Session.prototype.getCitationField = function(citation) { for(var j=0; j