From 70630a2e702ded4f6dbee0de3420d530eaaee488 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 1 Jun 2006 22:19:21 +0000 Subject: [PATCH] - Change: Scholar.Notifier.trigger() can be passed an array of ids in some cases rather than a single id -- trees that implement notify() should use Scholar.flattenArguments(ids) to get an array either way - Added Notifier triggers to Item.erase() (which only runs if not in a nested transaction) and Collections.erase() - notify() in ItemTreeView updated with example of taking multiple ids, though it doesn't actually work (and notify() implementations may decide just to refresh the whole tree when ids.length>1 rather than dealing with changes individually) - When deleting collections, use DB tables that actually exist --- .../content/scholar/itemTreeView.js | 52 +++++++++++-------- .../content/scholar/xpcom/data_access.js | 21 +++++--- .../content/scholar/xpcom/notifier.js | 11 ++-- 3 files changed, 50 insertions(+), 34 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/itemTreeView.js b/chrome/chromeFiles/content/scholar/itemTreeView.js index 17d31df99b..e84216528f 100644 --- a/chrome/chromeFiles/content/scholar/itemTreeView.js +++ b/chrome/chromeFiles/content/scholar/itemTreeView.js @@ -156,32 +156,38 @@ Scholar.ItemTreeView.prototype.getCollectionID = function() } //CALLED BY DATA LAYER ON CHANGE: -Scholar.ItemTreeView.prototype.notify = function(action, type, id) +Scholar.ItemTreeView.prototype.notify = function(action, type, ids) { - var row = this._itemRowMap[id]; - if(action == 'remove' && row) - { - this._hideItem(row); - this._treebox.rowCountChanged(row,-1); - } - else if(action == 'modify' && row) - { - this._treebox.invalidateRow(row) - } - else if(action == 'add' && !row) - { - var item = Scholar.Items.get(id); - - if(this._itemGroup.isLibrary() || item.inCollection(this.getCollectionID())) + ids = Scholar.flattenArguments(ids); + + for (var i=0, len=ids.length; i