--- loncom/homework/grades.pm 2014/02/04 18:53:44 1.718
+++ loncom/homework/grades.pm 2014/02/27 01:39:48 1.722
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.718 2014/02/04 18:53:44 bisitz Exp $
+# $Id: grades.pm,v 1.722 2014/02/27 01:39:48 raeburn 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- '.
&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?','
-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
@@ -2061,7 +2070,7 @@ sub submission {
if (1) {
my %lt = &Apache::lonlocal::texthash(
- keyh => 'Keyword Highlighting',
+ keyh => 'Keyword Highlighting for Essays',
keyw => 'Keyword Options',
list => 'List',
past => 'Paste Selection to List',
@@ -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=
' ';
@@ -8238,7 +8251,7 @@ sub hand_bubble_option {
return &mt('The sequence to be graded contains response types which are handgraded.').''.&mt('List of CODES to validate against:').' '.
$env{'form.scantron_CODElist'}.'
').
' '.&mt('or').' '.
- '