Diff for /loncom/publisher/loncfile.pm between versions 1.75 and 1.79

version 1.75, 2006/04/10 22:47:18 version 1.79, 2006/11/23 01:50:57
Line 72  use Apache::loncacc; Line 72  use Apache::loncacc;
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonlocal;  use Apache::lonlocal;
   use lib '/home/httpd/lib/perl/';
   use LONCAPA;
    
   
 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 1135  sub phasetwo { Line 1138  sub phasetwo {
           
     &Debug($r, "loncfile - Entering phase 2 for $fn");      &Debug($r, "loncfile - Entering phase 2 for $fn");
           
     # Break down the file into it's component pieces.      # Break down the file into its component pieces.
           
     my $dir; # Directory path      my $dir; # Directory path
     my $main; # Filename.      my $main; # Filename.
Line 1148  sub phasetwo { Line 1151  sub phasetwo {
  $suffix=$1; #This is the actually filename extension if it exists   $suffix=$1; #This is the actually filename extension if it exists
  $main=~s/\.\w+$//; #strip the extension   $main=~s/\.\w+$//; #strip the extension
     }      }
     my $dest;                   # On success this is where we'll go.      my $dest;                       #
           my $dest_dir;                   # On success this is where we'll go.
       my $disp_newname;               #
       my $dest_newname;               #
     &Debug($r,"loncfile::phase2 dir = $dir main = $main suffix = $suffix");      &Debug($r,"loncfile::phase2 dir = $dir main = $main suffix = $suffix");
     &Debug($r,"    newfilename = ".$env{'form.newfilename'});      &Debug($r,"    newfilename = ".$env{'form.newfilename'});
   
Line 1176  sub phasetwo { Line 1181  sub phasetwo {
     if(!&Rename2($r, $uname, $dir, $fn, $env{'form.newfilename'})) {      if(!&Rename2($r, $uname, $dir, $fn, $env{'form.newfilename'})) {
  return;   return;
     }      }
     $dest = $env{'form.newfilename'};      $dest = $dir."/";
       $dest_newname = $env{'form.newfilename'};
       $env{'form.newfilename'} =~ /.+(\/.+$)/;
       $disp_newname = $1;
       $disp_newname =~ s/\///;
  }   }
     } elsif ($env{'form.action'} eq 'delete') {       } elsif ($env{'form.action'} eq 'delete') { 
  if(!&Delete2($r, $uname, $env{'form.newfilename'})) {   if(!&Delete2($r, $uname, $env{'form.newfilename'})) {
Line 1207  sub phasetwo { Line 1216  sub phasetwo {
     if ( ($env{'form.action'} eq 'newdir') && ($env{'form.phase'} eq 'two') && ( ($env{'form.callingmode'} eq 'testbank') || ($env{'form.callingmode'} eq 'imsimport') ) ) {      if ( ($env{'form.action'} eq 'newdir') && ($env{'form.phase'} eq 'two') && ( ($env{'form.callingmode'} eq 'testbank') || ($env{'form.callingmode'} eq 'imsimport') ) ) {
  $r->print('<h3><a href="javascript:self.close()">'.&mt('Done').'</a></h3>');   $r->print('<h3><a href="javascript:self.close()">'.&mt('Done').'</a></h3>');
     } else {      } else {
  $r->print('<h3><a href="'.&url($dest).'">'.&mt('Done').'</a></h3>');          if ($env{'form.action'} eq 'rename') {
               $r->print('<h3><a href="'.&url($dest).'">'.&mt('Return to Directory').'</a></h3>');
               $r->print('<h3><a href="'.&url($dest_newname).'">'.$disp_newname.'</a></h3>');
           } else {
       $r->print('<h3><a href="'.&url($dest).'">'.&mt('Done').'</a></h3>');
    }
     }      }
 }  }
   
Line 1229  sub handler { Line 1243  sub handler {
   
     if ($env{'form.filename'}) {      if ($env{'form.filename'}) {
  &Debug($r, "test: $env{'form.filename'}");   &Debug($r, "test: $env{'form.filename'}");
  $fn=&Apache::lonnet::unescape($env{'form.filename'});   $fn=&unescape($env{'form.filename'});
  $fn=&URLToPath($fn);   $fn=&URLToPath($fn);
     }  elsif($ENV{'QUERY_STRING'} && $env{'form.phase'} ne 'two') {        }  elsif($ENV{'QUERY_STRING'} && $env{'form.phase'} ne 'two') {  
  #Just hijack the script only the first time around to inject the   #Just hijack the script only the first time around to inject the
  #correct information for further processing   #correct information for further processing
  $fn=&Apache::lonnet::unescape($env{'form.decompress'});   $fn=&unescape($env{'form.decompress'});
  $fn=&URLToPath($fn);   $fn=&URLToPath($fn);
  $env{'form.action'}="decompress";   $env{'form.action'}="decompress";
     } elsif ($env{'form.qualifiedfilename'}) {      } elsif ($env{'form.qualifiedfilename'}) {
Line 1287  function writeDone() { Line 1301  function writeDone() {
 }  }
   </script>    </script>
 |;  |;
  $loaditem{'onload'} => "writeDone()";   $loaditem{'onload'} = "writeDone()";
     }      }
           
     $r->print(&Apache::loncommon::start_page('Construction Space File Operation',      $r->print(&Apache::loncommon::start_page('Construction Space File Operation',

Removed from v.1.75  
changed lines
  Added in v.1.79


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>