From f621262cee28c2a9dfc4e6b8b3f6a9d1d8aca5c4 Mon Sep 17 00:00:00 2001 From: "rjc%netscape.com" Date: Sat, 1 Apr 2000 10:23:31 +0000 Subject: [PATCH] Small sorting changes on search results. --- .../search/resources/internetresults.xul | 16 ++++----- .../resources/locale/en-US/search-panel.dtd | 3 +- .../search/resources/search-panel.xul | 28 +++++++--------- xpfe/components/search/resources/shared.js | 33 +++++++++++++++---- 4 files changed, 48 insertions(+), 32 deletions(-) diff --git a/xpfe/components/search/resources/internetresults.xul b/xpfe/components/search/resources/internetresults.xul index b5ef79e048fb..e65a4ae66d6e 100644 --- a/xpfe/components/search/resources/internetresults.xul +++ b/xpfe/components/search/resources/internetresults.xul @@ -103,35 +103,35 @@ + onclick="return doSort('NameColumn', null);" /> + onclick="return doSort('PageRankColumn', null);" /> + onclick="return doSort('RelevanceColumn', null);" /> + onclick="return doSort('PriceColumn', null);" /> + onclick="return doSort('AvailabilityColumn', null);" /> + onclick="return doSort('DateColumn', null);" /> + onclick="return doSort('SiteColumn', null);" /> + onclick="return doSort('EngineColumn', null);" /> diff --git a/xpfe/components/search/resources/locale/en-US/search-panel.dtd b/xpfe/components/search/resources/locale/en-US/search-panel.dtd index 2b3b108f311d..257573c6afff 100755 --- a/xpfe/components/search/resources/locale/en-US/search-panel.dtd +++ b/xpfe/components/search/resources/locale/en-US/search-panel.dtd @@ -24,8 +24,7 @@ - - + diff --git a/xpfe/components/search/resources/search-panel.xul b/xpfe/components/search/resources/search-panel.xul index 780d5183c7c6..d6c6cb11c509 100644 --- a/xpfe/components/search/resources/search-panel.xul +++ b/xpfe/components/search/resources/search-panel.xul @@ -75,11 +75,6 @@ - - - - - - + - - + + + + + + + + + // magic, hidden secondary column used for sorting + @@ -135,11 +136,6 @@ - - - - - @@ -160,7 +156,7 @@ - + diff --git a/xpfe/components/search/resources/shared.js b/xpfe/components/search/resources/shared.js index 2cf5d496b5fe..d25a94314149 100644 --- a/xpfe/components/search/resources/shared.js +++ b/xpfe/components/search/resources/shared.js @@ -263,8 +263,10 @@ function doContextCmd(cmdName, treeName) -/* Note: doSort() does NOT support natural order sorting! */ -function doSort(sortColName) +/* Note: doSort() does NOT support natural order sorting, unless naturalOrderResource is valid, + in which case we sort ascending on naturalOrderResource + */ +function doSort(sortColName, naturalOrderResource) { var node = document.getElementById(sortColName); // determine column resource to sort on @@ -275,18 +277,37 @@ function doSort(sortColName) var isSortActive = node.getAttribute('sortActive'); if (isSortActive == "true") { + sortDirection = "ascending"; + var currentDirection = node.getAttribute('sortDirection'); if (currentDirection == "ascending") - sortDirection = "descending"; - else sortDirection = "ascending"; + { + if (sortResource != naturalOrderResource) + { + sortDirection = "descending"; + } + } + else if (currentDirection == "descending") + { + if (naturalOrderResource != null && naturalOrderResource != "") + { + sortResource = naturalOrderResource; + } + } } var isupports = Components.classes["component://netscape/rdf/xul-sort-service"].getService(); if (!isupports) return(false); var xulSortService = isupports.QueryInterface(Components.interfaces.nsIXULSortService); if (!xulSortService) return(false); - xulSortService.Sort(node, sortResource, sortDirection); - + try + { + xulSortService.Sort(node, sortResource, sortDirection); + } + catch(ex) + { + debug("Exception calling xulSortService.Sort()"); + } return(true); }