Diff for /loncom/interface/portfolio.pm between versions 1.65 and 1.72

version 1.65, 2004/12/12 01:35:44 version 1.72, 2005/01/18 17:45:06
Line 96  sub display_directory { Line 96  sub display_directory {
  return;   return;
     }      }
     $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 colspan="2">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";
     $r->print('<form method="post" action="/adm/portfolio">');      $r->print('<form method="post" action="/adm/portfolio">');
     foreach my $line (sort       foreach my $line (sort 
Line 110  sub display_directory { Line 110  sub display_directory {
     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); 
     if (($filename ne '.') && ($filename ne '..')) {      if (($filename ne '.') && ($filename ne '..')) {
             if ($dirptr&$testdir) {              if ($dirptr&$testdir) {
                 $r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'folder_closed.gif"></td>');                  $r->print('<tr bgcolor="#FFAA99"><td colspan="2"><img src="'.$iconpath.'folder_closed.gif"></td>');
                 $r->print('<td>Go to ...</td>');                  $r->print('<td>Go to ...</td>');
                 $r->print('<td>'.&make_anchor($filename.'/',$current_path.$filename.'/',$ENV{'form.mode'},$ENV{"form.fieldname"}).'</td>');                   $r->print('<td>'.&make_anchor($filename.'/',$current_path.$filename.'/',$ENV{'form.mode'},$ENV{"form.fieldname"}).'</td>'); 
                 $r->print('</tr>');                   $r->print('</tr>'); 
             } else {              } else {
                 $r->print('<tr bgcolor="#CCCCFF">');                  $r->print('<tr bgcolor="#CCCCFF">');
                 if (exists $locked_files{$current_path.$filename}){                  if (exists $locked_files{$current_path.$filename}){
                     $r->print('<td>Locked</td>');                      $r->print('<td colspan="2">Locked</td>');
                 } else {                  } else {
                     $r->print('<td>Delete<input type="checkbox" name="selectfile" value="'.$filename.'" />                      $r->print('<td><input type="checkbox" name="selectfile" value="'.$filename.'" />
                         <a href="/adm/portfolio?rename='.$filename.'&amp;currentpath='.$current_path.'">Rename</a>                                                  <a href="/adm/portfolio?rename='.$filename.'&amp;currentpath='.$current_path.'">Rename</a></td>
                           <td><a href="/adm/portfolio?meta='.$filename.'&amp;currentpath='.$current_path.'">Meta</a>
                         </td>');                          </td>');
                 }                  }
                 $r->print('<td><img src="'.$iconpath.'unknown.gif"></td>');                  $r->print('<td><img src="'.$iconpath.'unknown.gif"></td>');
Line 148  sub display_file_select { Line 149  sub display_file_select {
     my $iconpath= $r->dir_config('lonIconsURL') . "/";      my $iconpath= $r->dir_config('lonIconsURL') . "/";
     my $display_out;      my $display_out;
     my $checked_files = &Apache::lonnet::files_in_path($ENV{'user.name'}, $ENV{'form.currentpath'});      my $checked_files = &Apache::lonnet::files_in_path($ENV{'user.name'}, $ENV{'form.currentpath'});
     foreach my $key (keys %$checked_files) {  
         &Apache::lonnet::logthis("a key is $key $$checked_files{$key} is the value");  
     }  
     if ($is_empty && ($current_path ne '/')) {      if ($is_empty && ($current_path ne '/')) {
         $display_out = '<form method="post" action="/adm/portfolio">'.          $display_out = '<form method="post" action="/adm/portfolio">'.
         '<input type="hidden" name="action" value="deletedir" />'.          '<input type="hidden" name="action" value="deletedir" />'.
Line 188  sub display_file_select { Line 186  sub display_file_select {
                 $r->print('<td><input type="checkbox" name="selectfile" value="'.$filename.'"');                   $r->print('<td><input type="checkbox" name="selectfile" value="'.$filename.'"'); 
                 if ($$checked_files{$filename} eq 'selected') {                  if ($$checked_files{$filename} eq 'selected') {
                     $r->print("CHECKED");                      $r->print("CHECKED");
                     &Apache::lonnet::logthis("checked");  
                 } else {  
                     &Apache::lonnet::logthis("not checked $$checked_files{$filename} $filename");  
                 }                  }
                 $r->print('></td>');                  $r->print('></td>');
                 $r->print('<td><img src="'.$iconpath.'unknown.gif"></td>');                  $r->print('<td><img src="'.$iconpath.'unknown.gif"></td>');
Line 249  sub display_file { Line 244  sub display_file {
         $display_file_text = '<tt>'.$path.$filename.'</tt>';          $display_file_text = '<tt>'.$path.$filename.'</tt>';
     } elsif (ref($filename) eq "ARRAY") {      } elsif (ref($filename) eq "ARRAY") {
         foreach (@$filename) {          foreach (@$filename) {
             $display_file_text .= '<tt>'.$path.$_.'</tt>';              $display_file_text .= '<tt>'.$path.$_.'</tt><br />';
         }          }
     } elsif (ref($filename) eq "SCALAR") {      } elsif (ref($filename) eq "SCALAR") {
         $display_file_text = '<tt>'.$path.$filename.'</tt>';                  $display_file_text = '<tt>'.$path.$filename.'</tt>';        
Line 270  sub delete { Line 265  sub delete {
     my @check;      my @check;
     my $file_name = $ENV{'form.currentpath'}.$ENV{'form.selectfile'};      my $file_name = $ENV{'form.currentpath'}.$ENV{'form.selectfile'};
     my @files=&Apache::loncommon::get_env_multiple('form.selectfile');      my @files=&Apache::loncommon::get_env_multiple('form.selectfile');
   
     if (&Apache::lonnet::is_locked($file_name,$ENV{'user.domain'},$ENV{'user.name'} ) eq 'true') {      if (&Apache::lonnet::is_locked($file_name,$ENV{'user.domain'},$ENV{'user.name'} ) eq 'true') {
         $r->print ("The file is locked and cannot be deleted.<br />");          $r->print ("The file is locked and cannot be deleted.<br />");
         $r->print(&done());          $r->print(&done());
     } else {      } else {
         &open_form($r);          if (scalar(@files)) {
         $r->print('<p>'.&mt('Delete').' '.&display_file(undef,\@files).'?</p>');              &open_form($r);
         &close_form($r);              $r->print('<p>'.&mt('Delete').' '.&display_file(undef,\@files).'?</p>');
               &close_form($r);
           } else {
               $r->print("No file was checked to delete.<br />");
               $r->print(&done());
           }
     }      }
 }   } 
   
Line 285  sub delete_confirmed { Line 286  sub delete_confirmed {
     my @files=&Apache::loncommon::get_env_multiple('form.selectfile');      my @files=&Apache::loncommon::get_env_multiple('form.selectfile');
     my $result;      my $result;
     foreach my $delete_file (@files) {      foreach my $delete_file (@files) {
         &Apache::lonnet::logthis("trying to delete $delete_file");  
         $result=&Apache::lonnet::removeuserfile($ENV{'user.name'},          $result=&Apache::lonnet::removeuserfile($ENV{'user.name'},
        $ENV{'user.domain'},'portfolio'.         $ENV{'user.domain'},'portfolio'.
        $ENV{'form.currentpath'}.         $ENV{'form.currentpath'}.
Line 366  sub rename_confirmed { Line 366  sub rename_confirmed {
   ') while trying to rename '.&display_file().' to '.    ') while trying to rename '.&display_file().' to '.
   &display_file(undef,$filenewname).'</font><br />');    &display_file(undef,$filenewname).'</font><br />');
     }      }
       if ($filenewname ne $ENV{'form.filenewname'}) {
           $r->print("The new file name was changed from:<br /><strong>".$ENV{'form.filenewname'}."</strong> to <strong>$filenewname </strong>");
       }
     $r->print(&done());      $r->print(&done());
 }  }
 sub select_files {  sub select_files {
Line 435  sub upload { Line 438  sub upload {
         }          }
     }      }
     my $current_disk_usage = &Apache::lonnet::diskusage($ENV{'user.domain'}, $ENV{'user.name'},$portfolio_root);      my $current_disk_usage = &Apache::lonnet::diskusage($ENV{'user.domain'}, $ENV{'user.name'},$portfolio_root);
     if (($current_disk_usage + $filesize) > $disk_quota){      if ((($current_disk_usage/1000) + $filesize) > $disk_quota){
         $r->print('<font color="red">Unable to upload <strong>'.$fname.' (size = '.$filesize.' kilobytes</strong>. Disk quota will be exceeded.'.          $r->print('<font color="red">Unable to upload <strong>'.$fname.' (size = '.$filesize.' kilobytes</strong>. Disk quota will be exceeded.'.
                   '<br />Disk quota is '.$disk_quota.' kilobytes. Your current disk usage is '.$current_disk_usage.' kilobytes.');                    '<br />Disk quota is '.$disk_quota.' kilobytes. Your current disk usage is '.$current_disk_usage.' kilobytes.');
     }       } 
Line 487  sub createdir { Line 490  sub createdir {
           ') while trying to create a new directory '.&display_file().'</font><br />');            ') while trying to create a new directory '.&display_file().'</font><br />');
         }          }
     }      }
       if ($newdir ne $ENV{'form.newdir'}) {
           $r->print("The new directory name was changed from:<br /><strong>".$ENV{'form.newdir'}."</strong> to <strong>$newdir </strong>");  
       }
     $r->print(&done());      $r->print(&done());
 }  }
   
Line 506  sub handler { Line 512  sub handler {
               &Apache::loncommon::bodytag('Portfolio Manager'));                &Apache::loncommon::bodytag('Portfolio Manager'));
     $r->rflush();      $r->rflush();
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                             ['selectfile','currentpath',                                              ['selectfile','currentpath','meta',
      'currentfile','action','fieldname','mode','rename']);       'currentfile','action','fieldname','mode','rename']);
  if (($ENV{'form.storeupl'} eq 'Upload') & (!$ENV{'form.uploaddoc.filename'})){   if (($ENV{'form.storeupl'} eq 'Upload') & (!$ENV{'form.uploaddoc.filename'})){
        $r->print('<font color="red"> No file was selected to upload.'.         $r->print('<font color="red"> No file was selected to upload.'.
                'To upload a file, click <strong>Browse...</strong>'.                 'To upload a file, click <strong>Browse...</strong>'.
                ', select a file, then click <strong>Upload</strong>,</font>');                 ', select a file, then click <strong>Upload</strong>,</font>');
  }   }
       if ($ENV{'form.meta'}) {
           &open_form($r);
   #        $r->print(&edit_meta_data($r, $ENV{'form.currentpath'}.$ENV{'form.selectfile'}));
           $r->print('Edit the meta data<br />');
           &close_form($r);
       }
       if ($ENV{'form.store'}) {
       }
   
     if ($ENV{'form.uploaddoc.filename'}) {      if ($ENV{'form.uploaddoc.filename'}) {
  &upload($r);   &upload($r);
     } elsif ($ENV{'form.action'} eq 'delete' && $ENV{'form.confirmed'}) {      } elsif ($ENV{'form.action'} eq 'delete' && $ENV{'form.confirmed'}) {

Removed from v.1.65  
changed lines
  Added in v.1.72


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