use Fcntl qw/O_RDONLY/;
use Mail::Address;
use MLDBM qw/DB_File/;
-use POSIX;
+use POSIX qw/ceil/;
$config_path = '/etc/debbugs';
$lib_path = '/usr/lib/debbugs';
'pending' => 0,
'severity' => 0,
);
+my %common = (
+ 'show_list_header' => 1,
+ 'show_list_footer' => 1,
+);
sub exact_field_match {
my ($field, $values, $status) = @_;
return 0;
}
+sub detect_user_agent {
+ my $userAgent = $ENV{HTTP_USER_AGENT};
+ return { 'name' => 'links' } if ( $userAgent =~ m,^ELinks,);
+ return { 'name' => 'lynx' } if ( $userAgent =~ m,^Lynx,);
+ return { 'name' => 'wget' } if ( $userAgent =~ m,^Wget,);
+ return { 'name' => 'gecko' } if ( $userAgent =~ m,^Mozilla.* Gecko/,);
+ return { 'name' => 'ie' } if ( $userAgent =~ m,^.*MSIE.*,);
+ return { 'name' => 'unknown' };
+}
my %field_match = (
'subject' => \&contains_field_match,
'tags' => sub {
sub set_option {
my ($opt, $val) = @_;
+ if ($opt =~ m/^show_list_(foot|head)er$/) { $common{$opt} = $val; }
if ($opt eq "archive") { $common_archive = $val; }
if ($opt eq "repeatmerged") { $common_repeatmerged = $val; }
if ($opt eq "exclude") {
$footer .= "</ul>\n";
}
- $result = $header . $result;
+ $result = $header . $result if ( $common{show_list_header} );
$result .= $debbugs::gHTMLExpireNote if $gRemoveAge and $anydone;
- $result .= $footer;
+ $result .= $footer if ( $common{show_list_footer} );
return $result;
}
nice(5);
+my $userAgent = detect_user_agent();
my %param = readparse();
my $repeatmerged = ($param{'repeatmerged'} || "yes") eq "yes";
my $version = $param{'version'} || undef;
my $dist = $param{'dist'} || undef;
my $arch = $param{'arch'} || undef;
+my $show_list_header = ($param{'show_list_header'} || $userAgent->{'show_list_header'} || "yes" ) eq "yes";
+my $show_foot_header = ($param{'show_foot_header'} || $userAgent->{'show_list_footer'} || "yes" ) eq "yes";
my ($pkg, $src, $maint, $maintenc, $submitter, $severity, $status, $tag);
set_option("version", $version);
set_option("dist", $dist);
set_option("arch", $arch);
+set_option("show_list_header", $show_list_header);
+set_option("show_foot_header", $show_foot_header);
my $title;
my @bugs;
- Add in a Table of Contents to pkgreport.cgi.
- Display how long until a resolved bug will be archived in
pkgreport.cgi.
+ - Add user-agent detection. This currently doesn't change anything,
+ however.
+ - Add options show_list_(head|foot)er.
-- Colin Watson <cjwatson@debian.org> Fri, 20 Jun 2003 18:57:25 +0100