# HG changeset patch # User devi # Date 1138731534 -7200 # Node ID 1e1422588716b47381efefd475af2cdf8b84fa93 # Parent 8c3d80c4891be0f9512548b352319bc01eff2747 l3-agent, l3-frontend: 1) Добавилась поддержка автоматического выкусывания файлов. По-видимому нужно сделать чтобы автоматически вы журнале показывались только самые вкусные файлы, отмеченные знаком #! Остальные же чтобы можно было посмотреть по ссылке 2) Форма управления видимостью элементов находится в правом верхнем углу экрана, и не прокручивается по мере прокрутки журнала. Надо ещё будет сделать чтобы можно было её прятать. lm: Добавил lm show email diff -r 8c3d80c4891b -r 1e1422588716 l3-agent --- a/l3-agent Sat Jan 28 09:00:25 2006 +0200 +++ b/l3-agent Tue Jan 31 20:18:54 2006 +0200 @@ -488,7 +488,10 @@ # Вырезаем из вывода только нужное количество строк my $output=""; - if ($Config{"head_lines"} || $Config{"tail_lines"}) { + + if (!grep ($_ eq $cl{"last_command"}, @{$Config{"full_output_commands"}}) + && ($Config{"head_lines"} + || $Config{"tail_lines"})) # Partialy output my @lines = split '\n', $cl->{"output"}; # head diff -r 8c3d80c4891b -r 1e1422588716 l3-frontend --- a/l3-frontend Sat Jan 28 09:00:25 2006 +0200 +++ b/l3-frontend Tue Jan 31 20:18:54 2006 +0200 @@ -12,6 +12,8 @@ our $Mywi_Socket; our %Sessions; +our %Files; + # vvv Инициализация переменных выполняется процедурой init_variables our @Day_Name; our @Month_Name; @@ -38,6 +40,7 @@ sub print_all; sub print_command_lines; +sub print_files; sub print_stat; sub print_header; sub print_footer; @@ -498,8 +501,16 @@ # и нижних строк, # если эти параметры существуют + if ($cl->{"last_command"} eq "cat" && !$cl->{"err"} && !($cl->{"cline"} =~ /{"cline"}; + $filename =~ s/.*\s+(\S+)\s*$/$1/; + $Files{$filename} = $cl->{"output"}; + } my @lines = split '\n', $cl->{"output"}; - if (($Config{"head_lines"} || $Config{"tail_lines"}) + if (( + $Config{"head_lines"} + || $Config{"tail_lines"} + ) && $#lines > $Config{"head_lines"} + $Config{"tail_lines"} ) { for (my $i=0; $i<= $#lines && $i < $Config{"head_lines"}; $i++) { @@ -513,7 +524,7 @@ } } else { - $output .= $cl->{"output"}; + $ output .= $cl->{"output"}; } # @@ -737,9 +748,10 @@ my $hint; for my $c (reverse sort { $CommandsFDistribution{$a} <=> $CommandsFDistribution{$b} } @new_commands) { $hint = make_comment($c); + next unless $hint; my ($command, $hint) = $hint =~ m/(.*?) \s*- \s*(.*)/; next unless $command =~ s/\($entries_class\)//i; - $new_commands_section .= "$command$hint" if $hint; + $new_commands_section .= "$command$hint"; } } return $new_commands_section; @@ -761,9 +773,11 @@ my $result; my ($command_lines,$toc) = print_command_lines; + my $files_section = print_files; $result = print_header($toc); $result.= "

Журнал

" . $command_lines; + $result.= "

Файлы

" . $files_section if $files_section; $result.= "

Статистика

" . print_stat; $result.= "

Справка

" . $Html_Help . "
"; $result.= "

О программе

