]> git.donarmstrong.com Git - debbugs.git/commitdiff
[project @ 2000-11-17 03:03:15 by ajt]
authorajt <>
Fri, 17 Nov 2000 11:03:15 +0000 (03:03 -0800)
committerajt <>
Fri, 17 Nov 2000 11:03:15 +0000 (03:03 -0800)
Make the pkgindex display prettier

cgi/common.pl
cgi/pkgindex.cgi

index 7786b9c97f1c1e66c8a67e02c6bae256467a0dcf..ae8cc172034fc3218fcacac9f46a001d92e809af 100644 (file)
@@ -123,9 +123,17 @@ sub htmlindexentrystatus {
     return $result;
 }
 
+sub submitterurl {
+    my $ref = shift;
+    my $params = "submitter=" . emailfromrfc822($ref);
+    $params .= "&archive=yes" if ($common_archive);
+    $params .= "&repeatmerged=yes" if ($common_repeatmerged);
+    return $debbugs::gCGIDomain . "pkgreport.cgi" . "?" . $params;
+}
+
 sub mainturl {
     my $ref = shift;
-    my $params = "maintenc=" . maintencoded($ref);
+    my $params = "maint=" . emailfromrfc822($ref);
     $params .= "&archive=yes" if ($common_archive);
     $params .= "&repeatmerged=yes" if ($common_repeatmerged);
     return $debbugs::gCGIDomain . "pkgreport.cgi" . "?" . $params;
@@ -345,6 +353,13 @@ sub pkgbugsindex {
     return %descstr;
 }
 
+sub emailfromrfc822 {
+    my $email = shift;
+    $email =~ s/\s*\(.*\)\s*//;
+    $email = $1 if ($email =~ m/<(.*)>/);
+    return $email;
+}
+
 sub maintencoded {
     my $input = shift;
     my $encoded = '';
index 292c23740008efd4eca5a7802a0f20a5cb84e593..74ec98a73ab35300a2ecb35e6aca11ba95f7b583 100755 (executable)
@@ -49,29 +49,54 @@ set_option("archive", $archive);
 my %count;
 my $tag;
 my $note;
+my $linksub;
 if ($indexon eq "pkg") {
   $tag = "package";
   %count = countbugs(sub {my %d=@_; return $d{"pkg"}});
   $note = "<p>Note that with multi-binary packages there may be other\n";
   $note .= "reports filed under the different binary package names.</p>\n";
+  $linksub = sub {
+                   my $pkg = shift; 
+                   sprintf('<a href="%s">%s</a> ' 
+                            . '(maintained by <a href="%s">%s</a>',
+                           pkgurl($pkg),
+                           htmlsanit($pkg),
+                           mainturl($maintainers{$pkg}),
+                          htmlsanit($maintainers{$pkg}));
+                  };
 } elsif ($indexon eq "maint") {
   $tag = "maintainer";
-  %count = countbugs(sub {my %d=@_; my $me; 
-                          $me = $maintainers{$d{"pkg"}} || "";
-                          $me =~ s/\s*\(.*\)\s*//;
-                          $me = $1 if ($me =~ m/<(.*)>/);
-                          return $me;
+  %count = countbugs(sub {my %d=@_; 
+                          return emailfromrfc822($maintainers{$d{"pkg"}} || "");
                         });
   $note = "<p>Note that maintainers may use different Maintainer fields for\n";
   $note .= "different packages, so there may be other reports filed under\n";
   $note .= "different addresses.</p>\n";
+  $linksub = sub {
+                   my $maint = shift; my $maintfull = $maint;
+                  foreach my $x (values %maintainers) {
+                       if (emailfromrfc822($x) eq $maint) {
+                         $maintfull = $x; last;
+                      }
+                   }
+                   sprintf('<a href="%s">%s</a>',
+                           mainturl($maint),
+                          htmlsanit($maintfull));
+                  };
 } elsif ($indexon eq "submitter") {
   $tag = "submitter";
-  %count = countbugs(sub {my %d=@_; my $se; 
-                         ($se = $d{"submitter"} || "") =~ s/\s*\(.*\)\s*//;
-                         $se = $1 if ($se =~ m/<(.*)>/);
-                         return $se;
+  my %fullname = ();
+  %count = countbugs(sub {my %d=@_; my $f = $d{"submitter"} || "";
+                          my $em = emailfromrfc822($f);
+                          $fullname{$em} = $f if (!defined $fullname{$em});
+                         return $em;
                        });
+  $linksub = sub {
+                   my $sub = shift;
+                   sprintf('<a href="%s">%s</a>',
+                           submitterurl($sub),
+                          htmlsanit($fullname{$sub}));
+                  };
   $note = "<p>Note that people may use different email accounts for\n";
   $note .= "different bugs, so there may be other reports filed under\n";
   $note .= "different addresses.</p>\n";
@@ -79,10 +104,7 @@ if ($indexon eq "pkg") {
 
 my $result = "<ul>\n";
 foreach my $x (sort keys %count) {
-  $result .= sprintf('<li><a href="pkgreport.cgi?%s=%s%s">%s</a> %d bugs</li>',
-                    $indexon, $x, ($archive ? "&archive=yes" : ""), $x,
-                     $count{$x});
-  $result .= "\n";
+  $result .= "<li>" . $linksub->($x) . " has $count{$x} bugs</li>\n";
 }
 $result .= "</ul>\n";