[LON-CAPA-cvs] cvs: loncom /homework grades.pm /interface loncommon.pm
kruse
kruse at source.lon-capa.org
Tue Feb 11 09:29:11 EST 2014
kruse Tue Feb 11 14:29:11 2014 EDT
Modified files:
/loncom/interface loncommon.pm
/loncom/homework grades.pm
Log:
Changes regarding the display of students' submissions in handgrading-screen (Bug 6694)
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1172 loncom/interface/loncommon.pm:1.1173
--- loncom/interface/loncommon.pm:1.1172 Mon Jan 27 02:21:30 2014
+++ loncom/interface/loncommon.pm Tue Feb 11 14:29:04 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1172 2014/01/27 02:21:30 raeburn Exp $
+# $Id: loncommon.pm,v 1.1173 2014/02/11 14:29:04 kruse Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3846,7 +3846,7 @@
if (($data eq 'award') || ($data eq 'awarddetail')) {
my $value = &format_previous_attempt_value($key,
$returnhash{$version.':'.$key});
- $prevattempts.='<td>'.&HTML::Entities::encode($value, '"<>&').' </td>';
+ $prevattempts.='<td>'.$value.' </td>';
} else {
$prevattempts.='<td> </td>';
}
@@ -3854,7 +3854,7 @@
if ($key =~ /\./) {
my $value = &format_previous_attempt_value($key,
$returnhash{$version.':'.$key});
- $prevattempts.='<td>'.&HTML::Entities::encode($value, '"<>&').' </td>';
+ $prevattempts.='<td>'.$value.' </td>';
} else {
$prevattempts.='<td> </td>';
}
@@ -3865,7 +3865,7 @@
next if ($key =~ /\.foilorder$/);
my $value = &format_previous_attempt_value($key,
$returnhash{$version.':'.$key});
- $prevattempts.='<td>'.&HTML::Entities::encode($value, '"<>&').' </td>';
+ $prevattempts.='<td>'.$value.' </td>';
}
}
$prevattempts.=&end_data_table_row();
@@ -3890,7 +3890,7 @@
if ($key =~/$regexp$/ && (defined &$gradesub)) {
$value = &$gradesub($value);
}
- $prevattempts.='<td>'. &HTML::Entities::encode($value, '"<>&').' </td>';
+ $prevattempts.='<td>'. $value.' </td>';
} else {
$prevattempts.='<td> </td>';
}
@@ -3899,14 +3899,14 @@
if ($key =~/$regexp$/ && (defined &$gradesub)) {
$value = &$gradesub($value);
}
- $prevattempts.='<td>'.&HTML::Entities::encode($value, '"<>&').' </td>';
+ $prevattempts.='<td>'.$value.' </td>';
}
} else {
my $value = &format_previous_attempt_value($key,$lasthash{$key});
if ($key =~/$regexp$/ && (defined &$gradesub)) {
$value = &$gradesub($value);
}
- $prevattempts.='<td>'.&HTML::Entities::encode($value, '"<>&').' </td>';
+ $prevattempts.='<td>'.$value.' </td>';
}
}
$prevattempts.= &end_data_table_row().&end_data_table();
@@ -3927,11 +3927,13 @@
sub format_previous_attempt_value {
my ($key,$value) = @_;
if (($key =~ /timestamp/) || ($key=~/duedate/)) {
- $value = &Apache::lonlocal::locallocaltime($value);
+ $value = &Apache::lonlocal::locallocaltime($value);
} elsif (ref($value) eq 'ARRAY') {
- $value = '('.join(', ', @{ $value }).')';
+ $value = &HTML::Entities::encode('('.join(', ', @{ $value }).')','"<>&');
} elsif ($key =~ /answerstring$/) {
my %answers = &Apache::lonnet::str2hash($value);
+ my @answer = %answers;
+ %answers = map {&HTML::Entities::encode($_, '"<>&')} @answer;
my @anskeys = sort(keys(%answers));
if (@anskeys == 1) {
my $answer = $answers{$anskeys[0]};
@@ -3954,7 +3956,7 @@
}
}
} else {
- $value = &unescape($value);
+ $value = &HTML::Entities::encode(&unescape($value), '"<>&');
}
return $value;
}
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.719 loncom/homework/grades.pm:1.720
--- loncom/homework/grades.pm:1.719 Wed Feb 5 15:09:30 2014
+++ loncom/homework/grades.pm Tue Feb 11 14:29:10 2014
@@ -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.720 2014/02/11 14:29:10 kruse Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -330,6 +330,8 @@
my $grayFont = '<span class="LC_internal_info">';
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 @@
$bottomrow.'</tr></table></blockquote>';
} 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 @@
$bottomrow.'</tr></table></blockquote>';
} 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,10 @@
$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-<br />-g;
- return '<br /><br /><blockquote><tt>'.&keywords_highlight($answer).'</tt></blockquote>';
+ return '<br /><br /><blockquote><tt>'.&keywords_highlight(&HTML::Entities::encode($answer, '"<>&')).'</tt></blockquote>';
+
} elsif ( $response eq 'organic') {
- my $result='Smile representation: "<tt>'.$answer.'</tt>"';
+ my $result='Smile representation: "<tt>'.HTML::Entities::encode($answer, '"<>&').'</tt>"';
my $jme=$record->{$version."resource.$partid.$respid.molecule"};
$result.=&Apache::chemresponse::jme_img($jme,$answer,400);
return $result;
@@ -442,8 +449,9 @@
$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 +2310,7 @@
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,
More information about the LON-CAPA-cvs
mailing list