commit 2bf4c81a624845482ad04a908b9858b93db4ed4f
parent da09a8dfcd53079153aa5bfaa5c8bfda953034d4
Author: Dan Stillman <dstillman@zotero.org>
Date: Wed, 11 Jan 2012 19:02:57 -0500
Make creator-based report sorting slightly less broken
Diffstat:
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/reportInterface.js b/chrome/content/zotero/reportInterface.js
@@ -40,7 +40,7 @@ var Zotero_Report_Interface = new function() {
var sortColumn = ZoteroPane_Local.getSortField();
var sortDirection = ZoteroPane_Local.getSortDirection();
if (sortColumn != 'title' || sortDirection != 'ascending') {
- queryString = '?sort=' + sortColumn + (sortDirection != 'ascending' ? '' : '/d');
+ queryString = '?sort=' + sortColumn + (sortDirection == 'ascending' ? '' : '/d');
}
if (col) {
diff --git a/components/zotero-protocol-handler.js b/components/zotero-protocol-handler.js
@@ -424,6 +424,15 @@ function ChromeExtensionHandler() {
valA = Zotero.Date.strToMultipart(a[sorts[index].field]);
valB = Zotero.Date.strToMultipart(b[sorts[index].field]);
}
+ // TEMP: This is an ugly hack to make creator sorting
+ // slightly less broken. To do this right, real creator
+ // sorting needs to be abstracted from itemTreeView.js.
+ else if (sorts[index].field == 'firstCreator') {
+ var itemA = Zotero.Items.getByLibraryAndKey(a.libraryID, a.key);
+ var itemB = Zotero.Items.getByLibraryAndKey(b.libraryID, b.key);
+ valA = itemA.getField('firstCreator');
+ valB = itemB.getField('firstCreator');
+ }
else {
valA = a[sorts[index].field];
valB = b[sorts[index].field];