From 5b84dfe6d0ca7845ecc650703e403fe6ff4c1acc Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 8 Dec 2009 00:02:28 +0000 Subject: [PATCH] Closes #1550, add "smart folders" to groups Create via right-click on group - "New Subcollection" context-menu option was active in read-only groups - Zotero.Searches.getAll() now takes an optional libraryID parameter (and defaults to personal library) --- chrome/content/zotero/overlay.js | 7 +-- .../zotero/xpcom/collectionTreeView.js | 44 ++++++++++++++++--- chrome/content/zotero/xpcom/search.js | 25 ++++++++--- 3 files changed, 59 insertions(+), 17 deletions(-) diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index 49b2fbe7d..1dcfee4d1 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -753,6 +753,7 @@ var ZoteroPane = new function() } var s = new Zotero.Search(); + s.libraryID = this.getSelectedLibraryID(); s.addCondition('title', 'contains', ''); var untitled = Zotero.getString('pane.collections.untitled'); @@ -1745,7 +1746,7 @@ var ZoteroPane = new function() } // Group else if (itemGroup.isGroup()) { - show = [m.newCollection]; + show = [m.newCollection, m.newSavedSearch]; } // Library else @@ -1754,8 +1755,8 @@ var ZoteroPane = new function() } // Disable some actions if user doesn't have write access - var s = [m.editSelectedCollection, m.removeCollection, m.newCollection, m.newSavedSearch]; - if (itemGroup.isGroup() && !itemGroup.ref.editable) { + var s = [m.editSelectedCollection, m.removeCollection, m.newCollection, m.newSavedSearch, m.newSubcollection]; + if (itemGroup.isWithinGroup() && !itemGroup.editable) { disable = disable.concat(s); } else { diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index 700bf715b..2e9d53f03 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -205,10 +205,22 @@ Zotero.CollectionTreeView.prototype.refresh = function() self._showItem(new Zotero.ItemGroup('group', groups[i]), 1, null, startOpen); + var newRows = 0; + // Add group collections var collections = groups[i].getCollections(); for (var j=0; j