From bd66f44e912e9d54d3f441382c99dab532070d8d Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 25 Apr 2007 21:53:10 +0000 Subject: [PATCH] Fixes #624, search/tag selection still does not work for notes in non-saved-search collections Also fixes some JS strict warnings in overlay.js --- chrome/content/zotero/overlay.js | 4 ++-- chrome/content/zotero/xpcom/collectionTreeView.js | 10 +++++----- chrome/content/zotero/xpcom/zotero.js | 3 +++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index c7a28a842..e8f27f0ca 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -470,7 +470,7 @@ var ZoteroPane = new function() { if (!Zotero.stateCheck()) { this.displayErrorMessage(true); - return; + return false; } var item = new Zotero.Item(typeID); @@ -1655,7 +1655,7 @@ var ZoteroPane = new function() function addItemFromPage() { if (!Zotero.stateCheck()) { this.displayErrorMessage(true); - return; + return false; } var progressWin = new Zotero.ProgressWindow(); diff --git a/chrome/content/zotero/xpcom/collectionTreeView.js b/chrome/content/zotero/xpcom/collectionTreeView.js index 7e581b0a9..23c37508f 100644 --- a/chrome/content/zotero/xpcom/collectionTreeView.js +++ b/chrome/content/zotero/xpcom/collectionTreeView.js @@ -889,17 +889,17 @@ Zotero.ItemGroup.prototype.getChildItems = function() * This accounts for the collection, saved search, quicksearch, tags, etc. */ Zotero.ItemGroup.prototype.getSearchObject = function() { + var includeScopeChildren = false; + // Create/load the inner search var s = new Zotero.Search(); - if (this.isLibrary()) { - s.addCondition('noChildren', true); - } + if (this.isLibrary()) { } else if (this.isCollection()) { - s.addCondition('noChildren', true); s.addCondition('collectionID', 'is', this.ref.getID()); if (Zotero.Prefs.get('recursiveCollections')) { s.addCondition('recursive', 'true'); } + includeScopeChildren = true; } else if (this.isSearch()){ s.load(this.ref['id']); @@ -910,7 +910,7 @@ Zotero.ItemGroup.prototype.getSearchObject = function() { // Create the outer (filter) search var s2 = new Zotero.Search(); - s2.setScope(s); + s2.setScope(s, includeScopeChildren); if (this.searchText) { s2.addCondition('quicksearch', 'contains', this.searchText); diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index ae5410a1c..9810deadc 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -224,6 +224,9 @@ var Zotero = new function(){ } + /* + * Check if a DB transaction is open and, if so, disable Zotero + */ function stateCheck() { if (Zotero.DB.transactionInProgress()) { this.initialized = false;