/[pxelator]/lib/PXElator/httpd.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/PXElator/httpd.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 140 by dpavlin, Tue Aug 4 17:16:11 2009 UTC revision 149 by dpavlin, Wed Aug 5 13:25:55 2009 UTC
# Line 18  use File::Slurp; Line 18  use File::Slurp;
18  #use JSON;  #use JSON;
19  use IO::Socket::INET;  use IO::Socket::INET;
20    
21    sub menu {qq{
22    
23    <div style="font-size: 80%; color: #888">
24    <a href=/>home</a>
25    <a href=/server>server</a>
26    </div>
27    
28    }}
29    
30  our $pids;  our $pids;
31  $pids = { httpd => $$ } unless defined $pids; # keep pids on refresh  $pids = { httpd => $$ } unless defined $pids; # keep pids on refresh
32    
# Line 149  sub get_request { Line 158  sub get_request {
158                                           $pids->{screen} ? qq|start|                                                    : qq|start screen first|;                                           $pids->{screen} ? qq|start|                                                    : qq|start screen first|;
159    
160                  my @rows = (                  my @rows = (
                         'ip',           html::tt( $server::ip ),  
                         'netmask',      html::tt( $server::netmask ),  
   
161                          'debug',        qq|<a href=/our/debug/| . boolean::toggle($debug) . qq|>$debug</a>|,                          'debug',        qq|<a href=/our/debug/| . boolean::toggle($debug) . qq|>$debug</a>|,
162                  );                  );
163    
# Line 204  sub get_request { Line 210  sub get_request {
210                  }                  }
211    
212                  print $client $ok                  print $client $ok
213                            , menu()
214                          , html::table( 2, @rows )                          , html::table( 2, @rows )
215                          , $below_table                          , $below_table
216                          , html::tabs( log::mac_changes )                          , html::tabs( log::mac_changes )
217                          , $debug_proc                          , $debug_proc
218                          ;                          ;
219    
220            } elsif ( $path =~ m{^/server} ) {
221                    print $client $ok
222                            , menu()
223                            , html::table( 2, map { ( $_, eval '$server::'.$_ ) } ( 'ip', 'netmask', 'ip_from', 'ip_to', 'domain_name', 'base_dir' ) )
224                            ;
225          } elsif ( $path =~ m{^/our/(\w+)/(\S+)} ) {          } elsif ( $path =~ m{^/our/(\w+)/(\S+)} ) {
226                  eval 'our $' . $1 . ' = ' . $2;                  eval 'our $' . $1 . ' = ' . $2;
227                  warn $@ if $@;                  warn $@ if $@;
# Line 283  sub start { Line 295  sub start {
295                          warn "500 $request";                          warn "500 $request";
296                  }                  }
297    
298                  print $client qq{                  print $client menu() if $client->connected;
                 <div style="font-size: 80%; color: #888">  
                 <a href="">reload</a>  
                 <a href=/>index</a>  
                 <a href=/exit>exit</a>  
                 </div>  
                 } if $client->connected;  
299    
300          }          }
301    

Legend:
Removed from v.140  
changed lines
  Added in v.149

  ViewVC Help
Powered by ViewVC 1.1.26