--- loncom/publisher/lonretrieve.pm 2001/04/01 02:58:51 1.1
+++ loncom/publisher/lonretrieve.pm 2001/04/03 18:12:57 1.2
@@ -20,6 +20,26 @@ 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 $resdir=$docroot.'/res/'.$udom.'/'.$uname.$fn;
+ $resdir=~s/\/[^\/]+$/\//;
+
+ $fn=~/^\/(.+)\.(\w+)$/;
+ my $main=$1;
+ my $suffix=$2;
+
+ my $filename;
+ opendir(DIR,$resdir);
+ while ($filename=readdir(DIR)) {
+ if ($filename=~/^$main\.(\d+)\.$suffix$/) {
+ $r->print($resdir.' = '.$filename.'
');
+ }
+ }
+ closedir(DIR);
+}
sub handler {
@@ -29,16 +49,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 +75,13 @@ sub handler {
$r->print(
'