www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 35e9f3b3b743c506f6a17b0449aa528b50e74c4f
parent dcccee13a11ab6dae99796d110e1d87a062f507e
Author: Dan Stillman <dstillman@zotero.org>
Date:   Tue, 17 Jun 2008 20:39:26 +0000

Fix export from saved search content menu on trunk, changing ZoteroItemPane.getSortedItems() to return Item objects unless asIDs is passed (like getSelectedItems())


Diffstat:
Mchrome/content/zotero/fileInterface.js | 5++---
Mchrome/content/zotero/overlay.js | 17++++++++++-------
Mchrome/content/zotero/xpcom/itemTreeView.js | 21+++++++++++++++------
3 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js @@ -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; } } diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js @@ -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); } diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js @@ -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) {