]> git.donarmstrong.com Git - debbugs.git/blobdiff - cgi/common.pl
[project @ 2003-01-28 22:59:47 by cjwatson]
[debbugs.git] / cgi / common.pl
index 99b965cb0693956ad54f2d805eabf4c7c1c2b419..72f41886a3217ebc10efd8dd32e028bcdd6249e3 100644 (file)
@@ -70,7 +70,7 @@ sub readparse {
     } else {
         return;
     }
-    foreach (split(/&/,$in)) {
+    foreach (split(/[&;]/,$in)) {
         s/\+/ /g;
         ($key, $val) = split(/=/,$_,2);
         $key=~s/%(..)/pack("c",hex($1))/ge;
@@ -106,6 +106,30 @@ sub quit {
 #    exit 0;
 #}
 
+# Split a package string from the status file into a list of package names.
+sub splitpackages {
+    my $pkgs = shift;
+    return unless defined $pkgs;
+    return split /[ \t?,()]+/, $pkgs;
+}
+
+# Generate a comma-separated list of HTML links to each package given in
+# $pkgs. $pkgs may be empty, in which case an empty string is returned, or
+# it may be a comma-separated list of package names.
+sub htmlpackagelinks {
+    my $pkgs = shift;
+    return unless defined $pkgs and $pkgs ne '';
+    my @pkglist = splitpackages($pkgs);
+
+    return 'Package' . (@pkglist > 1 ? 's' : '') . ': ' .
+           join(', ',
+                map {
+                    '<a href="' . pkgurl($_) . '">' .
+                    '<strong>' . htmlsanit($_) . '</strong></a>'
+                } @pkglist
+           ) . ";\n";
+}
+
 sub htmlindexentry {
     my $ref = shift;
     my %status = %{getbugstatus($ref)};
@@ -127,9 +151,7 @@ sub htmlindexentrystatus {
         $showseverity = "Severity: <em>$status{severity}</em>;\n";
     }
 
-    $result .= "Package: <a href=\"" . pkgurl($status{"package"}) . "\">"
-               . "<strong>" . htmlsanit($status{"package"}) . "</strong></a>;\n"
-               if (length($status{"package"}));
+    $result .= htmlpackagelinks($status{"package"});
     $result .= $showseverity;
     $result .= "Reported by: <a href=\"" . submitterurl($status{originator})
                . "\">" . htmlsanit($status{originator}) . "</a>";
@@ -322,7 +344,13 @@ sub htmlizebugs {
             }
            next unless ($okay);
        }
-           
+       next if @common_pending_include and
+            not grep { $_ eq $status{pending} } @common_pending_include;
+       next if @common_severity_include and
+            not grep { $_ eq $status{severity} } @common_severity_include;
+       next if grep { $_ eq $status{pending} } @common_pending_exclude;
+       next if grep { $_ eq $status{severity} } @common_severity_exclude;
+
        my $html = sprintf "<li><a href=\"%s\">#%d: %s</a>\n<br>",
            bugurl($bug), $bug, htmlsanit($status{subject});
        $html .= htmlindexentrystatus(\%status) . "\n";
@@ -336,20 +364,16 @@ sub htmlizebugs {
        $result .= "<UL>\n" . join("", @rawsort ) . "</UL>\n";
     } else {
        my @pendingList = qw(pending forwarded pending-fixed fixed done);
-       @pendingList = @common_pending_include if @common_pending_include;
        @pendingList = reverse @pendingList if $common_pending_reverse;
 #print STDERR join(",",@pendingList)."\n";
 #print STDERR join(",",@common_pending_include).":$#common_pending_include\n";
     foreach my $pending (@pendingList) {
-       next if grep( /^$pending$/, @common_pending_exclude);
        my @severityList = @debbugs::gSeverityList;
-       @severityList = @common_severity_include if @common_severity_include;
        @severityList = reverse @severityList if $common_severity_reverse;
 #print STDERR join(",",@severityList)."\n";
 
 #        foreach my $severity(@debbugs::gSeverityList) {
         foreach my $severity(@severityList) {
-           next if grep( /^$severity$/, @common_severity_exclude);
             $severity = $debbugs::gDefaultSeverity if ($severity eq '');
             next unless defined $section{${pending} . "_" . ${severity}};
             $result .= "<HR><H2>$debbugs::gSeverityDisplay{$severity} - $displayshowpending{$pending}</H2>\n";