Diff for /loncom/interface/statistics/lonstudentassessment.pm between versions 1.166 and 1.177

version 1.166, 2011/12/22 00:28:11 version 1.177, 2023/04/07 16:46:44
Line 282  sub next_and_previous_buttons { Line 282  sub next_and_previous_buttons {
     # Build the 'all students' button      # Build the 'all students' button
     my $all = '';      my $all = '';
     $all .= '<input type="button" value="'.&mt('All Students').'" '.      $all .= '<input type="button" value="'.&mt('All Students').'" '.
             '" onclick="document.Statistics.SelectedStudent.value='.              ' onclick="document.Statistics.SelectedStudent.value='.
             "''".';'.'document.Statistics.submit();" />';              "''".';'.'document.Statistics.submit();" />';
     $Str .= $previousbutton.('&nbsp;'x5).$all.('&nbsp;'x5).$nextbutton;      $Str .= $previousbutton.('&nbsp;'x5).$all.('&nbsp;'x5).$nextbutton;
     return $Str;      return $Str;
Line 430  my @OutputOptions = Line 430  my @OutputOptions =
   
 sub OutputDescriptions {  sub OutputDescriptions {
     my $Str = '';      my $Str = '';
     $Str .= "<h2>Output Formats</h2>\n";      $Str .= '<h2>'.&mt('Output Formats')."</h2>\n";
     $Str .= "<dl>\n";      $Str .= "<dl>\n";
     foreach my $outputmode (@OutputOptions) {      foreach my $outputmode (@OutputOptions) {
  $Str .="    <dt>".$outputmode->{'name'}."</dt>\n";   $Str .="    <dt>".$outputmode->{'name'}."</dt>\n";
Line 465  sub CreateAndParseOutputSelector { Line 465  sub CreateAndParseOutputSelector {
     $Str = qq/<select size="5" name="$elementname">/;      $Str = qq/<select size="5" name="$elementname">/;
     foreach my $option (@OutputOptions) {      foreach my $option (@OutputOptions) {
         $Str .= "\n".'    <option value="'.$option->{'value'}.'"';          $Str .= "\n".'    <option value="'.$option->{'value'}.'"';
         $Str .= " selected " if ($option->{'value'} eq $selected);          $Str .= ' selected="selected"' if ($option->{'value'} eq $selected);
         $Str .= ">".&mt($option->{'name'})."<\/option>";          $Str .= ">".&mt($option->{'name'})."<\/option>";
     }      }
     $Str .= "\n</select>";      $Str .= "\n</select>";
Line 582  sub CreateAndParseOutputDataSelector { Line 582  sub CreateAndParseOutputDataSelector {
     $Str = qq/<select size="5" name="$elementname">/;      $Str = qq/<select size="5" name="$elementname">/;
     foreach my $option (@OutputDataOptions) {      foreach my $option (@OutputDataOptions) {
         $Str .= "\n".'    <option value="'.$option->{'value'}.'"';          $Str .= "\n".'    <option value="'.$option->{'value'}.'"';
         $Str .= " selected " if ($option->{'value'} eq $chosen_output->{'value'});          $Str .= ' selected="selected"' if ($option->{'value'} eq $chosen_output->{'value'});
         $Str .= ">".&mt($option->{'name'})."<\/option>";          $Str .= ">".&mt($option->{'name'})."<\/option>";
     }      }
     $Str .= "\n</select>";      $Str .= "\n</select>";
Line 605  sub count_parts { Line 605  sub count_parts {
 sub get_resources {  sub get_resources {
     my ($navmap,$sequence) = @_;      my ($navmap,$sequence) = @_;
     my @resources = $navmap->retrieveResources($sequence,      my @resources = $navmap->retrieveResources($sequence,
                                                sub { shift->is_problem(); },                                                 sub { shift->is_gradable(); },
                                                0,0,0);                                                 0,0,0);
     return @resources;      return @resources;
 }  }
Line 744  NEW_WINDOW_CHECKBOX Line 744  NEW_WINDOW_CHECKBOX
                             length($title)                              length($title)
                             )).$padding;                              )).$padding;
     }      }
     $total_sum_width = length($total_count)+1;      $total_sum_width = length($total_count);
       if ($total_sum_width < 6) {
           $total_sum_width = 6;
       }
     $Str .= "    total</pre>\n";      $Str .= "    total</pre>\n";
     $Str .= "<pre>";      $Str .= "<pre>";
   
Line 838  sub html_outputstudent { Line 841  sub html_outputstudent {
         if ($field eq 'comments') {          if ($field eq 'comments') {
             $title = '<a href="/adm/'.$student->{'domain'}.'/'.$student->{'username'}.'/'.'aboutme#coursecomment">'.&mt('Comments').'</a>';              $title = '<a href="/adm/'.$student->{'domain'}.'/'.$student->{'username'}.'/'.'aboutme#coursecomment">'.&mt('Comments').'</a>';
         }          }
           utf8::decode($title);
         my $base = length($title);          my $base = length($title);
         my $width=$Apache::lonstatistics::StudentData{$field}->{'width'};          my $width=$Apache::lonstatistics::StudentData{$field}->{'width'};
         $Str .= $title.' 'x($width-$base).$padding;          $Str .= $title.' 'x($width-$base).$padding;
Line 937  sub html_outputstudent { Line 941  sub html_outputstudent {
         $score = sprintf("%.2f",$score);          $score = sprintf("%.2f",$score);
         $score = (' 'x(6-length($score))).$score;          $score = (' 'x(6-length($score))).$score;
     }      }
       $max = sprintf("%.2f",$max);
     $Str .= ' '.' 'x($total_sum_width-length($score)).$score.' / '.$max;      $Str .= ' '.' 'x($total_sum_width-length($score)).$score.' / '.$max;
     $Str .= " \n";      $Str .= " \n";
     #      #
Line 1102  sub excel_initialize { Line 1107  sub excel_initialize {
         &Apache::lonstatistics::selected_sequences_with_assessments();          &Apache::lonstatistics::selected_sequences_with_assessments();
     if (! ref($navmap)) {      if (! ref($navmap)) {
         # Unable to get data, so bail out          # Unable to get data, so bail out
         $r->print("<h3>".          $r->print('<p class="LC_error">'.
                   &mt('Unable to retrieve course information.').                    &mt('Unable to retrieve course information.').
                   '</h3>');                    '</p>');
     }      }
     #      #
     my $total_columns = scalar(&get_student_fields_to_show());      my $total_columns = scalar(&get_student_fields_to_show());
Line 1119  sub excel_initialize { Line 1124  sub excel_initialize {
     }      }
     my $too_many_cols_error_message =       my $too_many_cols_error_message = 
         '<h2>'.&mt('Unable to Complete Request').'</h2>'.$/.          '<h2>'.&mt('Unable to Complete Request').'</h2>'.$/.
         '<p>'.&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.').'</p>'.$/.          '<p class="LC_warning">'.&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.').'</p>'.$/.
         '<p>'.&mt('You may consider reducing the number of <b>Sequences or Folders</b> you have selected.').'</p>'.$/.          '<p>'.&mt('You may consider reducing the number of [_1]Sequences or Folders[_2] you have selected.','<b>','</b>').'</p>'.$/.
         '<p>'.&mt('LON-CAPA can produce <b>CSV</b> files of this data or Excel files of the <b>Scores Summary</b> data.').'</p>'.$/;          '<p>'.&mt('LON-CAPA can produce [_1]CSV[_2] files of this data or Excel files of the [_1]Scores Summary[_2] data.','<b>','</b>').'</p>'.$/;
     if ($chosen_output->{'base'} eq 'tries' && $total_columns > 255) {      if ($chosen_output->{'base'} eq 'tries' && $total_columns > 255) {
         $r->print($too_many_cols_error_message);          $r->print($too_many_cols_error_message);
         $request_aborted = 1;          $request_aborted = 1;
Line 1178  sub excel_initialize { Line 1183  sub excel_initialize {
     my $sectionstring = '';      my $sectionstring = '';
     my @Sections = &Apache::lonstatistics::get_selected_sections();      my @Sections = &Apache::lonstatistics::get_selected_sections();
     $excel_sheet->write($header_row,$cols_output++,      $excel_sheet->write($header_row,$cols_output++,
                         &Apache::lonstatistics::section_and_enrollment_description('plaintext'),                          &Apache::lonstatistics::section_and_enrollment_description('localized'),
                         $format->{'h3'});                          $format->{'h3'});
     #      #
     # Put the date in there too      # Put the date in there too
Line 1202  sub excel_initialize { Line 1207  sub excel_initialize {
     # Add the student headers      # Add the student headers
     $cols_output = 0;      $cols_output = 0;
     foreach my $field (&get_student_fields_to_show()) {      foreach my $field (&get_student_fields_to_show()) {
         $excel_sheet->write($resource_name_row,$cols_output++,$field,          $excel_sheet->write($resource_name_row,$cols_output++,&mt($field),
                             $format->{'bold'});                              $format->{'bold'});
     }      }
     #      #
Line 1645  sub csv_initialize{ Line 1650  sub csv_initialize{
         &Apache::lonstatistics::selected_sequences_with_assessments();          &Apache::lonstatistics::selected_sequences_with_assessments();
     if (! ref($navmap)) {      if (! ref($navmap)) {
         # Unable to get data, so bail out          # Unable to get data, so bail out
         $r->print("<h3>".          $r->print('p class="LC_error">'.
                   &mt('Unable to retrieve course information.').                    &mt('Unable to retrieve course information.').
                   '</h3>');                    '</p>');
     }      }
     #      #
     # Deal with unimplemented requests      # Deal with unimplemented requests
     $request_aborted = undef;      $request_aborted = undef;
     if ($chosen_output->{'base'} =~ /final table/) {      if ($chosen_output->{'base'} =~ /final table/) {
         $r->print(<<END);          $r->print(
 <h2>Unable to Complete Request</h2>              '<h2>'.&mt('Unable to Complete Request').'</h2>'
 <p>             .'<p class="LC_warning">'
 The <b>Summary Table (Scores)</b> option is not available for non-HTML output.             .&mt('The [_1]Summary Table (Scores)[_2] option'
 </p>                 .' is not available for non-HTML output.','<b>','</b>')
 END             .'</p>'
           );
        $request_aborted = 1;         $request_aborted = 1;
     }      }
     return if ($request_aborted);      return if ($request_aborted);
Line 1969  sub student_tries_on_sequence { Line 1975  sub student_tries_on_sequence {
                  ($links eq 'all')) {                   ($links eq 'all')) {
                 my $link = '/adm/grades'.                  my $link = '/adm/grades'.
                     '?symb='.&escape($resource->shown_symb).                      '?symb='.&escape($resource->shown_symb).
                         '&student='.$student->{'username'}.                          '&amp;student='.$student->{'username'}.
                             '&userdom='.$student->{'domain'}.                              '&amp;userdom='.$student->{'domain'}.
                                 '&command=submission';                                  '&amp;command=submission';
                 $symbol = &link($symbol, $link);                  $symbol = &link($symbol, $link);
             }              }
             $value .= $symbol;              $value .= $symbol;
Line 2127  sub student_performance_on_sequence { Line 2133  sub student_performance_on_sequence {
             if ( ($links eq 'yes' && $symbol ne ' ') || ($links eq 'all')) {              if ( ($links eq 'yes' && $symbol ne ' ') || ($links eq 'all')) {
                 my $link = '/adm/grades' .                  my $link = '/adm/grades' .
                     '?symb='.&escape($resource->shown_symb).                      '?symb='.&escape($resource->shown_symb).
                     '&student='.$student->{'username'}.                      '&amp;student='.$student->{'username'}.
                     '&userdom='.$student->{'domain'}.                      '&amp;userdom='.$student->{'domain'}.
                     '&command=submission';                      '&amp;command=submission';
                 $symbol = &link($symbol, $link);                  $symbol = &link($symbol, $link);
             }              }
             $Str .= $symbol;              $Str .= $symbol;
Line 2142  sub student_performance_on_sequence { Line 2148  sub student_performance_on_sequence {
     }      }
     if ($randompick) {      if ($randompick) {
         my @uniquetotals = keys(%ptsfreq);          my @uniquetotals = keys(%ptsfreq);
         if ((@uniquetotals = 1) && ($ptsfreq{$uniquetotals[0]} > 0)) {          if ((@uniquetotals == 1) && ($ptsfreq{$uniquetotals[0]} > 0)) {
             $max = $max * $randompick/$ptsfreq{$uniquetotals[0]};              $max = $max * $randompick/$ptsfreq{$uniquetotals[0]};
         }          }
     }      }

Removed from v.1.166  
changed lines
  Added in v.1.177


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>