version 1.45, 2002/06/17 20:25:51
|
version 1.46, 2002/06/18 15:04:05
|
Line 190 sub logthis {
|
Line 190 sub logthis {
|
print $fh "$local ($$): $message\n"; |
print $fh "$local ($$): $message\n"; |
} |
} |
|
|
|
|
|
|
# -------------------------------------------- Return path to profile directory |
|
|
|
sub propath { |
|
my ($udom,$uname)=@_; |
|
$udom=~s/\W//g; |
|
$uname=~s/\W//g; |
|
my $subdir=$uname.'__'; |
|
$subdir =~ s/(.)(.)(.).*/$1\/$2\/$3/; |
|
my $proname="$perlvar{'lonUsersDir'}/$udom/$subdir/$uname"; |
|
return $proname; |
|
} |
|
|
|
# ------------------------------------------------------------------ Course log |
# ------------------------------------------------------------------ Course log |
|
|
sub courselog { |
sub courselog { |
my ($path,$command)=@_; |
my ($path,$command)=@_; |
return 'not_yet_implemented'; |
my %filters=(); |
|
foreach (split(/\=/,&unescape($command))) { |
|
my ($name,$value)=split(/\=/,$_); |
|
$filters{$name}=$value; |
|
} |
|
my @results=(); |
|
open(IN,$path.'/activity.log') or return ('file_error'); |
|
while ($line=<IN>) { |
|
chomp($line); |
|
my ($timestamp,$host,$log)=split(/\:/,$line); |
|
foreach (split(/\&/,&unescape($log))) { |
|
my ($res,$uname,$udom,$action,$values)=split(/\:/,$_); |
|
my $include=1; |
|
} |
|
} |
|
close IN; |
|
return join('&',sort(@results)); |
} |
} |
|
|
# -------------------------------------------------------------------- User log |
# -------------------------------------------------------------------- User log |
|
|
sub userlog { |
sub userlog { |
my ($path,$command)=@_; |
my ($path,$command)=@_; |
return 'not_yet_implemented'; |
my %filters=(); |
|
foreach (split(/\=/,&unescape($command))) { |
|
my ($name,$value)=split(/\=/,$_); |
|
$filters{$name}=$value; |
|
} |
|
my @results=(); |
|
open(IN,$path.'/activity.log') or return ('file_error'); |
|
while ($line=<IN>) { |
|
chomp($line); |
|
my ($timestamp,$host,$log)=split(/\:/,$line); |
|
$log=&unescape($log); |
|
my $include=1; |
|
if (($filters{'action'} eq 'log') && ($log!~/^Log/)) { $include=0; } |
|
if ($include) { |
|
push(@results,$timestamp.':'.$log); |
|
} |
|
} |
|
close IN; |
|
return join('&',sort(@results)); |
} |
} |
|
|
|
|
Line 430 sub make_new_child {
|
Line 450 sub make_new_child {
|
$result.=$customresult; |
$result.=$customresult; |
} |
} |
# ------------------------------------------------------------ end of sql query |
# ------------------------------------------------------------ end of sql query |
} |
} |
|
|
|
# result does need to be escaped |
|
|
|
$result=&escape($result); |
|
|
# reply with result, append \n unless already there |
# reply with result, append \n unless already there |
|
|
$result.="\n" unless ($result=~/\n$/); |
$result.="\n" unless ($result=~/\n$/); |