From: Mike Taylor Date: Tue, 19 Sep 2006 16:35:25 +0000 (+0000) Subject: Add support for sorting. X-Git-Tag: CPAN-v1.02~54^2~1043 X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=commitdiff_plain;h=f07da2fa4daa7525e39a42d417cd68ac6fc83d30 Add support for sorting. Query is now an

rather than a bold

--- diff --git a/web/htdocs/details/found.mc b/web/htdocs/details/found.mc index a358498..e957091 100644 --- a/web/htdocs/details/found.mc +++ b/web/htdocs/details/found.mc @@ -1,4 +1,4 @@ -%# $Id: found.mc,v 1.4 2006-09-19 11:12:33 mike Exp $ +%# $Id: found.mc,v 1.5 2006-09-19 16:35:25 mike Exp $ <%once> use XML::LibXML; use XML::LibXML::XPathContext; @@ -15,6 +15,13 @@ foreach my $key (keys %params) { } $query = 'cql.allRecords=x' if $query eq ""; +my $sort = $params{"_sort"}; +if ($sort) { + $query .= " or $sort=/sort"; + $query .= "-desc" if $params{_desc}; + $query .= " 0"; +} + ### We can think about keeping the Connection object open to re-use # for multiple requests, but that may not get us much. Same applies # for the XML parser. @@ -32,9 +39,8 @@ my $first = $skip+1; my $last = $first+$count-1; $last = $n if $last > $n; +

<% $query %>

- <% $query %> -
% if ($n == 0) { No matches % } elsif ($first > $n) {