--- loncom/publisher/lonretrieve.pm 2001/04/03 21:12:39 1.3
+++ loncom/publisher/lonretrieve.pm 2001/04/03 22:03:55 1.4
@@ -66,9 +66,37 @@ sub phaseone {
'
Current | '.localtime($rmtime).
' | '.
'Metadata current version | '.
+ 'Retrieval of an old version will '.
+ 'overwrite the file currently in construction space
'.
'');
}
+sub phasetwo {
+ my ($r,$fn,$uname,$udom)=@_;
+ if ($ENV{'form.version'}) {
+ my $version=$ENV{'form.version'};
+ if ($version eq 'new') {
+ $r->print('
Retrieving current (most recent) version
');
+ } else {
+ $r->print('Retrieving old version '.$version.'
');
+ }
+ my $logfile;
+ my $ctarget='/home/'.$uname.'/public_html'.$fn;
+ unless ($logfile=Apache::File->new('>>'.$ctarget.'.log')) {
+ $r->print(
+ 'No write permission to user directory, FAIL');
+ }
+ print $logfile
+"\n\n================= Retrieve ".localtime()." ================\n".
+"Version $version\n\n";
+
+ } else {
+ $r->print(
+ 'Please pick a version to retrieve');
+ &phaseone($r,$fn,$uname,$udom);
+ }
+}
+
sub handler {
my $r=shift;
@@ -107,6 +135,7 @@ sub handler {
$r->print('
Retrieve previous versions of '.$fn.'
');
if ($ENV{'form.phase'} eq 'two') {
+ &phasetwo($r,$fn,$uname,$udom);
} else {
&phaseone($r,$fn,$uname,$udom);
}