version 1.25, 2004/02/17 15:23:53
|
version 1.27, 2004/05/14 14:53:31
|
Line 165 sub phasetwo {
|
Line 165 sub phasetwo {
|
# target is the full filesystem path of the destination file. |
# target is the full filesystem path of the destination file. |
my $base = &File::Basename::basename($fn); |
my $base = &File::Basename::basename($fn); |
my $path = &File::Basename::dirname($fn); |
my $path = &File::Basename::dirname($fn); |
$base = &HTML::Entities::encode($base); |
$base = &HTML::Entities::encode($base,'<>&"'); |
my $url = $path."/".$base; |
my $url = $path."/".$base; |
&Debug($r, "URL is now ".$url); |
&Debug($r, "URL is now ".$url); |
my $datatoken=$ENV{'form.datatoken'}; |
my $datatoken=$ENV{'form.datatoken'}; |
Line 180 sub phasetwo {
|
Line 180 sub phasetwo {
|
'<input type="submit" name="override" value="'.&mt('Yes').'" /></form>'); |
'<input type="submit" name="override" value="'.&mt('Yes').'" /></form>'); |
} else { |
} else { |
my $source=$r->dir_config('lonDaemons').'/tmp/'.$datatoken.'.tmp'; |
my $source=$r->dir_config('lonDaemons').'/tmp/'.$datatoken.'.tmp'; |
|
my $dirpath=$path.'/'; |
|
$dirpath=~s/\/+/\//g; |
# Check for bad extension and disallow upload |
# Check for bad extension and disallow upload |
if ($fn=~/\.(\w+)$/ && |
if ($fn=~/\.(\w+)$/ && |
(&Apache::loncommon::fileembstyle($1) eq 'hdn')) { |
(&Apache::loncommon::fileembstyle($1) eq 'hdn')) { |
Line 188 sub phasetwo {
|
Line 190 sub phasetwo {
|
'<font color="red">'. |
'<font color="red">'. |
&mt('The extension on this file is reserved internally by LON-CAPA.'). |
&mt('The extension on this file is reserved internally by LON-CAPA.'). |
'</font>'); |
'</font>'); |
$r->print('<br /><font size=+2><a href="'.$path.'">'. |
$r->print('<br /><font size=+2><a href="'.$dirpath.'">'. |
&mt('Back to Directory').'</a></font>'); |
&mt('Back to Directory').'</a></font>'); |
} elsif ($fn=~/\.(\w+)$/ && |
} elsif ($fn=~/\.(\w+)$/ && |
!defined(&Apache::loncommon::fileembstyle($1))) { |
!defined(&Apache::loncommon::fileembstyle($1))) { |
Line 197 sub phasetwo {
|
Line 199 sub phasetwo {
|
'<font color="red">'. |
'<font color="red">'. |
&mt('The extension on this file is not recognized by LON-CAPA.'). |
&mt('The extension on this file is not recognized by LON-CAPA.'). |
'</font>'); |
'</font>'); |
$r->print('<br /><font size="+2"><a href="'.$path.'">'. |
$r->print('<br /><font size="+2"><a href="'.$dirpath.'">'. |
&mt('Back to Directory').'</a></font>'); |
&mt('Back to Directory').'</a></font>'); |
} elsif (-d $target) { |
} elsif (-d $target) { |
$r->print('File <tt>'.$fn.'</tt> could not be copied.<br />'. |
$r->print('File <tt>'.$fn.'</tt> could not be copied.<br />'. |
'<font color="red">'. |
'<font color="red">'. |
&mt('The target is an existing directory.'). |
&mt('The target is an existing directory.'). |
'</font><br />'); |
'</font><br />'); |
$r->print('<font size="+2"><a href="'.$path.'">'. |
$r->print('<font size="+2"><a href="'.$dirpath.'">'. |
&mt('Back to Directory').'</a></font>'); |
&mt('Back to Directory').'</a></font>'); |
} elsif (copy($source,$target)) { |
} elsif (copy($source,$target)) { |
chmod(0660, $target); # Set permissions to rw-rw---. |
chmod(0660, $target); # Set permissions to rw-rw---. |
Line 215 sub phasetwo {
|
Line 217 sub phasetwo {
|
$r->print(&mt('File copied.')); |
$r->print(&mt('File copied.')); |
$r->print('<br /><font size="+2"><a href="'.$url.'">'. |
$r->print('<br /><font size="+2"><a href="'.$url.'">'. |
&mt('View file').'</a></font>'); |
&mt('View file').'</a></font>'); |
$r->print('<br /><font size="+2"><a href="'.$path.'">'. |
$r->print('<br /><font size="+2"><a href="'.$dirpath.'">'. |
&mt('Back to Directory').'</a></font><br />'); |
&mt('Back to Directory').'</a></font><br />'); |
} |
} |
} else { |
} else { |