--- loncom/homework/grades.pm 2012/08/09 20:07:21 1.596.2.12.2.9 +++ loncom/homework/grades.pm 2019/02/19 21:27:46 1.596.2.12.2.46 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.596.2.12.2.9 2012/08/09 20:07:21 raeburn Exp $ +# $Id: grades.pm,v 1.596.2.12.2.46 2019/02/19 21:27:46 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -44,6 +44,7 @@ use Apache::Constants qw(:common :http); use Apache::lonlocal; use Apache::lonenc; use Apache::bridgetask(); +use Apache::lontexconvert(); use String::Similarity; use LONCAPA; @@ -253,7 +254,7 @@ sub showResourceInfo { $result.='
'.&keywords_highlight($answer).''; } elsif ( $response eq 'organic') { - my $result='Smile representation: "'.$answer.'"'; + my $result=&mt('Smile representation: [_1]', + '"'.&HTML::Entities::encode($answer, '"<>&').'"'); my $jme=$record->{$version."resource.$partid.$respid.molecule"}; $result.=&Apache::chemresponse::jme_img($jme,$answer,400); return $result; @@ -498,12 +511,14 @@ sub cleanRecord { $result.=''; return $result; } - } elsif ( $response =~ m/(?:numerical|formula)/) { + } elsif ( $response =~ m/(?:numerical|formula|custom)/) { + # Respect multiple input fields, see Bug #5409 $answer = &Apache::loncommon::format_previous_attempt_value('submission', $answer); + return $answer; } - return $answer; + return &HTML::Entities::encode($answer, '"<>&'); } #-- A couple of common js functions @@ -811,7 +826,7 @@ sub verifyreceipt { '