--- loncom/homework/inputtags.pm 2010/08/27 17:21:01 1.269 +++ loncom/homework/inputtags.pm 2010/11/09 17:41:47 1.271.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.269 2010/08/27 17:21:01 raeburn Exp $ +# $Id: inputtags.pm,v 1.271.2.1 2010/11/09 17:41:47 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -527,27 +527,31 @@ sub current_file_submissions { my ($part,$id) = @_; my $jspart=$part; $jspart=~s/\./_/g; - my $uploadedfile=&HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.uploadedfile"},'<>&"'); + my $uploadedfile=$Apache::lonhomework::history{"resource.$part.$id.uploadedfile"}; my $portfiles=$Apache::lonhomework::history{"resource.$part.$id.portfiles"}; return if (($uploadedfile eq '') && ($portfiles !~/[^\s]/)); my $header = &Apache::loncommon::start_data_table(). - &Apache::loncommon::start_data_table_header_row(). - ''.&mt('Delete?').''. - ''.&mt('Name').''. + &Apache::loncommon::start_data_table_header_row(); + if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') { + $header .= ''.&mt('Delete?').''; + } + $header .= ''.&mt('File').''. ''.&mt('Size (MB)').''. ''.&mt('Last Modified').''. &Apache::loncommon::end_data_table_header_row(); my (undef,$crsid,$udom,$uname)=&Apache::lonnet::whichuser(); my ($cdom,$cnum) = ($crsid =~ /^($LONCAPA::match_domain)_($LONCAPA::match_courseid)$/); - my ($result,$header_shown,%okfiles,%rows,@bad_file_list); + my ($result,$header_shown,%okfiles,%rows,%legacy,@bad_file_list); if ($uploadedfile) { my $url=$Apache::lonhomework::history{"resource.$part.$id.uploadedurl"}; - my ($path,$name) = ($url =~ m{^/uploaded/\Q$cdom\E/\Q$cnum\E/(essayresponse/.+/)([^/]+)}); + my $link = &HTML::Entities::encode($url,'<>&"'); + my ($path,$name) = ($url =~ m{^(/uploaded/\Q$udom\E/\Q$uname\E/essayresponse.*/)([^/]+)$}); my ($status,$hashref,$error) = - ¤t_file_info($url,$uploadedfile,$name,$path); + ¤t_file_info($url,$link,$name,$path); if ($status eq 'ok') { push(@{$okfiles{$name}},$url); $rows{$url} = $hashref; + $legacy{$url} = 1; &Apache::lonxml::extlink($url); &Apache::lonnet::allowuploaded('/adm/essayresponse',$url); } else { @@ -572,6 +576,7 @@ sub current_file_submissions { } foreach my $name (sort(keys(%okfiles))) { if (ref($okfiles{$name}) eq 'ARRAY') { + my $num = 0; foreach my $url (@{$okfiles{$name}}) { if (ref($rows{$url}) eq 'HASH') { my $link = $rows{$url}{link}; @@ -584,11 +589,20 @@ sub current_file_submissions { $header_shown = 1; } $result.= - &Apache::loncommon::start_data_table_row()."\n". - ''."\n". + &Apache::loncommon::start_data_table_row()."\n"; + if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') { + $result .= + ''."\n"; + $num ++; + } + my $showname = $rows{$url}{path}.$name; + if ($legacy{$url}) { + $showname = $name.' '.&mt('not in portfolio'); + } + $result .= ''.$name.''."\n". + '" border="0" />'.$showname.''."\n". ''.$rows{$url}{size}.''."\n". ''.$rows{$url}{lastmodified}.''."\n". &Apache::loncommon::end_data_table_row(); @@ -598,7 +612,9 @@ sub current_file_submissions { } } if ($header_shown) { - $result .= &Apache::loncommon::end_data_table(); + $result .= &Apache::loncommon::end_data_table(). + '
'. + &mt('Items checked for deletion will not be included amongst the files evaluated when your submission is graded.').''; } if (@bad_file_list) { my $bad_files = ''.