Make creator-based report sorting slightly less broken

This commit is contained in:
Dan Stillman 2012-01-11 19:02:57 -05:00
parent da09a8dfcd
commit 2bf4c81a62
2 changed files with 10 additions and 1 deletions

View file

@ -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) {

View file

@ -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];