lilalo

diff l3-cgi-lite @ 152:a2bd59599719

см. предыдущий коммит
author igor@chub.in
date Tue Jun 23 01:24:33 2009 +0300 (2009-06-23)
parents 51a232faeb27
children
line diff
     1.1 --- a/l3-cgi-lite	Wed Jul 23 00:41:26 2008 +0300
     1.2 +++ b/l3-cgi-lite	Tue Jun 23 01:24:33 2009 +0300
     1.3 @@ -6,7 +6,8 @@
     1.4  
     1.5  BEGIN {
     1.6      chdir("/etc/lilalo/");
     1.7 -    require l3config;
     1.8 +    require "/etc/lilalo/l3config.pm"
     1.9 +        or die " Can't open l3config.pm ";
    1.10      l3config::init_config();
    1.11  };
    1.12  
    1.13 @@ -27,10 +28,12 @@
    1.14  my $commands_to_show_at_a_go = $l3config::Config{"commands_to_show_at_a_go"};
    1.15  my $start_from_command = "0";
    1.16  my $this_page_number=0;
    1.17 +my $page_id;
    1.18  if ($path =~ s/:(.*)//) {
    1.19      $this_page_number = $1;
    1.20      $start_from_command = $this_page_number*$commands_to_show_at_a_go;
    1.21  }
    1.22 +$page_id=$this_page_number;
    1.23  
    1.24  my $real_path = $l3config::Config{"backend_datadir"} ;
    1.25  my $cgi_path = $l3config::Config{"cgi_path"} ;
    1.26 @@ -38,6 +41,10 @@
    1.27  my $frontend_css = $l3config::Config{"frontend_css"} ;
    1.28  
    1.29  my $filter=$ENV{QUERY_STRING};
    1.30 +if ($filter =~ s@command_id=([0-9]+)@@){
    1.31 +   $l3config::Config{"command_id"}=$1;
    1.32 +   $page_id=$1;
    1.33 +}
    1.34  if ($filter =~ /page=([^&]*)/ ) {
    1.35      open(PAGE_NAME, "grep $1 $real_path/sessions-index | tail -1 | sed 's^-<.*^^; s^/[^/]*\$^^'| ");
    1.36      my $page_name;
    1.37 @@ -84,11 +91,18 @@
    1.38  
    1.39      unless ( -e "$real_path/$data_file"
    1.40               && -e "$real_path/index.html" 
    1.41 -             && (stat("$real_path/index.html"))[9] > (stat("$real_path/$data_file"))[9] && 0!=0 ) {
    1.42 +             && (stat("$real_path/index$page_id.html"))[9] > (stat("$real_path/$data_file"))[9]) {
    1.43  
    1.44 +        my $fragment_options;
    1.45 +        if ($l3config::Config{"command_id"}) {
    1.46 +            $fragment_options = " --command_id ".$l3config::Config{"command_id"};
    1.47 +        }
    1.48 +        else {
    1.49 +            $fragment_options = " --start_from_command $start_from_command ";
    1.50 +        }
    1.51          my $l3_frontend = "l3-frontend --backend_datafile $real_path/$data_file".
    1.52 -                                     " --output $real_path/index.html".
    1.53 -                                     " --start_from_command $start_from_command ".
    1.54 +                                     $fragment_options.
    1.55 +                                     " --output $real_path/index$page_id.html".
    1.56                                       " --filter '$filter'";
    1.57          system($l3_frontend) == 0
    1.58              or error("Файл журнала найден, но возникла ошибка при его обработке:<br/> $!");
    1.59 @@ -96,7 +110,7 @@
    1.60  
    1.61      {
    1.62          local $/;
    1.63 -        open(HTML, "<:utf8", "$real_path/index.html");
    1.64 +        open(HTML, "<:utf8", "$real_path/index$page_id.html");
    1.65          my $html = <HTML>;
    1.66  
    1.67  # Добавим в начало документа навигационную строку