From da34d05d207103b049ca2c6169e576d1c24774aa Mon Sep 17 00:00:00 2001 From: "gerv%gerv.net" <> Date: Tue, 16 Oct 2001 10:09:52 +0000 Subject: Bug 30480 - add 'show dependencies as buglist' links. Patch by gerv, r=myk, kiko. --- showdependencytree.cgi | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/showdependencytree.cgi b/showdependencytree.cgi index 14d504567..c493508c0 100755 --- a/showdependencytree.cgi +++ b/showdependencytree.cgi @@ -28,8 +28,6 @@ use strict; use lib qw(.); require "CGI.pl"; -# Shut up misguided -w warnings about "used only once": - use vars %::FORM; ConnectToDatabase(); @@ -63,6 +61,9 @@ if ($hide_resolved !~ /^\d+$/ || $hide_resolved != 1) { $hide_resolved = 0 }; # A hash to count visited bugs, and also to avoid processing repeated bugs my %seen; +# A hash to keep track of the bugs we print for the 'as buglist' links. +my %printed; + # HTML output generated in the parse of the dependency tree. This is a # global only to avoid excessive complication in the recursion invocation my $html; @@ -92,6 +93,7 @@ my $scriptname = $::ENV{'SCRIPT_NAME'}; # showdependencytree.cgi # html: Bug descriptions are appended here # realdepth: We set the maximum depth of recursion reached # seen: We store the bugs analyzed so far +# printed: We store those bugs we actually print, for the "buglist" link # Globals Referenced # maxdepth # hide_resolved @@ -161,6 +163,8 @@ sub DumpKids { $short_desc.\n|; } if (! $opened) { $html .= ""; } + + $printed{$kid} = 1; } # End hideable output # Store the maximum depth so far @@ -197,6 +201,7 @@ sub makeTreeHTML { # Clean up globals for this run $html = ""; %seen = (); + %printed = (); DumpKids($i, $target); my $tmphtml = $html; @@ -205,6 +210,11 @@ sub makeTreeHTML { $html = "

Bugs that bug $linked_id ".($target eq "blocked" ? "blocks" : "depends on"); + if ((scalar keys %printed) > 0) { + $html .= ' (view as bug list)'; + } + # Provide feedback for omitted bugs if ($maxdepth || $hide_resolved) { $html .= " (Only "; @@ -218,7 +228,7 @@ sub makeTreeHTML { $html .= $tmphtml; # If no bugs were found, say so - if ((scalar keys %seen) < 2) { + if ((scalar keys %printed) == 0) { $html .= "    None

\n"; } @@ -296,7 +306,7 @@ sub drawDepForm {

- -- cgit v1.2.3-24-g4f1b