From b8465474ad9cc187ba020b16609ff6a1933d4e17 Mon Sep 17 00:00:00 2001 From: "bbaetz%student.usyd.edu.au" <> Date: Tue, 7 May 2002 16:14:35 +0000 Subject: Bug 134571 - client-side image maps in showdependencygraph.cgi Patch by zeroJ@null.net (John Vandenberg), r=bbaetz, justdave --- showdependencygraph.cgi | 24 ++++++++++++++++++++-- template/en/default/bug/dependency-graph.html.tmpl | 16 +++++++++++---- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/showdependencygraph.cgi b/showdependencygraph.cgi index dbde0edc8..4df71ac49 100755 --- a/showdependencygraph.cgi +++ b/showdependencygraph.cgi @@ -37,6 +37,26 @@ use vars qw($template $vars $userid $usergroupset); my %seen; my %edgesdone; +sub CreateImagemap { + my $mapfilename = shift; + my $map = "\n"; + my $default; + + open MAP, "<$mapfilename"; + while(my $line = ) { + if($line =~ /^default ([^ ]*)(.*)$/) { + $default = qq{\n}; + } + if ($line =~ /^rectangle \((.*),(.*)\) \((.*),(.*)\) (http[^ ]*)(.*)?$/) { + $map .= qq{\n}; + } + } + close MAP; + + $map .= "$default"; + return $map; +} + sub AddLink { my ($blocked, $dependson) = (@_); my $key = "$blocked,$dependson"; @@ -162,9 +182,9 @@ if ($webdotbase =~ /^https?:/) { my $pngfilename = "data/webdot/$$.png"; my $mapfilename = "data/webdot/$$.map"; system("$webdotbase","-Tpng","-o","$pngfilename","$filename"); - system("$webdotbase","-Timap","-o","$mapfilename","$filename"); $vars->{'image_url'} = $pngfilename; - $vars->{'map_url'} = $mapfilename; + system("$webdotbase","-Tismap","-o","$mapfilename","$filename"); + $vars->{'image_map'} = CreateImagemap($mapfilename); } # Cleanup any old .dot files created from previous runs. diff --git a/template/en/default/bug/dependency-graph.html.tmpl b/template/en/default/bug/dependency-graph.html.tmpl index 93c515bd8..3266f5fd7 100644 --- a/template/en/default/bug/dependency-graph.html.tmpl +++ b/template/en/default/bug/dependency-graph.html.tmpl @@ -27,7 +27,9 @@ # rankdir: string. "TB" if we are ranking top-to-bottom, "LR" if left-to-right. # image_url: string. The URL of the graphic showing the dependencies. - # map_url: string. The URL of the map file for the image. + # map_url: string. The URL of the map file for the image. (Optional) + # image_map: string. The image map for the graphic showing the + dependencies. (Optional) #%] [% title = "Dependency Graph" @@ -42,13 +44,19 @@ [% PROCESS global/header.html.tmpl %] +[% image_map %] +

Green circles represent open bugs.

- - - +[% IF image_map %] + +[% ELSE %] + + + +[% END %]
-- cgit v1.2.3-24-g4f1b