Revision 241

Date:
2009/11/26 15:22:12
Author:
dpavlin
Revision Log:
show results <h1> only if there is reasults and include gnuplot for date, keys
Files:

Legend:

 
Added
 
Removed
 
Modified
  • trunk/lib/Sack/Server.pm

     
    19 19 use Sack::Merge;
    20 20 use Sack::Server::HTTP;
    21 21 use Sack::Server::HTML;
    22 use Sack::Server::Gnuplot;
    22 23
    23 24 my @cloud;
    24 25 my $cloud_path = $ENV{CLOUD} || "etc/cloud";
     
    139 140 print $send "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n";
    140 141 Sack::Server::HTML::send_out( $send, Sack::Merge->out, $1, $param );
    141 142 return 1;
    143 } elsif ( $method =~ m{^/gnuplot} ) {
    144 eval {
    145 my $path = Sack::Server::Gnuplot::date( Sack::Merge->out );
    146 if ( -e $path ) {
    147 print $send "HTTP/1.0 200 OK\r\nContent-Type: image/png\r\n\r\n";
    148 open(my $fh, '<', $path) || die $path;
    149 my $b;
    150 while ( read($fh, $b, 4096) ) {
    151 print $send $b;
    152 }
    153 return 1;
    154 }
    155 };
    156 warn "ERROR: $@" if $@;
    142 157 }
    143 158
    144 159 print $send "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n";
     
    211 226 ;
    212 227
    213 228 my $out = Sack::Merge->out;
    214 print $send qq|<h1>Results</h1><ul>|
    215 , join("\n", map { qq|<li><a href="/out/$_" target="$_">$_</a>| } keys %$out )
    216 , qq|</ul>|
    217 ;
    229 if ( my $li = join("\n", map { qq|<li><a href="/out/$_" target="$_">$_</a>| } keys %$out ) ) {
    230 print $send qq|<h1>Results</h1><ul>$li</ul><img src="/gnuplot/">\n|;
    231 }
    218 232
    219 233 print $send qq|<h1>Nodes</h1>
    220 234 |, join("\n", map {