From be1eec3e50b94fe43906b2ac2d54db1ca6b34613 Mon Sep 17 00:00:00 2001 From: doogie <> Date: Wed, 17 Sep 2003 20:28:07 -0800 Subject: [PATCH] [project @ 2003-09-17 21:28:07 by doogie] Add in a Table of Contents to pkgreport.cgi. --- cgi/common.pl | 40 +++++++++++++++++++++++++++++++++++++--- debian/changelog | 1 + 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/cgi/common.pl b/cgi/common.pl index 0b2a2c02..28162b1b 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -60,6 +60,10 @@ my %common_grouping_order = ( 'pending' => [ qw( pending forwarded pending-fixed fixed done absent ) ], 'severity' => \@debbugs::gSeverityList, ); +my %common_grouping_display = ( + 'pending' => 'Status', + 'severity' => 'Severity', +); my %common_headers = ( 'pending' => { "pending" => "outstanding", @@ -71,7 +75,7 @@ my %common_headers = ( }, 'severity' => \%debbugs::gSeverityDisplay, ); - + my $common_version; my $common_dist; my $common_arch; @@ -468,6 +472,7 @@ sub htmlizebugs { my $anydone = 0; my @status = (); + my %count; if (@bugs == 0) { return "

No reports found!

\n"; @@ -487,7 +492,12 @@ sub htmlizebugs { my $html = sprintf "
  • #%d: %s\n
    ", bugurl($bug), $bug, htmlsanit($status{subject}); $html .= htmlindexentrystatus(\%status) . "\n"; - $section{join( '_', map( {$status{$_}} @common_grouping ) )} .= $html; + my $key = join( '_', map( {$status{$_}} @common_grouping ) ); + $section{$key} .= $html; + $count{"_$key"}++; + foreach my $grouping ( @common_grouping ) { + $count{"${grouping}_$status{$grouping}"}++; + } $anydone = 1 if $status{pending} eq 'done'; push @status, [ $bug, \%status, $html ]; } @@ -515,10 +525,34 @@ sub htmlizebugs { push @headers, map( { $common_headers{$common_grouping[$i]}{$_} } @items ); } } + $result .= "\n
    \n"; + $result .= "
      \n"; + for ( my $i = 0; $i < @order; $i++ ) { + my $order = $order[ $i ]; + next unless defined $section{$order}; + my $count = $count{"_$order"}; + my $bugs = $count == 1 ? "bug" : "bugs"; + $result .= "
    • $headers[$i] ($count $bugs)
    • \n"; + } + $result .= "
    \n
    \n
      \n"; + foreach my $grouping ( @common_grouping ) { + my $local_result = ''; + foreach my $key ( @{$common_grouping_order{ $grouping }} ) { + my $count = $count{"${grouping}_$key"}; + next if !$count; + $local_result .= "
    • $count $common_headers{$grouping}{$key}
    • \n"; + } + if ( $local_result ) { + $result .= "
    • $common_grouping_display{$grouping}
        \n$local_result
    • \n"; + } + } + $result .= "
    \n
    "; for ( my $i = 0; $i < @order; $i++ ) { my $order = $order[ $i ]; next unless defined $section{$order}; - $result .= "

    $headers[$i]

    \n"; + my $count = $count{"_$order"}; + my $bugs = $count == 1 ? "bug" : "bugs"; + $result .= "

    $headers[$i] ($count $bugs)

    \n"; $result .= "\n"; diff --git a/debian/changelog b/debian/changelog index cf8cd388..936ec4bd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -22,6 +22,7 @@ debbugs (2.4.2) UNRELEASED; urgency=low - Rewrite grouping logic in cgi's common.pl, to make it completely generic. There is now no longer 2 nested loops, to do the grouping. This makes adding new grouping levels simpler for the future. + - Add in a Table of Contents to pkgreport.cgi. -- Colin Watson Fri, 20 Jun 2003 18:57:25 +0100 -- 2.39.5