--- loncom/publisher/lonretrieve.pm 2001/05/02 21:35:15 1.8 +++ loncom/publisher/lonretrieve.pm 2001/08/20 13:18:41 1.14 @@ -11,7 +11,7 @@ # 03/23 Guy Albertelli # 03/24,03/29 Gerd Kortemeyer) # -# 03/31,04/03,05/02 Gerd Kortemeyer +# 03/31,04/03,05/02,05/09,06/23,08/20 Gerd Kortemeyer package Apache::lonretrieve; @@ -19,6 +19,7 @@ use strict; use Apache::File; use File::Copy; use Apache::Constants qw(:common :http :methods); +use Apache::loncacc; sub phaseone { my ($r,$fn,$uname,$udom)=@_; @@ -37,7 +38,7 @@ sub phaseone { if (-e $resfn) { $r->print('
'. - ''. + ''. ''. ''. ''. @@ -55,10 +56,11 @@ sub phaseone { $version.'">'. '
SelectVersionBecame this version on ...'.$version.''. localtime($rmtime).''. ''. - 'Metadata Version '.$version); + 'Metadata Version '.$version.''); if (&Apache::lonnet::fileembstyle($suffix) eq 'ssi') { $r->print( - '  Diffs with Version '.$version.''); } @@ -73,7 +75,15 @@ sub phaseone { $r->print('
Current'.localtime($rmtime). ''. - 'Metadata current version

'. + 'Metadata current version'); + if (&Apache::lonnet::fileembstyle($suffix) eq 'ssi') { + $r->print( + '  Diffs with current Version'); + } + $r->print('

'. 'Retrieval of an old version will '. 'overwrite the file currently in construction space

'. '

'); @@ -129,9 +139,24 @@ sub handler { my $fn; + +# Get query string for limited number of parameters + + map { + my ($name, $value) = split(/=/,$_); + $value =~ tr/+/ /; + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; + if ($name eq 'filename') { + unless ($ENV{'form.'.$name}) { + $ENV{'form.'.$name}=$value; + } + } + } (split(/&/,$ENV{'QUERY_STRING'})); + + if ($ENV{'form.filename'}) { $fn=$ENV{'form.filename'}; - $fn=~s/^http\:\/\/[^\/]+\/\~(\w+)//; + $fn=~s/^http\:\/\/[^\/]+//; } else { $r->log_reason($ENV{'user.name'}.' at '.$ENV{'user.domain'}. ' unspecified filename for retrieval', $r->filename); @@ -145,9 +170,20 @@ sub handler { } # ----------------------------------------------------------- Start page output + my $uname; + my $udom; + + ($uname,$udom)= + &Apache::loncacc::constructaccess($fn,$r->dir_config('lonDefDomain')); + unless (($uname) && ($udom)) { + $r->log_reason($uname.' at '.$udom. + ' trying to publish file '.$ENV{'form.filename'}. + ' ('.$fn.') - not authorized', + $r->filename); + return HTTP_NOT_ACCEPTABLE; + } - my $uname=$ENV{'user.name'}; - my $udom=$ENV{'user.domain'}; + $fn=~s/\/\~(\w+)//; $r->content_type('text/html'); $r->send_http_header; @@ -159,6 +195,12 @@ sub handler { $r->print('

Retrieve previous versions of '.$fn.'

'); + + if (($uname ne $ENV{'user.name'}) || ($udom ne $ENV{'user.domain'})) { + $r->print('

Co-Author: '.$uname.' at '.$udom. + '

'); + } + if ($ENV{'form.phase'} eq 'two') { &phasetwo($r,$fn,$uname,$udom); 500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.