From: ajt <> Date: Thu, 6 Oct 2005 10:46:13 +0000 (-0800) Subject: [project @ 2005-10-06 03:46:13 by ajt] X-Git-Tag: release/2.6.0~644 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=bdee795785ef1d53094fc90a90eebcd4d76067bf;p=debbugs.git [project @ 2005-10-06 03:46:13 by ajt] add support for user categories darcs changelog: * add support for selecting by usertag * add a (beta) note, and some doc links for user categories * provide a UI for user-categorisations (needs cookies and javascript) changed the handling of raw/oldview to be aliases for ordering= rather than the opposite split out javascript initialisation into pagemain() function some initial support for simple aliases of common categories like "severity" and "status" * improve Options stanza; add "oldview" support * Outstanding Status -> Classification * Patched -> Patch Available * Done -> Resolved * add "oldview" support * Unreviewed -> Unclassified * add support for pending and severity reverse (legacy) * tweak default sectioning for roll out on bugs.debian.org * start counting bug attributes from 1, not 0 for display * don't include the attribute in the title, just the name * support setting of section names properly * majorly redo dynamic sectioning, add "Summary" info back * parameterise ordering * first pass support for generalising pkgreport's sectioning --- diff --git a/Debbugs/User.pm b/Debbugs/User.pm index 7b8c38ee..fff2eea7 100644 --- a/Debbugs/User.pm +++ b/Debbugs/User.pm @@ -30,7 +30,7 @@ use vars qw($VERSION $DEBUG %EXPORT_TAGS @EXPORT_OK @EXPORT); use base qw(Exporter); BEGIN { - ($VERSION) = q$Revision: 1.1 $ =~ /^Revision:\s+([^\s+])/; + ($VERSION) = q$Revision: 1.2 $ =~ /^Revision:\s+([^\s+])/; $DEBUG = 0 unless defined $DEBUG; @EXPORT = (); diff --git a/cgi/cookies.cgi b/cgi/cookies.cgi index 1251e921..20a98101 100644 --- a/cgi/cookies.cgi +++ b/cgi/cookies.cgi @@ -17,7 +17,7 @@ my $time_future = strftime("%a, %d-%b-%Y %T GMT", my $time_past = strftime("%a, %d-%b-%Y %T GMT", 59, 59, 23, 31, 11, $time_now[5]-10); -my @cookie_options = qw(repeatmerged terse reverse trim); +my @cookie_options = qw(repeatmerged terse reverse trim oldview); print "Content-Type: text/html; charset=utf-8\n"; diff --git a/cgi/pkgreport.cgi b/cgi/pkgreport.cgi index e92e9d75..86ba7515 100755 --- a/cgi/pkgreport.cgi +++ b/cgi/pkgreport.cgi @@ -12,6 +12,7 @@ require '/etc/debbugs/config'; require '/etc/debbugs/text'; use Debbugs::User; +my $cats = 5; use vars qw($gPackagePages $gWebDomain); @@ -29,7 +30,18 @@ my $repeatmerged = ($param{'repeatmerged'} || "yes") eq "yes"; my $archive = ($param{'archive'} || "no") eq "yes"; my $include = $param{'&include'} || $param{'include'} || ""; my $exclude = $param{'&exclude'} || $param{'exclude'} || ""; + +my $users = $param{'users'} || ""; + +my $ordering = $param{'ordering'}; my $raw_sort = ($param{'raw'} || "no") eq "yes"; +my $old_view = ($param{'oldview'} || "no") eq "yes"; +unless (defined $ordering) { + $ordering = "normal"; + $ordering = "old" if $old_view; + $ordering = "raw" if $raw_sort; +} + my $bug_rev = ($param{'bug-rev'} || "no") eq "yes"; my $pend_rev = ($param{'pend-rev'} || "no") eq "yes"; my $sev_rev = ($param{'sev-rev'} || "no") eq "yes"; @@ -45,17 +57,95 @@ my $arch = $param{'arch'} || undef; my $show_list_header = ($param{'show_list_header'} || $userAgent->{'show_list_header'} || "yes" ) eq "yes"; my $show_list_footer = ($param{'show_list_footer'} || $userAgent->{'show_list_footer'} || "yes" ) eq "yes"; -my $users = $param{'users'} || ""; -my %bugusertags; -my %ut; -for my $user (split /\s*,\s*/, $users) { - Debbugs::User::read_usertags(\%ut, $user); +my @p = ( + "pending:pending,forwarded,pending-fixed,fixed,done,absent", + "severity:critical,grave,serious,important,normal,minor,wishlist", + "pending=pending+tag=wontfix,pending=pending+tag=moreinfo,pending=pending+tag=patch,pending=pending+tag=confirmed,pending=pending"); +my @t = ( + "Outstanding,Forwarded,Pending Upload,Fixed in NMU,Resolved,From other Branch,Unknown Pending Status", + "Critical,Grave,Serious,Important,Normal,Minor,Wishlist,Unknown Severity", + "Will Not Fix,More information needed,Patch Available,Confirmed,Unclassified"); +my @o = ("0,1,2,3,4,5,6","0,1,2,3,4,5,6,7","2,3,4,1,0,5"); +my @n = ("Status", "Severity", "Classification"); + +if ($ordering eq "old") { + splice @p, 2, 1; + splice @t, 2, 1; + splice @o, 2, 1; + splice @n, 2, 1; } -for my $t (keys %ut) { - for my $b (@{$ut{$t}}) { - $bugusertags{$b} = [] unless defined $bugusertags{$b}; - push @{$bugusertags{$b}}, $t; +$o[0] = scalar reverse($o[0]) if ($pend_rev); +$o[1] = scalar reverse($o[1]) if ($sev_rev); + +if (!defined $param{"pri0"} && $ordering =~ m/^user(\d+)$/) { + my $id = $1; + my $l = 0; + if (defined $param{"cat${id}_users"}) { + $users .= "," . $param{"cat${id}_users"}; } + while (defined $param{"cat${id}_nam$l"}) { + my ($n, $p, $t, $o) = + map { $param{"cat${id}_${_}$l"} || "" } + ("nam", "pri", "ttl", "ord"); + if ($p eq "") { + if ($n eq "status") { + ($p, $t, $o) = ($p[0], $t[0], $o[0]); + } elsif ($n eq "severity") { + ($p, $t, $o) = ($p[1], $t[1], $o[1]) + } else { + $ordering = "raw"; + last; + } + } + $param{"nam$l"} = $n; + $param{"pri$l"} = $p; + $param{"ttl$l"} = $t; + $param{"ord$l"} = $o; + $l++; + } +} +if (defined $param{"pri0"}) { + my $i = 0; + @p = (); @o = (); @t = (); @n = (); + while (defined $param{"pri$i"}) { + push @p, $param{"pri$i"}; + push @o, $param{"ord$i"} || ""; + push @t, $param{"ttl$i"} || ""; + push @n, $param{"nam$i"} || ""; + $i++; + } +} +for my $x (@p) { + next if "$x," =~ m/^(pending|severity|tag):(([*]|[a-z0-9.-]+),)+$/; + next if "$x," =~ m/^((pending|severity|tag)=([*]|[a-z0-9.-]+)[,+])+/; + quitcgi("Bad syntax in Priority: $x"); +} + +my @names; my @prior; my @title; my @order; +for my $i (0..$#p) { + push @prior, [ make_order_list($p[$i]) ]; + if ($n[$i]) { + push @names, $n[$i]; + } elsif ($p[$i] =~ m/^([^:]+):/) { + push @names, $1; + } else { + push @names, "Bug attribute #" . (1+$i); + } + if ($o[$i]) { + push @order, [ split /,/, $o[$i] ]; + } else { + push @order, [ 0..$#{$prior[$i]} ]; + } + my @t = split /,/, $t[$i]; + push @t, map { toenglish($prior[$i]->[$_]) } ($#t+1)..($#{$prior[$i]}); + push @title, [@t]; +} + +sub toenglish { + my $expr = shift; + $expr =~ s/[+]/ and /g; + $expr =~ s/[a-z]+=//g; + return $expr; } { @@ -68,12 +158,6 @@ for my $t (keys %ut) { } if ($vt eq "bypkg" || $vt eq "bysrc") { $dist = undef; $arch = undef; } } - if (defined $param{'ordering'}) { - my $o = $param{'ordering'}; - if ($o eq "raw") { $raw_sort = 1; $bug_rev = 0; } - if ($o eq "normal") { $raw_sort = 0; $bug_rev = 0; } - if ($o eq "reverse") { $raw_sort = 0; $bug_rev = 1; } - } if (defined $param{'includesubj'}) { my $is = $param{'includesubj'}; $include .= "," . join(",", map { "subj:$_" } (split /[\s,]+/, $is)); @@ -85,7 +169,14 @@ for my $t (keys %ut) { } -my ($pkg, $src, $maint, $maintenc, $submitter, $severity, $status, $tag); +my %bugusertags; +my %ut; +for my $user (split /[\s*,]+/, $users) { + next unless ($user =~ m/..../); + Debbugs::User::read_usertags(\%ut, $user); +} + +my ($pkg, $src, $maint, $maintenc, $submitter, $severity, $status, $tag, $usertag); my %which = ( 'pkg' => \$pkg, @@ -95,6 +186,7 @@ my %which = ( 'submitter' => \$submitter, 'severity' => \$severity, 'tag' => \$tag, + 'usertag' => \$usertag, ); my @allowedEmpty = ( 'maint' ); @@ -128,6 +220,25 @@ if (!$found) { } quitcgi("You have to choose something to select by") if (!$found); +if (defined $usertag) { + my %select_ut = (); + my ($u, $t) = split /:/, $usertag, 2; + Debbugs::User::read_usertags(\%select_ut, $u); + unless (defined $t && $t ne "") { + $t = join(",", keys(%select_ut)); + } + + Debbugs::User::read_usertags(\%ut, $u); + $tag = $t; +} + +for my $t (keys %ut) { + for my $b (@{$ut{$t}}) { + $bugusertags{$b} = [] unless defined $bugusertags{$b}; + push @{$bugusertags{$b}}, $t; + } +} + my $Archived = $archive ? " Archived" : ""; my $this = ""; @@ -147,10 +258,6 @@ set_option("repeatmerged", $repeatmerged); set_option("archive", $archive); set_option("include", $include); set_option("exclude", $exclude); -set_option("raw", $raw_sort); -set_option("bug-rev", $bug_rev); -set_option("pend-rev", $pend_rev); -set_option("sev-rev", $sev_rev); set_option("pend-exc", $pend_exc); set_option("pend-inc", $pend_inc); set_option("sev-exc", $sev_exc); @@ -298,7 +405,7 @@ print "
\n" . "$tail_html"; @@ -558,14 +771,13 @@ sub pkg_htmlindexentrystatus { sub pkg_htmlizebugs { $b = $_[0]; my @bugs = @$b; - my $anydone = 0; my @status = (); my %count; my $header = ''; my $footer = "
" . $debbugs::gHTMLExpireNote if $debbugs::gRemoveAge and $anydone;
$result .= $footer if ( $common{show_list_footer} );
return $result;
}
@@ -732,6 +923,54 @@ sub pkg_javascript {
return <