lilalo

diff l3-frontend @ 154:71d6b2a6b8eb

Ветка с поддержкой sqlite в l3-agent'е
author igor@book.xt.vpn
date Mon Dec 28 22:00:37 2009 +0300 (2009-12-28)
parents 822b36252d7f
children
line diff
     1.1 --- a/l3-frontend	Tue Jun 23 01:15:02 2009 +0300
     1.2 +++ b/l3-frontend	Mon Dec 28 22:00:37 2009 +0300
     1.3 @@ -4,6 +4,7 @@
     1.4  use lib '/etc/lilalo';
     1.5  use l3config;
     1.6  use utf8;
     1.7 +no warnings;
     1.8  
     1.9  our @Command_Lines;
    1.10  our @Command_Lines_Index;
    1.11 @@ -60,6 +61,7 @@
    1.12  sub print_files_html;
    1.13  sub print_stat_html;
    1.14  sub print_header_html;
    1.15 +sub print_header2_html;
    1.16  sub print_footer_html;
    1.17  sub tigra_hints_generate;
    1.18  
    1.19 @@ -419,6 +421,7 @@
    1.20  
    1.21          my $cl = \$Command_Lines[$i];
    1.22  
    1.23 +
    1.24          # Запоминаем предыщуюу команду
    1.25          # Она нам потребуется, в частности, для ввода tab_seq рпи обработке tab_completion
    1.26          my $prev_cl;
    1.27 @@ -436,6 +439,7 @@
    1.28  
    1.29          $$cl->{id} = $$cl->{"time"};
    1.30  
    1.31 +
    1.32          $$cl->{err} ||=0;
    1.33  
    1.34  
    1.35 @@ -475,7 +479,8 @@
    1.36             $Files{$filename}->{"source_command_id"} = $$cl->{"id"}
    1.37          }
    1.38          my @lines = split '\n', $$cl->{"output"};
    1.39 -        if ((
    1.40 +        if ( !$Config{"command_id"} &&
    1.41 +             (
    1.42               $Config{"head_lines"} 
    1.43               || $Config{"tail_lines"}
    1.44               )
    1.45 @@ -484,7 +489,7 @@
    1.46              for (my $i=0; $i<= $#lines && $i < $Config{"head_lines"}; $i++) {
    1.47                  $output .= $lines[$i]."\n";
    1.48              }
    1.49 -            $output .= $Config{"skip_text"}."\n";
    1.50 +            $output .= "<a href='?command_id=".$$cl->{id}."'>".$Config{"skip_text"}."</a>\n";
    1.51  
    1.52              my $start_line=$#lines-$Config{"tail_lines"}+1;
    1.53              for (my $i=$start_line; $i<= $#lines; $i++) {
    1.54 @@ -643,6 +648,7 @@
    1.55          next if $current_command < $Config{"start_from_command"};
    1.56          last if $current_command > $Config{"start_from_command"} + $Config{"commands_to_show_at_a_go"};
    1.57  
    1.58 +        next if $Config{"command_id"} && $cl->{id} ne $Config{"command_id"};
    1.59  
    1.60  
    1.61  # Пропускаем строки, которые противоречат фильтру
    1.62 @@ -1287,19 +1293,17 @@
    1.63  
    1.64      $result = $debug_output;
    1.65      $result .= print_header_html($toc);
    1.66 -
    1.67 -
    1.68 -#    $result.= join " <br/>", keys %Sessions;
    1.69 -#    for my $sess (keys %Sessions) {
    1.70 -#            $result .= join " ", keys (%{$Sessions{$sess}});
    1.71 -#            $result .= "<br/>";
    1.72 -#    }
    1.73 -
    1.74 -    $result.= "<h2 id='log'>Журнал</h2>"       . $command_lines;
    1.75 -    $result.= "<h2 id='files'>Файлы</h2>"      . $files_section if $files_section;
    1.76 -    $result.= "<h2 id='stat'>Статистика</h2>"  . print_stat_html;
    1.77 -    $result.= "<h2 id='help'>Справка</h2>"     . $Html_Help . "<br/>"; 
    1.78 -    $result.= "<h2 id='about'>О программе</h2>". $Html_About. "<br/>"; 
    1.79 +    if ($Config{"command_id"}) {
    1.80 +        $result .= $command_lines;
    1.81 +    }
    1.82 +    else {
    1.83 +        $result .= print_header2_html($toc);
    1.84 +        $result.= "<h2 id='log'>Журнал</h2>"       . $command_lines;
    1.85 +        $result.= "<h2 id='files'>Файлы</h2>"      . $files_section if $files_section;
    1.86 +        $result.= "<h2 id='stat'>Статистика</h2>"  . print_stat_html;
    1.87 +        $result.= "<h2 id='help'>Справка</h2>"     . $Html_Help . "<br/>"; 
    1.88 +        $result.= "<h2 id='about'>О программе</h2>". $Html_About. "<br/>"; 
    1.89 +    }
    1.90      $result.= print_footer_html;
    1.91  
    1.92      if ($output_filename eq "-") {
    1.93 @@ -1324,6 +1328,55 @@
    1.94  
    1.95  sub print_header_html
    1.96  {
    1.97 +    my $tigra_hints_array=tigra_hints_generate;
    1.98 +
    1.99 +    my $result;
   1.100 +    $result = <<HEADER;
   1.101 +    <html>
   1.102 +    <head>
   1.103 +    <meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
   1.104 +    <link rel='stylesheet' href='$Config{frontend_css}' type='text/css'/>
   1.105 +    <title>$title</title>
   1.106 +    </head>
   1.107 +    <body>
   1.108 +    <!--<script>
   1.109 +    $Html_JavaScript
   1.110 +    </script>-->
   1.111 +
   1.112 +<!-- vvv Tigra Hints vvv -->
   1.113 +<script language="JavaScript" src="/tigra/hints.js"></script>
   1.114 +<!--<script language="JavaScript" src="/tigra/hints_cfg.js"></script>-->
   1.115 +<script>$tigra_hints_array</script>
   1.116 +<style>
   1.117 +/* a class for all Tigra Hints boxes, TD object */
   1.118 +    .hintsClass
   1.119 +        {text-align: left; font-size:80%; font-family: Verdana, Arial, Helvetica; background-color:#ffffee; padding: 0px 0px 0px 0px;}
   1.120 +/* this class is used by Tigra Hints wrappers */
   1.121 +    .row
   1.122 +        {background: white;}
   1.123 +
   1.124 +
   1.125 +    .bl2 {border: 1px solid #e68200; background:url(/tigra/block/bl2.gif) 0 100% no-repeat; text-align:left}
   1.126 +    .bl {background:url(/tigra/block/bl2.gif) 0 100% no-repeat; text-align:left}
   1.127 +    .br {background:url(/tigra/block/br2.gif) 100% 100% no-repeat}
   1.128 +    .tl {background:url(/tigra/block/tl2.gif) 0 0 no-repeat}
   1.129 +    .tr {background:url(/tigra/block/tr2.gif) 100% 0 no-repeat; padding:10px}
   1.130 +    .tr2 {background:url(/tigra/block/tr2.gif) 100% 0 no-repeat}
   1.131 +    .t {background:url(/tigra/block/dot2.gif) 0 0 repeat-x}
   1.132 +    .b {background:url(/tigra/block/dot2.gif) 0 100% repeat-x}
   1.133 +    .l {background:url(/tigra/block/dot2.gif) 0 0 repeat-y}
   1.134 +    .r {background:url(/tigra/block/dot2.gif) 100% 0 repeat-y}
   1.135 +
   1.136 +
   1.137 +</style>
   1.138 +<!-- ^^^ Tigra Hints ^^^ -->
   1.139 +HEADER
   1.140 +    return $result;
   1.141 +}
   1.142 +
   1.143 +sub print_header2_html
   1.144 +{
   1.145 +    my $result ="";
   1.146      my $toc = $_[0];
   1.147      my $course_name = $Config{"course-name"};
   1.148      my $course_code = $Config{"course-code"};
   1.149 @@ -1364,63 +1417,8 @@
   1.150      # Она слишком сильно мешает, нужно что-то переделать
   1.151      $control_form = "";
   1.152  
   1.153 -    my $tigra_hints_array=tigra_hints_generate;
   1.154  
   1.155 -    my $result;
   1.156 -    $result = <<HEADER;
   1.157 -    <html>
   1.158 -    <head>
   1.159 -    <meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
   1.160 -    <link rel='stylesheet' href='$Config{frontend_css}' type='text/css'/>
   1.161 -    <title>$title</title>
   1.162 -    </head>
   1.163 -    <body>
   1.164 -    <!--<script>
   1.165 -    $Html_JavaScript
   1.166 -    </script>-->
   1.167 -
   1.168 -<!-- vvv Tigra Hints vvv -->
   1.169 -<script language="JavaScript" src="/tigra/hints.js"></script>
   1.170 -<!--<script language="JavaScript" src="/tigra/hints_cfg.js"></script>-->
   1.171 -<script>$tigra_hints_array</script>
   1.172 -<style>
   1.173 -/* a class for all Tigra Hints boxes, TD object */
   1.174 -    .hintsClass
   1.175 -        {text-align: left; font-size:80%; font-family: Verdana, Arial, Helvetica; background-color:#ffffee; padding: 0px 0px 0px 0px;}
   1.176 -/* this class is used by Tigra Hints wrappers */
   1.177 -    .row
   1.178 -        {background: white;}
   1.179 -
   1.180 -
   1.181 -    .bl2 {border: 1px solid #e68200; background:url(/tigra/block/bl2.gif) 0 100% no-repeat; text-align:left}
   1.182 -    .bl {background:url(/tigra/block/bl2.gif) 0 100% no-repeat; text-align:left}
   1.183 -    .br {background:url(/tigra/block/br2.gif) 100% 100% no-repeat}
   1.184 -    .tl {background:url(/tigra/block/tl2.gif) 0 0 no-repeat}
   1.185 -    .tr {background:url(/tigra/block/tr2.gif) 100% 0 no-repeat; padding:10px}
   1.186 -    .tr2 {background:url(/tigra/block/tr2.gif) 100% 0 no-repeat}
   1.187 -    .t {background:url(/tigra/block/dot2.gif) 0 0 repeat-x}
   1.188 -    .b {background:url(/tigra/block/dot2.gif) 0 100% repeat-x}
   1.189 -    .l {background:url(/tigra/block/dot2.gif) 0 0 repeat-y}
   1.190 -    .r {background:url(/tigra/block/dot2.gif) 100% 0 repeat-y}
   1.191 -
   1.192 -
   1.193 -</style>
   1.194 -<!-- ^^^ Tigra Hints ^^^ -->
   1.195 -
   1.196 -<!--
   1.197 -    .bl2 {border: 1px solid #e68200; background:url(/tigra/block/bl2.gif) 0 100% no-repeat; width:20em; text-align:center}
   1.198 -    .bl {background:url(/tigra/block/bl2.gif) 0 100% no-repeat; width:20em; text-align:center}
   1.199 -    .br {background:url(/tigra/block/br2.gif) 100% 100% no-repeat}
   1.200 -    .tl {background:url(/tigra/block/tl2.gif) 0 0 no-repeat}
   1.201 -    .tr {background:url(/tigra/block/tr2.gif) 100% 0 no-repeat; padding:10px}
   1.202 -    .tr2 {background:url(/tigra/block/tr2.gif) 100% 0 no-repeat}
   1.203 -    .t {background:url(/tigra/block/dot2.gif) 0 0 repeat-x; width:20em}
   1.204 -    .b {background:url(/tigra/block/dot2.gif) 0 100% repeat-x}
   1.205 -    .l {background:url(/tigra/block/dot2.gif) 0 0 repeat-y}
   1.206 -    .r {background:url(/tigra/block/dot2.gif) 100% 0 repeat-y}
   1.207 --->
   1.208 -
   1.209 -
   1.210 +    $result .= <<HEADER;
   1.211      <div class='edit_link'>
   1.212      [ <a href='?filter=action::edit;;$filter_url'>править</a> ]
   1.213      </div>