Fix Create Bib for saved searches

This commit is contained in:
Dan Stillman 2017-09-01 13:21:18 -04:00
parent 01ecff8e2b
commit ed6d628f4e

View File

@ -126,7 +126,6 @@ var Zotero_File_Interface = new function() {
this.exportCollection = exportCollection; this.exportCollection = exportCollection;
this.exportItemsToClipboard = exportItemsToClipboard; this.exportItemsToClipboard = exportItemsToClipboard;
this.exportItems = exportItems; this.exportItems = exportItems;
this.bibliographyFromCollection = bibliographyFromCollection;
this.bibliographyFromItems = bibliographyFromItems; this.bibliographyFromItems = bibliographyFromItems;
/** /**
@ -392,33 +391,26 @@ var Zotero_File_Interface = new function() {
progressWin.startCloseTimer(5000); progressWin.startCloseTimer(5000);
}); });
/* /**
* Creates a bibliography from a collection or saved search * Creates a bibliography from a collection or saved search
*/ */
function bibliographyFromCollection() { this.bibliographyFromCollection = function () {
// find sorted items var items = ZoteroPane.getSortedItems();
var items = Zotero.Items.get(ZoteroPane_Local.getSortedItems(true));
if(!items) return;
// find name // Find collection name
var name = false; var name = false;
var collection = ZoteroPane.getSelectedCollection();
var collection = ZoteroPane_Local.getSelectedCollection(); if (collection) {
if(collection) { name = collection.name;
name = collection.getName(); }
} else { else {
var searchRef = ZoteroPane_Local.getSelectedSavedSearch(); let search = ZoteroPane.getSelectedSavedSearch();
if(searchRef) { if (search) {
var search = new Zotero.Search();
search.id = searchRef.id;
name = search.name; name = search.name;
} }
} }
_doBibliographyOptions(name, items); _doBibliographyOptions(name, items);
return;
throw ("No collection or saved search currently selected");
} }
/* /*