From 7da1a248bc2ac4c548a016cd6bce528e63d9c779 Mon Sep 17 00:00:00 2001 From: "jake%acutex.net" Date: Wed, 30 May 2001 22:13:03 +0000 Subject: [PATCH] Bug 80388 - cvsblame shouldn't require layers for popups r=baloo --- webtools/bonsai/cvsblame.cgi | 90 +++++++++++++++++++++++++++++++----- 1 file changed, 78 insertions(+), 12 deletions(-) diff --git a/webtools/bonsai/cvsblame.cgi b/webtools/bonsai/cvsblame.cgi index 8a5cec9565c0..6ad2b971523b 100755 --- a/webtools/bonsai/cvsblame.cgi +++ b/webtools/bonsai/cvsblame.cgi @@ -76,12 +76,18 @@ my $SubHead = ''; my @src_roots = getRepositoryList(); -# Do not use layers if the client does not support them. -my $use_layers = 1; +# Layers are supported only by Netscape 4. +# The DOM standards are supported by Mozilla and IE 5 or above. It should +# also be supported by any browser claiming "Mozilla/5" or above. +my ($use_layers, $use_dom) = 0; if (defined $ENV{HTTP_USER_AGENT}) { my $user_agent = $ENV{HTTP_USER_AGENT}; - if (not $user_agent =~ m@^Mozilla/4.@ or $user_agent =~ /MSIE/) { - $use_layers = 0; + if ($user_agent =~ m@^Mozilla/4.@ && $user_agent !~ /MSIE/) { + $use_layers = 1; + } elsif ($user_agent =~ m@MSIE (\d+)@) { + $use_dom = 1 if $1 >= 5; + } elsif ($user_agent =~ m@^Mozilla/(\d+)@) { + $use_dom = 1 if $1 >= 5; } } @@ -243,6 +249,7 @@ print "$file_tail "; print " ("; print "$browse_revtag:" unless $browse_revtag eq 'HEAD'; print $revision if $revision; @@ -359,6 +366,7 @@ foreach $revision (@::revision_map) $::prev_revision{$revision} = ''; } $output .= " onmouseover='return log(event,\"$::prev_revision{$revision}\",\"$revision\");'" if $use_layers; + $output .= " onmouseover=\"showMessage('$revision','$line')\" id=\"line_$line\"" if $use_dom; $output .= ">"; my $author = $::revision_author{$revision}; $author =~ s/%.*$//; @@ -387,10 +395,10 @@ foreach $revision (@::revision_map) } print "\n"; -if ($use_layers) { +if ($use_layers || $use_dom) { # Write out cvs log messages as a JS variables - # - print ""; } @@ -512,7 +523,62 @@ initialLayer = "
__TOP__ - print '' if not $use_layers; + print <<__TOP__ if $use_dom; + + + + +__TOP__ + print '' if not ($use_layers || $use_dom); } # print_top sub print_usage {