diff --git a/webtools/bugzilla/CGI.pl b/webtools/bugzilla/CGI.pl index 3c0795d44d3..7fb0298d8de 100644 --- a/webtools/bugzilla/CGI.pl +++ b/webtools/bugzilla/CGI.pl @@ -22,6 +22,7 @@ # Joe Robins # Dave Miller # Christopher Aillon +# Gervase Markham # Contains some global routines used throughout the CGI scripts of Bugzilla. @@ -408,6 +409,48 @@ sub navigation_header { print "     Enter new bug\n" } +# Adds elements for bug lists. These can be inserted into the header by +# (ab)using the "jscript" parameter to PutHeader, which inserts an arbitrary +# string into the header. This function is modelled on the one above. +sub navigation_links($) { + my ($buglist) = @_; + + my $retval = ""; + + # We need to be able to pass in a buglist because when you sort on a column + # the bugs in the cookie you are given will still be in the old order. + # If a buglist isn't passed, we just use the cookie. + $buglist ||= $::COOKIE{"BUGLIST"}; + + if (defined $buglist && $buglist ne "") { + my @bugs = split(/:/, $buglist); + + if (defined $::FORM{'id'}) { + # We are on an individual bug + my $cur = lsearch(\@bugs, $::FORM{"id"}); + + if ($cur > 0) { + $retval .= "\n"; + $retval .= "\n"; + } + if ($cur < $#bugs) { + $retval .= "\n"; + $retval .= "\n"; + } + + $retval .= "\n"; + $retval .= "\n"; + } else { + # We are on a bug list + $retval .= "\n"; + $retval .= "\n"; + $retval .= "\n"; + } + } + + return $retval; +} + sub make_checkboxes { my ($src,$default,$isregexp,$name) = (@_); my $last = ""; diff --git a/webtools/bugzilla/buglist.cgi b/webtools/bugzilla/buglist.cgi index e08df3952d0..f6143abaa32 100755 --- a/webtools/bugzilla/buglist.cgi +++ b/webtools/bugzilla/buglist.cgi @@ -1313,7 +1313,7 @@ if (length($buglist) < 4000) { print "Set-Cookie: BUGLIST=\n\n"; $toolong = 1; } -PutHeader($::querytitle); +PutHeader($::querytitle, undef, "", "", navigation_links($buglist)); print " diff --git a/webtools/bugzilla/show_bug.cgi b/webtools/bugzilla/show_bug.cgi index eced9cfbef7..c5b569a459c 100755 --- a/webtools/bugzilla/show_bug.cgi +++ b/webtools/bugzilla/show_bug.cgi @@ -68,7 +68,7 @@ GetVersionTable(); SendSQL("SELECT short_desc FROM bugs WHERE bug_id = $::FORM{'id'}"); my ($summary) = FetchSQLData(); $summary = html_quote($summary); -PutHeader("Bug $::FORM{'id'} - $summary", "Bugzilla Bug $::FORM{'id'}", $summary ); +PutHeader("Bug $::FORM{'id'} - $summary", "Bugzilla Bug $::FORM{'id'}", $summary, "", navigation_links() ); navigation_header();