version 1.40, 2003/08/26 19:17:02
|
version 1.47, 2003/12/15 20:44:06
|
Line 72 use Apache::loncacc;
|
Line 72 use Apache::loncacc;
|
use Apache::Log (); |
use Apache::Log (); |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncommon(); |
use Apache::loncommon(); |
|
use Apache::lonlocal; |
|
|
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 110 sub Debug {
|
Line 111 sub Debug {
|
# Put out the indicated message butonly if DEBUG is true. |
# Put out the indicated message butonly if DEBUG is true. |
|
|
if ($DEBUG) { |
if ($DEBUG) { |
$log->debug($message); |
$r->log_reason($message); |
} |
} |
} |
} |
|
|
Line 168 sub url {
|
Line 169 sub url {
|
|
|
sub display { |
sub display { |
my $fn=shift; |
my $fn=shift; |
$fn=~s/^\/home\/(\w+)\/public\_html//; |
$fn=~s-^/home/(\w+)/public_html-/priv/$1-; |
return '<tt>'.$fn.'</tt>'; |
return '<tt>'.$fn.'</tt>'; |
} |
} |
|
|
Line 211 sub exists {
|
Line 212 sub exists {
|
s/^\/home\/$user\/public\_html\//\/home\/httpd\/html\/res\/$domain\/$user\//; |
s/^\/home\/$user\/public\_html\//\/home\/httpd\/html\/res\/$domain\/$user\//; |
my $result=''; |
my $result=''; |
if ( -d $construct ) { |
if ( -d $construct ) { |
return 'Error: destination for operation is an existing directory.'; |
return &mt('Error: destination for operation is an existing directory.'); |
} |
} |
if ( -e $published) { |
if ( -e $published) { |
$result.='<p><font color="red">Warning: target file exists, and has been published!</font></p>'; |
$result.='<p><font color="red">'.&mt('Warning: target file exists, and has been published!').'</font></p>'; |
} elsif ( -e $construct) { |
} elsif ( -e $construct) { |
$result.='<p><font color="red">Warning: target file exists!</font></p>'; |
$result.='<p><font color="red">'.&mt('Warning: target file exists!').'</font></p>'; |
} |
} |
return $result; |
return $result; |
|
|
Line 260 sub checksuffix {
|
Line 261 sub checksuffix {
|
if ($old=~m:(.*)/+([^/]+)\.(\w+)$:) { $oldsuffix=$3; } |
if ($old=~m:(.*)/+([^/]+)\.(\w+)$:) { $oldsuffix=$3; } |
if ($oldsuffix ne $newsuffix) { |
if ($oldsuffix ne $newsuffix) { |
$result.= |
$result.= |
'<p><font color="red">Warning: change of MIME type!</font></p>'; |
'<p><font color="red">'.&mt('Warning: change of MIME type!').'</font></p>'; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 269 sub cleanDest {
|
Line 270 sub cleanDest {
|
my ($request,$dest)=@_; |
my ($request,$dest)=@_; |
#remove bad characters |
#remove bad characters |
if ($dest=~/[\#\?&]/) { |
if ($dest=~/[\#\?&]/) { |
$request->print("<p><font color=\"red\">Invalid characters in requested name have been removed.</font></p>"); |
$request->print("<p><font color=\"red\">".&mt('Invalid characters in requested name have been removed.')."</font></p>"); |
$dest=~s/[\#\?&]//g; |
$dest=~s/[\#\?&]//g; |
} |
} |
return $dest; |
return $dest; |
Line 312 Parameters:
|
Line 313 Parameters:
|
|
|
sub CloseForm1 { |
sub CloseForm1 { |
my ($request, $fn) = @_; |
my ($request, $fn) = @_; |
$request->print('<p><input type="submit" value="Continue" /></p></form>'); |
$request->print('<p><input type="submit" value="'.&mt('Continue').'" /></p></form>'); |
$request->print('<form action="'.&url($fn). |
$request->print('<form action="'.&url($fn). |
'" method="POST"><p><input type="submit" value="Cancel" /></p></form>'); |
'" method="POST"><p><input type="submit" value="'.&mt('Cancel').'" /></p></form>'); |
} |
} |
|
|
|
|
Line 344 Parameters:
|
Line 345 Parameters:
|
|
|
sub CloseForm2 { |
sub CloseForm2 { |
my ($request, $user, $fn) = @_; |
my ($request, $user, $fn) = @_; |
$request->print('<h3><a href="'.&url($fn).'/">Done</a></h3>'); |
$request->print('<h3><a href="'.&url($fn).'/">'.&mt('Done').'</a></h3>'); |
} |
} |
|
|
=pod |
=pod |
Line 387 sub Rename1 {
|
Line 388 sub Rename1 {
|
|
|
if(-e $fn) { |
if(-e $fn) { |
if($newfilename) { |
if($newfilename) { |
|
# is dest a dir |
|
if (-d $newfilename) { |
|
if ($fn =~ m|/([^/]*)$|) { $newfilename .= '/'.$1; } |
|
} |
if ($newfilename =~ m|/[^\.]+$|) { |
if ($newfilename =~ m|/[^\.]+$|) { |
#no extension add on original extension |
#no extension add on original extension |
if ($fn =~ m|/[^\.]*\.([^\.]+)$|) { |
if ($fn =~ m|/[^\.]*\.([^\.]+)$|) { |
Line 399 sub Rename1 {
|
Line 404 sub Rename1 {
|
if (-d $fn) { |
if (-d $fn) { |
$newfilename=~s/\/[^\/]+\/([^\/]+)$/\/$1/; |
$newfilename=~s/\/[^\/]+\/([^\/]+)$/\/$1/; |
} |
} |
|
$newfilename=~s://+:/:g; # remove duplicate / |
|
while ($newfilename=~m:/\.\./:) { |
|
$newfilename=~ s:/[^/]+/\.\./:/:g; #remove dir/.. |
|
} |
my $return=&exists($user, $domain, $newfilename); |
my $return=&exists($user, $domain, $newfilename); |
$request->print($return); |
$request->print($return); |
if ($return =~/^Error:/) { |
if ($return =~/^Error:/) { |
$request->print('<br /><a href="'.&url($fn).'">Cancel</a>'); |
$request->print('<br /><a href="'.&url($fn).'">'.&mt('Cancel').'</a>'); |
return; |
return; |
} |
} |
$request->print('<input type="hidden" name="newfilename" value="'. |
$request->print('<input type="hidden" name="newfilename" value="'. |
$newfilename. |
$newfilename. |
'" /><p>Rename '.&display($fn). |
'" /><p>'.&mt('Rename').' '.&display($fn). |
'</tt><br />to '.&display($newfilename).'?</p>'); |
'</tt><br />to '.&display($newfilename).'?</p>'); |
&CloseForm1($request, $fn); |
&CloseForm1($request, $fn); |
} else { |
} else { |
$request->print('<p>No new filename specified.</p></form>'); |
$request->print('<p>'.&mt('No new filename specified.').'</p></form>'); |
return; |
return; |
} |
} |
} else { |
} else { |
$request->print('<p> No such file: '.&display($fn).'</p></form>'); |
$request->print('<p> '.&mt('No such file').': '.&display($fn).'</p></form>'); |
return; |
return; |
} |
} |
|
|
Line 450 sub Delete1 {
|
Line 459 sub Delete1 {
|
if( -e $fn) { |
if( -e $fn) { |
$request->print('<input type="hidden" name="newfilename" value="'. |
$request->print('<input type="hidden" name="newfilename" value="'. |
$fn.'"/>'); |
$fn.'"/>'); |
$request->print('<p>Delete '.&display($fn).'?</p>'); |
$request->print('<p>'.&mt('Delete').' '.&display($fn).'?</p>'); |
&CloseForm1($request, $fn); |
&CloseForm1($request, $fn); |
} else { |
} else { |
$request->print('<p>No such file: '.&display($fn).'</p></form>'); |
$request->print('<p>'.&mt('No such file').': '.&display($fn).'</p></form>'); |
} |
} |
} |
} |
|
|
Line 485 Parameters:
|
Line 494 Parameters:
|
=cut |
=cut |
|
|
sub Copy1 { |
sub Copy1 { |
my ($request, $user, $domain, $fn, $newfilename) = @_; |
my ($request, $user, $domain, $fn, $newfilename) = @_; |
|
|
if(-e $fn) { |
if(-e $fn) { |
$request->print(&checksuffix($fn,$newfilename)); |
# is dest a dir |
my $return=&exists($user, $domain, $newfilename); |
if (-d $newfilename) { |
$request->print($return); |
if ($fn =~ m|/([^/]*)$|) { $newfilename .= '/'.$1; } |
if ($return =~/^Error:/) { |
} |
$request->print('<br /><a href="'.&url($fn).'">Cancel</a>'); |
if ($newfilename =~ m|/[^\.]+$|) { |
return; |
#no extension add on original extension |
|
if ($fn =~ m|/[^\.]*\.([^\.]+)$|) { $newfilename.='.'.$1; } |
|
} |
|
$newfilename=~s://+:/:g; # remove duplicate / |
|
while ($newfilename=~m:/\.\./:) { |
|
$newfilename=~ s:/[^/]+/\.\./:/:g; #remove dir/.. |
|
} |
|
$request->print(&checksuffix($fn,$newfilename)); |
|
my $return=&exists($user, $domain, $newfilename); |
|
$request->print($return); |
|
if ($return =~/^Error:/) { |
|
$request->print('<br /><a href="'.&url($fn).'">'.&mt('Cancel').'</a>'); |
|
return; |
|
} |
|
$request->print('<input type="hidden" name="newfilename" value="'. |
|
$newfilename. |
|
'" /><p>'.&mt('Copy').' '.&display($fn).'<br />to '. |
|
&display($newfilename).'?</p>'); |
|
&CloseForm1($request, $fn); |
|
} else { |
|
$request->print('<p>'.&mt('No such file').': '.&display($fn).'</p></form>'); |
} |
} |
$request->print('<input type = "hidden" name = "newfilename" value = "'. |
|
$newfilename. |
|
'" /><p>Copy '.&display($fn).'<br />to '. |
|
&display($newfilename).'?</p>'); |
|
&CloseForm1($request, $fn); |
|
} else { |
|
$request->print('<p>No such file: '.&display($fn).'</p></form>'); |
|
} |
|
} |
} |
|
|
=pod |
=pod |
Line 553 sub NewDir1
|
Line 574 sub NewDir1
|
$request->print('<font color="red">'.$result.'</font></form>'); |
$request->print('<font color="red">'.$result.'</font></form>'); |
} else { |
} else { |
$request->print('<input type="hidden" name="newfilename" value="'. |
$request->print('<input type="hidden" name="newfilename" value="'. |
$newfilename.'" /><p>Make new directory '. |
$newfilename.'" /><p>'.&mt('Make new directory').' '. |
&display($newfilename).'?</p>'); |
&display($newfilename).'?</p>'); |
&CloseForm1($request, $fn); |
&CloseForm1($request, $fn); |
} |
} |
} |
} |
|
|
|
|
|
sub Decompress1 { |
|
my ($request, $user, $domain, $fn) = @_; |
|
if( -e $fn) { |
|
$request->print('<input type="hidden" name="newfilename" value="'.$fn.'"/>'); |
|
$request->print('<p>'.&mt('Decompress').' '.&display($fn).'?</p>'); |
|
&CloseForm1($request, $fn); |
|
} else { |
|
$request->print('<p>'.&mt('No such file').': '.&display($fn).'</p></form>'); |
|
} |
|
} |
=pod |
=pod |
|
|
=item NewFile1 |
=item NewFile1 |
Line 609 sub NewFile1 {
|
Line 641 sub NewFile1 {
|
##Informs User (name).(number).(extension) not allowed |
##Informs User (name).(number).(extension) not allowed |
if($newfilename =~ /\.(\d+)\.(\w+)$/){ |
if($newfilename =~ /\.(\d+)\.(\w+)$/){ |
$r->print('<font color="red">'.$newfilename. |
$r->print('<font color="red">'.$newfilename. |
' - Bad Filename<br />(name).(number).(extension)'. |
' - '.&mt('Bad Filename').'<br />('.&mt('name').').('.&mt('number').').('.&mt('extension').')'. |
' Not Allowed</font>'); |
' '.&mt('Not Allowed').'</font>'); |
return; |
return; |
} |
} |
if ($newfilename !~ /\Q.$extension\E$/) { |
if ($newfilename !~ /\Q.$extension\E$/) { |
Line 625 sub NewFile1 {
|
Line 657 sub NewFile1 {
|
if($result) { |
if($result) { |
$request->print('<font color="red">'.$result.'</font></form>'); |
$request->print('<font color="red">'.$result.'</font></form>'); |
} else { |
} else { |
$request->print('<p>Make new file '.&display($newfilename).'?</p>'); |
$request->print('<p>'.&mt('Make new file').' '.&display($newfilename).'?</p>'); |
$request->print('</form>'); |
$request->print('</form>'); |
$request->print('<form action="'.&url($newfilename). |
$request->print('<form action="'.&url($newfilename). |
'" method="POST"><p><input type="submit" value="Continue" /></p></form>'); |
'" method="POST"><p><input type="submit" value="'.&mt('Continue').'" /></p></form>'); |
$request->print('<form action="'.&url($fn). |
$request->print('<form action="'.&url($fn). |
'" method="POST"><p><input type="submit" value="Cancel" /></p></form>'); |
'" method="POST"><p><input type="submit" value="'.&mt('Cancel').'" /></p></form>'); |
} |
} |
} |
} |
|
|
Line 667 sub phaseone {
|
Line 699 sub phaseone {
|
|
|
my $newfilename=&cleanDest($r,$ENV{'form.newfilename'}); |
my $newfilename=&cleanDest($r,$ENV{'form.newfilename'}); |
$newfilename=&relativeDest($fn,$newfilename,$uname); |
$newfilename=&relativeDest($fn,$newfilename,$uname); |
|
|
$r->print('<form action="/adm/cfile" method="post">'. |
$r->print('<form action="/adm/cfile" method="post">'. |
'<input type="hidden" name="qualifiedfilename" value="'.$fn.'" />'. |
'<input type="hidden" name="qualifiedfilename" value="'.$fn.'" />'. |
'<input type="hidden" name="phase" value="two" />'. |
'<input type="hidden" name="phase" value="two" />'. |
Line 677 sub phaseone {
|
Line 708 sub phaseone {
|
&Rename1($r, $uname, $udom, $fn, $newfilename); |
&Rename1($r, $uname, $udom, $fn, $newfilename); |
} elsif ($ENV{'form.action'} eq 'delete') { |
} elsif ($ENV{'form.action'} eq 'delete') { |
&Delete1($r, $uname, $udom, $fn); |
&Delete1($r, $uname, $udom, $fn); |
|
} elsif ($ENV{'form.action'} eq 'decompress') { |
|
&Decompress1($r, $uname, $udom, $fn); |
} elsif ($ENV{'form.action'} eq 'copy') { |
} elsif ($ENV{'form.action'} eq 'copy') { |
if($newfilename) { |
if($newfilename) { |
&Copy1($r, $uname, $udom, $fn, $newfilename); |
&Copy1($r, $uname, $udom, $fn, $newfilename); |
} else { |
} else { |
$r->print('<p>No new filename specified.</p></form>'); |
$r->print('<p>'.&mt('No new filename specified.').'</p></form>'); |
} |
} |
} elsif ($ENV{'form.action'} eq 'newdir') { |
} elsif ($ENV{'form.action'} eq 'newdir') { |
&NewDir1($r, $uname, $udom, $fn, $newfilename); |
&NewDir1($r, $uname, $udom, $fn, $newfilename); |
Line 696 sub phaseone {
|
Line 729 sub phaseone {
|
if ($newfilename) { |
if ($newfilename) { |
&NewFile1($r, $uname, $udom, $fn, $newfilename); |
&NewFile1($r, $uname, $udom, $fn, $newfilename); |
} else { |
} else { |
$r->print('<p>No new filename specified.</p></form>'); |
$r->print('<p>'.&mt('No new filename specified.').'</p></form>'); |
} |
} |
} |
} |
} |
} |
Line 748 sub Rename2 {
|
Line 781 sub Rename2 {
|
my $oRN=$oldfile; |
my $oRN=$oldfile; |
my $nRN=$newfile; |
my $nRN=$newfile; |
unless (rename($oldfile,$newfile)) { |
unless (rename($oldfile,$newfile)) { |
$request->print('<font color="red">Error: '.$!.'</font>'); |
$request->print('<font color="red">'.&mt('Error').': '.$!.'</font>'); |
return 0; |
return 0; |
} |
} |
## If old name.(extension) exits, move under new name. |
## If old name.(extension) exits, move under new name. |
Line 758 sub Rename2 {
|
Line 791 sub Rename2 {
|
my $tmp2=$nRN.'.meta'; |
my $tmp2=$nRN.'.meta'; |
if(-e $tmp1){ |
if(-e $tmp1){ |
unless(rename($tmp1,$tmp2)){ } |
unless(rename($tmp1,$tmp2)){ } |
}else if(-e $tmp2){ |
} elsif(-e $tmp2){ |
unlink $tmp2; |
unlink $tmp2; |
} |
} |
$tmp1=$oRN.'.save'; |
$tmp1=$oRN.'.save'; |
$tmp2=$nRN.'.save'; |
$tmp2=$nRN.'.save'; |
if(-e $tmp1){ |
if(-e $tmp1){ |
unless(rename($tmp1,$tmp2)){ } |
unless(rename($tmp1,$tmp2)){ } |
}else if(-e $tmp2){ |
} elsif(-e $tmp2){ |
unlink $tmp2; |
unlink $tmp2; |
} |
} |
$tmp1=$oRN.'.log'; |
$tmp1=$oRN.'.log'; |
$tmp2=$nRN.'.log'; |
$tmp2=$nRN.'.log'; |
if(-e $tmp1){ |
if(-e $tmp1){ |
unless(rename($tmp1,$tmp2)){ } |
unless(rename($tmp1,$tmp2)){ } |
}else if(-e $tmp2){ |
} elsif(-e $tmp2){ |
unlink $tmp2; |
unlink $tmp2; |
} |
} |
$tmp1=$oRN.'.bak'; |
$tmp1=$oRN.'.bak'; |
$tmp2=$nRN.'.bak'; |
$tmp2=$nRN.'.bak'; |
if(-e $tmp1){ |
if(-e $tmp1){ |
unless(rename($tmp1,$tmp2)){ } |
unless(rename($tmp1,$tmp2)){ } |
}else if(-e $tmp2){ |
} elsif(-e $tmp2){ |
unlink $tmp2; |
unlink $tmp2; |
} |
} |
} else { |
} else { |
$request->print("<p> No such file: ".&display($oldfile).'</p></form>'); |
$request->print("<p> ".&mt('No such file').": ".&display($oldfile).'</p></form>'); |
return 0; |
return 0; |
} |
} |
return 1; |
return 1; |
Line 819 Returns:
|
Line 852 Returns:
|
|
|
sub Delete2 { |
sub Delete2 { |
my ($request, $user, $filename) = @_; |
my ($request, $user, $filename) = @_; |
|
if(opendir DIR, $filename) { |
if(-e $filename) { |
my @files=readdir(DIR); |
unless(unlink($filename)) { |
shift @files; shift @files; # takes off . and .. |
$request->print('<font color="red">Error: '.$!.'</font>'); |
if(@files) { |
|
$request->print('<font color="red"> '.&mt('Error: Directory Non Empty').'</font>'); |
return 0; |
return 0; |
} |
} |
} else { |
else { |
$request->print('<p> No such file. </p></form'); |
if(-e $filename) { |
return 0; |
unless(rmdir($filename)) { |
|
$request->print('<font color="red">'.&mt('Error').': '.$!.'</font>'); |
|
return 0; |
|
} |
|
} |
|
else { |
|
$request->print('<p> '.&mt('No such file').'. </p></form'); |
|
return 0; |
|
} |
|
|
|
} |
|
|
|
} |
|
else { |
|
if(-e $filename) { |
|
unless(unlink($filename)) { |
|
$request->print('<font color="red">'.&mt('Error').': '.$!.'</font>'); |
|
return 0; |
|
} |
|
} |
|
else { |
|
$request->print('<p> '.&mt('No such file').'. </p></form'); |
|
return 0; |
} |
} |
|
} |
return 1; |
return 1; |
} |
} |
|
|
Line 865 sub Copy2 {
|
Line 922 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"> copy Error: '.$!.'</font>'); |
$request->print('<font color="red"> '.&mt('copy Error').': '.$!.'</font>'); |
return 0; |
return 0; |
} else { |
} else { |
unless (chmod(0660, $newfile)) { |
unless (chmod(0660, $newfile)) { |
$request->print('<font color="red"> chmod error: '.$!.'</font>'); |
$request->print('<font color="red"> '.&mt('chmod error').': '.$!.'</font>'); |
return 0; |
return 0; |
} |
} |
return 1; |
return 1; |
} |
} |
} else { |
} else { |
$request->print('<p> No such file </p>'); |
$request->print('<p> '.&mt('No such file').' </p>'); |
return 0; |
return 0; |
} |
} |
return 1; |
return 1; |
Line 906 sub NewDir2 {
|
Line 963 sub NewDir2 {
|
my ($request, $user, $newdirectory) = @_; |
my ($request, $user, $newdirectory) = @_; |
|
|
unless(mkdir($newdirectory, 02770)) { |
unless(mkdir($newdirectory, 02770)) { |
$request->print('<font color="red">Error: '.$!.'</font>'); |
$request->print('<font color="red">'.&mt('Error').': '.$!.'</font>'); |
return 0; |
return 0; |
} |
} |
unless(chmod(02770, ($newdirectory))) { |
unless(chmod(02770, ($newdirectory))) { |
$request->print('<font color="red"> Error: '.$!.'</font>'); |
$request->print('<font color="red"> '.&mt('Error').': '.$!.'</font>'); |
return 0; |
return 0; |
} |
} |
return 1; |
return 1; |
} |
} |
|
sub decompress2 { |
|
my ($r, $user, $dir, $file) = @_; |
|
&Apache::lonnet::appenv('cgi.file' => $file); |
|
&Apache::lonnet::appenv('cgi.dir' => $dir); |
|
my $result=&Apache::lonnet::ssi_body('/cgi-bin/decompress.pl'); |
|
$r->print($result); |
|
&Apache::lonnet::delenv('cgi.file'); |
|
&Apache::lonnet::delenv('cgi.dir'); |
|
return 1; |
|
} |
=pod |
=pod |
|
|
=item phasetwo($r, $fn, $uname, $udom) |
=item phasetwo($r, $fn, $uname, $udom) |
Line 958 sub phasetwo {
|
Line 1024 sub phasetwo {
|
my $dir; # Directory path |
my $dir; # Directory path |
my $main; # Filename. |
my $main; # Filename. |
my $suffix; # Extension. |
my $suffix; # Extension. |
|
if ($fn=~m:(.*)/([^/]+):) { |
if ($fn=~m:(.*)/([^/]+)\.(\w+)$:) { |
|
$dir=$1; # Directory path |
$dir=$1; # Directory path |
$main=$2; # Filename. |
$main=$2; # Filename. |
$suffix=$3; # Extension. |
} |
} |
if($main=~m:\.(\w+)$:){ # Fixes problems with filenames with no extensions |
|
$main=$`; |
|
$suffix=$1; |
|
} |
my $dest; # On success this is where we'll go. |
my $dest; # On success this is where we'll go. |
|
|
&Debug($r, |
&Debug($r, |
Line 981 sub phasetwo {
|
Line 1048 sub phasetwo {
|
"loncfie::phase2 action is $ENV{'form.action'}"); |
"loncfie::phase2 action is $ENV{'form.action'}"); |
|
|
# Select the appropriate processing sub. |
# Select the appropriate processing sub. |
|
if ($ENV{'form.action'} eq 'decompress') { |
if ($ENV{'form.action'} eq 'rename') { # Rename. |
$main .= '.'; |
|
$main .= $suffix; |
|
if(!&decompress2($r, $uname, $dir, $main)) { |
|
return ; |
|
} |
|
$dest = $dir."/."; |
|
|
|
|
|
} elsif ($ENV{'form.action'} eq 'rename') { # Rename. |
if($ENV{'form.newfilename'}) { |
if($ENV{'form.newfilename'}) { |
if (!defined($dir)) { |
if (!defined($dir)) { |
$fn=~m:^(.*)/:; |
$fn=~m:^(.*)/:; |
Line 1004 sub phasetwo {
|
Line 1079 sub phasetwo {
|
} elsif ($ENV{'form.action'} eq 'copy') { |
} elsif ($ENV{'form.action'} eq 'copy') { |
if($ENV{'form.newfilename'}) { |
if($ENV{'form.newfilename'}) { |
if(!&Copy2($r, $uname, $dir, $fn, $ENV{'form.newfilename'})) { |
if(!&Copy2($r, $uname, $dir, $fn, $ENV{'form.newfilename'})) { |
return |
return ; |
} |
} |
$dest = $ENV{'form.newfilename'}; |
$dest = $ENV{'form.newfilename'}; |
|
|
} else { |
} else { |
$r->print('<p>No New filename specified</p></form>'); |
$r->print('<p>'.&mt('No New filename specified').'</p></form>'); |
return; |
return; |
} |
} |
|
|
Line 1020 sub phasetwo {
|
Line 1095 sub phasetwo {
|
} |
} |
$dest = $newdir."/" |
$dest = $newdir."/" |
} |
} |
$r->print('<h3><a href="'.&url($dest).'">Done</a></h3>'); |
$r->print('<h3><a href="'.&url($dest).'">'.&mt('Done').'</a></h3>'); |
} |
} |
|
|
sub handler { |
sub handler { |
Line 1039 sub handler {
|
Line 1114 sub handler {
|
my $fn; |
my $fn; |
|
|
if ($ENV{'form.filename'}) { |
if ($ENV{'form.filename'}) { |
|
|
|
&Debug($r, "test: $ENV{'form.filename'}"); |
$fn=&Apache::lonnet::unescape($ENV{'form.filename'}); |
$fn=&Apache::lonnet::unescape($ENV{'form.filename'}); |
$fn=&URLToPath($fn); |
$fn=&URLToPath($fn); |
} elsif ($ENV{'form.qualifiedfilename'}) { |
} |
|
#Just hijack the script only the first time around to inject the correct information for further processing |
|
elsif($ENV{'QUERY_STRING'} && $ENV{'form.phase'} ne 'two') { |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['decompress']); |
|
$fn=&Apache::lonnet::unescape($ENV{'form.decompress'}); |
|
$fn=&URLToPath($fn); |
|
$ENV{'form.action'}="decompress"; |
|
} |
|
|
|
elsif ($ENV{'form.qualifiedfilename'}) { |
$fn=$ENV{'form.qualifiedfilename'}; |
$fn=$ENV{'form.qualifiedfilename'}; |
} else { |
} else { |
&Debug($r, "loncfile::handler - no form.filename"); |
&Debug($r, "loncfile::handler - no form.filename"); |
Line 1082 sub handler {
|
Line 1168 sub handler {
|
$r->print(&Apache::loncommon::bodytag('Construction Space File Operation')); |
$r->print(&Apache::loncommon::bodytag('Construction Space File Operation')); |
|
|
|
|
$r->print('<h3>Location: '.&display($fn).'</h3>'); |
$r->print('<h3>'.&mt('Location').': '.&display($fn).'</h3>'); |
|
|
if (($uname ne $ENV{'user.name'}) || ($udom ne $ENV{'user.domain'})) { |
if (($uname ne $ENV{'user.name'}) || ($udom ne $ENV{'user.domain'})) { |
$r->print('<h3><font color="red">Co-Author: '.$uname.' at '.$udom. |
$r->print('<h3><font color="red">'.&mt('Co-Author').': '.$uname.' at '.$udom. |
'</font></h3>'); |
'</font></h3>'); |
} |
} |
|
|
Line 1093 sub handler {
|
Line 1179 sub handler {
|
&Debug($r, "loncfile::handler Form action is $ENV{'form.action'} "); |
&Debug($r, "loncfile::handler Form action is $ENV{'form.action'} "); |
if ($ENV{'form.action'} eq 'delete') { |
if ($ENV{'form.action'} eq 'delete') { |
|
|
$r->print('<h3>Delete</h3>'); |
$r->print('<h3>'.&mt('Delete').'</h3>'); |
} elsif ($ENV{'form.action'} eq 'rename') { |
} elsif ($ENV{'form.action'} eq 'rename') { |
$r->print('<h3>Rename</h3>'); |
$r->print('<h3>'.&mt('Rename').'</h3>'); |
} elsif ($ENV{'form.action'} eq 'newdir') { |
} elsif ($ENV{'form.action'} eq 'newdir') { |
$r->print('<h3>New Directory</h3>'); |
$r->print('<h3>'.&mt('New Directory').'</h3>'); |
|
} elsif ($ENV{'form.action'} eq 'decompress') { |
|
$r->print('<h3>'.&mt('Decompress').'</h3>'); |
} elsif ($ENV{'form.action'} eq 'copy') { |
} elsif ($ENV{'form.action'} eq 'copy') { |
$r->print('<h3>Copy</h3>'); |
$r->print('<h3>'.&mt('Copy').'</h3>'); |
} elsif ($ENV{'form.action'} eq 'newfile' || |
} elsif ($ENV{'form.action'} eq 'newfile' || |
$ENV{'form.action'} eq 'newhtmlfile' || |
$ENV{'form.action'} eq 'newhtmlfile' || |
$ENV{'form.action'} eq 'newproblemfile' || |
$ENV{'form.action'} eq 'newproblemfile' || |
Line 1108 sub handler {
|
Line 1196 sub handler {
|
$ENV{'form.action'} eq 'newrightsfile' || |
$ENV{'form.action'} eq 'newrightsfile' || |
$ENV{'form.action'} eq 'newstyfile' || |
$ENV{'form.action'} eq 'newstyfile' || |
$ENV{'form.action'} eq 'Select Action' ) { |
$ENV{'form.action'} eq 'Select Action' ) { |
$r->print('<h3>New Resource</h3>'); |
$r->print('<h3>'.&mt('New Resource').'</h3>'); |
} else { |
} else { |
$r->print('<p>Unknown Action '.$ENV{'form.action'}.' </p></body></html>'); |
$r->print('<p>'.&mt('Unknown Action').' '.$ENV{'form.action'}.' </p></body></html>'); |
return OK; |
return OK; |
} |
} |
if ($ENV{'form.phase'} eq 'two') { |
if ($ENV{'form.phase'} eq 'two') { |