lilalo

diff l3-frontend @ 64:3326053f9b23

Порядок таблиц в начале дня; интервалы бездействия
author devi
date Fri Jan 27 09:04:44 2006 +0200 (2006-01-27)
parents 1864df6ccbfe
children 563e3ee69ce8
line diff
     1.1 --- a/l3-frontend	Fri Jan 27 00:06:41 2006 +0200
     1.2 +++ b/l3-frontend	Fri Jan 27 09:04:44 2006 +0200
     1.3 @@ -412,10 +412,10 @@
     1.4      $Stat{MistypedCommands} ||= 0;
     1.5  
     1.6      my %new_entries_of = (
     1.7 -        "1"     =>   "программы пользователя",
     1.8 -        "8"     =>   "программы администратора",
     1.9 -        "sh"    =>   "команды интерпретатора",
    1.10 -        "script"=>   "скрипты",
    1.11 +        "1 1"     =>   "программы пользователя",
    1.12 +        "2 8"     =>   "программы администратора",
    1.13 +        "3 sh"    =>   "команды интерпретатора",
    1.14 +        "4 script"=>   "скрипты",
    1.15      );
    1.16  
    1.17  COMMAND_LINE:
    1.18 @@ -431,16 +431,6 @@
    1.19  
    1.20          next if $Stat{LastCommand} == $cl->{time};
    1.21  
    1.22 -# Набираем статистику
    1.23 -# Хэш %Stat
    1.24 -
    1.25 -        $Stat{FirstCommand} = $cl->{time} unless $Stat{FirstCommand};
    1.26 -        if ($cl->{time} - $Stat{LastCommand} < $Config{stat_inactivity_interval}) {
    1.27 -            $Stat{TotalTime} += $cl->{time} - $Stat{LastCommand}
    1.28 -        }
    1.29 -        $Stat{LastCommand} = $cl->{time};
    1.30 -        $Stat{TotalCommands}++;
    1.31 -
    1.32  # Пропускаем строки, которые противоречат фильтру
    1.33  # Если у нас недостаточно информации о том, подходит строка под  фильтр или нет, 
    1.34  # мы её выводим
    1.35 @@ -456,6 +446,18 @@
    1.36                  && $Sessions{$cl->{local_session_id}}->{$filter_key} ne $filter{$filter_key};
    1.37          }
    1.38  
    1.39 +# Набираем статистику
    1.40 +# Хэш %Stat
    1.41 +
    1.42 +        $Stat{FirstCommand} = $cl->{time} unless $Stat{FirstCommand};
    1.43 +        if ($cl->{time} - $Stat{LastCommand} < $Config{stat_inactivity_interval}) {
    1.44 +            $Stat{TotalTime} += $cl->{time} - $Stat{LastCommand}
    1.45 +        }
    1.46 +        my $seconds_since_last_command = $cl->{time} - $Stat{LastCommand};
    1.47 +        $Stat{LastCommand} = $cl->{time};
    1.48 +        $Stat{TotalCommands}++;
    1.49 +
    1.50 +
    1.51  # Пропускаем строки, выходящие за границу "signature",
    1.52  # при условии, что границы указаны
    1.53  # Пропускаем неправильные/прерванные/другие команды
    1.54 @@ -543,14 +545,14 @@
    1.55  
    1.56  
    1.57  
    1.58 -                for my $entry_class (keys %new_entries_of) {
    1.59 -                    my $new_commands_section = make_new_entries_table("$entry_class", \@known_commands);
    1.60 +                for my $entry_class (sort keys %new_entries_of) {
    1.61 +                    my $new_commands_section = make_new_entries_table($entry_class=~/[0-9]+\s+(.*)/, \@known_commands);
    1.62  
    1.63 -                    my $table_caption = "Таблица ".$table_number++.". Новые ".$new_entries_of{$entry_class}.". ".$Day_Name[$last_wday];
    1.64 +                    my $table_caption = "Таблица ".$table_number++.". ".$Day_Name[$last_wday].". Новые ".$new_entries_of{$entry_class};
    1.65                      if ($new_commands_section) {
    1.66 -                        $result .= "<table class='new_commands_table'>"
    1.67 +                        $result .= "<table class='new_commands_table' width='100%'>"
    1.68                                  .  "<tr class='new_commands_caption'><td colspan='2' align='right'>$table_caption</td></tr>"
    1.69 -                                .  "<tr class='new_commands_header'><td>Команда</td><td>Описание</td></tr>"
    1.70 +                                .  "<tr class='new_commands_header'><td width=100>Команда</td><td>Описание</td></tr>"
    1.71                                  .  $new_commands_section 
    1.72                                  .  "</table>"
    1.73                      }
    1.74 @@ -567,6 +569,21 @@
    1.75              $last_wday=$wday;
    1.76              $this_day_result = q();
    1.77          }
    1.78 +        elsif ($seconds_since_last_command > 600) {
    1.79 +            my $height = $seconds_since_last_command > 1200 ? 100: 60;
    1.80 +            my $minutes_passed =  int($seconds_since_last_command/60);
    1.81 +            my $minutes_word = $minutes_passed % 10 == 1 ? "минута":
    1.82 +                               $minutes_passed % 10 == 0 ? "минут" :
    1.83 +                               $minutes_passed % 10  > 4 ? "минут" :
    1.84 +                                                           "минуты";
    1.85 +
    1.86 +            $this_day_result .= "<tr height='60'>"
    1.87 +                             .  "<td colspan='4' height='$height'>"
    1.88 +                             .  "<font size='-1'>"
    1.89 +                             .  "прошло ".$minutes_passed." ".$minutes_word
    1.90 +                             .  "</font>"
    1.91 +                             .  "</td></tr>\n";
    1.92 +        }
    1.93  
    1.94          $this_day_result .= "<tr class='command'>\n";
    1.95                          
    1.96 @@ -587,6 +604,9 @@
    1.97                   ? "<td valign='top' class='time' width='$Config{time_width}'>$hour:$min:$sec</td>"
    1.98                   : "<td width='0'/>";
    1.99  
   1.100 +# CLASS
   1.101 +        $this_day_result .= "<td width='20' valign='top'>F</td>";
   1.102 +
   1.103  # COMMAND
   1.104          my $hint = make_comment($cl->{"cline"});
   1.105  
   1.106 @@ -697,7 +717,7 @@
   1.107          for my $c (reverse sort { $CommandsFDistribution{$a} <=> $CommandsFDistribution{$b} } @new_commands) {
   1.108                  $hint = make_comment($c);
   1.109                  my ($command, $hint) = $hint =~ m/(.*?) \s*- \s*(.*)/;
   1.110 -                next unless $command =~ /\($entries_class\)/i;
   1.111 +                next unless $command =~ s/\($entries_class\)//i;
   1.112                  $new_commands_section .= "<tr><td valign='top'>$command</td><td>$hint</td></tr>"  if $hint;
   1.113          }
   1.114      }