[LON-CAPA-cvs] cvs: loncom /interface/statistics lonstudentsubmissions.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Fri, 08 Oct 2004 16:40:55 -0000
matthew Fri Oct 8 12:40:55 2004 EDT
Modified files:
/loncom/interface/statistics lonstudentsubmissions.pm
Log:
Added further cleanups to submission output.
Index: loncom/interface/statistics/lonstudentsubmissions.pm
diff -u loncom/interface/statistics/lonstudentsubmissions.pm:1.24 loncom/interface/statistics/lonstudentsubmissions.pm:1.25
--- loncom/interface/statistics/lonstudentsubmissions.pm:1.24 Thu Sep 23 10:55:24 2004
+++ loncom/interface/statistics/lonstudentsubmissions.pm Fri Oct 8 12:40:54 2004
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonstudentsubmissions.pm,v 1.24 2004/09/23 14:55:24 matthew Exp $
+# $Id: lonstudentsubmissions.pm,v 1.25 2004/10/08 16:40:54 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -109,7 +109,7 @@
my $resource = $navmap->getBySymb($symb);
push(@Problems,$resource);
}
- #
+ #
if (! scalar(@Problems) || ! defined($Problems[0])) {
$r->print('resource is undefined');
} else {
@@ -458,6 +458,9 @@
sub html_format_sub {
my ($submission,$resptype) = @_;
return '' if (! defined($submission) || $submission eq '');
+ $submission = &HTML::Entities::decode($submission);
+ $submission =~ s/\\\"/\"/g;
+ $submission =~ s/\\\'/\'/g;
if ($resptype eq 'essay') {
$submission =~ s|\\r\\n|$/|g;
$submission = &HTML::Entities::encode($submission,'<>&"');
@@ -465,16 +468,20 @@
$submission =~ s|\\||g;
$submission = '<p>'.$submission.'</p>';
} elsif ($resptype eq 'radiobutton') {
+ $submission = &HTML::Entities::encode($submission,'<>&"');
$submission =~ s/=([^=])$//;
} elsif ($resptype =~ /^(option|match|rank)$/) {
$submission =
'<ul class="sub_studentans">'.
'<li>'.join('</li><li>',
- map {
- &Apache::lonnet::unescape($_) ;
- } sort split('&',$submission)
+ map { &HTML::Entities::encode($_,'<>&"');
+ } map {
+ &Apache::lonnet::unescape($_) ;
+ } sort split('&',$submission)
).
'</li><ul>';
+ } else {
+ $submission = &HTML::Entities::encode($submission,'<>&"');
}
return $submission;
}
@@ -709,6 +716,10 @@
&Apache::lonnet::unescape($_) ;
} sort split('&',$answer)
);
+ } elsif ($responsetype eq 'string') {
+ $answer =~ s/\\(n|r)/\n/g;
+ $answer =~ s/(\s*$|^\s*)//g;
+ $answer =~ s/\\\'/\'/g;
}
if ($answer =~ m/^=/) {
$answer = ' '.$answer;