version 1.13, 2002/07/29 01:55:51
|
version 1.15, 2002/08/24 03:56:58
|
Line 7
|
Line 7
|
# presents a page that describes the proposed action to the user |
# presents a page that describes the proposed action to the user |
# and requests confirmation. The second phase commits the action |
# and requests confirmation. The second phase commits the action |
# and displays a page showing the results of the action. |
# and displays a page showing the results of the action. |
# |
# |
|
|
# |
# |
# $Id$ |
# $Id$ |
Line 86 package Apache::loncfile;
|
Line 86 package Apache::loncfile;
|
|
|
use strict; |
use strict; |
use Apache::File; |
use Apache::File; |
|
use File::Basename; |
use File::Copy; |
use File::Copy; |
use Apache::Constants qw(:common :http :methods); |
use Apache::Constants qw(:common :http :methods); |
use Apache::loncacc; |
use Apache::loncacc; |
use Apache::Log (); |
use Apache::Log (); |
|
use Apache::lonnet; |
|
|
my $DEBUG=0; |
my $DEBUG=0; |
my $r; # Needs to be global for some stuff RF. |
my $r; # Needs to be global for some stuff RF. |
Line 856 sub Copy2 {
|
Line 858 sub Copy2 {
|
&Debug($request ,"Will try to copy $oldfile to $newfile"); |
&Debug($request ,"Will try to copy $oldfile to $newfile"); |
if(-e $oldfile) { |
if(-e $oldfile) { |
unless (copy($oldfile, $newfile)) { |
unless (copy($oldfile, $newfile)) { |
$request->print('<font color=red> Error: '.$!.'</font>'); |
$request->print('<font color=red> copy Error: '.$!.'</font>'); |
return 0; |
return 0; |
} else { |
} else { |
|
unless (chmod(0660, $newfile)) { |
|
$request->print('<font color=red> chmod error: '.$!.'</font>'); |
|
return 0; |
|
} |
return 1; |
return 1; |
} |
} |
} else { |
} else { |
Line 1012 sub phasetwo {
|
Line 1018 sub phasetwo {
|
&Debug($r, "Final url is: $dest"); |
&Debug($r, "Final url is: $dest"); |
$dest =~ s/\/home\//\/priv\//; |
$dest =~ s/\/home\//\/priv\//; |
$dest =~ s/\/public_html//; |
$dest =~ s/\/public_html//; |
|
|
|
my $base = &Apache::lonnet::escape(&File::Basename::basename($dest)); |
|
my $dpath= &File::Basename::dirname($dest); |
|
$dest = $dpath.'/'.$base; |
|
|
|
|
&Debug($r, "Final url after rewrite: $dest"); |
&Debug($r, "Final url after rewrite: $dest"); |
|
|
$r->print('<h3><a href="'.$dest.'">Done</a></h3>'); |
$r->print('<h3><a href="'.$dest.'">Done</a></h3>'); |