version 1.477, 2004/03/16 20:15:08
|
version 1.478, 2004/03/16 21:29:31
|
Line 1172 sub tokenwrapper {
|
Line 1172 sub tokenwrapper {
|
$ENV{'user.environment'}=~/\/([^\/]+)\.id/; |
$ENV{'user.environment'}=~/\/([^\/]+)\.id/; |
my $token=$1; |
my $token=$1; |
# if ($uri=~/^uploaded\/([^\/]+)\/([^\/]+)\/([^\/]+)(\?\.*)*$/) { |
# if ($uri=~/^uploaded\/([^\/]+)\/([^\/]+)\/([^\/]+)(\?\.*)*$/) { |
if ($uri=~/^uploaded\/([^\/]+)\/([^\/]+)\/(.+)(\?\.*)*$/) { |
if ($uri=~m|^uploaded/([^/]+)/([^/]+)/(.+)(\?\.*)*$|) { |
&appenv('userfile.'.$1.'/'.$2.'/'.$3 => $ENV{'request.course.id'}); |
&appenv('userfile.'.$1.'/'.$2.'/'.$3 => $ENV{'request.course.id'}); |
return 'http://'.$hostname{ &homeserver($2,$1)}.'/'.$uri. |
return 'http://'.$hostname{ &homeserver($2,$1)}.'/'.$uri. |
(($uri=~/\?/)?'&':'?').'token='.$token. |
(($uri=~/\?/)?'&':'?').'token='.$token. |
Line 1182 sub tokenwrapper {
|
Line 1182 sub tokenwrapper {
|
} |
} |
} |
} |
|
|
# --------------- File operations in /home/httpd/html/userfiles/$domain/1/2/3/$course |
# --------- File operations in /home/httpd/html/userfiles/$domain/1/2/3/$course |
# input: action, courseID, current domain, home server for course, intended path to file, |
# input: action, courseID, current domain, home server for course, intended |
# source of file. |
# path to file, source of file. |
# output: ok if successful, diagnostic message otherwise |
# output: ok if successful, diagnostic message otherwise |
# |
# |
# Allows directory structure to be used within lonUsers/../userfiles/ for a course. |
# Allows directory structure to be used within lonUsers/../userfiles/ for a |
|
# course. |
# |
# |
# action = propagate - /home/httpd/html/userfiles/$domain/1/2/3/$course/$file will |
# action = propagate - /home/httpd/html/userfiles/$domain/1/2/3/$course/$file |
# be copied to /home/httpd/lonUsers/1/2/3/$course/userfiles in course's home server. |
# will be copied to /home/httpd/lonUsers/1/2/3/$course/userfiles in |
|
# course's home server. |
# |
# |
# action = copy - /home/httpd/html/userfiles/$domain/1/2/3/$course/$file will be copied |
# action = copy - /home/httpd/html/userfiles/$domain/1/2/3/$course/$file will |
# from $source (current location) to /home/httpd/html/userfiles/$domain/1/2/3/$course/$file |
# be copied from $source (current location) to |
# and will then be copied to /home/httpd/lonUsers/1/2/3/$course/userfiles/$file in |
# /home/httpd/html/userfiles/$domain/1/2/3/$course/$file |
# course's home server. |
# and will then be copied to |
|
# /home/httpd/lonUsers/$domain/1/2/3/$course/userfiles/$file in |
|
# course's home server. |
|
|
sub process_coursefile { |
sub process_coursefile { |
my ($action,$docuname,$docudom,$docuhome,$file,$source)=@_; |
my ($action,$docuname,$docudom,$docuhome,$file,$source)=@_; |
Line 1207 sub process_coursefile {
|
Line 1211 sub process_coursefile {
|
my $fetchresult = ''; |
my $fetchresult = ''; |
my $fpath = ''; |
my $fpath = ''; |
my $fname = $file; |
my $fname = $file; |
($fpath,$fname) = ($file =~ m/^(.*)\/([^\/]+)$/); |
($fpath,$fname) = ($file =~ m|^(.*)/([^/]+)$|); |
$fpath=$docudom.'/'.$docuname.'/'.$fpath; |
$fpath=$docudom.'/'.$docuname.'/'.$fpath; |
my $filepath=$perlvar{'lonDocRoot'}.'/userfiles'; |
my $filepath=$perlvar{'lonDocRoot'}.'/userfiles'; |
unless ($fpath eq '') { |
unless ($fpath eq '') { |
my @parts=split(/\//,$fpath); |
my @parts=split('/',$fpath); |
foreach my $part (@parts) { |
foreach my $part (@parts) { |
$filepath.= '/'.$part; |
$filepath.= '/'.$part; |
if ((-e $filepath)!=1) { |
if ((-e $filepath)!=1) { |