". $Html_About. "
"; @@ -810,16 +824,20 @@ } # Управляющая форма - my $control_form .= "
Видимые элементы
\n"; - for my $element (keys %Elements_Visibility) + my $control_form .= "
" + . "Видимые элементы" + . "_ x" + . "
\n"; + for my $element (sort keys %Elements_Visibility) { - my @e = split /\s+/, $element; + my ($skip, @e) = split /\s+/, $element; my $showhide = join "", map { "ShowHide('$_');" } @e ; - $control_form .= "". + $control_form .= "
". $Elements_Visibility{$element}. - "
\n"; + "
"; } - $control_form .= "
\n"; + $control_form .= "\n" + . "\n"; my $result; $result = <
  • Журнал
  • +
  • Файлы
  • Статистика
  • Справка
  • О программе
  • @@ -1028,6 +1047,19 @@ } +sub print_files +{ + my $result = qq(); + my @toc; + for my $file (sort keys %Files) { + my $div_id = $file; + $div_id =~ s@/@_@g; + push @toc, "$file"; + $result .= "
    ".$file."
    \n" + . "
    ".$Files{$file}."
    "; + } + return "
    ".collapse_list(\@toc)."
    ".$result; +} sub init_variables @@ -1053,9 +1085,9 @@ @@ -1069,7 +1101,7 @@
    -
    +
     \$ l s-l
    -
    bash: l: command not found
    +
    bash: l: command not found
     
    @@ -1085,7 +1117,7 @@
    -
    +
     \$ test 5 -lt 4
    -
    +
     \$ find / -name abc
    find: /home/devi-orig/.gnome2: Keine Berechtigung
     find: /home/devi-orig/.gnome2_private: Keine Berechtigung
    @@ -1266,7 +1298,7 @@
         

    LiLaLo (L3) расшифровывается как Live Lab Log.
    Программа разработана для повышения эффективности обучения Unix/Linux-системам.
    - (c) Игорь Чубин, 2004-2005
    + (c) Игорь Чубин, 2004-2006

    ABOUT $Html_About.='$Id$

    '; @@ -1337,15 +1369,17 @@ ); %Elements_Visibility = ( - "note" => "замечания", - "diff" => "редактор", - "time" => "время", - "ttychange" => "терминал", - "wrong_output wrong_cline wrong_root_output wrong_root_cline" - => "команды с ошибками", - "interrupted_output interrupted_cline interrupted_root_output interrupted_root_cline" + "0 new_commands_table" => "новые команды", + "1 diff" => "редактор", + "2 time" => "время", + "3 ttychange" => "терминал", + "4 wrong_output wrong_cline wrong_root_output wrong_root_cline" + => "команды с ненулевым кодом завершения", + "5 mistyped_output mistyped_cline mistyped_root_output mistyped_root_cline" + => "неверно набранные команды", + "6 interrupted_output interrupted_cline interrupted_root_output interrupted_root_cline" => "прерванные команды", - "tab_completion_output tab_completion_cline" + "7 tab_completion_output tab_completion_cline" => "продолжение с помощью tab" ); diff -r 8c3d80c4891b -r 1e1422588716 l3config.pm --- a/l3config.pm Sat Jan 28 09:00:25 2006 +0200 +++ b/l3config.pm Tue Jan 31 20:18:54 2006 +0200 @@ -14,122 +14,123 @@ our %Config = ( - "skip_empty" => "yes", - "skip_interrupted" => "no", - "skip_wrong" => "no", - "editors" => ["vi", "pico", "ee", "vim", "nano"], - "pagers" => ["more", "less", "zmore", "zless", "info", - "man", "mc", "trafshow", "screen", "cfdisk", - "trafshow-bsd", "yes", "lynx", "links", "centericq" - ], - "terminal" => ["mc"], - "suppress_editors" => "yes", - "suppress_pagers" => "yes", - "suppress_terminal" => "yes", + "skip_empty" => "yes", + "skip_interrupted" => "no", + "skip_wrong" => "no", + "editors" => ["vi", "pico", "ee", "vim", "nano"], + "pagers" => ["more", "less", "zmore", "zless", "info", + "man", "mc", "trafshow", "screen", "cfdisk", + "trafshow-bsd", "yes", "lynx", "links", "centericq" + ], + "full_output_commands" => ["cat"], + "terminal" => ["mc"], + "suppress_editors" => "yes", + "suppress_pagers" => "yes", + "suppress_terminal" => "yes", - "terminal_width" => 400, - "terminal_height" => 100, - "verbose" => "yes", + "terminal_width" => 400, + "terminal_height" => 100, + "verbose" => "yes", - "head_lines" => 5, - "tail_lines" => 5, - "cache_head_lines" => 50, - "cache_tail_lines" => 50, - "skip_text" => "...", - "show_time" => "yes", - "show_diffs" => "yes", - "show_comments" => "yes", - "show_notes" => "yes", + "head_lines" => 5, + "tail_lines" => 5, + "cache_head_lines" => 50, + "cache_tail_lines" => 50, + "skip_text" => "...", + "show_time" => "yes", + "show_diffs" => "yes", + "show_comments" => "yes", + "show_notes" => "yes", - "input" => "$ENV{HOME}/.lilalo", - "diffs" => "", - "input_mask" => "*.script", - "encoding" => "utf-8", + "input" => "$ENV{HOME}/.lilalo", + "diffs" => "", + "input_mask" => "*.script", + "encoding" => "utf-8", - "cache" => "$ENV{HOME}/.lilalo/report.xml", - "cache_stat" => "$ENV{HOME}/.lilalo/.report.dat", + "cache" => "$ENV{HOME}/.lilalo/report.xml", + "cache_stat" => "$ENV{HOME}/.lilalo/.report.dat", - "output" => "/tmp/report.html", - "output_mask" => "INDEX", - "output_format" => "html", - "frontend_css" => "/l3/l3.css", - "frontend_google_ico" => "/l3/google.ico", - "frontend_linux_ico" => "/l3/linux.ico", - "frontend_freebsd_ico" => "/l3/freebsd.ico", - "frontend_opennet_ico" => "/l3/opennet.ico", - "frontend_local_ico" => "/l3/freebsd.ico", + "output" => "/tmp/report.html", + "output_mask" => "INDEX", + "output_format" => "html", + "frontend_css" => "/l3/l3.css", + "frontend_google_ico" => "/l3/google.ico", + "frontend_linux_ico" => "/l3/linux.ico", + "frontend_freebsd_ico" => "/l3/freebsd.ico", + "frontend_opennet_ico" => "/l3/opennet.ico", + "frontend_local_ico" => "/l3/freebsd.ico", - "mywi_server" => "127.0.0.1", - "mywi_port" => "19801", + "mywi_server" => "127.0.0.1", + "mywi_port" => "19801", - "stat_inactivity_interval" => "1800", + "stat_inactivity_interval" => "1800", - "signature" => "#lm:", - "from" => "", - "to" => "", - "lab" => "", - "keywords" => "linux command", - "files_keywords" => "linux file", + "signature" => "#lm:", + "from" => "", + "to" => "", + "lab" => "", + "keywords" => "linux command", + "files_keywords" => "linux file", - comment_width => "300", - note_width => "500", - time_width => "60", + comment_width => "300", + note_width => "500", + time_width => "60", - "mode" => "daemon", # daemon | normal - "daemon_sleep_interval" => "10", - "detach" => "yes", - "agent_pidfile" => "$ENV{HOME}/.lilalo/l3-agent.pid", + "mode" => "daemon", # daemon | normal + "daemon_sleep_interval" => "10", + "detach" => "yes", + "agent_pidfile" => "$ENV{HOME}/.lilalo/l3-agent.pid", - "backend_address" => "192.168.15.254", - "backend_port" => "18030", - "backend_pidfile" => "/tmp/l3-backend.pid", - "backend_datafile" => "/var/lilalo/lablogs-xml/backend.xml", + "backend_address" => "192.168.15.254", + "backend_port" => "18030", + "backend_pidfile" => "/tmp/l3-backend.pid", + "backend_datafile" => "/var/lilalo/lablogs-xml/backend.xml", - "l3-agent" => "l3-agent", - "l3-backend" => "l3-backend", + "l3-agent" => "l3-agent", + "l3-backend" => "l3-backend", - "course-name" => "", - "course-code" => "", - "course-date" => "", - "course-center" => "", - "course-trainer" => "", - "course-student" => "", + "course-name" => "", + "course-code" => "", + "course-date" => "", + "course-center" => "", + "course-trainer" => "", + "course-student" => "", - "filter" => "", + "filter" => "", #lm - "show_host" => "no", + "show_host" => "no", # Вспомогательные программы -#"l3-report" => "./lm-report", - "l3-report" => "./l3-report", +#"l3-report" => "./lm-report", + "l3-report" => "./l3-report", # Каталоги - "path_lilalo" => "/var/lilalo/", - "path_classes" => "/var/lilalo/classes/", - "path_lablogs" => "/var/lilalo/lablogs/", - "courses_path" => "/var/lilalo/courses/", - "outpath" => "/var/lilalo/out/", - "path_web" => "/var/www/l3", # Путь к web-отчётам - "path_share" => "./share/", # Путь к web-отчётам + "path_lilalo" => "/var/lilalo/", + "path_classes" => "/var/lilalo/classes/", + "path_lablogs" => "/var/lilalo/lablogs/", + "courses_path" => "/var/lilalo/courses/", + "outpath" => "/var/lilalo/out/", + "path_web" => "/var/www/l3", # Путь к web-отчётам + "path_share" => "./share/", # Путь к web-отчётам # Файлы - "runfile" => "lm.run", - "logfile" => "lm.log", + "runfile" => "lm.run", + "logfile" => "lm.log", - "class" => "class", # Имя файла класса - "class_suffix" => ".xml", # Cуффикс файла класса - "classfile" => "", + "class" => "class", # Имя файла класса + "class_suffix" => ".xml", # Cуффикс файла класса + "classfile" => "", - "sshkey" => "$ENV{HOME}/.ssh/id_dsa.pub", - "lmssh" => "./lm-ssh", - "lminstall" => "./lm-install", - "ssh_user" => "root", + "sshkey" => "$ENV{HOME}/.ssh/id_dsa.pub", + "lmssh" => "./lm-ssh", + "lminstall" => "./lm-install", + "ssh_user" => "root", - "l3scripts" => "l3scripts", + "l3scripts" => "l3scripts", - "cgi_path_info" => "", - "cgi2file" => "", + "cgi_path_info" => "", + "cgi2file" => "", "year" => "2006", ); diff -r 8c3d80c4891b -r 1e1422588716 lm --- a/lm Sat Jan 28 09:00:25 2006 +0200 +++ b/lm Tue Jan 31 20:18:54 2006 +0200 @@ -68,6 +68,7 @@ sub lm_do; sub lm_report; sub lm_show_hosts; +sub lm_show_email; sub lm_show_labs; sub load_run; @@ -119,6 +120,7 @@ case "start" { lm_start } case "stop" { lm_stop } case "show hosts" { lm_show_hosts } + case "show email" { lm_show_email } case "show labs" { lm_show_labs } case /do / { $arg =~ /do (.*)/; lm_do "$1" } else { print_usage_info() } @@ -173,6 +175,7 @@ "name" => "$student->{firstname} $student->{surname}", "firstname" => "$student->{firstname}", "user" => "$student->{user}", + "email" => "$student->{email}", "student" => $student, } } @@ -258,6 +261,18 @@ } } +sub lm_show_email +# Show hosts used to run a commands +{ + my $i=1; + for my $m (sort keys %Machines) { + if (!@SelectedMachines || grep /^$i$/, @SelectedMachines) { + print $Machines{$m}->{"email"},"\t",$Machines{$m}->{"name"},"\n"; + } + $i++; + } +} + sub lm_show_labs # Show hosts used to run a commands {