lilalo

changeset 111:99ea38e538c9

Добавил:
* l3upload

Исправил:
* хинт теперь всплывает только при наведении непосредственно на команду
(а не на приглашение и не на символ кода завершения)
* подсветка неизвестных команд не такая сильная
author igor
date Sat Feb 16 13:41:48 2008 +0200 (2008-02-16)
parents 2fc1f3f08760
children da65f1cbaf3a
files l3-frontend l3bashrc
line diff
     1.1 --- a/l3-frontend	Wed Feb 13 02:43:33 2008 +0200
     1.2 +++ b/l3-frontend	Sat Feb 16 13:41:48 2008 +0200
     1.3 @@ -425,7 +425,7 @@
     1.4          }
     1.5          $tigra_hints{$$cl->{"time"}} = $hint;
     1.6  
     1.7 -        $$cl->{hint}="";
     1.8 +        #$$cl->{hint}="";
     1.9  
    1.10  # Выводим <head_lines> верхних строк
    1.11  # и <tail_lines> нижних строк,
    1.12 @@ -466,6 +466,11 @@
    1.13  
    1.14          if ($$cl->{cline} =~ /l3shot/) {
    1.15                  if ($$cl->{output} =~ m@Screenshot is written to.*/(.*)\.xwd@) {
    1.16 +                    $$cl->{screenshot}="$1".$Config{l3shot_suffix};
    1.17 +                }
    1.18 +        }
    1.19 +        if ($$cl->{cline} =~ /l3upload/) {
    1.20 +                if ($$cl->{output} =~ m@Uploaded file name is (.*)@) {
    1.21                      $$cl->{screenshot}="$1";
    1.22                  }
    1.23          }
    1.24 @@ -739,18 +744,20 @@
    1.25  # COMMAND
    1.26          my $cline;
    1.27          $prompt_hint = join ("&#10;", map("$_=$cl->{$_}", grep (!/^(output|diff)$/, sort(keys(%{$cl})))));
    1.28 -        $cline = "<span title='$prompt_hint'>".$cl->{"prompt"}."</span>".$cl->{"cline"};
    1.29 +        $cline = "<span title='$prompt_hint'>".$cl->{"prompt"}."</span>"
    1.30 +                ."<span onmouseover=\"myHint.show('".$cl->{time}."')\" onmouseout=\"myHint.hide()\">".$cl->{"cline"}."</span>";
    1.31          $cline =~ s/\n//;
    1.32  
    1.33          if ($cl->{"hint"}) {
    1.34 -            $cline = "<span title='$cl->{hint}' class='with_hint'>$cline</span>" ;
    1.35 +#            $cline = "<span title='$cl->{hint}' class='with_hint'>$cline</span>" ;
    1.36 +            $cline = "<span class='with_hint'>$cline</span>" ;
    1.37          } 
    1.38          else {
    1.39              $cline = "<span class='without_hint'>$cline</span>";
    1.40          }
    1.41  
    1.42          $this_day_result .= "<DIV class='fixed_div'><table cellpadding='0' cellspacing='0'><tr><td>\n<div class='cblock_$cl->{class}'>\n";
    1.43 -        $this_day_result .= "<div class='cline' onmouseover=\"myHint.show('".$cl->{time}."')\" onmouseout=\"myHint.hide()\">\n" . $cline ;      #cline
    1.44 +        $this_day_result .= "<div class='cline'>" . $cline ;      #cline
    1.45          $this_day_result .= "<span title='Код завершения ".$cl->{"err"}."'>\n"
    1.46                           .  "<img src='".$Config{frontend_ico_path}."/error.png'/>\n"
    1.47                           .  "</span>\n" if $cl->{"err"};
    1.48 @@ -773,7 +780,6 @@
    1.49          $this_day_result .= "<img src='"
    1.50                  .$Config{l3shot_path}
    1.51                  .$cl->{"screenshot"}
    1.52 -                .$Config{l3shot_suffix}
    1.53                  ."' alt ='screenshot id ".$cl->{"screenshot"}
    1.54                  ."'/>"
    1.55              if ( $Config{"show_screenshots"} =~ /^y/i && $cl->{"screenshot"});
    1.56 @@ -1814,7 +1820,7 @@
    1.57      <p>
    1.58      <a href='http://xgu.ru/lilalo/'>LiLaLo</a> (L3) расшифровывается как Live Lab Log.<br/>
    1.59      Программа разработана для повышения эффективности обучения Unix/Linux-системам.<br/>
    1.60 -    (c) Игорь Чубин, 2004-2006<br/>
    1.61 +    (c) Игорь Чубин, 2004-2008<br/>
    1.62      </p>
    1.63  ABOUT
    1.64  $Html_About.='$Id$ </p>';
     2.1 --- a/l3bashrc	Wed Feb 13 02:43:33 2008 +0200
     2.2 +++ b/l3bashrc	Sat Feb 16 13:41:48 2008 +0200
     2.3 @@ -188,10 +188,8 @@
     2.4          echo -n Choose window to be shoot ... >&2
     2.5          [ -d ${_l3_home} ] || mkdir -p ${_l3_home}
     2.6          xwd -out "$_l3_home/$shot_name" \
     2.7 -        && echo  Ok\
     2.8 -        && echo Shot was successful. \
     2.9          && echo Screenshot is written to ${_l3_home}/${shot_name} \
    2.10 -        && echo Screenshot will appears in the lablog.
    2.11 +        && curl -s -F photo=@$_l3_home/$shot_name http://xgu.ru/l3-upload
    2.12      else
    2.13          {
    2.14              echo
    2.15 @@ -205,10 +203,35 @@
    2.16      fi
    2.17  }
    2.18  
    2.19 +l3upload()
    2.20 +{
    2.21 +    if [ $# -lt 1 ]
    2.22 +    then
    2.23 +        echo Usage:
    2.24 +        echo 
    2.25 +        echo    l3upload "<filename>"
    2.26 +        echo
    2.27 +        echo "<filename>" - name of the file to upload
    2.28 +        return 1
    2.29 +    else
    2.30 +        source=$1 
    2.31 +        target="${L3_SESSION_ID}_`date +%s`"_"$(echo $source|sed s@.*/@@)"
    2.32 +        if echo $source | grep -q http://
    2.33 +        then
    2.34 +            curl -s "$source" > /tmp/$target 
    2.35 +        else 
    2.36 +            [ -r "$source" ] || { echo "l3upload: Can't open $source for reading" > /dev/stderr; return 1; }
    2.37 +            cp $source /tmp/$target
    2.38 +        fi
    2.39 +        echo Uploaded file name is ${target}
    2.40 +        curl -s -F photo=@/tmp/$target http://xgu.ru/l3-upload && rm -f /tmp/$target
    2.41 +    fi
    2.42 +}
    2.43 +
    2.44  # Append lines from "$@" files to the end of the shell history
    2.45 -hist_append () 
    2.46 -{ 
    2.47 -    eval $(cat "$@" | sed 's/"/\\\\"/g' | while read line; do echo history -s \"$line\"\;; done); 
    2.48 +hist_append ()
    2.49 +{
    2.50 +    eval $(cat "$@" | sed 's/"/\\\\"/g' | while read line; do echo history -s \"$line\"\;; done);
    2.51  }
    2.52  
    2.53  l3_save_last_line ()