--- loncom/interface/statistics/lonstudentsubmissions.pm 2004/09/22 15:38:49 1.21 +++ loncom/interface/statistics/lonstudentsubmissions.pm 2004/12/06 16:53:39 1.29 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentsubmissions.pm,v 1.21 2004/09/22 15:38:49 matthew Exp $ +# $Id: lonstudentsubmissions.pm,v 1.29 2004/12/06 16:53:39 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -109,7 +109,7 @@ sub BuildStudentSubmissionsPage { my $resource = $navmap->getBySymb($symb); push(@Problems,$resource); } - # + # if (! scalar(@Problems) || ! defined($Problems[0])) { $r->print('resource is undefined'); } else { @@ -126,6 +126,8 @@ sub BuildStudentSubmissionsPage { } if ($ENV{'form.output'} eq 'excel') { &prepare_excel_output($r,\@Problems,\@Students); + } elsif ($ENV{'form.output'} eq 'csv') { + &prepare_csv_output($r,\@Problems,\@Students); } else { &prepare_html_output($r,\@Problems,\@Students); } @@ -217,7 +219,7 @@ sub prepare_html_output { if (! $single_part) { my $tmpname = $partid; if ($partid =~/^\d+$/) { - $tmpname = &mt('Part [_1]',$partid); + $tmpname = $prob->part_display($partid); } $headers{'part'} .= qq{$tmpname}; $nonempty_part_headers = 1; @@ -226,7 +228,7 @@ sub prepare_html_output { } $prob_span += $part_span; } - my $title = &get_title($prob->title,$prob->src); + my $title = $prob->compTitle; if ($prob_span > 0) { $headers{'problem'}.= qq{$title}; } elsif ($single_response) { @@ -381,16 +383,16 @@ sub html_essay_results { # my $correct = ''; if ($ENV{'form.correctans'} eq 'true') { - $correct = &Apache::lonstathelpers::analyze_problem_as_student + $correct = &Apache::lonstathelpers::get_student_answer ($prob,$student->{'username'},$student->{'domain'}, $partid,$respid); $correct = &html_format_sub($correct,'essay'); } my $Str; if (! $single_response) { - my $id = &get_title($prob->title,$prob->src); + my $id = $prob->compTitle; if (defined($partid) && $partid ne '0') { - $id .= ' '.$partid; + $id .= ' '.$prob->part_display($partid); } if (defined($respid)) { $id .= ' '.$respid; @@ -425,7 +427,7 @@ sub html_results { $submission = &html_format_sub($submission,$resptype); my $correct = ''; if ($ENV{'form.correctans'} eq 'true') { - $correct = &Apache::lonstathelpers::analyze_problem_as_student + $correct = &Apache::lonstathelpers::get_student_answer ($prob,$student->{'username'},$student->{'domain'}, $partid,$respid); $correct = &html_format_sub($correct,$resptype); @@ -456,6 +458,9 @@ sub html_results { 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,'<>&"'); @@ -463,16 +468,20 @@ sub html_format_sub { $submission =~ s|\\||g; $submission = '

'.$submission.'

'; } elsif ($resptype eq 'radiobutton') { + $submission = &HTML::Entities::encode($submission,'<>&"'); $submission =~ s/=([^=])$//; } elsif ($resptype =~ /^(option|match|rank)$/) { $submission = '