--- loncom/publisher/loncfile.pm 2004/01/05 16:48:50 1.50
+++ loncom/publisher/loncfile.pm 2004/03/02 16:48:27 1.52
@@ -9,7 +9,7 @@
# and displays a page showing the results of the action.
#
#
-# $Id: loncfile.pm,v 1.50 2004/01/05 16:48:50 www Exp $
+# $Id: loncfile.pm,v 1.52 2004/03/02 16:48:27 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -406,13 +406,15 @@ new filename relative to the current dir
=cut
sub Rename1 {
- my ($request, $user, $domain, $fn, $newfilename) = @_;
+ my ($request, $user, $domain, $fn, $newfilename, $style) = @_;
if(-e $fn) {
if($newfilename) {
# is dest a dir
- if (-d $newfilename) {
- if ($fn =~ m|/([^/]*)$|) { $newfilename .= '/'.$1; }
+ if ($style eq 'move') {
+ if (-d $newfilename) {
+ if ($fn =~ m|/([^/]*)$|) { $newfilename .= '/'.$1; }
+ }
}
if ($newfilename =~ m|/[^\.]+$|) {
#no extension add on original extension
@@ -441,9 +443,15 @@ sub Rename1 {
'
'.&mt('Cancel').'');
return;
}
+ my $action;
+ if ($style eq 'rename') {
+ $action=&mt('Rename');
+ } else {
+ $action=&mt('Move');
+ }
$request->print('
'.&mt('Rename').' '.&display($fn). + '" />
'.$action.' '.&display($fn).
'
to '.&display($newfilename).'?
'.&mt('Make new directory').' '. &display($newfilename).'?
'); @@ -737,7 +750,9 @@ sub phaseone { ''); if ($ENV{'form.action'} eq 'rename') { - &Rename1($r, $uname, $udom, $fn, $newfilename); + &Rename1($r, $uname, $udom, $fn, $newfilename, 'rename'); + } elsif ($ENV{'form.action'} eq 'move') { + &Rename1($r, $uname, $udom, $fn, $newfilename, 'move'); } elsif ($ENV{'form.action'} eq 'delete') { &Delete1($r, $uname, $udom, $fn); } elsif ($ENV{'form.action'} eq 'decompress') { @@ -749,7 +764,11 @@ sub phaseone { $r->print(''.&mt('No new filename specified.').'
'); } } elsif ($ENV{'form.action'} eq 'newdir') { - &NewDir1($r, $uname, $udom, $fn, $newfilename); + my $mode = ''; + if (exists($ENV{'form.callingmode'}) ) { + $mode = $ENV{'form.callingmode'}; + } + &NewDir1($r, $uname, $udom, $fn, $newfilename, $mode); } elsif ($ENV{'form.action'} eq 'newfile' || $ENV{'form.action'} eq 'newhtmlfile' || $ENV{'form.action'} eq 'newproblemfile' || @@ -1121,7 +1140,11 @@ sub phasetwo { } $dest = $newdir."/" } - $r->print('