# HG changeset patch # User devi # Date 1138313201 -7200 # Node ID 1864df6ccbfe2b22674a66f0cb83c57bc137684d # Parent c4bea959dbb1302df7bb744533cc47b6ad03db13 Новые команды дня разбиваются по секциям diff -r c4bea959dbb1 -r 1864df6ccbfe l3-frontend --- a/l3-frontend Thu Jan 26 00:00:53 2006 +0200 +++ b/l3-frontend Fri Jan 27 00:06:41 2006 +0200 @@ -22,11 +22,12 @@ our %Stat; our %CommandsFDistribution; # Сколько раз в журнале встречается какая команда +our $table_number=1; my %mywi_cache_for; # Кэш для экономии обращений к mywi sub make_comment; -sub make_new_commands_table; +sub make_new_entries_table; sub load_command_lines_from_xml; sub load_sessions_from_xml; sub sort_command_lines; @@ -173,7 +174,7 @@ $CommandsFDistribution{$command}++; if (!$Commands_Description{$command}) { $mywi_cache_for{$command} ||= mywi_client ($command) || ""; - my $mywi = join ("\n", grep(/\([18]\)/, split(/\n/, $mywi_cache_for{$command}))); + my $mywi = join ("\n", grep(/\([18]|sh|script\)/, split(/\n/, $mywi_cache_for{$command}))); $mywi =~ s/\s+/ /; if ($mywi !~ /^\s*$/) { $Commands_Description{$command} = $mywi; @@ -410,6 +411,13 @@ $Stat{ErrorCommands} ||= 0; $Stat{MistypedCommands} ||= 0; + my %new_entries_of = ( + "1" => "программы пользователя", + "8" => "программы администратора", + "sh" => "команды интерпретатора", + "script"=> "скрипты", + ); + COMMAND_LINE: for my $k (@Command_Lines_Index) { @@ -533,17 +541,22 @@ $result .= "

".$Day_Name[$last_wday]."

"; - my $new_commands_section = make_new_commands_table(\@known_commands); + + + for my $entry_class (keys %new_entries_of) { + my $new_commands_section = make_new_entries_table("$entry_class", \@known_commands); + + my $table_caption = "Таблица ".$table_number++.". Новые ".$new_entries_of{$entry_class}.". ".$Day_Name[$last_wday]; + if ($new_commands_section) { + $result .= "" + . "" + . "" + . $new_commands_section + . "
$table_caption
КомандаОписание
" + } + + } @known_commands = keys %CommandsFDistribution; - - if ($new_commands_section) { - $result .= "
Новые команды
" - . "" - . "" - . $new_commands_section - . "
КомандаОписание
" - } - $result .= "\n"; $result .= $this_day_result; $result .= "
"; @@ -636,16 +649,22 @@ $this_day_result .= "\n"; } last: { - my $new_commands_section = make_new_commands_table(\@known_commands); - @known_commands = keys %CommandsFDistribution; + $result .= "

".$Day_Name[$last_wday]."

"; - $result .= "

".$Day_Name[$last_wday]."

"; - if ($new_commands_section) { - $result .= "
Новые команды
" - . "" - . "" - . $new_commands_section - . "
КомандаОписание
" + for my $entry_class (keys %new_entries_of) { + my $new_commands_section = make_new_entries_table("$entry_class", \@known_commands); + @known_commands = keys %CommandsFDistribution; + + my $table_caption = "Таблица ".$table_number++.". Новые ".$new_entries_of{$entry_class}. ". ".$Day_Name[$last_wday]; + if ($new_commands_section) { + $result .= "" + . "" + . "" + . $new_commands_section + . "
$table_caption
КомандаОписание
" + ; + } + } $result .= "\n"; @@ -657,8 +676,9 @@ } -sub make_new_commands_table +sub make_new_entries_table { + my $entries_class = shift; my @known_commands = @{$_[0]}; my %count; @@ -677,7 +697,8 @@ for my $c (reverse sort { $CommandsFDistribution{$a} <=> $CommandsFDistribution{$b} } @new_commands) { $hint = make_comment($c); my ($command, $hint) = $hint =~ m/(.*?) \s*- \s*(.*)/; - $new_commands_section .= "" if $hint; + next unless $command =~ /\($entries_class\)/i; + $new_commands_section .= "" if $hint; } } return $new_commands_section;
$command$hint
$command$hint