lilalo

diff l3-cgi @ 32:4d252e7dd478

l3-frontend:
Добавлена поддержка фильтрации по пользователю (user) и хосту (hostname).
Пока только прототип - нужно оптимизировать.
И нужно стандартизировать имена для полей

l3-cgi:
В current теперь могут быть подразделы
author devi
date Mon Nov 14 07:42:57 2005 +0200 (2005-11-14)
parents 196c82b6e538
children e22df843b512
line diff
     1.1 --- a/l3-cgi	Fri Nov 11 21:29:49 2005 +0200
     1.2 +++ b/l3-cgi	Mon Nov 14 07:42:57 2005 +0200
     1.3 @@ -9,7 +9,14 @@
     1.4  	require l3config;
     1.5  };
     1.6  
     1.7 -my $value = param('PARAM');
     1.8 +my @filter;
     1.9 +
    1.10 +for my $i (qw(host)) {
    1.11 +	my $value = param("$i");
    1.12 +	if ($value) {
    1.13 +		push @filter, "$i=$value";
    1.14 +	}
    1.15 +}
    1.16  
    1.17  my %Trainings;
    1.18  my $XMLTraining;
    1.19 @@ -23,7 +30,7 @@
    1.20          $l3config::Config{"path_classes"}."/".$l3config::Config{"class"}.$l3config::Config{"class_suffix"};
    1.21  
    1.22          my $XMLTraining = XMLin($classfile , ForceArray => [ 'student' ] )  
    1.23 -                or die "Can't open file of the class ",$classfile,"\n";
    1.24 +                or die "Can't open file of the training ",$classfile,"\n";
    1.25  
    1.26          for my $student (@{$XMLTraining->{"student"}}) {
    1.27  		$XMLTraining->{host}->{$student->{"host"}}=$student;
    1.28 @@ -83,7 +90,7 @@
    1.29  	# Вызов производится по URL
    1.30  	my ($skip, $course, $host, $user) = split /\//,$ENV{PATH_INFO},4;
    1.31  
    1.32 -	$l3config::Config{"class"}=$course;
    1.33 +	$l3config::Config{"class"}=$course if $course ne 'current';
    1.34  	$XMLTraining = load_training;
    1.35  
    1.36  	my @args=(
    1.37 @@ -94,9 +101,13 @@
    1.38  		"--course-student"	=>	$XMLTraining->{host}->{$host}->{firstname}." ".$XMLTraining->{host}->{$host}->{surname},
    1.39  		"--course-code"		=>	$XMLTraining->{course},
    1.40  		"--course-date"		=>	$XMLTraining->{date},
    1.41 -		"--backend_datafile"	=>	"/var/lilalo/lablogs-xml/$course/$host/$user.xml",
    1.42  		"--encoding"		=>	$XMLTraining->{host}->{$host}->{charset},
    1.43  	);
    1.44 +	if ($course ne 'current') {
    1.45 +		push @args, 	("--backend_datafile"	=>	"/var/lilalo/lablogs-xml/$course/$host/$user.xml");
    1.46 +	} else {
    1.47 +		push @args, ("--filter" => "hostname=".$host."&user=".$user);
    1.48 +	}
    1.49  
    1.50  	open (FRONTEND, "./l3-frontend ".join(" ",map("\"$_\"",@args))." |");
    1.51  	while (<FRONTEND>) {