commit 69b53b158384ce5b2bfcb043835c7717ebd8bfb1
parent 5aa3189dd148360d95be8843b92fb08f5c5ff216
Author: Simon Kornblith <simon@simonster.com>
Date: Sun, 10 Jul 2011 18:02:09 +0000
Closes #1860, Scaffold can't safely test collection creation
Zotero.Translate#translate(false) should no longer create collections. There was already a collectionDone event; it now gets the unprocessed collection object when false is passed to Zotero.Translate#translate.
Diffstat:
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js
@@ -552,8 +552,14 @@ Zotero.Translate.Sandbox = {
* @param {SandboxCollection} collection
*/
"_collectionDone":function(translate, collection) {
- var newCollection = translate._itemSaver.saveCollection(collection);
- translate._runHandler("collectionDone", newCollection);
+ if(this._libraryID == false) {
+ this.newCollections.push(collection);
+ translate._runHandler("collectionDone", collection);
+ } else {
+ var newCollection = translate._itemSaver.saveCollection(collection);
+ this.newCollections.push(newCollection);
+ translate._runHandler("collectionDone", newCollection);
+ }
},
/**
@@ -1587,7 +1593,7 @@ Zotero.Translate.Import.prototype._prepareTranslation = function() {
this._itemSaver = new Zotero.Translate.ItemSaver(this._libraryID,
Zotero.Translate.ItemSaver[(this._saveAttachments ? "ATTACHMENT_MODE_FILE" : "ATTACHMENT_MODE_IGNORE")]);
this.newItems = [];
- this.newCollections = this._itemSaver.newCollections;
+ this.newCollections = [];
}
Zotero.Translate.Import.prototype.__defineGetter__("progress",