Fix import

This commit is contained in:
Simon Kornblith 2012-06-09 14:12:27 -04:00
parent a750203f4f
commit d5fa7be95a
2 changed files with 9 additions and 3 deletions

View File

@ -1199,6 +1199,7 @@ Zotero.Translate.Base.prototype = {
deferredProgress[i][1], deferredProgress[i][2]);
}
me.newItems = me.newItems.concat(newItems);
me._savingItems--;
me._checkIfDone();
} else {
@ -1208,8 +1209,10 @@ Zotero.Translate.Base.prototype = {
},
function(attachment, progress, error) {
var attachmentIndex = me._savingAttachments.indexOf(attachment);
if((progress === false || progress === 100) && attachmentIndex !== -1) {
me._savingAttachments.splice(attachmentIndex, 1);
if(progress === false || progress === 100) {
if(attachmentIndex !== -1) {
me._savingAttachments.splice(attachmentIndex, 1);
}
} else if(attachmentIndex === -1) {
me._savingAttachments.push(attachment);
}
@ -1231,6 +1234,9 @@ Zotero.Translate.Base.prototype = {
* Checks if saving done, and if so, fires done event
*/
"_checkIfDone":function() {
Zotero.debug(this._savingItems);
Zotero.debug(this._savingAttachments.length);
Zotero.debug(this._currentState);
if(!this._savingItems && !this._savingAttachments.length && !this._currentState) {
this._runHandler("done", true);
}

View File

@ -216,7 +216,7 @@ Zotero.Translate.ItemSaver.prototype = {
return topLevelCollection;
},
"_saveAttachmentFile":function(attachment, parentID) {
"_saveAttachmentFile":function(attachment, parentID, attachmentCallback) {
const urlRe = /(([A-Za-z]+):\/\/[^\s]*)/i;
Zotero.debug("Translate: Adding attachment", 4);