Fix export from saved search content menu on trunk, changing ZoteroItemPane.getSortedItems() to return Item objects unless asIDs is passed (like getSelectedItems())
This commit is contained in:
parent
dcccee13a1
commit
35e9f3b3b7
3 changed files with 27 additions and 16 deletions
|
@ -143,9 +143,8 @@ var Zotero_File_Interface = new function() {
|
|||
if(!exporter.items) throw ("No items to save");
|
||||
|
||||
// find name
|
||||
var searchRef = ZoteroPane.getSelectedSavedSearch();
|
||||
if(searchRef) {
|
||||
var search = new Zotero.Search(searchRef.id);
|
||||
var search = ZoteroPane.getSelectedSavedSearch();
|
||||
if(search) {
|
||||
exporter.name = search.name;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1322,22 +1322,25 @@ var ZoteroPane = new function()
|
|||
*/
|
||||
function getSelectedItems(asIDs)
|
||||
{
|
||||
if (this.itemsView) {
|
||||
return this.itemsView.getSelectedItems(asIDs);
|
||||
if (!this.itemsView) {
|
||||
return [];
|
||||
}
|
||||
return [];
|
||||
|
||||
return this.itemsView.getSelectedItems(asIDs);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns an array of item ids of visible items in current sort order
|
||||
* Returns an array of Zotero.Item objects of visible items in current sort order
|
||||
*
|
||||
* If asIDs is true, return an array of itemIDs instead
|
||||
*/
|
||||
function getSortedItems() {
|
||||
function getSortedItems(asIDs) {
|
||||
if (!this.itemsView) {
|
||||
return false;
|
||||
return [];
|
||||
}
|
||||
|
||||
return this.itemsView.getSortedItems();
|
||||
return this.itemsView.getSortedItems(asIDs);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1439,17 +1439,26 @@ Zotero.ItemTreeView.prototype.getVisibleFields = function() {
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns an array of item ids of visible items in current sort order
|
||||
/**
|
||||
* Returns an array of items of visible items in current sort order
|
||||
*
|
||||
* @param bool asIDs Return itemIDs
|
||||
* @return array An array of Zotero.Item objects or itemIDs
|
||||
*/
|
||||
Zotero.ItemTreeView.prototype.getSortedItems = function() {
|
||||
var ids = [];
|
||||
Zotero.ItemTreeView.prototype.getSortedItems = function(asIDs) {
|
||||
var items = [];
|
||||
for each(var item in this._dataItems) {
|
||||
ids.push(item.ref.id);
|
||||
if (asIDs) {
|
||||
items.push(item.ref.id);
|
||||
}
|
||||
else {
|
||||
items.push(item.ref);
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
Zotero.ItemTreeView.prototype.getSortField = function() {
|
||||
var column = this._treebox.columns.getSortedColumn()
|
||||
if (!column) {
|
||||
|
|
Loading…
Reference in a new issue