--- loncom/publisher/lonretrieve.pm 2001/04/01 02:58:51 1.1 +++ loncom/publisher/lonretrieve.pm 2001/04/03 21:12:39 1.3 @@ -11,7 +11,7 @@ # 03/23 Guy Albertelli # 03/24,03/29 Gerd Kortemeyer) # -# 03/31 Gerd Kortemeyer +# 03/31,04/03 Gerd Kortemeyer package Apache::lonretrieve; @@ -20,6 +20,54 @@ use Apache::File; use File::Copy; use Apache::Constants qw(:common :http :methods); +sub phaseone { + my ($r,$fn,$uname,$udom)=@_; + my $docroot=$r->dir_config('lonDocRoot'); + + my $urldir='/res/'.$udom.'/'.$uname.$fn; + $urldir=~s/\/[^\/]+$/\//; + + my $resfn=$docroot.'/res/'.$udom.'/'.$uname.$fn; + my $resdir=$resfn; + $resdir=~s/\/[^\/]+$/\//; + + $fn=~/^\/(.+)\.(\w+)$/; + my $main=$1; + my $suffix=$2; + + $r->print('
'); +} sub handler { @@ -29,16 +77,16 @@ sub handler { if ($ENV{'form.filename'}) { $fn=$ENV{'form.filename'}; - $fn=~s/^http\:\/\/[^\/]+\/\~(\w+)/\/home\/$1\/public_html/; - $fn=~s/\/[^\/]+$//; + $fn=~s/^http\:\/\/[^\/]+\/\~(\w+)//; } else { - $fn=$r->filename(); + $r->log_reason($ENV{'user.name'}.' at '.$ENV{'user.domain'}. + ' unspecified filename for retrieval', $r->filename); + return HTTP_NOT_FOUND; } - unless ($fn) { $r->log_reason($ENV{'user.name'}.' at '.$ENV{'user.domain'}. - ' trying to publish empty directory', $r->filename); + ' trying to retrieve non-existing file', $r->filename); return HTTP_NOT_FOUND; } @@ -55,26 +103,13 @@ sub handler { $r->print( ''); - my $thisdisfn=$fn; - $thisdisfn=~s/^\/home\/$uname\/public_html//; - $r->print('