diff -cr gnats-3.999.1/contrib/gnatsweb/ChangeLog gnats-3.999.1-Peyton/contrib/gnatsweb/ChangeLog *** gnats-3.999.1/contrib/gnatsweb/ChangeLog Thu Dec 27 13:07:47 2001 --- gnats-3.999.1-Peyton/contrib/gnatsweb/ChangeLog Mon Sep 9 10:01:11 2002 *************** *** 1,3 **** --- 1,17 ---- + 2002-09-09 Robert Lupton + + * Use gnatsweb-site-v4.pl if it exists, allowing gnatsweb v2 and v4 + to coexist + + * Allow a user to provide a custom sort routine via a callback + + * Allow the Synopsis field to be wrapped + + * Allow the cb routine to return an array (needed to support + custom sort callback) + + * Fix typo in login_page when requesting passwords + 2001-12-12 Yngve Svendsen * gnatsweb.pl: Set VERSION to 3.99.3. This is beta 3. diff -cr gnats-3.999.1/contrib/gnatsweb/gnatsweb.pl gnats-3.999.1-Peyton/contrib/gnatsweb/gnatsweb.pl *** gnats-3.999.1/contrib/gnatsweb/gnatsweb.pl Thu Dec 27 13:07:48 2001 --- gnats-3.999.1-Peyton/contrib/gnatsweb/gnatsweb.pl Mon Sep 9 09:56:40 2002 *************** *** 82,87 **** --- 82,91 ---- # you could, i suppose, by dint of creative programming, have different # config files for different databases, or some such madness... my $gnatsweb_site_file = './gnatsweb-site.pl'; + my $gnatsweb_site_file_v4 = './gnatsweb-site-v4.pl'; + if (-r $gnatsweb_site_file_v4) { + $gnatsweb_site_file = $gnatsweb_site_file_v4; + } # Site-specific customization - # *************** *** 2427,2448 **** # Reset param 'sortby' to its original value, so that 'store query' works. $q->param(-name=>'sortby', -value=>$sortby); # Sort @query_results according to the rules in by_field(). # Using the "map, sort" idiom allows us to perform the expensive # split() only once per item, as opposed to during every comparison. my(@presplit_prs) = map { [ (split /\037/) ] } @query_results; ! my(@sorted_prs); ! my $sortby_fieldtype = fieldinfo ($sortby, 'fieldtype') || ''; ! if ($sortby_fieldtype eq 'enum' || $sortby_fieldtype eq 'integer' ! || $sortby eq 'PR') { ! # sort numerically ! @sorted_prs = sort({$a->[$sortbyfieldnum] <=> $b->[$sortbyfieldnum]} ! @presplit_prs); ! } else { ! # sort alphabetically ! @sorted_prs = sort({($a->[$sortbyfieldnum] || '') cmp ($b->[$sortbyfieldnum] ||'')} ! @presplit_prs); } # Print the PR's. --- 2431,2464 ---- # Reset param 'sortby' to its original value, so that 'store query' works. $q->param(-name=>'sortby', -value=>$sortby); + # If there's a site callback to sort, provide a link to do it. + if(cb('sort_query', 'custom', 'checking_if_custom_sort_exists')) { + my $href = $q->self_url(); + $href =~ s/&sortby=[^&]+//; + $href .= "&sortby=custom"; + # 6/25/99 kenstir: CEL claims this avoids a problem w/ apache+mod_perl. + $href =~ s/^[^?]*\?/$script_name\?/; #CEL + print "Site-specific sort"; + } + # Sort @query_results according to the rules in by_field(). # Using the "map, sort" idiom allows us to perform the expensive # split() only once per item, as opposed to during every comparison. my(@presplit_prs) = map { [ (split /\037/) ] } @query_results; ! my(@sorted_prs) = cb('sort_query', $sortby, @presplit_prs); + if(!defined($sorted_prs[0])) { + my $sortby_fieldtype = fieldinfo ($sortby, 'fieldtype') || ''; + if ($sortby_fieldtype eq 'enum' || $sortby_fieldtype eq 'integer' + || $sortby eq 'PR') { + # sort numerically + @sorted_prs = sort({$a->[$sortbyfieldnum] <=> $b->[$sortbyfieldnum]} + @presplit_prs); + } else { + # sort alphabetically + @sorted_prs = sort({($a->[$sortbyfieldnum] || '') cmp ($b->[$sortbyfieldnum] ||'')} + @presplit_prs); + } } # Print the PR's. *************** *** 2480,2486 **** $fieldcontents = mark_urls($fieldcontents); } ! print "$fieldcontents"; $whichfield++; } # Pad the remaining, empty columns with  's --- 2496,2504 ---- $fieldcontents = mark_urls($fieldcontents); } ! print "$fieldcontents"; $whichfield++; } # Pad the remaining, empty columns with  's *************** *** 2980,2991 **** sub cb { my($reason, @args) = @_; ! my $val = undef; if (defined &site_callback) { ! $val = site_callback($reason, @args); } ! $val; } # print_header - --- 2998,3010 ---- sub cb { my($reason, @args) = @_; ! my @val = undef; if (defined &site_callback) { ! (@val) = site_callback($reason, @args); } ! ! return wantarray ? @val : $val[0]; } # print_header - *************** *** 3909,3915 **** } else { print "\nPassword:\n", $q->password_field(-name=>'password', ! -value=>$db_prefs{'password'} -size=>20), "\n\n"; } --- 3928,3934 ---- } else { print "\nPassword:\n", $q->password_field(-name=>'password', ! -value=>$db_prefs{'password'}, -size=>20), "\n\n"; }