From 2a117168a99dca738f75bd35d8725e580a60a759 Mon Sep 17 00:00:00 2001 From: David Norton Date: Fri, 2 Jun 2006 14:11:23 +0000 Subject: [PATCH] Interface code for delete selected collection. (doesn't the function deleteCollectionSelection just sound great?) Although I do not yet have interface code for it, collections do not have any sort of setName(), save() functions. Collections list now implements notify() --- .../content/scholar/folderTreeView.js | 80 +++++++++++++++++-- .../content/scholar/itemTreeView.js | 4 +- chrome/chromeFiles/content/scholar/overlay.js | 15 +++- .../chromeFiles/content/scholar/overlay.xul | 3 +- 4 files changed, 89 insertions(+), 13 deletions(-) diff --git a/chrome/chromeFiles/content/scholar/folderTreeView.js b/chrome/chromeFiles/content/scholar/folderTreeView.js index 960344fdf4..43bb519454 100644 --- a/chrome/chromeFiles/content/scholar/folderTreeView.js +++ b/chrome/chromeFiles/content/scholar/folderTreeView.js @@ -4,6 +4,70 @@ Scholar.FolderTreeView = function() this._dataItems = new Array(); this.rowCount = 0; this._showItem(new Scholar.ItemGroup('library',null),0,1); + this._unregisterID = Scholar.Notifier.registerColumnTree(this); +} + +Scholar.FolderTreeView.prototype.unregister = function() +{ + Scholar.Notifier.unregisterColumnTree(this._unregisterID); +} + +//CALLED BY DATA LAYER ON CHANGE: +Scholar.FolderTreeView.prototype.notify = function(action, type, ids) +{ + ids = Scholar.flattenArguments(ids); + var madeChanges = false; + + if(action == 'remove') + { + //Since a remove involves shifting of rows, we have to do it in order + + //sort the ids by row + var rows = new Array(); + for(var i=0, len=ids.length; i 0) + { + rows.sort(function(a,b) { return a-b }); + + for(var i=0, len=rows.length; i 0 && confirm("Are you sure you want to delete the selected items?")) itemsView.deleteSelection(); } + function deleteCollectionSelection() + { + if(itemsView && foldersView.selection.count > 0 && confirm("Are you sure you want to delete the selected collections?")) + foldersView.deleteSelection(); + } + function search() { if(itemsView) diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul index 8a81b9d44d..579cb0914e 100644 --- a/chrome/chromeFiles/content/scholar/overlay.xul +++ b/chrome/chromeFiles/content/scholar/overlay.xul @@ -34,6 +34,7 @@