version 1.23, 2004/09/23 14:35:54
|
version 1.26, 2004/11/08 15:14:52
|
Line 109 sub BuildStudentSubmissionsPage {
|
Line 109 sub BuildStudentSubmissionsPage {
|
my $resource = $navmap->getBySymb($symb); |
my $resource = $navmap->getBySymb($symb); |
push(@Problems,$resource); |
push(@Problems,$resource); |
} |
} |
# |
# |
if (! scalar(@Problems) || ! defined($Problems[0])) { |
if (! scalar(@Problems) || ! defined($Problems[0])) { |
$r->print('resource is undefined'); |
$r->print('resource is undefined'); |
} else { |
} else { |
Line 219 sub prepare_html_output {
|
Line 219 sub prepare_html_output {
|
if (! $single_part) { |
if (! $single_part) { |
my $tmpname = $partid; |
my $tmpname = $partid; |
if ($partid =~/^\d+$/) { |
if ($partid =~/^\d+$/) { |
$tmpname = &mt('Part [_1]',$partid); |
$tmpname = $prob->part_display($partid); |
} |
} |
$headers{'part'} .= qq{<th colspan="$part_span">$tmpname</th>}; |
$headers{'part'} .= qq{<th colspan="$part_span">$tmpname</th>}; |
$nonempty_part_headers = 1; |
$nonempty_part_headers = 1; |
Line 383 sub html_essay_results {
|
Line 383 sub html_essay_results {
|
# |
# |
my $correct = ''; |
my $correct = ''; |
if ($ENV{'form.correctans'} eq 'true') { |
if ($ENV{'form.correctans'} eq 'true') { |
$correct = &Apache::lonstathelpers::analyze_problem_as_student |
$correct = &Apache::lonstathelpers::get_student_answer |
($prob,$student->{'username'},$student->{'domain'}, |
($prob,$student->{'username'},$student->{'domain'}, |
$partid,$respid); |
$partid,$respid); |
$correct = &html_format_sub($correct,'essay'); |
$correct = &html_format_sub($correct,'essay'); |
Line 392 sub html_essay_results {
|
Line 392 sub html_essay_results {
|
if (! $single_response) { |
if (! $single_response) { |
my $id = $prob->compTitle; |
my $id = $prob->compTitle; |
if (defined($partid) && $partid ne '0') { |
if (defined($partid) && $partid ne '0') { |
$id .= ' '.$partid; |
$id .= ' '.$prob->part_display($partid); |
} |
} |
if (defined($respid)) { |
if (defined($respid)) { |
$id .= ' '.$respid; |
$id .= ' '.$respid; |
Line 427 sub html_results {
|
Line 427 sub html_results {
|
$submission = &html_format_sub($submission,$resptype); |
$submission = &html_format_sub($submission,$resptype); |
my $correct = ''; |
my $correct = ''; |
if ($ENV{'form.correctans'} eq 'true') { |
if ($ENV{'form.correctans'} eq 'true') { |
$correct = &Apache::lonstathelpers::analyze_problem_as_student |
$correct = &Apache::lonstathelpers::get_student_answer |
($prob,$student->{'username'},$student->{'domain'}, |
($prob,$student->{'username'},$student->{'domain'}, |
$partid,$respid); |
$partid,$respid); |
$correct = &html_format_sub($correct,$resptype); |
$correct = &html_format_sub($correct,$resptype); |
Line 458 sub html_results {
|
Line 458 sub html_results {
|
sub html_format_sub { |
sub html_format_sub { |
my ($submission,$resptype) = @_; |
my ($submission,$resptype) = @_; |
return '' if (! defined($submission) || $submission eq ''); |
return '' if (! defined($submission) || $submission eq ''); |
|
$submission = &HTML::Entities::decode($submission); |
|
$submission =~ s/\\\"/\"/g; |
|
$submission =~ s/\\\'/\'/g; |
if ($resptype eq 'essay') { |
if ($resptype eq 'essay') { |
$submission =~ s|\\r\\n|$/|g; |
$submission =~ s|\\r\\n|$/|g; |
$submission = &HTML::Entities::encode($submission,'<>&"'); |
$submission = &HTML::Entities::encode($submission,'<>&"'); |
Line 465 sub html_format_sub {
|
Line 468 sub html_format_sub {
|
$submission =~ s|\\||g; |
$submission =~ s|\\||g; |
$submission = '<p>'.$submission.'</p>'; |
$submission = '<p>'.$submission.'</p>'; |
} elsif ($resptype eq 'radiobutton') { |
} elsif ($resptype eq 'radiobutton') { |
|
$submission = &HTML::Entities::encode($submission,'<>&"'); |
$submission =~ s/=([^=])$//; |
$submission =~ s/=([^=])$//; |
} elsif ($resptype =~ /^(option|match|rank)$/) { |
} elsif ($resptype =~ /^(option|match|rank)$/) { |
$submission = |
$submission = |
'<ul class="sub_studentans">'. |
'<ul class="sub_studentans">'. |
'<li>'.join('</li><li>', |
'<li>'.join('</li><li>', |
map { |
map { &HTML::Entities::encode($_,'<>&"'); |
&Apache::lonnet::unescape($_) ; |
} map { |
} sort split('&',$submission) |
&Apache::lonnet::unescape($_) ; |
|
} sort split('&',$submission) |
). |
). |
'</li><ul>'; |
'</li><ul>'; |
|
} else { |
|
$submission = &HTML::Entities::encode($submission,'<>&"'); |
} |
} |
return $submission; |
return $submission; |
} |
} |
Line 569 sub prepare_excel_output {
|
Line 576 sub prepare_excel_output {
|
$worksheet->write($title_row,$cols_output, |
$worksheet->write($title_row,$cols_output, |
$title,$format->{'h3'}); |
$title,$format->{'h3'}); |
foreach my $partid (@{$prob->parts}) { |
foreach my $partid (@{$prob->parts}) { |
$worksheet->write($partid_row,$cols_output,$partid); |
$worksheet->write($partid_row,$cols_output, |
|
$prob->part_display($partid)); |
my $responses = [$prob->responseIds($partid)]; |
my $responses = [$prob->responseIds($partid)]; |
my $resptypes = [$prob->responseType($partid)]; |
my $resptypes = [$prob->responseType($partid)]; |
for (my $i=0;$i<scalar(@$responses);$i++) { |
for (my $i=0;$i<scalar(@$responses);$i++) { |
Line 675 sub write_excel_row {
|
Line 683 sub write_excel_row {
|
$submission = &excel_format_response($submission,$resptype); |
$submission = &excel_format_response($submission,$resptype); |
$worksheet->write($row,$col++,$submission); |
$worksheet->write($row,$col++,$submission); |
if ($ENV{'form.correctans'} eq 'true') { |
if ($ENV{'form.correctans'} eq 'true') { |
my $correct = &Apache::lonstathelpers::analyze_problem_as_student |
my $correct = &Apache::lonstathelpers::get_student_answer |
($prob,$student->{'username'},$student->{'domain'}, |
($prob,$student->{'username'},$student->{'domain'}, |
$partid,$respid); |
$partid,$respid); |
$correct =&excel_format_response($correct,$resptype); |
$correct =&excel_format_response($correct,$resptype); |
Line 708 sub excel_format_response {
|
Line 716 sub excel_format_response {
|
&Apache::lonnet::unescape($_) ; |
&Apache::lonnet::unescape($_) ; |
} sort split('&',$answer) |
} sort split('&',$answer) |
); |
); |
|
} elsif ($responsetype eq 'string') { |
|
$answer =~ s/\\(n|r)/\n/g; |
|
$answer =~ s/(\s*$|^\s*)//g; |
|
$answer =~ s/\\\'/\'/g; |
} |
} |
if ($answer =~ m/^=/) { |
if ($answer =~ m/^=/) { |
$answer = ' '.$answer; |
$answer = ' '.$answer; |
Line 781 sub prepare_csv_output {
|
Line 793 sub prepare_csv_output {
|
$headers{'problem'}->[$prob_start_idx] = $prob->compTitle; |
$headers{'problem'}->[$prob_start_idx] = $prob->compTitle; |
my $part_start_idx = $prob_start_idx; |
my $part_start_idx = $prob_start_idx; |
foreach my $partid (@{$prob->parts}) { |
foreach my $partid (@{$prob->parts}) { |
$headers{'part'}->[$part_start_idx] = &mt('Part [_1]',$partid); |
$headers{'part'}->[$part_start_idx] = $prob->part_display($partid); |
my $responses = [$prob->responseIds($partid)]; |
my $responses = [$prob->responseIds($partid)]; |
for (my $i=0;$i<scalar(@$responses);$i++) { |
for (my $i=0;$i<scalar(@$responses);$i++) { |
my $resp_idx = $prob_start_idx + $response_multiplier * $i; |
my $resp_idx = $prob_start_idx + $response_multiplier * $i; |
Line 873 sub compile_response_data {
|
Line 885 sub compile_response_data {
|
my @rowdata; |
my @rowdata; |
push(@rowdata,$response->[&Apache::loncoursedata::RDs_submission()]); |
push(@rowdata,$response->[&Apache::loncoursedata::RDs_submission()]); |
if ($ENV{'form.correctans'} eq 'true') { |
if ($ENV{'form.correctans'} eq 'true') { |
my $correct = &Apache::lonstathelpers::analyze_problem_as_student |
my $correct = &Apache::lonstathelpers::get_student_answer |
($prob,$student->{'username'},$student->{'domain'}, |
($prob,$student->{'username'},$student->{'domain'}, |
$partid,$respid); |
$partid,$respid); |
push(@rowdata,$correct); |
push(@rowdata,$correct); |