--- loncom/lonnet/perl/lonnet.pm 2004/08/27 21:09:22 1.534 +++ loncom/lonnet/perl/lonnet.pm 2004/08/31 15:40:49 1.537 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.534 2004/08/27 21:09:22 albertel Exp $ +# $Id: lonnet.pm,v 1.537 2004/08/31 15:40:49 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3680,10 +3680,10 @@ sub revokecustomrole { } # ------------------------------------------------------------ Disk usage -sub diskusage{ +sub diskusage { my ($udom,$uname,$directoryRoot)=@_; $directoryRoot =~ s/\/$//; - my $listing=reply('du:'.$directoryRoot,homeserver($uname,$udom)) + my $listing=&reply('du:'.$directoryRoot,homeserver($uname,$udom)); return $listing; } @@ -5056,20 +5056,18 @@ sub filelocation { $location = $file; $location =~ s:/~(.*?)/(.*):/home/$1/public_html/$2:; } elsif ($file=~/^\/*uploaded/) { # is an uploaded file - if ($file=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/(\/)?simplepage\/([^\/]+)$/) { - $location=&Apache::loncommon::propath($1,$2).'/userfiles/simplepage/'.$4; - if (not -e $location) { - $file=~/^\/uploaded\/(.*)$/; - $location=$Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'.$1; - } - } elsif ($file=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/aboutme\/([^\/]+)$/) { - $location=&Apache::loncommon::propath($1,$2).'/userfiles/aboutme/'.$3; - if (not -e $location) { - $file=~/^\/uploaded\/(.*)$/; - $location=$Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'.$1; - } + my ($udom,$uname,$filename)= + ($file=~m|^/+uploaded/+([^/]+)/+([^/]+)/+(.*)$|); + my $home=&homeserver($uname,$udom); + my $is_me=0; + my @ids=¤t_machine_ids(); + foreach my $id (@ids) { if ($id eq $home) { $is_me=1; } } + if ($is_me) { + $location=&Apache::loncommon::propath($udom,$uname). + '/userfiles/'.$filename; } else { - $location=$file; + $location=$Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'. + $udom.'/'.$uname.'/'.$filename; } } else { $file=~s/^\Q$perlvar{'lonDocRoot'}\E//;