Diff for /loncom/interface/portfolio.pm between versions 1.82 and 1.83

version 1.82, 2005/04/07 06:56:23 version 1.83, 2005/04/12 01:15:46
Line 34  use Apache::lonnet; Line 34  use Apache::lonnet;
 # receives a file name and path stub from username/userfiles/portfolio/  # receives a file name and path stub from username/userfiles/portfolio/
 # returns an anchor tag consisting encoding filename and currentpath  # returns an anchor tag consisting encoding filename and currentpath
 sub make_anchor {  sub make_anchor {
     my ($filename, $current_path, $current_mode, $field_name) = @_;      my ($filename, $current_path, $current_mode, $field_name, $continue_select) = @_;
     my $anchor = '<a href="/adm/portfolio?selectfile='.$filename.'&currentpath='.$current_path.'&mode='.$current_mode.'&fieldname='.$field_name.'">'.$filename.'</a>';      if ($continue_select ne 'true') {$continue_select = 'false'};
       my $anchor = '<a href="/adm/portfolio?selectfile='.$filename.'&currentpath='.$current_path.'&mode='.$current_mode.'&continue='.$continue_select.'&fieldname='.$field_name.'">'.$filename.'</a>';
     return $anchor;      return $anchor;
 }  }
 my $dirptr=16384;  my $dirptr=16384;
Line 65  sub display_common { Line 66  sub display_common {
     $r->print($displayOut);      $r->print($displayOut);
     $r->print('</td></tr></table>');      $r->print('</td></tr></table>');
     my @tree = split (/\//,$current_path);      my @tree = split (/\//,$current_path);
     $r->print('<font size="+2">'.&make_anchor('portfolio','/',$env{"form.mode"},$env{"form.fieldname"}).'/');      $r->print('<font size="+2">'.&make_anchor('portfolio','/',$env{"form.mode"},$env{"form.fieldname"},$env{"form.continue"}).'/');
     if (@tree > 1){      if (@tree > 1){
         my $newCurrentPath = '';          my $newCurrentPath = '';
         for (my $i = 1; $i< @tree; $i++){          for (my $i = 1; $i< @tree; $i++){
             $newCurrentPath .= $tree[$i].'/';              $newCurrentPath .= $tree[$i].'/';
             $r->print(&make_anchor($tree[$i],'/'.$newCurrentPath, $env{"form.mode"},$env{"form.fieldname"}).'/');              $r->print(&make_anchor($tree[$i],'/'.$newCurrentPath, $env{"form.mode"},$env{"form.fieldname"}, $env{"form.continue"}).'/');
         }          }
     }      }
     $r->print('</font>');      $r->print('</font>');
Line 132  sub display_directory { Line 133  sub display_directory {
                     $r->print('<tr bgcolor="#FFAA99"><td colspan="2"><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"},$env{'form.continue'}).'</td>'); 
                 $r->print('</tr>');                   $r->print('</tr>'); 
             } else {              } else {
                 $r->print('<tr bgcolor="#CCCCFF">');                  $r->print('<tr bgcolor="#CCCCFF">');
                 if ($select_mode eq 'true'){                  if ($select_mode eq 'true'){
                     $r->print('<td><input type="checkbox" name="selectfile" value="'.$filename.'"');                       $r->print('<td><input type="checkbox" name="checkfile" value="'.$filename.'"'); 
                     if ($$checked_files{$filename} eq 'selected') {                      if ($$checked_files{$filename} eq 'selected') {
                         $r->print("CHECKED");                          $r->print("CHECKED");
                     }                      }
Line 351  sub select_files { Line 352  sub select_files {
     if ($env{'form.continue'} eq 'true') {      if ($env{'form.continue'} eq 'true') {
         # here we update the selections for the currentpath          # here we update the selections for the currentpath
         # eventually, have to handle removing those not checked, but . . .           # eventually, have to handle removing those not checked, but . . . 
         my @items=&Apache::loncommon::get_env_multiple('form.selectfile');          my @items=&Apache::loncommon::get_env_multiple('form.checkfile');
         &Apache::lonnet::save_selected_files($env{'user.name'}, $env{'form.currentpath'}, @items);          if (scalar(@items)){
               &Apache::lonnet::logthis("one of the items is $items[0]");
               &Apache::lonnet::save_selected_files($env{'user.name'}, $env{'form.currentpath'}, @items);
           }
     } else {      } else {
         if ($env{'form.currentpath'} eq '/') {  
             #empty the file for a fresh start              #empty the file for a fresh start
             # &Apache::lonnet::clear_selected_files($env{'user.name'});              &Apache::lonnet::logthis("Clearing saved files");
         }              &Apache::lonnet::clear_selected_files($env{'user.name'});
     }      }
     my @files = &Apache::lonnet::files_not_in_path($env{'user.name'}, $env{'form.currentpath'});      my @files = &Apache::lonnet::files_not_in_path($env{'user.name'}, $env{'form.currentpath'});
     my $java_files = join ",", @files;      my $java_files = join ",", @files;
Line 497  sub handler { Line 500  sub handler {
  '/userfiles/portfolio';   '/userfiles/portfolio';
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                             ['selectfile','currentpath','meta','lockinfo',                                              ['selectfile','currentpath','meta','lockinfo',
      'currentfile','action','fieldname','mode','rename']);       'currentfile','action','fieldname','mode','rename','continue']);
     &Apache::loncommon::no_cache($r);      &Apache::loncommon::no_cache($r);
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;

Removed from v.1.82  
changed lines
  Added in v.1.83


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