Diff for /loncom/homework/grades.pm between versions 1.596.2.12.2.36 and 1.596.2.12.2.37

version 1.596.2.12.2.36, 2016/08/04 18:47:52 version 1.596.2.12.2.37, 2016/10/14 17:33:34
Line 1255  sub processGroup { Line 1255  sub processGroup {
 sub sub_page_js {  sub sub_page_js {
     my $request = shift;      my $request = shift;
     my $alertmsg = &mt('A number equal or greater than 0 is expected. Entered value = ');      my $alertmsg = &mt('A number equal or greater than 0 is expected. Entered value = ');
     &js_escape(\$alertmsg);       &js_escape(\$alertmsg);
     $request->print(<<SUBJAVASCRIPT);      $request->print(<<SUBJAVASCRIPT);
 <script type="text/javascript" language="javascript">  <script type="text/javascript" language="javascript">
     function updateRadio(formname,id,weight) {      function updateRadio(formname,id,weight) {
Line 3754  sub viewgrades { Line 3754  sub viewgrades {
  '<input type="hidden" name="Status" value="'.$env{'stu_status'}.'" />'."\n".   '<input type="hidden" name="Status" value="'.$env{'stu_status'}.'" />'."\n".
  '<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n";   '<input type="hidden" name="probTitle" value="'.$env{'form.probTitle'}.'" />'."\n";
   
     my ($common_header,$specific_header);      #retrieve selected groups
     if ($env{'form.section'} eq 'all') {      my (@groups,$group_display);
  $common_header = &mt('Assign Common Grade to Class');      @groups = &Apache::loncommon::get_env_multiple(form.group');
         $specific_header = &mt('Assign Grade to Specific Students in Class');      if (grep(/^all$/,@groups)) {
     } elsif ($env{'form.section'} eq 'none') {          @groups = ('all');
         $common_header = &mt('Assign Common Grade to Students in no Section');      } elsif (grep(/^none$/,@groups)) {
  $specific_header = &mt('Assign Grade to Specific Students in no Section');          @groups = ('none');
       } elsif (@groups > 0) {
           $group_display = join(', ',@groups);
       }
   
       my ($common_header,$specific_header,@sections,$section_display);
       @sections = &Apache::loncommon::get_env_multiple('form.section');
       if (grep(/^all$/,@sections)) {
           @sections = ('all');
           if ($group_display) {
               $common_header = &mt('Assign Common Grade to Students in Group(s) [_1]',$group_display);
               $specific_header = &mt('Assign Grade to Specific Students in Group(s) [_1]',$group_display);
           } elsif (grep(/^none$/,@groups)) {
               $common_header = &mt('Assign Common Grade to Students not assigned to any groups');
               $specific_header = &mt('Assign Grade to Specific Students not assigned to any groups');
           } else {
               $common_header = &mt('Assign Common Grade to Class');
               $specific_header = &mt('Assign Grade to Specific Students in Class');
           }
       } elsif (grep(/^none$/,@sections)) {
           @sections = ('none');
           if ($group_display) {
               $common_header = &mt('Assign Common Grade to Students in no Section and in Group(s) [_1]',$group_display);
               $specific_header = &mt('Assign Grade to Specific Students in no Section and in Group(s)',$group_display);
           } elsif (grep(/^none$/,@groups)) {
               $common_header = &mt('Assign Common Grade to Students in no Section and in no Group');
               $specific_header = &mt('Assign Grade to Specific Students in no Section and in no Group');
           } else {
               $common_header = &mt('Assign Common Grade to Students in no Section');
               $specific_header = &mt('Assign Grade to Specific Students in no Section');
           }
       } else {
           $section_display = join (", ",@sections);
           if ($group_display) {
               $common_header = &mt('Assign Common Grade to Students in Section(s) [_1], and in Group(s) [_2]',
                                    $section_display,$group_display);
               $specific_header = &mt('Assign Grade to Specific Students in Section(s) [_1], and in Group(s) [_2]',
                                      $section_display,$group_display);
           } elsif (grep(/^none$/,@groups)) {
               $common_header = &mt('Assign Common Grade to Students in Section(s) [_1] and no Group',$section_display);
               $specific_header = &mt('Assign Grade to Specific Students in Section(s) [_1] and no Group',$section_display);
           } else {
               $common_header = &mt('Assign Common Grade to Students in Section(s) [_1]',$section_display);
               $specific_header = &mt('Assign Grade to Specific Students in Section(s) [_1]',$section_display);
           }
       }
       my %submit_types = &substatus_options();
       my $submission_status = $submit_types{$env{'form.submitonly'}};
   
       if ($env{'form.submitonly'} eq 'all') {
           $result.= '<h3>'.$common_header.'</h3>';
     } else {      } else {
         my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section'));          $result.= '<h3>'.$common_header.'&nbsp;'.&mt('(submission status: "[_1]")',$submission_status).'</h3>'; 
         $common_header = &mt('Assign Common Grade to Students in Section(s) [_1]',$section_display);  
  $specific_header = &mt('Assign Grade to Specific Students in Section(s) [_1]',$section_display);  
     }      }
     $result.= '<h3>'.$common_header.'</h3>'.&Apache::loncommon::start_data_table();      $result .= &Apache::loncommon::start_data_table();
     #radio buttons/text box for assigning points for a section or class.      #radio buttons/text box for assigning points for a section or class.
     #handles different parts of a problem      #handles different parts of a problem
     my $res_error;      my $res_error;
Line 3829  sub viewgrades { Line 3877  sub viewgrades {
   
     #table listing all the students in a section/class      #table listing all the students in a section/class
     #header of table      #header of table
     $result.= '<h3>'.$specific_header.'</h3>'.      if ($env{'form.submitonly'} eq 'all') { 
               &Apache::loncommon::start_data_table().          $result.= '<h3>'.$specific_header.'</h3>';
       } else {
           $result.= '<h3>'.$specific_header.'&nbsp;'.&mt('(submission status: "[_1]")',$submission_status).'</h3>';
       }
       $result.= &Apache::loncommon::start_data_table().
       &Apache::loncommon::start_data_table_header_row().        &Apache::loncommon::start_data_table_header_row().
       '<th>'.&mt('No.').'</th>'.        '<th>'.&mt('No.').'</th>'.
       '<th>'.&nameUserString('header')."</th>\n";        '<th>'.&nameUserString('header')."</th>\n";
Line 3873  sub viewgrades { Line 3925  sub viewgrades {
   
     #get info for each student      #get info for each student
     #list all the students - with points and grade status      #list all the students - with points and grade status
     my (undef,undef,$fullname) = &getclasslist($env{'form.section'},'1');      my (undef,undef,$fullname) = &getclasslist(\@sections,'1',\@groups);
     my $ctr = 0;      my $ctr = 0;
     foreach (sort       foreach (sort 
      {       {
Line 3882  sub viewgrades { Line 3934  sub viewgrades {
  }   }
  return $a cmp $b;   return $a cmp $b;
      } (keys(%$fullname))) {       } (keys(%$fullname))) {
  $ctr++;  
  $result.=&viewstudentgrade($symb,$env{'request.course.id'},   $result.=&viewstudentgrade($symb,$env{'request.course.id'},
    $_,$$fullname{$_},\@parts,\%weight,$ctr,\%last_resets);     $_,$$fullname{$_},\@parts,\%weight,\$ctr,\%last_resets);
     }      }
     $result.=&Apache::loncommon::end_data_table();      $result.=&Apache::loncommon::end_data_table();
     $result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n";      $result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n";
     $result.='<input type="button" value="'.&mt('Save').'" '.      $result.='<input type="button" value="'.&mt('Save').'" '.
  'onclick="javascript:submit();" target="_self" /></form>'."\n";   'onclick="javascript:submit();" target="_self" /></form>'."\n";
     if (scalar(%$fullname) eq 0) {      if ($ctr == 0) {
  my $colspan=3+scalar(@parts);  
  my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section'));  
         my $stu_status = join(' or ',&Apache::loncommon::get_env_multiple('form.Status'));          my $stu_status = join(' or ',&Apache::loncommon::get_env_multiple('form.Status'));
  $result='<span class="LC_warning">'.          $result='<h3><span class="LC_info">'.&mt('Manual Grading').'</span></h3>'.
     &mt('There are no students in section(s) [_1] with enrollment status [_2] to modify or grade.',                  '<span class="LC_warning">';
         $section_display, $stu_status).          if ($env{'form.submitonly'} eq 'all') {
     '</span>';              if (grep(/^all$/,@sections)) {
                   if (grep(/^all$/,@groups)) {
                       $result .= &mt('There are no students with enrollment status [_1] to modify or grade.',
                                      $stu_status);
                   } elsif (grep(/^none$/,@groups)) {
                       $result .= &mt('There are no students with no group assigned and with enrollment status [_1] to modify or grade.',
                                      $stu_status);
                   } else {
                       $result .= &mt('There are no students in group(s) [_1] with enrollment status [_2] to modify or grade.',
                                      $group_display,$stu_status);
                   }
               } elsif (grep(/^none$/,@sections)) {
                   if (grep(/^all$/,@groups)) {
                       $result .= &mt('There are no students in no section with enrollment status [_1] to modify or grade.',
                                      $stu_status);
                   } elsif (grep(/^none$/,@groups)) {
                       $result .= &mt('There are no students in no section and no group with enrollment status [_1] to modify or grade.',
                                      $stu_status);
                   } else {
                       $result .= &mt('There are no students in no section in group(s) [_1] with enrollment status [_2] to modify or grade.',
                                      $group_display,$stu_status);
                   }
               } else {
                   if (grep(/^all$/,@groups)) {
                       $result .= &mt('There are no students in section(s) [_1] with enrollment status [_2] to modify or grade.',
                                      $section_display,$stu_status);
                   } elsif (grep(/^none$/,@groups)) {
                       $result .= &mt('There are no students in section(s) [_1] nd no group with enrollment status [_2] to modify or grade.',
                                      $section_display,$stu_status);
                   } else {
                       $result .= &mt('There are no students in section(s) [_1] and group(s) [_2] with enrollment status [_3] to modify or grade.',
                                      $section_display,$group_display,$stu_status);
                   }
               }
           } else {
               if (grep(/^all$/,@sections)) {
                   if (grep(/^all$/,@groups)) {
                       $result .= &mt('There are no students with enrollment status [_1] and submission status "[_2]" to modify or grade.',
                                      $stu_status,$submission_status);
                   } elsif (grep(/^none$/,@groups)) {
                       $result .= &mt('There are no students with no group assigned with enrollment status [_1] and submission status "[_2]" to modify or grade.',
                                      $stu_status,$submission_status);
                   } else {
                       $result .= &mt('There are no students in group(s) [_1] with enrollment status [_2] and submission status "[_3]" to modify or grade.',
                                      $group_display,$stu_status,$submission_status);
                   }
               } elsif (grep(/^none$/,@sections)) {
                   if (grep(/^all$/,@groups)) {
                       $result .= &mt('There are no students in no section with enrollment status [_1] and submission status "[_2]" to modify or grade.',
                                      $stu_status,$submission_status);
                   } elsif (grep(/^none$/,@groups)) {
                       $result .= &mt('There are no students in no section and no group with enrollment status [_1] and submission status "[_2]" to modify or grade.',
                                      $stu_status,$submission_status);
                   } else {
                       $result .= &mt('There are no students in no section in group(s) [_1] with enrollment status [_2] and submission status "[_3]" to modify or grade.',
                                      $group_display,$stu_status,$submission_status);
                   }
               } else {
                   if (grep(/^all$/,@groups)) {
                       $result .= &mt('There are no students in section(s) [_1] with enrollment status [_2] and submission status "[_3]" to modify or grade.',
                                      $section_display,$stu_status,$submission_status);
                   } elsif (grep(/^none$/,@groups)) {
                       $result .= &mt('There are no students in section(s) [_1] and no group with enrollment status [_2] and submission status "[_3]" to modify or grade.',
                                      $section_display,$stu_status,$submission_status);
                   } else {
                       $result .= &mt('There are no students in section(s) [_1] and group(s) [_2] with enrollment status [_3] and submission status "[_4]" to modify or grade.',
                                      $section_display,$group_display,$stu_status,$submission_status);
                   }
               }
    }
    $result .= '</span><br />';
     }      }
     $result.=&show_grading_menu_form($symb);      $result.=&show_grading_menu_form($symb);
     return $result;      return $result;
 }  }
   
 #--- call by previous routine to display each student  #--- call by previous routine to display each student who satisfies submission filter.
 sub viewstudentgrade {  sub viewstudentgrade {
     my ($symb,$courseid,$student,$fullname,$parts,$weight,$ctr,$last_resets) = @_;      my ($symb,$courseid,$student,$fullname,$parts,$weight,$ctr,$last_resets) = @_;
     my ($uname,$udom) = split(/:/,$student);      my ($uname,$udom) = split(/:/,$student);
     my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);      my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
     my %aggregates = ();       my $submitonly = $env{'form.submitonly'};
       unless (($submitonly eq 'all') || ($submitonly eq 'queued')) {
           my %partstatus = ();
           if (ref($parts) eq 'ARRAY') {
               foreach my $apart (@{$parts}) {
                   my ($part,$type) = &split_part_type($apart);
                   my ($status,undef) = split(/_/,$record{"resource.$part.solved"},2);
                   $status = 'nothing' if ($status eq '');
                   $partstatus{$part}      = $status;
                   my $subkey = "resource.$part.submitted_by";
                   $partstatus{$subkey} = $record{$subkey} if ($record{$subkey} ne '');
               }
               my $submitted = 0;
               my $graded = 0;
               my $incorrect = 0;
               foreach my $key (keys(%partstatus)) {
                   $submitted = 1 if ($partstatus{$key} ne 'nothing');
                   $graded = 1 if ($partstatus{$key} =~ /^ungraded/);
                   $incorrect = 1 if ($partstatus{$key} =~ /^incorrect/);
   
                   my $partid = (split(/\./,$key))[1];
                   if ($partstatus{'resource.'.$partid.'.'.$key.'.submitted_by'} ne '') {
                       $submitted = 0;
                   }
               }
               return if (!$submitted && ($submitonly eq 'yes' ||
                                          $submitonly eq 'incorrect' ||
                                          $submitonly eq 'graded'));
               return if (!$graded && ($submitonly eq 'graded'));
               return if (!$incorrect && $submitonly eq 'incorrect');
           }
       }
       if ($submitonly eq 'queued') {
           my ($cdom,$cnum) = split(/_/,$courseid);
           my %queue_status =
               &Apache::bridgetask::get_student_status($symb,$cdom,$cnum,
                                                       $udom,$uname);
           return if (!defined($queue_status{'gradingqueue'}));
       }
       $$ctr++;
       my %aggregates = ();
     my $result=&Apache::loncommon::start_data_table_row().'<td align="right">'.      my $result=&Apache::loncommon::start_data_table_row().'<td align="right">'.
  '<input type="hidden" name="ctr'.($ctr-1).'" value="'.$student.'" />'.   '<input type="hidden" name="ctr'.($$ctr-1).'" value="'.$student.'" />'.
  "\n".$ctr.'&nbsp;</td><td>&nbsp;'.   "\n".$$ctr.'&nbsp;</td><td>&nbsp;'.
  '<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom.   '<a href="javascript:viewOneStudent(\''.$uname.'\',\''.$udom.
  '\');" target="_self">'.$fullname.'</a> '.   '\');" target="_self">'.$fullname.'</a> '.
  '<span class="LC_internal_info">('.$uname.($env{'user.domain'} eq $udom ? '' : ':'.$udom).')</span></td>'."\n";   '<span class="LC_internal_info">('.$uname.($env{'user.domain'} eq $udom ? '' : ':'.$udom).')</span></td>'."\n";
Line 8897  sub scantron_upload_scantron_data { Line 9056  sub scantron_upload_scantron_data {
     my ($symb) = &get_symb($r,1);      my ($symb) = &get_symb($r,1);
     my $default_form_data=&defaultFormData($symb);      my $default_form_data=&defaultFormData($symb);
     my $nofile_alert = &mt('Please use the browse button to select a file from your local directory.');      my $nofile_alert = &mt('Please use the browse button to select a file from your local directory.');
     &js_escape(\$nofile_alert);       &js_escape(\$nofile_alert);
     my $nocourseid_alert = &mt("Please use the 'Select Course' link to open a separate window where you can search for a course to which a file can be uploaded.");      my $nocourseid_alert = &mt("Please use the 'Select Course' link to open a separate window where you can search for a course to which a file can be uploaded.");
     &js_escape(\$nocourseid_alert);      &js_escape(\$nocourseid_alert);
     $r->print('      $r->print('
Line 9843  GRADINGMENUJS Line 10002  GRADINGMENUJS
     return $result;      return $result;
 }  }
   
   sub substatus_options {
       return &Apache::lonlocal::texthash(
                                         'yes'       => 'with submissions',
                                         'queued'    => 'in grading queue',
                                         'graded'    => 'with ungraded submissions',
                                         'incorrect' => 'with incorrect submissions',
                                         'all'       => 'with any status');
   }
   
 sub reset_perm {  sub reset_perm {
     undef(%perm);      undef(%perm);
 }  }

Removed from v.1.596.2.12.2.36  
changed lines
  Added in v.1.596.2.12.2.37


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