]> xenbits.xensource.com Git - people/aperard/emesinae.git/commitdiff
bugs: improved bug list
authorIan Campbell <ijc@hellion.org.uk>
Sun, 18 Nov 2012 20:48:13 +0000 (20:48 +0000)
committerIan Campbell <ijc@hellion.org.uk>
Sun, 18 Nov 2012 20:48:13 +0000 (20:48 +0000)
CGI/bugs.pl
CGI/common.pl
config.pl
css/style.css

index a0910eb2c8686a55a6bcfbaa59f3ae587ee43643..0dcf12e6410eb972d83236921187597ae60de969 100755 (executable)
@@ -17,6 +17,42 @@ my $dbh = opendb;
 
 my $ml = htmlsanit( $c{ListAddress} );
 
+my @all_bugs = Bugs::Bug->listall($dbh);
+
+my @index;
+my $lists;
+
+sub buglist ($$) {
+    my $open = shift;
+    my $sev  = shift;
+
+    my @bugs =
+      grep { $_->{open} == $open and $_->{severity} eq $sev } @all_bugs;
+
+    return "" unless @bugs;
+
+    sub bug($) {
+        return (
+            buglink( $_, "#" . $_->{id} ) . " " . buglink( $_, $_->{title} ) );
+    }
+
+    my $title  = ( $open ? "Open" : "Closed" ) . " $sev bugs";
+    my $anchor = ( $open ? "open" : "closed" ) . "_${sev}_bugs";
+    push @index,
+      li( a( { -href => "#$anchor" }, $title . " (" . @bugs . " bugs)" ) );
+    $lists .=
+      h2( { -class => "buglistsect" }, a( { -name => $anchor }, $title ) )
+      . "\n";
+
+    $lists .=
+      ul( li( [ map { bug($_) } sort { $a->{id} cmp $b->{id} } @bugs, ] ) );
+    $lists .= "\n";
+}
+
+foreach my $open ( 1, 0 ) {
+    foreach my $sev ( @{ $c{SeverityLevels} } ) { buglist( $open, $sev ); }
+}
+
 print header;
 
 print start_html(
@@ -24,25 +60,23 @@ print start_html(
     -style => { 'src' => $c{StyleSheet} }
 ) . "\n";
 
+print h1( $c{TrackerName} );
+
 print p(
     [
-        "This is the $ml bug tracker.",
-        "For information on how to report a bug please see "
+        "This is the bug tracker for $ml.",
+        "You cannot submit bugs here. "
+          . "For information on how to report a bug please see "
           . a( { -href => $c{ReportingURL} }, "this link" )
     ]
 ) . "\n";
 
-print hr;
+print hr . "\n";
+
+print ul (@index);
 
-my @bugs = Bugs::Bug->listall($dbh);
+print hr . "\n";
 
-print table(
-    Tr(
-        [
-            th( [ 'Bug #', 'Title' ] ),
-            map { td( [ $_->{id}, buglink($_) ] ) } @bugs,
-        ],
-    )
-);
+print $lists;
 print end_html;
 
index c605371ff9176962213dd9a133a7d38602f880c1..763cb8ab320c54e958daf7e276f41aabdef5b28d 100644 (file)
@@ -1,7 +1,8 @@
 sub buglink {
     my $b   = shift;
+    my $t   = shift or $b->{title};
     my $url = "/cgi-bin/bug.pl?id=" . $b->{id};
-    return a( { href => $url }, $b->{title} );
+    return a( { href => $url }, $t );
 }
 
 sub htmlsanit {
index 4ea7ef3d19f2bd075eac6cff89c89f94e53a82da..a62a7476e385be6c8c5e5ebe7ab755c8f4bc086b 100644 (file)
--- a/config.pl
+++ b/config.pl
@@ -21,5 +21,6 @@ $c{ControlAddress} = "control@foobugs.example.com";
 
 @{$c{ControlAllow}} = qw/ijc@hellion.org.uk foo@example.com/;
 
-@{$c{SeverityLevels}} = qw/wishlist normal critical blocker/;
+# Severity levels, in decending order of criticality
+@{$c{SeverityLevels}} = qw/blocker critical normal wishlist/;
 $c{DefaultSeverity} = "normal";
index 4a35f08606cb643cb585d9fcda3811153d832dab..e8dcdb9da90417cced4be0110539976560244064 100644 (file)
@@ -16,14 +16,23 @@ pre.headers {
 
 .bugmetadata p
 { 
-  font-family: sans-serif;
-  font-size: 110%;
-  margin-bottom: 0px
+    font-family: sans-serif;
+    font-size: 110%;
+    margin-bottom: 0px
 }
 
 .bugmetadata p + p
 { 
-  margin: 0;
-  margin-top: 0px;
-  border: 0;
+    margin: 0;
+    margin-top: 0px;
+    border: 0;
+}
+
+h2.buglistsect
+{
+    font-family: sans-serif;
+    background-color: #f0f0f0;
+    color: #3c3c3c;
+    border: #a7a7a7 1px solid;
+    padding: 10px;
 }