lilalo

diff l3-frontend @ 55:d3fcff5e3757

mywi ответы кэшируются + подсветка для записей с хинтами
author devi
date Thu Dec 22 11:56:06 2005 +0200 (2005-12-22)
parents f9447da96f15
children 43aeb3036aaa
line diff
     1.1 --- a/l3-frontend	Wed Dec 21 14:39:44 2005 +0200
     1.2 +++ b/l3-frontend	Thu Dec 22 11:56:06 2005 +0200
     1.3 @@ -23,6 +23,9 @@
     1.4  our %Stat;
     1.5  our %CommandsFDistribution; # Сколько раз в журнале встречается какая команда
     1.6  
     1.7 +my %mywi_cache_for;         # Кэш для экономии обращений к mywi
     1.8 +
     1.9 +
    1.10  sub search_buy;
    1.11  sub make_comment;
    1.12  sub load_command_lines_from_xml;
    1.13 @@ -150,7 +153,7 @@
    1.14      my $cline = $_[0];
    1.15      #my $files = $_[1];
    1.16  
    1.17 -    my @comments=(); 
    1.18 +    my @comments;
    1.19      my @commands = keys %{extract_from_cline("commands", $cline)};
    1.20      my @args = keys %{extract_from_cline("args", $cline)};
    1.21      return if (!@commands && !@args);
    1.22 @@ -161,9 +164,8 @@
    1.23          $command =~ s/'//g;
    1.24          $CommandsFDistribution{$command}++;
    1.25          if (!$Commands_Description{$command}) {
    1.26 -            my $mywi="";
    1.27 -            $mywi = mywi_client ($command) || "";
    1.28 -            $mywi = join ("\n", grep(/\([18]\)/, split(/\n/, $mywi)));
    1.29 +            $mywi_cache_for{$command} ||= mywi_client ($command) || "";
    1.30 +            my $mywi = join ("\n", grep(/\([18]\)/, split(/\n/, $mywi_cache_for{$command})));
    1.31              $mywi =~ s/\s+/ /;
    1.32              if ($mywi !~ /^\s*$/) {
    1.33                  $Commands_Description{$command} = $mywi;
    1.34 @@ -576,7 +578,8 @@
    1.35          #$cline .= "(".$Sessions{$cl->{local_session_id}}.")";
    1.36          
    1.37          my $hint = make_comment($cl->{"cline"});
    1.38 -        $cline = "<div title='$hint'>$cline</div>" if $hint;
    1.39 +        $cline = "<span title='$hint' class='with_hint'>$cline</span>" if $hint;
    1.40 +        $cline = "<span class='without_hint'>$cline</span>" if !$hint;
    1.41          $Result{"body"} .= $cline;
    1.42          $Result{"body"} .= "</pre>\n";
    1.43