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.
This commit is contained in:
Simon Kornblith 2011-07-10 18:02:09 +00:00
parent 5aa3189dd1
commit 69b53b1583

View file

@ -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",