From a5b7e0d7a2c566eba768c6b6c7d3f699639d0997 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Tue, 27 Mar 2007 15:25:31 +0000 Subject: [PATCH] provide for sorting by os/version or compiler/version --- cgi-bin/show_status.pl | 49 +++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/cgi-bin/show_status.pl b/cgi-bin/show_status.pl index 3e35bcf..3816185 100644 --- a/cgi-bin/show_status.pl +++ b/cgi-bin/show_status.pl @@ -18,44 +18,38 @@ my $dsn="dbi:Pg:dbname=$dbname"; $dsn .= ";host=$dbhost" if $dbhost; $dsn .= ";port=$dbport" if $dbport; + +my $sort_clause = ""; +my $sortby = $query->param('sortby') || 'nosort'; +if ($sortby eq 'name') +{ + $sort_clause = 'sysname,'; +} +elsif ($sortby eq 'os') +{ + $sort_clause = 'operating_system, os_version desc,'; +} +elsif ($sortby eq 'compiler') +{ + $sort_clause = "compiler, compiler_version,"; +} + my $db = DBI->connect($dsn,$dbuser,$dbpass) or die("$dsn,$dbuser,$dbpass,$!"); # there is possibly some redundancy in this query, but it makes # a lot of the processing simpler. -my $statement = < now() - '30 days'::interval - ) m - where name = sysname - and s.status = 'approved' - order by branch = 'HEAD' desc, - branch desc, - snapshot desc - -EOS -; - -$statement =<finish; $db->disconnect; + my $template = new Template({}); print "Content-Type: text/html\n\n"; -- 2.30.2