Diff for /loncom/interface/portfolio.pm between versions 1.24 and 1.26

version 1.24, 2004/08/24 06:16:55 version 1.26, 2004/08/24 06:51:11
Line 197  sub display_directory { Line 197  sub display_directory {
     $r->print('<table border="0" cellspacing="2" cellpadding="2">'.      $r->print('<table border="0" cellspacing="2" cellpadding="2">'.
             '<tr><th>Actions</th><th>&nbsp;</th><th>Name</th><th>Size</th><th>Last Modified</th></tr>');              '<tr><th>Actions</th><th>&nbsp;</th><th>Name</th><th>Size</th><th>Last Modified</th></tr>');
     my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio/$current_path/";      my $href_location="/uploaded/$ENV{'user.domain'}/$ENV{'user.name'}/portfolio/$current_path/";
     foreach my $line (@$dir_list) {      foreach my $line (sort 
         { 
     my ($afile)=split('&',$a,2);
     my ($bfile)=split('&',$b,2);
     return (lc($afile) cmp lc($bfile));
         } (@$dir_list)) {
     #$strip holds directory/file name      #$strip holds directory/file name
     #$dom       #$dom 
     my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16);       my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16); 
Line 268  sub display_file { Line 273  sub display_file {
 }  }
   
 sub done {  sub done {
     return ('<h3><a href="/adm/portfolio?currentpath="'.      return ('<h3><a href="/adm/portfolio?currentpath='.
     $ENV{'form.currentpath'}.'">'.&mt('Done').'</a></h3>');      $ENV{'form.currentpath'}.'">'.&mt('Done').'</a></h3>');
 }  }
   
Line 287  sub delete_confirmed { Line 292  sub delete_confirmed {
        $ENV{'form.selectfile'});         $ENV{'form.selectfile'});
     if ($result ne 'ok') {      if ($result ne 'ok') {
  $r->print('<font color="red"> An errror occured ('.$result.   $r->print('<font color="red"> An errror occured ('.$result.
   ')while trying to delete '.&display_file().'</font><br />');    ') while trying to delete '.&display_file().'</font><br />');
     }      }
     $r->print(&done());      $r->print(&done());
 }  }
Line 306  sub rename_confirmed { Line 311  sub rename_confirmed {
   
 sub upload {  sub upload {
     my ($r)=@_;      my ($r)=@_;
       #FIXME if the file already exists we need to do a confirmation pass 
       #before overwriting
     my $result=&Apache::lonnet::userfileupload('uploaddoc','',      my $result=&Apache::lonnet::userfileupload('uploaddoc','',
  'portfolio'.$ENV{'form.currentpath'});   'portfolio'.$ENV{'form.currentpath'});
     if ($result !~ m|^/uploaded/|) {      if ($result !~ m|^/uploaded/|) {
  $r->print('<font color="red"> An errror occured ('.$result.   $r->print('<font color="red"> An errror occured ('.$result.
   ')while trying to upload '.&display_file().'</font><br />');    ') while trying to upload '.&display_file().'</font><br />');
       }
       $r->print(&done());
   }
   
   sub createdir {
       my ($r)=@_;
       #FIXME 1) bad dirnames ( '/' etc)
       #      2) file exists in place of dir (errormessage needs improvement)
       my $result=&Apache::lonnet::mkdiruserfile($ENV{'user.name'},
        $ENV{'user.domain'},'portfolio'.$ENV{'form.currentpath'}.$ENV{'form.newdir'});
       if ($result ne 'ok') {
    $r->print('<font color="red"> An errror occured ('.$result.
     ') while trying to create a new directory '.&display_file().'</font><br />');
     }      }
     $r->print(&done());      $r->print(&done());
 }  }
Line 352  sub handler { Line 372  sub handler {
  # similarly, we need to delete or rename files before getting   # similarly, we need to delete or rename files before getting
  # directory list   # directory list
  &rename($r);   &rename($r);
       } elsif ($ENV{'form.createdir'}) {
    &createdir($r);
     } else {      } else {
  my $current_path='/';   my $current_path='/';
  if ($ENV{'form.currentpath'}) {   if ($ENV{'form.currentpath'}) {

Removed from v.1.24  
changed lines
  Added in v.1.26


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