commit 864fa537b56c92aba9484cb95e203385f0b4bb12
parent 70630a2e702ded4f6dbee0de3420d530eaaee488
Author: Dan Stillman <dstillman@zotero.org>
Date: Fri, 2 Jun 2006 01:17:44 +0000
Last of the update triggers, I think
Diffstat:
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/chrome/chromeFiles/content/scholar/xpcom/data_access.js b/chrome/chromeFiles/content/scholar/xpcom/data_access.js
@@ -597,7 +597,14 @@ Scholar.Item.prototype.save = function(){
Scholar.Items.reload(this.getID());
- return isNew ? this.getID() : true;
+ if (isNew){
+ Scholar.Notifier.trigger('add', 'item', this.getID());
+ return this.getID();
+ }
+ else {
+ Scholar.Notifier.trigger('modify', 'item', this.getID());
+ return true;
+ }
}
@@ -635,12 +642,12 @@ Scholar.Item.prototype.erase = function(){
throw (e);
}
+ Scholar.Items.unload(this.getID());
+
// If we're not in the middle of a larger commit, trigger the notifier now
if (!Scholar.DB.transactionInProgress()){
Scholar.Notifier.trigger('remove', 'item', this.getID());
}
-
- Scholar.Items.unload(this.getID());
}
@@ -952,6 +959,9 @@ Scholar.Collection.prototype.getName = function(){
return this._name;
}
+/**
+* Returns the parent collection
+**/
Scholar.Collection.prototype.getParent = function(){
return this._parent;
}
@@ -1074,11 +1084,11 @@ Scholar.Collection.prototype.erase = function(deleteItems){
Scholar.DB.commitTransaction();
- Scholar.Notifier.trigger('remove', 'collection', collections);
- Scholar.Notifier.trigger('remove', 'item', items);
-
// Clear deleted collection from internal memory
Scholar.Collections.unload(collections);
+
+ Scholar.Notifier.trigger('remove', 'collection', collections);
+ Scholar.Notifier.trigger('remove', 'item', items);
}
diff --git a/chrome/chromeFiles/content/scholar/xpcom/notifier.js b/chrome/chromeFiles/content/scholar/xpcom/notifier.js
@@ -66,7 +66,7 @@ Scholar.Notifier = new function(){
}
while (_observers[type][hash]);
- Scholar.debug('Registering ' + type + " with hash '" + hash + "'", 4);
+ Scholar.debug('Registering ' + type + " in notifier with hash '" + hash + "'", 4);
_observers[type][hash] = ref;
return hash;
}