diff --git a/chrome/content/zotero/bindings/tagselector.xml b/chrome/content/zotero/bindings/tagselector.xml new file mode 100644 index 0000000000..8466d42c32 --- /dev/null +++ b/chrome/content/zotero/bindings/tagselector.xml @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js index 1ee8de3a33..f1ceefdd43 100644 --- a/chrome/content/zotero/overlay.js +++ b/chrome/content/zotero/overlay.js @@ -36,6 +36,9 @@ var ZoteroPane = new function() this.newItem = newItem; this.newCollection = newCollection; this.newSearch = newSearch; + this.toggleTagSelector = toggleTagSelector; + this.getTagSelection = getTagSelection; + this.updateTagFilter = updateTagFilter; this.onCollectionSelected = onCollectionSelected; this.itemSelected = itemSelected; this.deleteSelectedItem = deleteSelectedItem; @@ -126,8 +129,8 @@ var ZoteroPane = new function() moreMenu.appendChild(menuitem); } - var menu = document.getElementById("contentAreaContextMenu"); - menu.addEventListener("popupshowing", ZoteroPane.contextPopupShowing, false); + var menu = document.getElementById("contentAreaContextMenu"); + menu.addEventListener("popupshowing", ZoteroPane.contextPopupShowing, false); } /* @@ -233,6 +236,40 @@ var ZoteroPane = new function() window.openDialog('chrome://zotero/content/searchDialog.xul','','chrome,modal',io); } + + function toggleTagSelector(){ + var tagSelector = document.getElementById('zotero-tag-selector'); + var collapsed = tagSelector.getAttribute('collapsed')=='true'; + // If hiding, clear selection + if (!collapsed){ + tagSelector.init(); + } + tagSelector.setAttribute('collapsed', !collapsed); + } + + + function getTagSelection(){ + var tagSelector = document.getElementById('zotero-tag-selector'); + return tagSelector.selection; + } + + + function updateTagFilter(){ + if (itemsView) + { + itemsView.unregister(); + } + + if (collectionsView){ + var itemgroup = collectionsView._getItemAtRow(collectionsView.selection.currentIndex); + itemgroup.setTags(getTagSelection()); + + itemsView = new Zotero.ItemTreeView(itemgroup); + document.getElementById('zotero-items-tree').view = itemsView; + } + } + + function onCollectionSelected() { if(itemsView) @@ -244,6 +281,7 @@ var ZoteroPane = new function() { var itemgroup = collectionsView._getItemAtRow(collectionsView.selection.currentIndex); itemgroup.setSearch(''); + itemgroup.setTags(getTagSelection()); itemsView = new Zotero.ItemTreeView(itemgroup); document.getElementById('zotero-items-tree').view = itemsView; @@ -485,6 +523,7 @@ var ZoteroPane = new function() } } + function search() { if(itemsView) diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul index 8804221ed9..8c95aa4932 100644 --- a/chrome/content/zotero/overlay.xul +++ b/chrome/content/zotero/overlay.xul @@ -24,7 +24,8 @@ + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + xmlns:html="http://www.w3.org/1999/xhtml"> @@ -34,7 +35,6 @@