--- loncom/homework/grades.pm 2014/02/05 15:09:30 1.719 +++ loncom/homework/grades.pm 2014/02/13 18:13:22 1.721 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.719 2014/02/05 15:09:30 bisitz Exp $ +# $Id: grades.pm,v 1.721 2014/02/13 18:13:22 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -330,6 +330,8 @@ sub cleanRecord { my $grayFont = ''; if ($response =~ /^(option|rank)$/) { my %answer=&Apache::lonnet::str2hash($answer); + my @answer = %answer; + %answer = map {&HTML::Entities::encode($_, '"<>&')} @answer; my %grading=&Apache::lonnet::str2hash($record->{$version."resource.$partid.$respid.submissiongrading"}); my ($toprow,$bottomrow); foreach my $foil (@$order) { @@ -346,6 +348,8 @@ sub cleanRecord { $bottomrow.''; } elsif ($response eq 'match') { my %answer=&Apache::lonnet::str2hash($answer); + my @answer = %answer; + %answer = map {&HTML::Entities::encode($_, '"<>&')} @answer; my %grading=&Apache::lonnet::str2hash($record->{$version."resource.$partid.$respid.submissiongrading"}); my @items=&Apache::lonnet::str2array($record->{$version."resource.$partid.$respid.submissionitems"}); my ($toprow,$middlerow,$bottomrow); @@ -368,6 +372,8 @@ sub cleanRecord { $bottomrow.''; } elsif ($response eq 'radiobutton') { my %answer=&Apache::lonnet::str2hash($answer); + my @answer = %answer; + %answer = map {&HTML::Entities::encode($_, '"<>&')} @answer; my ($toprow,$bottomrow); my $correct = &get_radiobutton_correct_foil($partid,$respid,$symb,$uname,$udom,$type,$trial,$rndseed); @@ -401,9 +407,11 @@ sub cleanRecord { $env{'form.'.$symb} = 1; # so that we don't have to read it from disk for multiple sub of the same prob. } $answer =~ s-\n-
-g; - return '

'.&keywords_highlight($answer).'
'; + return '

'.&keywords_highlight(&HTML::Entities::encode($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; @@ -442,8 +450,9 @@ sub cleanRecord { $answer = &Apache::loncommon::format_previous_attempt_value('submission', $answer); + return $answer; } - return $answer; + return &HTML::Entities::encode($answer, '"<>&'); } #-- A couple of common js functions @@ -2302,6 +2311,7 @@ sub submission { if ($env{'form.lastSub'} eq 'datesub') { my ($parts,$handgrade,$responseType) = &response_type($symb,\$res_error); $request->print(&displaySubByDates($symb,\%record,$parts,$responseType,$checkIcon,$uname,$udom)); + } if ($env{'form.lastSub'} =~ /^(last|all)$/) { $request->print(&Apache::loncommon::get_previous_attempt($symb,$uname,$udom, @@ -2765,7 +2775,10 @@ sub processHandGrade { next; } if ($errorflag eq 'not_allowed') { - $request->print("Not allowed to modify grades for $uname:$udom"); + $request->print( + '' + .&mt('Not allowed to modify grades for [_1]',"$uname:$udom") + .''); $ctr++; next; } @@ -6605,7 +6618,7 @@ sub scantron_warning_screen { $scantron_config{'CODEstart'} && $scantron_config{'CODElength'}) { $CODElist=$env{'form.scantron_CODElist'}; - if ($env{'form.scantron_CODElist'} eq '') { $CODElist='None'; } + if ($env{'form.scantron_CODElist'} eq '') { $CODElist=''.&mt('None').''; } $CODElist= ''.&mt('List of CODES to validate against:').''. $env{'form.scantron_CODElist'}.''; @@ -8238,7 +8251,7 @@ sub hand_bubble_option { return &mt('The sequence to be graded contains response types which are handgraded.').'

'. &mt('If you have already graded these by bubbling sheets to indicate points awarded, [_1]what point value is assigned to a filled last bubble in each row?','
'). ' '.&mt('or').' '. - '

'; + '

'; } return; } @@ -9072,14 +9085,14 @@ sub checkscantron_results { ''.&mt('Bubblesheet').''.$showscandata.''.$last.''.$pid.''."\n". ''."\n". ''."\n". -'Submissions'.$showrecord.''."\n"; +''.&mt('Submissions').''.$showrecord.''."\n"; $passed ++; } else { my $css_class = ($failed % 2)?'LC_odd_row':'LC_even_row'; $badstudents .= ''.&mt('Bubblesheet').''.$scandata{$pid}.''.$last.''.$pid.''."\n". ''."\n". ''."\n". -'Submissions'.$record{$pid}.''."\n". +''.&mt('Submissions').''.$record{$pid}.''."\n". ''."\n"; $failed ++; }