- Revert async notifier change in r9341

- Better fix for excessive item saving activity
- Fix for erroneous switch to library after adding an item to a collection (since r9341)
This commit is contained in:
Dan Stillman 2011-06-01 14:28:59 +00:00
parent c7a44a6f37
commit 09e22e1e5d
3 changed files with 46 additions and 46 deletions

View file

@ -2000,17 +2000,6 @@ Zotero.Item.prototype.save = function() {
} }
} }
//Zotero.History.commit();
Zotero.DB.commitTransaction();
}
catch (e) {
//Zotero.History.cancel();
Zotero.DB.rollbackTransaction();
Zotero.debug(e);
throw(e);
}
if (!this.id) { if (!this.id) {
this._id = itemID; this._id = itemID;
} }
@ -2050,8 +2039,19 @@ Zotero.Item.prototype.save = function() {
Zotero.Items.reload(this.id); Zotero.Items.reload(this.id);
this._previousData = null; //Zotero.History.commit();
Zotero.DB.commitTransaction();
}
catch (e) {
//Zotero.History.cancel();
Zotero.DB.rollbackTransaction();
Zotero.debug(e);
throw(e);
}
// New items have to be reloaded via Zotero.Items.get(),
// so mark them as disabled
if (isNew) { if (isNew) {
var id = this.id; var id = this.id;
this._disabled = true; this._disabled = true;

View file

@ -471,11 +471,7 @@ var Zotero = new function(){
// Add notifier queue callbacks to the DB layer // Add notifier queue callbacks to the DB layer
Zotero.DB.addCallback('begin', Zotero.Notifier.begin); Zotero.DB.addCallback('begin', Zotero.Notifier.begin);
Zotero.DB.addCallback('commit', function () { Zotero.DB.addCallback('commit', Zotero.Notifier.commit);
setTimeout(function () {
Zotero.Notifier.commit();
}, 1)
});
Zotero.DB.addCallback('rollback', Zotero.Notifier.reset); Zotero.DB.addCallback('rollback', Zotero.Notifier.reset);
Zotero.Fulltext.init(); Zotero.Fulltext.init();

View file

@ -661,6 +661,8 @@ var ZoteroPane = new function()
var itemGroup = null; var itemGroup = null;
} }
Zotero.DB.beginTransaction();
var item = new Zotero.Item(typeID); var item = new Zotero.Item(typeID);
item.libraryID = libraryID; item.libraryID = libraryID;
for (var i in data) { for (var i in data) {
@ -672,6 +674,8 @@ var ZoteroPane = new function()
itemGroup.ref.addItem(itemID); itemGroup.ref.addItem(itemID);
} }
Zotero.DB.commitTransaction();
//set to Info tab //set to Info tab
document.getElementById('zotero-view-item').selectedIndex = 0; document.getElementById('zotero-view-item').selectedIndex = 0;