lilalo

diff l3-cgi @ 106:53b890d1ae90

small changes
author devi
date Fri Aug 04 17:41:31 2006 +0300 (2006-08-04)
parents 62001c1e3295
children 54fbf2041159
line diff
     1.1 --- a/l3-cgi	Thu Mar 02 20:13:31 2006 +0200
     1.2 +++ b/l3-cgi	Fri Aug 04 17:41:31 2006 +0300
     1.3 @@ -40,8 +40,7 @@
     1.4  {
     1.5          my $training_file;
     1.6      
     1.7 -    $training_file = $l3config::Config{"path_classes"}.$_[0].$l3config::Config{"class_suffix"} if $_[0];
     1.8 -        $training_file ||= $l3config::Config{"classfile"} || 
     1.9 +        $training_file = $_[0] || $l3config::Config{"classfile"} || 
    1.10          $l3config::Config{"path_classes"}.$l3config::Config{"class"}.$l3config::Config{"class_suffix"};
    1.11  
    1.12          my $XMLTraining = XMLin($training_file , ForceArray => [ 'student' ] )  
    1.13 @@ -123,8 +122,14 @@
    1.14      if (!$host || $host eq "index") {
    1.15          # Нам неизвестен курс или явно указан просмотр индекса
    1.16          # Просматриваем его
    1.17 -
    1.18 -        my $t = load_training($training);
    1.19 +        my $t;
    1.20 +        if ( -e "/var/lilalo/lablogs-xml/$training/class.xml" ) {
    1.21 +         $t = load_training("/var/lilalo/lablogs-xml/$training/class.xml");
    1.22 +        }
    1.23 +        else {
    1.24 +         $l3config::Config{class}=$training;
    1.25 +         $t = load_training;
    1.26 +        }
    1.27          $training ||= "current";
    1.28  
    1.29          my $prefix = "/cgi-bin/l3/$training/";
    1.30 @@ -202,22 +207,33 @@
    1.31      }
    1.32      else {
    1.33  
    1.34 -        $l3config::Config{"class"}=$training if $training ne 'current';
    1.35 -        $XMLTraining = load_training;
    1.36  
    1.37          my @args=(
    1.38              "--output"      =>  "-",
    1.39              "--show_comments"   =>  "no",
    1.40 -            "--course-center"   =>  $XMLTraining->{center},
    1.41 -            "--course-trainer"  =>  $XMLTraining->{instructor}->{firstname}." ".$XMLTraining->{instructor}->{surname},
    1.42 -            "--course-student"  =>  $XMLTraining->{host}->{$host}->{firstname}." ".$XMLTraining->{host}->{$host}->{surname},
    1.43 -            "--course-code"     =>  $XMLTraining->{course},
    1.44 -            "--course-date"     =>  $XMLTraining->{date},
    1.45 -            "--encoding"        =>  $XMLTraining->{host}->{$host}->{charset},
    1.46          );
    1.47 -        if ($XMLTraining->{"course-name"}) {
    1.48 -            push @args, ("--course-name"     =>  $XMLTraining->{"course-name"});
    1.49 -        };
    1.50 +
    1.51 +        $l3config::Config{"class"}=$training if $training ne 'current';
    1.52 +        if ( -e "/var/lilalo/lablogs-xml/$training/class.xml" ) {
    1.53 +         $XMLTraining = load_training("/var/lilalo/lablogs-xml/$training/class.xml");
    1.54 +        }
    1.55 +        else {
    1.56 +         $XMLTraining = load_training;
    1.57 +        }
    1.58 +
    1.59 +        if ($XMLTraining) {
    1.60 +            my @args=(
    1.61 +                "--course-center"   =>  $XMLTraining->{center},
    1.62 +                "--course-trainer"  =>  $XMLTraining->{instructor}->{firstname}." ".$XMLTraining->{instructor}->{surname},
    1.63 +                "--course-student"  =>  $XMLTraining->{host}->{$host}->{firstname}." ".$XMLTraining->{host}->{$host}->{surname},
    1.64 +                "--course-code"     =>  $XMLTraining->{course},
    1.65 +                "--course-date"     =>  $XMLTraining->{date},
    1.66 +                "--encoding"        =>  $XMLTraining->{host}->{$host}->{charset},
    1.67 +            );
    1.68 +            if ($XMLTraining->{"course-name"}) {
    1.69 +                push @args, ("--course-name"     =>  $XMLTraining->{"course-name"});
    1.70 +            };
    1.71 +        }
    1.72          if ($training ne 'current') {
    1.73              push @args,     ("--backend_datafile"   =>  "/var/lilalo/lablogs-xml/$training/$host/$user.xml");
    1.74          } else {