www

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

commit 380584986a627ae6bbcf56b20fe9327e418035e3
parent 4904c04e3e387b1e15cdc8e5e6f18789e884f29a
Author: David Norton <david@nortoncrew.com>
Date:   Fri, 16 Jun 2006 16:30:03 +0000

[fix] If you do a sort, modify a note, etc. it does not reload the selected item
[interface/fix] There will always be a secondary sort on date modified. (fixes the infamous Turkle Toggle issue once and for all)

Diffstat:
Mchrome/chromeFiles/content/scholar/itemPane.js | 5++++-
Mchrome/chromeFiles/content/scholar/itemTreeView.js | 25+++++++++++++++++++++++--
2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/chrome/chromeFiles/content/scholar/itemPane.js b/chrome/chromeFiles/content/scholar/itemPane.js @@ -50,7 +50,10 @@ ScholarItemPane = new function() * Loads an item */ function viewItem(thisItem) - { + { + if(_itemBeingEdited && thisItem.getID() == _itemBeingEdited.getID()) + return; + _itemBeingEdited = thisItem; reloadFields(); diff --git a/chrome/chromeFiles/content/scholar/itemTreeView.js b/chrome/chromeFiles/content/scholar/itemTreeView.js @@ -233,6 +233,13 @@ Scholar.ItemTreeView.prototype.sort = function() return (typeA > typeB) ? -1 : (typeA < typeB) ? 1 : 0; } } + else if(column.id == 'numNotes') + { + function columnSort(a,b) + { + return b.numNotes() - a.numNotes(); + } + } else { function columnSort(a,b) @@ -241,15 +248,29 @@ Scholar.ItemTreeView.prototype.sort = function() } } + function doSort(a,b) + { + var s = columnSort(a,b); + if(s) + return s; + else + return secondarySort(a,b); + } + function oppositeSort(a,b) { - return(columnSort(a,b) * -1); + return(doSort(a,b) * -1); + } + + function secondarySort(a,b) + { + return (a.getField('dateModified') > b.getField('dateModified')) ? -1 : (a.getField('dateModified') < b.getField('dateModified')) ? 1 : 0; } if(order) this._dataItems.sort(oppositeSort); else - this._dataItems.sort(columnSort); + this._dataItems.sort(doSort); this._refreshHashMap();