www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit e531493ba05e5f4ecf0308e494beddac368db8e6
parent 8027e6c4f241b6d7fa7860df679bb5a4e4447716
Author: Simon Kornblith <simon@simonster.com>
Date:   Sat,  6 Nov 2010 20:52:15 +0000

fix collection import/export


Diffstat:
Mchrome/content/zotero/xpcom/translation/item_local.js | 12++++++------
Mchrome/content/zotero/xpcom/translation/translate.js | 6+++---
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/chrome/content/zotero/xpcom/translation/item_local.js b/chrome/content/zotero/xpcom/translation/item_local.js @@ -132,7 +132,7 @@ Zotero.Translate.ItemSaver.prototype = { var parentIDs = [null]; var topLevelCollection; - while(collectionsToProcess) { + while(collectionsToProcess.length) { var collection = collectionsToProcess.shift(); var parentID = parentIDs.shift(); @@ -143,8 +143,9 @@ Zotero.Translate.ItemSaver.prototype = { var toAdd = []; - for each(child in collection.children) { - if(child.type == "collection") { + for(var i=0; i<collection.children.length; i++) { + var child = collection.children[i]; + if(child.type === "collection") { // do recursive processing of collections collectionsToProcess.push(child); parentIDs.push(newCollection.id); @@ -417,7 +418,6 @@ Zotero.Translate.ItemSaver.prototype = { "_saveNotes":function(item, parentID) { for(var i=0; i<item.notes.length; i++) { var note = item.notes[i]; - Zotero.debug(note); var myNote = new Zotero.Item('note'); myNote.libraryID = this._libraryID; myNote.setNote(typeof note == "object" ? note.note : note); @@ -516,7 +516,7 @@ Zotero.Translate.ItemGetter.prototype = { if(this._collectionsLeft.length) { // only include parent collection if there are actually children - this._collectionsLeft.unshift(getChildren); + this._collectionsLeft.unshift(collection); } // get items in child collections @@ -705,7 +705,7 @@ Zotero.Translate.ItemGetter.prototype = { }, "nextCollection":function() { - if(!this._collectionsLeft || !this._collectionsLeft.length == 0) return false; + if(!this._collectionsLeft || this._collectionsLeft.length == 0) return false; var returnItem = this._collectionsLeft.shift(); var obj = returnItem.serialize(true); diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js @@ -435,8 +435,8 @@ Zotero.Translate.Sandbox = { * @param {Object} collection */ "_collectionDone":function(translate, collection) { - var collection = translate._itemSaver.saveCollection(collection); - translate._runHandler("collectionDone", collection); + var newCollection = translate._itemSaver.saveCollection(collection); + translate._runHandler("collectionDone", newCollection); } }, @@ -1189,7 +1189,7 @@ Zotero.Translate.Export.prototype._detect = function() { Zotero.Translate.Export.prototype._prepareTranslation = function(libraryID, saveAttachments) { // initialize ItemGetter this._itemGetter = new Zotero.Translate.ItemGetter(); - var getCollections = this._displayOptions.getCollections ? this._displayOptions.getCollections : false; + var getCollections = this.translator[0].configOptions.getCollections ? this.translator[0].configOptions.getCollections : false; if(this._collection) { this._itemGetter.setCollection(this._collection, getCollections); delete this._collection;