--- loncom/interface/portfolio.pm 2010/10/29 23:19:54 1.228 +++ loncom/interface/portfolio.pm 2010/10/29 23:22:43 1.229 @@ -1,7 +1,7 @@ # The LearningOnline Network # portfolio browser # -# $Id: portfolio.pm,v 1.228 2010/10/29 23:19:54 raeburn Exp $ +# $Id: portfolio.pm,v 1.229 2010/10/29 23:22:43 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -303,7 +303,7 @@ sub display_directory { my %access_controls = &Apache::lonnet::get_access_controls($current_permissions,$group); my $now = time; if ($env{"form.mode"} eq 'selectfile') { - &select_files($r); + &select_files($r,$dir_list); $checked_files =&Apache::lonnet::files_in_path($uname,$env{'form.currentpath'}); $select_mode = 'true'; } @@ -396,6 +396,7 @@ sub display_directory { push(@dir_lines, [$filename,$dom,$testdir,$size,$mtime,$obs]); } } + my $zerobyte; foreach my $dir_line (@dir_lines) { my ($filename,$dom,$testdir,$size,$mtime,$obs) = @$dir_line; my ($fname,$version,$extension) = &Apache::grades::file_name_version_ext($filename); @@ -455,11 +456,16 @@ sub display_directory { my $css_class = 'LC_browser_file'; my $line; if ($select_mode eq 'true') { - $line=' 0) { + $line='print(&Apache::loncommon::end_data_table().' + $r->print(&Apache::loncommon::end_data_table()); + if ($zerobyte) { + $r->print('

'.&mt('[quant,_1,file] in list not selectable as file size is 0 bytes.',$zerobyte).'

'); + } + $r->print(' @@ -1854,13 +1864,24 @@ END_SCRIPT } sub select_files { - my ($r) = @_; + my ($r,$dir_list) = @_; 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.checkfile'); if (scalar(@items)){ - &Apache::lonnet::save_selected_files($env{'user.name'}, $env{'form.currentpath'}, @items); + my @ok_items; + if (ref($dir_list) eq 'ARRAY') { + foreach my $dir_line (@{$dir_list}) { + my ($filename,undef,undef,undef,undef,undef,undef,undef,$size)=split(/\&/,$dir_line,10); + if (grep(/^\Q$filename\E$/,@items)) { + if ($size) { + push(@ok_items,$filename); + } + } + } + } + &Apache::lonnet::save_selected_files($env{'user.name'}, $env{'form.currentpath'}, @ok_items); } } else { #empty the file for a fresh start 500 Internal Server Error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.