--- loncom/interface/statistics/lonstudentsubmissions.pm 2012/03/20 17:52:23 1.67 +++ loncom/interface/statistics/lonstudentsubmissions.pm 2014/02/03 16:32:34 1.70 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentsubmissions.pm,v 1.67 2012/03/20 17:52:23 bisitz Exp $ +# $Id: lonstudentsubmissions.pm,v 1.70 2014/02/03 16:32:34 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -196,9 +196,9 @@ sub BuildStudentSubmissionsPage { $threshold = 10; } } - $r->print('

'. + $r->print('

'. &Apache::lonstatistics::section_and_enrollment_description(). - '

'); + '

'); if (! scalar(@Problems) || ! defined($Problems[0])) { $r->print(&mt('resource is undefined')); } elsif (!$show_named && @Students < $threshold) { @@ -414,7 +414,8 @@ sub prepare_html_output { qq{\ }. $headers{'response'}; } - my $full_header = $/.''.$/; + #my $full_header = $/.'
'.$/; + my $full_header = $/.&Apache::loncommon::start_data_table().$/; $full_header .= ''.$headers{'problem'}.''.$/; if ($nonempty_part_headers) { $full_header .= ''.$headers{'part'}.''.$/; @@ -425,11 +426,10 @@ sub prepare_html_output { # Main loop my $count; $r->print($/.$full_header.$/); - my $row_class = 'odd'; # css foreach my $student (@$students) { my $student_row_data; if ($count++ >= 30) { - $r->print('
'.$/.$full_header.$/); + $r->print(&Apache::loncommon::end_data_table().$/.$full_header.$/); $count = 0; } last if ($c->aborted()); @@ -527,11 +527,6 @@ sub prepare_html_output { next if (! $maxrow && ! scalar(@essays)); # # Go through the problem data and output a row. - if ($row_class eq 'even') { - $row_class = 'odd'; - } else { - $row_class = 'even'; - } my $printed_something; for (my $rows_output = 0;$rows_output<$maxrow;$rows_output++) { my $html; @@ -555,22 +550,23 @@ sub prepare_html_output { } } if (! $no_data) { - $r->print(qq{$student_row_data$html}.$/); + $r->print(&Apache::loncommon::start_data_table_row().$student_row_data.$html. + &Apache::loncommon::end_data_table_row().$/); $printed_something=1; } } if (@essays) { - my $tr = qq{}; + my $tr = &Apache::loncommon::start_data_table_row(); my $td = qq{}; if (! $printed_something) { - $r->print($tr.$student_row_data.''.$/); + $r->print($tr.$student_row_data.&Apache::loncommon::end_data_table_row().$/); } $r->print($tr.$td. join(''.$/.$tr.$td,@essays).''.$/); undef(@essays); } } # end of student loop - $r->print(''.$/); + $r->print(&Apache::loncommon::end_data_table().$/); return; } @@ -736,7 +732,22 @@ sub html_non_essay_results { } } } else { - @values = map { $response->{$_}; } @$headers; + foreach my $original_header (@$headers) { + if ($original_header eq 'Time') { + push(@values,&Apache::lonlocal::locallocaltime($response->{$original_header})); + } elsif (($original_header eq 'Submission') && + !($resptype =~ /^(radiobutton|option|match|rank)$/)) { + # encode all submissions which have not been encoded above + push(@values,&HTML::Entities::encode($response->{$original_header},'<>&"')); + } elsif (($original_header eq 'Correct') && + ($resptype eq 'radiobutton')) { + # encode foil separators + push(@values,&HTML::Entities::encode($response->{$original_header},'&')); + } else { + # A normal column + push(@values,$response->{$original_header}); + } + } } my $td = ''; my $str = $td.join(''.$td,@values).''; @@ -787,9 +798,9 @@ sub prepare_excel_output { $lastprob = $prob; } if ($columncount > 255) { - $r->print('

'.&mt('Unable to complete request').'

'.$/. - '

'.&mt('LON-CAPA is unable to produce your Excel spreadsheet because your selections will result in more than 255 columns. Excel allows only 255 columns in a spreadsheet.').'

'.$/. - '

'.&mt('Consider selecting fewer problems to generate reports on, or reducing the number of items per problem. Or use HTML or CSV output.').'

'.$/); + $r->print('

'.&mt('Unable to complete request').'

'.$/. + '

'.&mt('LON-CAPA is unable to produce your Excel spreadsheet because your selections will result in more than 255 columns. Excel allows only 255 columns in a spreadsheet.').'

'.$/. + '

'.&mt('Consider selecting fewer problems to generate reports on, or reducing the number of items per problem. Or use HTML or CSV output.').'

'.$/); if (ref($lastprob)) { $r->print('

'.&mt('The last problem that will fit in the current spreadsheet is [_1].',$lastprob->compTitle).'

'); } @@ -799,14 +810,14 @@ sub prepare_excel_output { # # Print out a message telling them what we are doing if (scalar(@$Problems) > 1) { - $r->print('

'. + $r->print('

'. &mt('Preparing Excel spreadsheet of student responses to [_1] problems', scalar(@$Problems)). - '

'); + '

'); } else { - $r->print('

'. + $r->print('

'. &mt('Preparing Excel spreadsheet of student responses'). - '

'); + '

'); } $r->rflush(); # @@ -1071,8 +1082,8 @@ sub prepare_csv_output { my ($r,$problems,$students,$anoncounter,$show_named) = @_; my $c = $r->connection(); # - $r->print('

'. - &mt('Generating CSV report of student responses').'

'); + $r->print('

'. + &mt('Generating CSV report of student responses').'

'); # # Progress window my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,scalar(@$students)); @@ -1242,7 +1253,7 @@ sub prepare_csv_output { sub csv_format_item { my ($item,$type) = @_; if ($type eq 'Time') { - $item = localtime($item); + $item = &Apache::lonlocal::locallocaltime($item); } $item =&Apache::loncommon::csv_translate($item); return $item;