lilalo

diff l3-frontend @ 70:6f5ad37fc8d9

Добавлен файл l3bashrc, который настраивает среду интерпретатора
и включает запись lilalo-скриптов.
Настройка разбита по функциям.

ПОКА ЧТО НЕ РАБОТАЕТ!
author devi
date Fri Feb 03 22:49:46 2006 +0200 (2006-02-03)
parents 8c3d80c4891b
children 35e0d61c820d
line diff
     1.1 --- a/l3-frontend	Sat Jan 28 09:00:25 2006 +0200
     1.2 +++ b/l3-frontend	Fri Feb 03 22:49:46 2006 +0200
     1.3 @@ -12,6 +12,8 @@
     1.4  our $Mywi_Socket;
     1.5  our %Sessions;
     1.6  
     1.7 +our %Files;
     1.8 +
     1.9  # vvv Инициализация переменных выполняется процедурой init_variables
    1.10  our @Day_Name;
    1.11  our @Month_Name;
    1.12 @@ -38,6 +40,7 @@
    1.13  
    1.14  sub print_all;
    1.15  sub print_command_lines;
    1.16 +sub print_files;
    1.17  sub print_stat;
    1.18  sub print_header;
    1.19  sub print_footer;
    1.20 @@ -498,8 +501,16 @@
    1.21  # и <tail_lines> нижних строк,
    1.22  # если эти параметры существуют
    1.23  
    1.24 +        if ($cl->{"last_command"} eq "cat" && !$cl->{"err"} && !($cl->{"cline"} =~ /</)) {
    1.25 +            my $filename = $cl->{"cline"};
    1.26 +            $filename =~ s/.*\s+(\S+)\s*$/$1/;
    1.27 +            $Files{$filename} = $cl->{"output"};
    1.28 +        }
    1.29          my @lines = split '\n', $cl->{"output"};
    1.30 -        if (($Config{"head_lines"} || $Config{"tail_lines"})
    1.31 +        if ((
    1.32 +             $Config{"head_lines"} 
    1.33 +             || $Config{"tail_lines"}
    1.34 +             )
    1.35               && $#lines >  $Config{"head_lines"} + $Config{"tail_lines"} ) {
    1.36  
    1.37              for (my $i=0; $i<= $#lines && $i < $Config{"head_lines"}; $i++) {
    1.38 @@ -513,7 +524,7 @@
    1.39              }
    1.40          } 
    1.41          else {
    1.42 -            $output .= $cl->{"output"};
    1.43 +           $ output .= $cl->{"output"};
    1.44          }   
    1.45  
    1.46  #
    1.47 @@ -737,9 +748,10 @@
    1.48          my $hint;
    1.49          for my $c (reverse sort { $CommandsFDistribution{$a} <=> $CommandsFDistribution{$b} } @new_commands) {
    1.50                  $hint = make_comment($c);
    1.51 +                next unless $hint;
    1.52                  my ($command, $hint) = $hint =~ m/(.*?) \s*- \s*(.*)/;
    1.53                  next unless $command =~ s/\($entries_class\)//i;
    1.54 -                $new_commands_section .= "<tr><td valign='top'>$command</td><td>$hint</td></tr>"  if $hint;
    1.55 +                $new_commands_section .= "<tr><td valign='top'>$command</td><td>$hint</td></tr>";
    1.56          }
    1.57      }
    1.58      return $new_commands_section;
    1.59 @@ -761,9 +773,11 @@
    1.60  
    1.61      my $result;
    1.62      my ($command_lines,$toc)  = print_command_lines;
    1.63 +    my $files_section         = print_files;
    1.64  
    1.65      $result = print_header($toc);
    1.66      $result.= "<h2 id='log'>Журнал</h2>"       . $command_lines;
    1.67 +    $result.= "<h2 id='files'>Файлы</h2>"      . $files_section if $files_section;
    1.68      $result.= "<h2 id='stat'>Статистика</h2>"  . print_stat;
    1.69      $result.= "<h2 id='help'>Справка</h2>"     . $Html_Help . "<br/>"; 
    1.70      $result.= "<h2 id='about'>О программе</h2>". $Html_About. "<br/>"; 
    1.71 @@ -810,16 +824,20 @@
    1.72      }
    1.73  
    1.74      # Управляющая форма
    1.75 -    my $control_form .= "<table id='visibility_form' class='visibility_form'><tr><td>Видимые элементы</TD></tr><tr><td><form>\n";
    1.76 -    for my $element (keys %Elements_Visibility)
    1.77 +    my $control_form .= "<div class='visibility_form' title='Выберите какие элементы должны быть показаны в журнале'>"
    1.78 +                     .  "<span class='header'>Видимые элементы</span>"
    1.79 +                     .  "<span class='window_controls'><a href='' onclick='' title='свернуть форму управления'>_</a> <a href='' onclick='' title='закрыть форму управления'>x</a></span>"
    1.80 +                     .  "<div><form>\n";
    1.81 +    for my $element (sort keys %Elements_Visibility)
    1.82      {
    1.83 -        my @e = split /\s+/, $element;
    1.84 +        my ($skip, @e) = split /\s+/, $element;
    1.85          my $showhide = join "", map { "ShowHide('$_');" } @e ;
    1.86 -        $control_form .= "<input type='checkbox' name='$e[0]' onclick=\"$showhide\" checked>".
    1.87 +        $control_form .= "<div><input type='checkbox' name='$e[0]' onclick=\"$showhide\" checked>".
    1.88                  $Elements_Visibility{$element}.
    1.89 -                "</input><br>\n";
    1.90 +                "</input></div>";
    1.91      }
    1.92 -    $control_form .= "</form></td></tr></table>\n";
    1.93 +    $control_form .= "</form>\n"
    1.94 +                  .  "</div>\n";
    1.95  
    1.96      my $result;
    1.97      $result = <<HEADER;
    1.98 @@ -881,6 +899,7 @@
    1.99      <ul>
   1.100          <li><a href='#log'>Журнал</a></li>
   1.101          <ul>$toc</ul>
   1.102 +        <li><a href='#files'>Файлы</a></li>
   1.103          <li><a href='#stat'>Статистика</a></li>
   1.104          <li><a href='#help'>Справка</a></li>
   1.105          <li><a href='#about'>О программе</a></li>
   1.106 @@ -1028,6 +1047,19 @@
   1.107  }
   1.108  
   1.109  
   1.110 +sub print_files
   1.111 +{
   1.112 +    my $result = qq(); 
   1.113 +    my @toc;
   1.114 +    for my $file (sort keys %Files) {
   1.115 +          my $div_id = $file;
   1.116 +          $div_id =~ s@/@_@g;
   1.117 +          push @toc, "<a href='#$div_id'>$file</a>";
   1.118 +          $result .= "<div class='filename' id='$div_id'>".$file."</div>\n"
   1.119 +                  .  "<div class='filedata'><pre>".$Files{$file}."</pre></div>";
   1.120 +    }
   1.121 +    return "<div class='files_toc'>".collapse_list(\@toc)."</div>".$result;
   1.122 +}
   1.123  
   1.124  
   1.125  sub init_variables
   1.126 @@ -1053,9 +1085,9 @@
   1.127  <table>
   1.128  <tr class='command'>
   1.129  <td class='script'>
   1.130 -<pre class='mistyped_cline'>
   1.131 +<pre class='_mistyped_cline'>
   1.132  \$ l s-l</pre>
   1.133 -<pre class='mistyped_output'>bash: l: command not found
   1.134 +<pre class='_mistyped_output'>bash: l: command not found
   1.135  </pre>
   1.136  </td>
   1.137  </tr>
   1.138 @@ -1069,7 +1101,7 @@
   1.139  <table>
   1.140  <tr class='command'>
   1.141  <td class='script'>
   1.142 -<pre class='wrong_cline'>
   1.143 +<pre class='_wrong_cline'>
   1.144  \$ test 5 -lt 4</pre>
   1.145  </pre>
   1.146  </td>
   1.147 @@ -1085,7 +1117,7 @@
   1.148  <table>
   1.149  <tr class='command'>
   1.150  <td class='script'>
   1.151 -<pre class='interrupted_cline'>
   1.152 +<pre class='_interrupted_cline'>
   1.153  \$ find / -name abc</pre>
   1.154  <pre class='interrupted_output'>find: /home/devi-orig/.gnome2: Keine Berechtigung
   1.155  find: /home/devi-orig/.gnome2_private: Keine Berechtigung
   1.156 @@ -1266,7 +1298,7 @@
   1.157      <p>
   1.158      LiLaLo (L3) расшифровывается как Live Lab Log.<br/>
   1.159      Программа разработана для повышения эффективности обучения Unix/Linux-системам.<br/>
   1.160 -    (c) Игорь Чубин, 2004-2005<br/>
   1.161 +    (c) Игорь Чубин, 2004-2006<br/>
   1.162      </p>
   1.163  ABOUT
   1.164  $Html_About.='$Id$ </p>';
   1.165 @@ -1337,15 +1369,17 @@
   1.166      );
   1.167  
   1.168  %Elements_Visibility = (
   1.169 -        "note"      =>  "замечания",
   1.170 -        "diff"      =>  "редактор",
   1.171 -        "time"      =>  "время",
   1.172 -        "ttychange"     =>  "терминал",
   1.173 -        "wrong_output wrong_cline wrong_root_output wrong_root_cline" 
   1.174 -                =>  "команды с ошибками",
   1.175 -        "interrupted_output interrupted_cline interrupted_root_output interrupted_root_cline" 
   1.176 +        "0 new_commands_table"      =>  "новые команды",
   1.177 +        "1 diff"      =>  "редактор",
   1.178 +        "2 time"      =>  "время",
   1.179 +        "3 ttychange"     =>  "терминал",
   1.180 +        "4 wrong_output wrong_cline wrong_root_output wrong_root_cline" 
   1.181 +                =>  "команды с ненулевым кодом завершения",
   1.182 +        "5 mistyped_output mistyped_cline mistyped_root_output mistyped_root_cline" 
   1.183 +                =>  "неверно набранные команды",
   1.184 +        "6 interrupted_output interrupted_cline interrupted_root_output interrupted_root_cline" 
   1.185                  =>  "прерванные команды",
   1.186 -        "tab_completion_output tab_completion_cline"    
   1.187 +        "7 tab_completion_output tab_completion_cline"    
   1.188                  =>  "продолжение с помощью tab"
   1.189  );
   1.190