--- loncom/interface/portfolio.pm 2005/04/07 06:56:23 1.82 +++ loncom/interface/portfolio.pm 2005/04/12 01:15:46 1.83 @@ -34,8 +34,9 @@ use Apache::lonnet; # receives a file name and path stub from username/userfiles/portfolio/ # returns an anchor tag consisting encoding filename and currentpath sub make_anchor { - my ($filename, $current_path, $current_mode, $field_name) = @_; - my $anchor = ''.$filename.''; + my ($filename, $current_path, $current_mode, $field_name, $continue_select) = @_; + if ($continue_select ne 'true') {$continue_select = 'false'}; + my $anchor = ''.$filename.''; return $anchor; } my $dirptr=16384; @@ -65,12 +66,12 @@ sub display_common { $r->print($displayOut); $r->print(''); my @tree = split (/\//,$current_path); - $r->print(''.&make_anchor('portfolio','/',$env{"form.mode"},$env{"form.fieldname"}).'/'); + $r->print(''.&make_anchor('portfolio','/',$env{"form.mode"},$env{"form.fieldname"},$env{"form.continue"}).'/'); if (@tree > 1){ my $newCurrentPath = ''; for (my $i = 1; $i< @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(''); @@ -132,12 +133,12 @@ sub display_directory { $r->print(''); } $r->print('Go to ...'); - $r->print(''.&make_anchor($filename.'/',$current_path.$filename.'/',$env{'form.mode'},$env{"form.fieldname"}).''); + $r->print(''.&make_anchor($filename.'/',$current_path.$filename.'/',$env{'form.mode'},$env{"form.fieldname"},$env{'form.continue'}).''); $r->print(''); } else { $r->print(''); if ($select_mode eq 'true'){ - $r->print('print('print("CHECKED"); } @@ -351,13 +352,15 @@ sub select_files { if ($env{'form.continue'} eq 'true') { # here we update the selections for the currentpath # eventually, have to handle removing those not checked, but . . . - my @items=&Apache::loncommon::get_env_multiple('form.selectfile'); - &Apache::lonnet::save_selected_files($env{'user.name'}, $env{'form.currentpath'}, @items); + my @items=&Apache::loncommon::get_env_multiple('form.checkfile'); + 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 { - if ($env{'form.currentpath'} eq '/') { #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 $java_files = join ",", @files; @@ -497,7 +500,7 @@ sub handler { '/userfiles/portfolio'; &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['selectfile','currentpath','meta','lockinfo', - 'currentfile','action','fieldname','mode','rename']); + 'currentfile','action','fieldname','mode','rename','continue']); &Apache::loncommon::no_cache($r); &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header;