--- loncom/interface/portfolio.pm 2004/12/11 19:54:22 1.64 +++ loncom/interface/portfolio.pm 2004/12/12 01:35:44 1.65 @@ -185,7 +185,7 @@ sub display_file_select { $r->print(''); } else { $r->print(''); - $r->print('print('print("CHECKED"); &Apache::lonnet::logthis("checked"); @@ -214,12 +214,15 @@ sub display_file_select { sub open_form { my ($r)=@_; + my @files=&Apache::loncommon::get_env_multiple('form.selectfile'); $r->print('
'); $r->print(''); $r->print(''); - $r->print(''); + foreach (@files) { + $r->print(''); + } $r->print(''); } @@ -239,9 +242,19 @@ sub close_form { sub display_file { my ($path,$filename)=@_; + my $display_file_text; if (!defined($path)) { $path=$ENV{'form.currentpath'}; } - if (!defined($filename)) { $filename=$ENV{'form.selectfile'}; } - return ''.$path.$filename.''; + if (!defined($filename)) { + $filename=$ENV{'form.selectfile'}; + $display_file_text = ''.$path.$filename.''; + } elsif (ref($filename) eq "ARRAY") { + foreach (@$filename) { + $display_file_text .= ''.$path.$_.''; + } + } elsif (ref($filename) eq "SCALAR") { + $display_file_text = ''.$path.$filename.''; + } + return $display_file_text; } sub done { @@ -256,25 +269,31 @@ sub delete { my ($r)=@_; my @check; my $file_name = $ENV{'form.currentpath'}.$ENV{'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') { $r->print ("The file is locked and cannot be deleted.
"); $r->print(&done()); } else { &open_form($r); - $r->print('

'.&mt('Delete').' '.&display_file().'?

'); + $r->print('

'.&mt('Delete').' '.&display_file(undef,\@files).'?

'); &close_form($r); } } sub delete_confirmed { my ($r)=@_; - my $result=&Apache::lonnet::removeuserfile($ENV{'user.name'}, + my @files=&Apache::loncommon::get_env_multiple('form.selectfile'); + my $result; + foreach my $delete_file (@files) { + &Apache::lonnet::logthis("trying to delete $delete_file"); + $result=&Apache::lonnet::removeuserfile($ENV{'user.name'}, $ENV{'user.domain'},'portfolio'. $ENV{'form.currentpath'}. - $ENV{'form.selectfile'}); - if ($result ne 'ok') { + $delete_file); + if ($result ne 'ok') { $r->print(' An error occured ('.$result. - ') while trying to delete '.&display_file().'
'); + ') while trying to delete '.&display_file(undef, $delete_file).'
'); + } } $r->print(&done()); } @@ -354,7 +373,7 @@ 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.selectedfile'); + my @items=&Apache::loncommon::get_env_multiple('form.selectfile'); &Apache::lonnet::save_selected_files($ENV{'user.name'}, $ENV{'form.currentpath'}, @items); } else { if ($ENV{'form.currentpath'} eq '/') {