version 1.4, 2001/04/03 22:03:55
|
version 1.7, 2001/05/02 20:34:34
|
Line 31 sub phaseone {
|
Line 31 sub phaseone {
|
my $resdir=$resfn; |
my $resdir=$resfn; |
$resdir=~s/\/[^\/]+$/\//; |
$resdir=~s/\/[^\/]+$/\//; |
|
|
$fn=~/^\/(.+)\.(\w+)$/; |
$fn=~/\/([^\/]+)\.(\w+)$/; |
my $main=$1; |
my $main=$1; |
my $suffix=$2; |
my $suffix=$2; |
|
|
|
if (-e $resfn) { |
$r->print('<form action=/adm/retrieve method=post>'. |
$r->print('<form action=/adm/retrieve method=post>'. |
'<input type=hidden name=filename value="'.$fn.'">'. |
'<input type=hidden name=filename value="'.$fn.'">'. |
'<input type=hidden name=phase value=two>'. |
'<input type=hidden name=phase value=two>'. |
Line 69 sub phaseone {
|
Line 70 sub phaseone {
|
'<font size=+1 color=red>Retrieval of an old version will '. |
'<font size=+1 color=red>Retrieval of an old version will '. |
'overwrite the file currently in construction space</font><p>'. |
'overwrite the file currently in construction space</font><p>'. |
'<input type=submit value="Retrieve version"></form>'); |
'<input type=submit value="Retrieve version"></form>'); |
|
} else { |
|
$r->print('<h3>No previous versions published.</h3>'); |
|
} |
} |
} |
|
|
sub phasetwo { |
sub phasetwo { |
Line 82 sub phasetwo {
|
Line 86 sub phasetwo {
|
} |
} |
my $logfile; |
my $logfile; |
my $ctarget='/home/'.$uname.'/public_html'.$fn; |
my $ctarget='/home/'.$uname.'/public_html'.$fn; |
|
my $vfn=$fn; |
|
if ($version ne 'new') { |
|
$vfn=~s/\.(\w+)$/\.$version\.$1/; |
|
} |
|
my $csource=$r->dir_config('lonDocRoot').'/res/'.$udom.'/'.$uname.$vfn; |
unless ($logfile=Apache::File->new('>>'.$ctarget.'.log')) { |
unless ($logfile=Apache::File->new('>>'.$ctarget.'.log')) { |
$r->print( |
$r->print( |
'<font color=red>No write permission to user directory, FAIL</font>'); |
'<font color=red>No write permission to user directory, FAIL</font>'); |
} |
} |
print $logfile |
print $logfile |
"\n\n================= Retrieve ".localtime()." ================\n". |
"\n\n================= Retrieve ".localtime()." ================\n". |
"Version $version\n\n"; |
"Version: $version\nSource: $csource\nTarget: $ctarget\n"; |
|
$r->print('<p>Copying file: '); |
|
if (copy($csource,$ctarget)) { |
|
$r->print('ok<p>'); |
|
print $logfile "Copied sucessfully.\n\n"; |
|
} else { |
|
my $error=$!; |
|
$r->print('fail, '.$error.'<p>'); |
|
print $logfile "Copy failed: $error\n\n"; |
|
} |
|
$r->print('<font size=+2><a href="/priv/'.$uname.$fn. |
|
'">Back to '.$fn.'</a></font>'); |
} else { |
} else { |
$r->print( |
$r->print( |
'<font size=+1 color=red>Please pick a version to retrieve</font><p>'); |
'<font size=+1 color=red>Please pick a version to retrieve</font><p>'); |
Line 143 sub handler {
|
Line 162 sub handler {
|
$r->print('</body></html>'); |
$r->print('</body></html>'); |
return OK; |
return OK; |
} |
} |
|
|
|
1; |
|
__END__ |