]> git.donarmstrong.com Git - debbugs.git/blobdiff - cgi/version.cgi
Merge changes from the dla source tree
[debbugs.git] / cgi / version.cgi
index 338075f985cea9e87c73d08c80ca0b2e08f6e7dc..105111a351d4bd880cae056f78a237f99df1f627 100755 (executable)
@@ -34,12 +34,14 @@ my %img_types = (svg => 'image/svg+xml',
 my $q = new CGI::Simple;
 
 my %cgi_var = cgi_parameters(query   => $q,
-                            single  => [qw(package format ignore_boring)],
+                            single  => [qw(package format ignore_boring width height)],
                             default => {package       => 'xterm',
                                         found         => [],
                                         fixed         => [],
                                         ignore_boring => 1,
                                         format        => 'png',
+                                        width         => undef,
+                                        height        => undef,
                                        },
                            );
 
@@ -54,6 +56,24 @@ for my $dist (@{$config{distributions}}) {
          push @{$version_to_dist{$version}}, $dist;
      }
 }
+
+if (defined $cgi_var{width}) {
+     $cgi_var{width} =~ /(\d+)/;
+     $cgi_var{width} = $1;
+}
+if (defined $cgi_var{height}) {
+     $cgi_var{height} =~ /(\d+)/;
+     $cgi_var{height} = $1;
+}
+
+if (defined $cgi_var{format}) {
+     $cgi_var{format} =~ /(png|svg|jpg|gif)/;
+     $cgi_var{format} = $1 || 'png';
+}
+else {
+     $cgi_var{format} = 'png';
+}
+
 # then figure out which are affected.
 # turn found and fixed into full versions
 @{$cgi_var{found}} = makesourceversions($cgi_var{package},undef,@{$cgi_var{found}});
@@ -96,6 +116,9 @@ for my $found_fixed (qw(found fixed)) {
 my %all_states = $version->allstates($cgi_var{found},$cgi_var{fixed});
 
 my $dot = "digraph G {\n";
+if (defined $cgi_var{width} and defined $cgi_var{height}) {
+     $dot .= qq(size="$cgi_var{width},$cgi_var{height}";\n);
+}
 my %state = (found  => ['fillcolor="salmon"',
                        'style="filled"',
                        'shape="diamond"',
@@ -108,6 +131,8 @@ my %state = (found  => ['fillcolor="salmon"',
                        'shape="rect"',
                       ],
            );
+# TODO: Allow collapsing versions which are at the same state and not
+# in a suite.
 foreach my $key (keys %all_states) {
      my ($short_version) = $key =~ m{/(.+)$};
      next if $cgi_var{ignore_boring} and (not defined $all_states{$key}