--- loncom/interface/statistics/lonstudentsubmissions.pm 2006/05/01 19:29:13 1.43 +++ loncom/interface/statistics/lonstudentsubmissions.pm 2008/12/11 14:55:27 1.51 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonstudentsubmissions.pm,v 1.43 2006/05/01 19:29:13 albertel Exp $ +# $Id: lonstudentsubmissions.pm,v 1.51 2008/12/11 14:55:27 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -37,6 +37,9 @@ use Apache::lonstathelpers; use HTML::Entities(); use Time::Local(); use Spreadsheet::WriteExcel(); +use lib '/home/httpd/lib/perl/'; +use LONCAPA; + my @SubmitButtons = ({ name => 'SelectAnother', text => 'Choose a different Problem' }, @@ -63,12 +66,14 @@ sub BuildStudentSubmissionsPage { my @Students = @Apache::lonstatistics::Students; # if (@Students < 1) { - $r->print('<h2>There are no students in the sections selected</h2>'); + $r->print('<div class="LC_warning">' + .&mt('There are no students in the sections selected.') + .'</div>'); } # my @CacheButtonHTML = &Apache::lonstathelpers::manage_caches($r,'Statistics','stats_status', - '<h3>'.&mt('Loading student data').'</h3>'); + '<div class="LC_info">'.&mt('Loading student data...').'</div>'); $r->rflush(); # if (exists($env{'form.problemchoice'}) && @@ -100,7 +105,7 @@ sub BuildStudentSubmissionsPage { # Get resource objects my $navmap = Apache::lonnavmaps::navmap->new(); if (!defined($navmap)) { - $r->print('<h1>'.&mt("Internal error").'</h1>'); + $r->print('<div class="LC_error">'.&mt("Internal error").'</div>'); return; } my %already_seen; @@ -142,7 +147,7 @@ sub BuildStudentSubmissionsPage { &mt('Computing correct answers greatly increasese the amount of time required to prepare a report.'). '</p>'); $r->print('<p>'. - &mt('please select problems and use the <b>Prepare Report</b> button to continue.'). + &mt('Please select problems and use the [_1]Prepare Report[_2] button to continue.','<b>','</b>'). '</p>'); $r->print(&Apache::lonstathelpers::MultipleProblemSelector (undef,'problemchoice','Statistics')); @@ -260,9 +265,9 @@ sub prepare_html_output { $headers{'response'} .= '<th colspan="'.scalar(@headers).'">'. &mt('Response [_1]',$responses->[$i]).'</th>'; - $headers{'student'}.= '<th>'.join('</th><th><nobr>', + $headers{'student'}.= '<th>'.join('</th><th><span class="LC_nobreak">', @headers). - '</nobr></th>'; + '</span></th>'; } } if ($part_span == 0) { @@ -496,7 +501,7 @@ sub html_essay_results { if (defined($respid)) { $id .= ' '.$respid; } - $Str .= '<nobr>'.$id.'</nobr>'.(' 'x4); + $Str .= '<span class="LC_nobreak">'.$id.'</span>'.(' 'x4); } # shift(@$headers); # Get rid of the Submission header @@ -505,11 +510,11 @@ sub html_essay_results { $correct = &html_format_essay_sub($response->{'Correct'}); shift(@$headers); } - $Str .= '<nobr>'. + $Str .= '<span class="LC_nobreak">'. join('', map { (' 'x4).&mt($_.': [_1]',$response->{$_}); - } @$headers).'</nobr>'; + } @$headers).'</span>'; if (@$headers || ! $single_response) { $Str .= '<br />'; } @@ -555,14 +560,14 @@ sub html_non_essay_results { return ''; } # - my $submission = &HTML::Entities::decode(&Apache::lonnet::unescape($response->{'Submission'})); + my $submission = &HTML::Entities::decode(&unescape($response->{'Submission'})); return '' if (! defined($submission) || $submission eq ''); $submission =~ s/\\\"/\"/g; $submission =~ s/\\\'/\'/g; if ($resptype eq 'radiobutton') { $submission = &HTML::Entities::encode($submission,'<>&"'); $submission =~ s/=([^=])$//; - $submission = '<nobr>'.$submission.'</nobr>'; + $submission = '<span class="LC_nobreak">'.$submission.'</span>'; } $response->{'Submission'} = $submission; # @@ -570,14 +575,14 @@ sub html_non_essay_results { if ($resptype =~ /^(option|match|rank)$/) { my %submission = map { - my ($foil,$value) = split('=',&Apache::lonnet::unescape($_)); + my ($foil,$value) = split('=',&unescape($_)); ($foil,$value); } split('&',$response->{'Submission'}); my %correct; if (exists($response->{'Correct'})) { %correct = map { - my ($foil,$value)=split('=',&Apache::lonnet::unescape($_)); + my ($foil,$value)=split('=',&unescape($_)); ($foil,$value); } split('&',$response->{'Correct'}); } @@ -828,7 +833,7 @@ sub compile_response_data { # my $submission = &HTML::Entities::decode - (&Apache::lonnet::unescape($response->{'Submission'})); + (&unescape($response->{'Submission'})); if (!$prob->is_task()) { return () if (! defined($submission) || $submission eq ''); } @@ -843,14 +848,14 @@ sub compile_response_data { if ($resptype =~ /^(option|match|rank)$/) { my %submission = map { - my ($foil,$value) = split('=',&Apache::lonnet::unescape($_)); + my ($foil,$value) = split('=',&unescape($_)); ($foil,$value); } split('&',$response->{'Submission'}); my %correct; if (exists($response->{'Correct'})) { %correct = map { - my ($foil,$value)=split('=',&Apache::lonnet::unescape($_)); + my ($foil,$value)=split('=',&unescape($_)); ($foil,$value); } split('&',$response->{'Correct'}); } @@ -925,9 +930,11 @@ sub prepare_csv_output { time.'_'.rand(1000000000).'.csv'; unless ($outputfile = Apache::File->new('>/home/httpd'.$filename)) { $r->log_error("Couldn't open $filename for output $!"); - $r->print("Problems occured in writing the csv file. ". - "This error has been logged. ". - "Please alert your LON-CAPA administrator."); + $r->print('<div class="LC_error">' + .&mt('Problems occurred in writing the CSV file. ' + .'This error has been logged. ' + .'Please alert your LON-CAPA administrator.') + .'</div>'); $outputfile = undef; } # @@ -1043,9 +1050,9 @@ sub prepare_csv_output { # Close the progress window &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); # - # Tell the user where to get their csv file + # Tell the user where to get their CSV file $r->print('<br />'. - '<a href="'.$filename.'">'.&mt('Your csv file.').'</a>'."\n"); + '<a href="'.$filename.'">'.&mt('Your CSV file.').'</a>'."\n"); $r->rflush(); return; } @@ -1083,17 +1090,25 @@ sub CreateInterface { my $Str = ''; $Str .= &Apache::lonhtmlcommon::breadcrumbs('Student Submission Reports'); $Str .= '<p>'; - $Str .= '<table cellspacing="5">'."\n"; - $Str .= '<tr>'; + $Str .= &Apache::loncommon::start_data_table(); + $Str .= &Apache::loncommon::start_data_table_header_row(); $Str .= '<th>'.&mt('Sections').'</th>'; - $Str .= '<th>'.&mt('Enrollment Status').'</th>'; - $Str .= '<th>'.&mt('Output as [_1]',$output_selector).'</th>'; - $Str .= '</tr>'."\n"; + $Str .= '<th>'.&mt('Groups').'</th>'; + $Str .= '<th>'.&mt('Access Status').'</th>'; +# $Str .= '<th>'.&mt('Output as [_1]',$output_selector).'</th>'; + $Str .= '<th>'.&mt('Options').'</th>'; + $Str .= '<th>'.&mt('Output Format').'</th>'; + $Str .= &Apache::loncommon::end_data_table_header_row(); # - $Str .= '<tr><td align="center">'."\n"; + $Str .= &Apache::loncommon::start_data_table_row(); + $Str .= '<td align="center">'."\n"; $Str .= &Apache::lonstatistics::SectionSelect('Section','multiple',5); $Str .= '</td>'; # + $Str .= '<td align="center">'."\n"; + $Str .= &Apache::lonstatistics::GroupSelect('Group','multiple',5); + $Str .= '</td>'; + # $Str .= '<td align="center">'; $Str .= &Apache::lonhtmlcommon::StatusOptions(undef,undef,5); $Str .= '</td>'; @@ -1101,14 +1116,14 @@ sub CreateInterface { # Render problem checkbox my $prob_checkbox = '<input type="checkbox" name="renderprob" '; if (exists($env{'form.renderprob'}) && $env{'form.renderprob'} eq 'true') { - $prob_checkbox .= 'checked '; + $prob_checkbox .= 'checked="checked" '; } $prob_checkbox .= 'value="true" />'; # # Compute correct answers checkbox my $ans_checkbox = '<input type="checkbox" name="correctans" '; if (exists($env{'form.correctans'}) && $env{'form.correctans'} eq 'true') { - $ans_checkbox .= 'checked '; + $ans_checkbox .= 'checked="checked" '; } $ans_checkbox .= 'value="true" />'; # @@ -1116,7 +1131,7 @@ sub CreateInterface { my $all_sub_checkbox = '<input type="checkbox" name="all_sub" '; if (exists($env{'form.all_sub'}) && $env{'form.all_sub'} eq 'true') { - $all_sub_checkbox .= 'checked '; + $all_sub_checkbox .= 'checked="checked" '; } $all_sub_checkbox.= 'value="true" />'; # @@ -1124,7 +1139,7 @@ sub CreateInterface { my $prob_status_checkbox = '<input type="checkbox" name="prob_status" '; if (exists($env{'form.prob_status'}) && $env{'form.prob_status'} eq 'true') { - $prob_status_checkbox .= 'checked '; + $prob_status_checkbox .= 'checked="checked" '; } $prob_status_checkbox .= 'value="true" />'; # @@ -1141,13 +1156,16 @@ sub CreateInterface { '</b></label><br />'. '</td>'; # - $Str .= '</tr>'."\n"; - $Str .= '</table>'."\n"; + $Str .= '<td align="center" valign="top">'.$output_selector.'</td>'; + # + $Str .= &Apache::loncommon::end_data_table_row(); + $Str .= &Apache::loncommon::end_data_table(); # - $Str .= '<p><nobr>'.&mt('Status: [_1]', - '<input type="text" '. - 'name="stats_status" size="60" value="" />'). - '</nobr>'.'</p>'; + $Str .= '<p><span class="LC_nobreak">' + .&mt('Status: [_1]', + '<input type="text" name="stats_status"' + .' size="60" value="" readonly="readonly" />') + .'</span></p>'; ## return $Str; }