diff --git a/chrome/chromeFiles/content/scholar/fileInterface.js b/chrome/chromeFiles/content/scholar/fileInterface.js index 60f5440792..aface1fb17 100644 --- a/chrome/chromeFiles/content/scholar/fileInterface.js +++ b/chrome/chromeFiles/content/scholar/fileInterface.js @@ -41,15 +41,29 @@ var Scholar_File_Interface = new function() { } /* - * exports a collection + * exports a collection or saved search */ function exportCollection() { var collection = ScholarPane.getSelectedCollection(); - if(!collection) throw("no collection currently selected"); + if (collection) + { + exportFile(Scholar.getItems(collection.getID())); + return; + } - exportFile(Scholar.getItems(collection.getID())); + var searchRef = ScholarPane.getSelectedSavedSearch(); + if (searchRef) + { + var search = new Scholar.Search(); + search.load(searchRef['id']); + exportFile(Scholar.Items.get(search.search())); + return; + } + + throw ("No collection or saved search currently selected"); } + /* * exports items */ @@ -181,13 +195,26 @@ var Scholar_File_Interface = new function() { } /* - * Creates a bibliography from a collection + * Creates a bibliography from a collection or saved search */ function bibliographyFromCollection() { var collection = ScholarPane.getSelectedCollection(); - if(!collection) throw("no collection currently selected"); + if (collection) + { + _doBibliographyOptions(Scholar.getItems(collection.getID())); + return; + } - _doBibliographyOptions(Scholar.getItems(collection.getID())); + var searchRef = ScholarPane.getSelectedSavedSearch(); + if (searchRef) + { + var search = new Scholar.Search(); + search.load(searchRef['id']); + _doBibliographyOptions(Scholar.Items.get(search.search())); + return; + } + + throw ("No collection or saved search currently selected"); } /* diff --git a/chrome/chromeFiles/content/scholar/overlay.js b/chrome/chromeFiles/content/scholar/overlay.js index 5aaf2e1366..7dd53f015d 100644 --- a/chrome/chromeFiles/content/scholar/overlay.js +++ b/chrome/chromeFiles/content/scholar/overlay.js @@ -38,12 +38,13 @@ var ScholarPane = new function() this.itemSelected = itemSelected; this.deleteSelectedItem = deleteSelectedItem; this.deleteSelectedCollection = deleteSelectedCollection; - this.renameSelectedCollection = renameSelectedCollection; + this.editSelectedCollection = editSelectedCollection; this.search = search; this.getCollectionsView = getCollectionsView; this.getItemsView = getItemsView; this.selectItem = selectItem; this.getSelectedCollection = getSelectedCollection; + this.getSelectedSavedSearch = getSelectedSavedSearch; this.getSelectedItems = getSelectedItems; this.buildCollectionContextMenu = buildCollectionContextMenu; this.buildItemContextMenu = buildItemContextMenu; @@ -281,7 +282,7 @@ var ScholarPane = new function() collectionsView.deleteSelection(); } - function renameSelectedCollection() + function editSelectedCollection() { if(collectionsView.selection.count > 0) { @@ -359,6 +360,18 @@ var ScholarPane = new function() } } + function getSelectedSavedSearch() + { + if(collectionsView.selection.count > 0 && collectionsView.selection.currentIndex != -1) + { + collection = collectionsView._getItemAtRow(collectionsView.selection.currentIndex); + if(collection && collection.isSearch()) + { + return collection.ref; + } + } + } + function getSelectedItems() { if(itemsView) @@ -380,19 +393,35 @@ var ScholarPane = new function() { var menu = document.getElementById('scholar-collectionmenu'); - if(collectionsView.selection.count == 1 && !collectionsView._getItemAtRow(collectionsView.selection.currentIndex).isLibrary()) + // Collection + if (collectionsView.selection.count == 1 && + collectionsView._getItemAtRow(collectionsView.selection.currentIndex).isCollection()) { - menu.childNodes[2].removeAttribute('disabled'); - menu.childNodes[3].removeAttribute('disabled'); - menu.childNodes[5].removeAttribute('disabled'); - menu.childNodes[6].removeAttribute('disabled'); + var hide = [4,6,9,11,12]; + var show = [3,5,7,8,10]; } + // Saved Search + else if (collectionsView.selection.count == 1 && + collectionsView._getItemAtRow(collectionsView.selection.currentIndex).isSearch()) + { + var hide = [3,5,8,10,12]; + var show = [4,6,7,9,11]; + } + // Library else { - menu.childNodes[2].setAttribute('disabled', true); - menu.childNodes[3].setAttribute('disabled', true); - menu.childNodes[5].setAttribute('disabled', true); - menu.childNodes[6].setAttribute('disabled', true); + var hide = [3,4,5,6,7,8,9,10,11]; + var show = [12]; + } + + for (var i in hide) + { + menu.childNodes[hide[i]].setAttribute('hidden', true); + } + + for (var i in show) + { + menu.childNodes[show[i]].setAttribute('hidden', false); } } diff --git a/chrome/chromeFiles/content/scholar/overlay.xul b/chrome/chromeFiles/content/scholar/overlay.xul index ecc983e4db..1b85d86c97 100644 --- a/chrome/chromeFiles/content/scholar/overlay.xul +++ b/chrome/chromeFiles/content/scholar/overlay.xul @@ -48,12 +48,18 @@ + - + + + + + + @@ -67,8 +73,8 @@ - - + + diff --git a/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd b/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd index ef434017d6..df979ee54e 100644 --- a/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd +++ b/chrome/chromeFiles/locale/en-US/scholar/scholar.dtd @@ -21,14 +21,18 @@ - + + + + +