From 52220cb756169373733b83897f25bcfc3b326240 Mon Sep 17 00:00:00 2001
From: cjwatson <>
Date: Wed, 6 Aug 2003 22:35:55 -0800
Subject: [PATCH] [project @ 2003-08-06 23:35:55 by cjwatson] Support
 indexon=tag for pkgindex.cgi.

---
 cgi/common.pl    |  8 ++++++++
 cgi/pkgindex.cgi | 12 +++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/cgi/common.pl b/cgi/common.pl
index 9986d2a6..5886cf2c 100644
--- a/cgi/common.pl
+++ b/cgi/common.pl
@@ -287,6 +287,14 @@ sub srcurl {
     return urlsanit("pkgreport.cgi" . "?" . "$params");
 }
 
+sub tagurl {
+    my $ref = shift;
+    my $params = "tag=$ref";
+    $params .= "&archive=yes" if ($common_archive);
+    $params .= "&repeatmerged=no" unless ($common_repeatmerged);
+    return urlsanit("pkgreport.cgi" . "?" . "$params");
+}
+
 sub urlsanit {
     my $url = shift;
     $url =~ s/%/%25/g;
diff --git a/cgi/pkgindex.cgi b/cgi/pkgindex.cgi
index a2c73e50..029ecd87 100755
--- a/cgi/pkgindex.cgi
+++ b/cgi/pkgindex.cgi
@@ -16,7 +16,7 @@ nice(5);
 my %param = readparse();
 
 my $indexon = $param{'indexon'} || 'pkg';
-if ($indexon !~ m/^(pkg|src|maint|submitter)$/) {
+if ($indexon !~ m/^(pkg|src|maint|submitter|tag)$/) {
     quitcgi("You have to choose something to index on");
 }
 
@@ -124,6 +124,16 @@ if ($indexon eq "pkg") {
   $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";
+} elsif ($indexon eq "tag") {
+  $tag = "tag";
+  %count = countbugs(sub {my %d=@_; return split ' ', $d{tags}; });
+  $note = "";
+  foreach my $keyword (keys %count) {
+    $sortkey{$keyword} = lc $keyword;
+    $htmldescrip{$keyword} = sprintf('<a href="%s">%s</a>',
+                               tagurl($keyword),
+                               htmlsanit($keyword));
+  }
 }
 
 my $result = "<ul>\n";
-- 
2.39.5