From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9634 invoked from network); 26 Sep 2002 13:41:05 -0000 Received: from unknown (HELO monty-python.gnu.org) (199.232.76.173) by sources.redhat.com with SMTP; 26 Sep 2002 13:41:05 -0000 Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17uYt6-0003N0-00; Thu, 26 Sep 2002 09:41:04 -0400 Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17uYsI-0003E5-00 for help-gnats@gnu.org; Thu, 26 Sep 2002 09:40:14 -0400 Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17uYsF-0003DW-00 for help-gnats@gnu.org; Thu, 26 Sep 2002 09:40:13 -0400 Received: from claven.astro.princeton.edu ([128.112.25.10]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17uYsF-0003DG-00 for help-gnats@gnu.org; Thu, 26 Sep 2002 09:40:11 -0400 Received: from wire7.Princeton.EDU (IDENT:Y+Opr8rmeHPqL/cCyPuNa4U/ciNE1xuM@wire7 [128.112.24.203]) by claven.astro.princeton.edu (8.11.6/8.11.6) with ESMTP id g8QDeAd02273 for ; Thu, 26 Sep 2002 09:40:10 -0400 Received: (from rhl@localhost) by wire7.Princeton.EDU (8.11.6/8.11.2) id g8QDeAj22499; Thu, 26 Sep 2002 09:40:10 -0400 From: Robert Lupton the Good Message-ID: <15763.3642.610545.301933@wire7.Princeton.EDU> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: help-gnats@gnu.org Subject: Patch for gnatsweb.pl In-Reply-To: <20020925181413.GA1154909@cluster2.netman.dk> References: <20020922184733.GA1071317@cluster2.netman.dk> <15749.57217.976539.558063@wire7.Princeton.EDU> <5.1.0.14.2.20020925174747.044096d0@romulus.holland.sun.com> <20020925181413.GA1154909@cluster2.netman.dk> X-Mailer: VM 7.03 under Emacs 20.7.1 Sender: help-gnats-admin@gnu.org Errors-To: help-gnats-admin@gnu.org X-BeenThere: help-gnats@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General discussion about GNU GNATS List-Archive: Date: Fri, 27 Sep 2002 00:32:00 -0000 X-SW-Source: 2002-q3/txt/msg00131.txt.bz2 I don't think that I ever posted my custom sort routine. Thinking about it, this might go better in gnatsweb.pl itself, as the custom sort itself uses cb('sort_keys') for customization. R elsif ($reason eq 'sort_keys') { return qw(Severity Priority Class State Category Scheduled); } elsif ($reason eq 'sort_query') { my($sortby) = shift @args; if(defined($sortby) && $sortby eq "custom") { if($args[0] ne 'checking_if_custom_sort_exists') { my(@fields) = $q->param('columns'); # # Sort by these fields in this order; PR is always added # as a final key. We'll start by figuring out which # field is which, and whether they are numeric or string valued # my(@sort_keys) = cb('sort_keys'); my($field, $i, @keys); my($whichfield) = 1; # field counter (0 is PR) for $field (@fields) { $field = param2field($field); $i = 0; foreach (@sort_keys) { if($_ eq $field) { my $fieldtype = fieldinfo($field, 'fieldtype') || ''; $keys[$i] = {}; $keys[$i]->{field} = $field; $keys[$i]->{i} = $whichfield; if ($fieldtype eq 'enum' || $fieldtype eq 'integer') { $keys[$i]->{cmp} = "<=>" } else { $keys[$i]->{cmp} = "cmp"; } } $i++; } $whichfield++; } # # OK, @keys is now an array telling us how to sort. # Generate the sort BLOCK # my($sort_block) = ""; for (@keys) { if(defined($_->{field})) { $sort_block .= " \$a->[$_->{i}] $_->{cmp} \$b->[$_->{i}] or \# $_->{field}\n"; } } $sort_block .= " \$a->[0] <=> \$b->[0]; \# PR\n"; my($debug) = 0; if($debug) { print_header(); print "
sort_block:
$sort_block
\n"; } eval "\@args = sort({ $sort_block } \@args)"; if($@) { print $@; } } return @args; } else { return undef; } } _______________________________________________ Help-gnats mailing list Help-gnats@gnu.org http://mail.gnu.org/mailman/listinfo/help-gnats