add dynamic part of cropper CGIs
[os-autoinst:opensuse.git] / www / cgi-bin / viewimg
1 #!/usr/bin/perl -w
2 use strict;
3 use CGI ":standard";
4 use lib "/srv/www/cgi-bin/modules";
5 use awstandard;
6 #use sort_table;
7 use openqa;
8
9 my $name=$ENV{PATH_INFO};
10 if($name=~m/\.\./) {print header(-status=>403)."invalid path"; exit 0; }
11 $name=~s/\.png$//;
12 $name=~s/\.jpg$//;
13
14 $name=~s/^opensuse\///;
15 $name=~s/^\/opensuse\//\//;
16
17 my $fullname="/space/geekotest/opensuse/$name.ppm";
18 if (!-e $fullname) {print header(-status=>404)."file not found".$fullname; exit 0; }
19 my(undef,undef,$testrun,$testname) = split(/\//, $name);
20
21 my ($header,$footer)=get_header_footer(qq{View Image &gt; <a href="/results/$testrun">$testrun</a> &gt; $testname});
22 $header=~s{<!-- DEFSTYLE_START}{};
23 $header=~s{DEFSTYLE_END -->}{};
24 $header=~s{FLUIDSTYLE_START -->}{};
25 $header=~s{<!-- FLUIDSTYLE_END}{};
26 $header=~s{container_12}{container_16};
27 $header=~s{container_16}{container_16};
28 $header=~s{grid_9}{grid_16};
29 print header("text/html").
30 $header.
31 '
32 <div id="content" class="container_16 content-wrapper">
33   <div class="grid_2 box box-shadow alpha" id="cropdetails_box">
34     <div class="box-header aligncenter">Actions</div>
35     <div class="aligncenter">
36       <a href="/cropimg/'.$name.'.png"><img src="/images/edit.png" alt="crop" title="Crop Image" /></a> 
37       <a href="/results/'.$testrun.'"><img src="/images/back.png" alt="back" title="back to overview page" /></a> 
38     </div>
39   </div>
40
41   <div class="grid_14 box box-shadow omega">
42     <div style="margin: 0 10px;">
43       <a href="/opensuse/'.$name.'.png"><img src="/opensuse/'.$name.'.jpg" width="800" height="600" alt="'.$testname.'" /></a>
44     </div>
45   </div>
46
47 </div>
48 '.
49 $footer;
50