зеркало из https://github.com/mozilla/gecko-dev.git
Small sorting changes on search results.
This commit is contained in:
Родитель
412069f87e
Коммит
f621262cee
|
@ -103,35 +103,35 @@
|
|||
<treecell id="NameCell" align="center"
|
||||
value="&name.column.label;" observes="NameColumn"
|
||||
resource="http://home.netscape.com/NC-rdf#Name"
|
||||
onclick="return doSort('NameColumn');" />
|
||||
onclick="return doSort('NameColumn', null);" />
|
||||
<treecell id="PageRankCell" align="center"
|
||||
value="&pagerank.column.label;" observes="PageRankColumn"
|
||||
resource="http://home.netscape.com/NC-rdf#PageRank"
|
||||
onclick="return doSort('PageRankColumn');" />
|
||||
onclick="return doSort('PageRankColumn', null);" />
|
||||
<treecell id="RelevanceCell" align="center"
|
||||
value="&relevance.column.label;" observes="RelevanceColumn"
|
||||
resource="http://home.netscape.com/NC-rdf#Relevance"
|
||||
onclick="return doSort('RelevanceColumn');" />
|
||||
onclick="return doSort('RelevanceColumn', null);" />
|
||||
<treecell id="PriceCell" align="center"
|
||||
value="&price.column.label;" observes="PriceColumn"
|
||||
resource="http://home.netscape.com/NC-rdf#Price"
|
||||
onclick="return doSort('PriceColumn');" />
|
||||
onclick="return doSort('PriceColumn', null);" />
|
||||
<treecell id="AvailabilityCell" align="center"
|
||||
value="&availability.column.label;" observes="AvailabilityColumn"
|
||||
resource="http://home.netscape.com/NC-rdf#Availability"
|
||||
onclick="return doSort('AvailabilityColumn');" />
|
||||
onclick="return doSort('AvailabilityColumn', null);" />
|
||||
<treecell id="DateCell" align="center"
|
||||
value="&date.column.label;" observes="DateColumn"
|
||||
resource="http://home.netscape.com/NC-rdf#Date"
|
||||
onclick="return doSort('DateColumn');" />
|
||||
onclick="return doSort('DateColumn', null);" />
|
||||
<treecell id="SiteCell" align="center"
|
||||
value="&site.column.label;" observes="SiteColumn"
|
||||
resource="http://home.netscape.com/NC-rdf#Site"
|
||||
onclick="return doSort('SiteColumn');" />
|
||||
onclick="return doSort('SiteColumn', null);" />
|
||||
<treecell id="EngineCell" align="center"
|
||||
value="&engine.column.label;" observes="EngineColumn"
|
||||
resource="http://home.netscape.com/NC-rdf#Engine"
|
||||
onclick="return doSort('EngineColumn');" />
|
||||
onclick="return doSort('EngineColumn', null);" />
|
||||
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
|
|
@ -24,8 +24,7 @@
|
|||
<!ENTITY search.advanced.tab "Settings for ">
|
||||
<!ENTITY allengines.label "All Engines">
|
||||
<!ENTITY within.label "within">
|
||||
<!ENTITY useResults.label "Search results:">
|
||||
<!ENTITY useTheseProviders.label "Available search engines:">
|
||||
<!ENTITY results.label "Search Results">
|
||||
<!ENTITY engine.column.label "Search Engines">
|
||||
<!ENTITY checkbox.column.label "Use">
|
||||
<!ENTITY stop.button.label "Stop">
|
||||
|
|
|
@ -75,11 +75,6 @@
|
|||
|
||||
<box align="vertical" class="searchpanel-outerbox" flex="1">
|
||||
|
||||
<box orient="horizontal" align="center">
|
||||
<text value="&useResults.label;" class="indented-label"/>
|
||||
</box>
|
||||
<spring style="height: 2px;"/>
|
||||
|
||||
<tree id="Tree" ref="NC:LastSearchRoot" context="contextual"
|
||||
rdf:resource="http://home.netscape.com/NC-rdf#PageRank"
|
||||
rdf:resource2="http://home.netscape.com/NC-rdf#Name"
|
||||
|
@ -111,16 +106,22 @@
|
|||
<treerow class="searchresult">
|
||||
<treecell value="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
src="rdf:http://home.netscape.com/NC-rdf#Icon" />
|
||||
<!--<treecell>
|
||||
<html:a href="rdf:http://home.netscape.com/NC-rdf#URL"><html:div class="searchresult">This is a test</html:div></html:a>
|
||||
</treecell>-->
|
||||
<treecell />
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<treecol rdf:resource="http://home.netscape.com/NC-rdf#PageRank" rdf:resource2="http://home.netscape.com/NC-rdf#Name" />
|
||||
<treehead>
|
||||
<treerow>
|
||||
<treecell observes="SortNameColumn" align="center" value="&results.label;" resource="http://home.netscape.com/NC-rdf#Name" onclick="return doSort('SortNameColumn', 'http://home.netscape.com/NC-rdf#PageRank');" sortActive="true" sortDirection="ascending" flex="1"/>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
<treecol style="width: 100%;" flex="100%" rdf:resource="http://home.netscape.com/NC-rdf#PageRank" rdf:resource2="http://home.netscape.com/NC-rdf#Name" />
|
||||
// magic, hidden secondary column used for sorting
|
||||
<treecol style="width: 0;" id="SortNameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name" />
|
||||
|
||||
</tree>
|
||||
|
||||
|
@ -135,11 +136,6 @@
|
|||
<!-- advanced panel -->
|
||||
<box align="vertical" class="searchpanel-outerbox" flex="1">
|
||||
|
||||
<box orient="horizontal" align="center">
|
||||
<text value="&useTheseProviders.label;" class="indented-label"/>
|
||||
</box>
|
||||
<spring style="height: 2px;"/>
|
||||
|
||||
<tree align="horizontal" id="searchengines" flex="1" datasources="rdf:internetsearch" ref="NC:SearchEngineRoot" class="inset">
|
||||
<treecol id="CheckboxColumn" class="checkboxColumn" />
|
||||
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name" sortActive="true" sortDirection="ascending" />
|
||||
|
@ -160,7 +156,7 @@
|
|||
<treehead>
|
||||
<treerow>
|
||||
<treecell value="&checkbox.column.label;" style="width: 23px;"/>
|
||||
<treecell observes="NameColumn" align="center" value="&engine.column.label;" resource="http://home.netscape.com/NC-rdf#Name" onclick="return doSort('NameColumn');" sortActive="true" sortDirection="ascending" flex="1"/>
|
||||
<treecell observes="NameColumn" align="center" value="&engine.column.label;" resource="http://home.netscape.com/NC-rdf#Name" onclick="return doSort('NameColumn', null);" sortActive="true" sortDirection="ascending" flex="1"/>
|
||||
</treerow>
|
||||
</treehead>
|
||||
</tree>
|
||||
|
|
|
@ -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")
|
||||
{
|
||||
if (sortResource != naturalOrderResource)
|
||||
{
|
||||
sortDirection = "descending";
|
||||
else sortDirection = "ascending";
|
||||
}
|
||||
}
|
||||
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);
|
||||
try
|
||||
{
|
||||
xulSortService.Sort(node, sortResource, sortDirection);
|
||||
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
debug("Exception calling xulSortService.Sort()");
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче