Diff for /loncom/homework/grades.pm between versions 1.596.2.12.2.24 and 1.596.2.12.2.25

version 1.596.2.12.2.24, 2013/12/14 00:22:27 version 1.596.2.12.2.25, 2013/12/30 15:31:00
Line 8844  sub scantron_upload_scantron_data_save { Line 8844  sub scantron_upload_scantron_data_save {
     }      }
     my %coursedata=&Apache::lonnet::coursedescription($env{'form.domainid'}.'_'.$env{'form.courseid'});      my %coursedata=&Apache::lonnet::coursedescription($env{'form.domainid'}.'_'.$env{'form.courseid'});
     my $uploadedfile;      my $uploadedfile;
     $r->print('<h3>'.&mt("Uploading file to [_1]",$coursedata{'description'}).'</h3>');      $r->print('<p>'.&mt("Uploading file to [_1]",$coursedata{'description'}).'</p>');
     if (length($env{'form.upfile'}) < 2) {      if (length($env{'form.upfile'}) < 2) {
         $r->print(&mt('[_1]Error:[_2] The file you attempted to upload, [_3] contained no information. Please check that you entered the correct filename.','<span class="LC_error">','</span>','<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>'));          $r->print(
               &Apache::lonhtmlcommon::confirm_success(
                   &mt('The file: [_1] you attempted to upload contained no information. Please check that you entered the correct filename.',
                           '<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>'),1));
     } else {      } else {
         my $result =           my $result = 
             &Apache::lonnet::userfileupload('upfile','','scantron','','','',              &Apache::lonnet::userfileupload('upfile','','scantron','','','',
                                             $env{'form.courseid'},$env{'form.domainid'});                                              $env{'form.courseid'},$env{'form.domainid'});
  if ($result =~ m{^/uploaded/}) {   if ($result =~ m{^/uploaded/}) {
     $r->print(&mt('[_1]Success:[_2] Successfully uploaded [_3] bytes of data into location: [_4]',              $r->print(
                           '<span class="LC_success">','</span>',(length($env{'form.upfile'})-1),                  &Apache::lonhtmlcommon::confirm_success(&mt('Upload successful')).'<br />'.
   '<span class="LC_filename">'.$result.'</span>'));                  &mt('Uploaded [_1] bytes of data into location: [_2]',
                           (length($env{'form.upfile'})-1),
                           '<span class="LC_filename">'.$result.'</span>'));
             ($uploadedfile) = ($result =~ m{/([^/]+)$});              ($uploadedfile) = ($result =~ m{/([^/]+)$});
             $r->print(&validate_uploaded_scantron_file($env{'form.domainid'},              $r->print(&validate_uploaded_scantron_file($env{'form.domainid'},
                                                        $env{'form.courseid'},$uploadedfile));                                                         $env{'form.courseid'},$uploadedfile));
  } else {   } else {
     $r->print(&mt('[_1]Error:[_2] An error ([_3]) occurred when attempting to upload the file, [_4]',              $r->print(
                           '<span class="LC_error">','</span>',$result,                  &Apache::lonhtmlcommon::confirm_success(&mt('Upload failed'),1).'<br />'.
                       &mt('An error ([_1]) occurred when attempting to upload the file: [_2]',
                             $result,
   '<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>'));    '<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>'));
  }   }
     }      }
Line 8882  sub validate_uploaded_scantron_file { Line 8889  sub validate_uploaded_scantron_file {
     my $output;      my $output;
     if (@lines) {      if (@lines) {
         my (%counts,$max_match_format);          my (%counts,$max_match_format);
         my ($max_match_count,$max_match_pct) = (0,0);          my ($found_match_count,$max_match_count,$max_match_pct) = (0,0,0);
         my $classlist = &Apache::loncoursedata::get_classlist($cdom,$cname);          my $classlist = &Apache::loncoursedata::get_classlist($cdom,$cname);
         my %idmap = &username_to_idmap($classlist);          my %idmap = &username_to_idmap($classlist);
         foreach my $key (keys(%idmap)) {          foreach my $key (keys(%idmap)) {
Line 8925  sub validate_uploaded_scantron_file { Line 8932  sub validate_uploaded_scantron_file {
                 if (($max_match_format eq '') || ($percent_match > $max_match_pct)) {                  if (($max_match_format eq '') || ($percent_match > $max_match_pct)) {
                     $max_match_pct = $percent_match;                      $max_match_pct = $percent_match;
                     $max_match_format = $key;                      $max_match_format = $key;
                       $found_match_count = $counts{$key}{'found'};
                     $max_match_count = $counts{$key}{'total'};                      $max_match_count = $counts{$key}{'total'};
                 }                  }
             }              }
Line 8943  sub validate_uploaded_scantron_file { Line 8951  sub validate_uploaded_scantron_file {
                 }                  }
             }              }
             my $showpct = sprintf("%.0f",$max_match_pct).'%';              my $showpct = sprintf("%.0f",$max_match_pct).'%';
             $output .= '<br />'.&mt('Comparison of student IDs in the uploaded file with the course roster found matches for [_1] of the [_2] entries in the file (for the format defined for [_3]).','<b>'.$showpct.'</b>','<b>'.$max_match_count.'</b>',$format_descs).              $output .= '<br />';
                        '<br />'.&mt('A low percentage of matches results from one of the following:').'<ul>'.              if ($found_match_count == $max_match_count) {
                        '<li>'.&mt('The file was uploaded to the wrong course').'</li>'.                  # 100% matching entries
                        '<li>'.&mt('The data are not in the format expected for the domain: [_1]',                  $output .= &Apache::lonhtmlcommon::confirm_success(
                                   '<i>'.$cdom.'</i>').'</li>'.                       &mt('Comparison of student IDs: [_1] matching ([quant,_2,entry,entries])',
                        '<li>'.&mt('Students did not bubble their IDs, or mis-bubbled them').'</li>'.                              '<b>'.$showpct.'</b>',$found_match_count)).'<br />'.
                        '<li>'.&mt('The course roster is not up to date').'</li>'.                  &mt('Comparison of student IDs in the uploaded file with'.
                        '</ul>';                      ' the course roster found matches for [_1] of the [_2] entries'.
                       ' in the file (for the format defined for [_3]).',
                           '<b>'.$showpct.'</b>','<b>'.$max_match_count.'</b>',$format_descs);
               } else {
                   # Not all entries matching? -> Show warning and additional info
                   $output .=
                       &Apache::lonhtmlcommon::confirm_success(
                           &mt('Comparison of student IDs: [_1] matching ([_2]/[quant,_3,entry,entries])',
                                   '<b>'.$showpct.'</b>',$found_match_count,$max_match_count).'<br />'.
                           &mt('Not all entries could be matched!'),1).'<br />'.
                       &mt('Comparison of student IDs in the uploaded file with'.
                           ' the course roster found matches for [_1] of the [_2] entries'.
                           ' in the file (for the format defined for [_3]).',
                               '<b>'.$showpct.'</b>','<b>'.$max_match_count.'</b>',$format_descs).
                       '<p class="LC_info">'.
                       &mt('A low percentage of matches results from one of the following:').
                       '</p><ul>'.
                       '<li>'.&mt('The file was uploaded to the wrong course.').'</li>'.
                       '<li>'.&mt('The data is not in the format expected for the domain: [_1]',
                                  '<i>'.$cdom.'</i>').'</li>'.
                       '<li>'.&mt('Students did not bubble their IDs, or mis-bubbled them').'</li>'.
                       '<li>'.&mt('The course roster is not up to date.').'</li>'.
                       '</ul>';
               }
         }          }
     } else {      } else {
         $output = '<span class="LC_warning">'.&mt('Uploaded file contained no data').'</span>';          $output = '<p class="LC_warning">'.&mt('Uploaded file contained no data').'</p>';
     }      }
     return $output;      return $output;
 }  }
Line 9946  sub process_clicker_file { Line 9977  sub process_clicker_file {
     $number++;      $number++;
  }   }
         $result.="</p>\n";          $result.="</p>\n";
  if ($number==0) {          if ($number==0) {
     $result.='<span class="LC_error">'.&mt('No IDs found to determine correct answer').'</span>';              $result .=
     return $result.&show_grading_menu_form($symb);                   &Apache::lonhtmlcommon::confirm_success(
  }                       &mt('No IDs found to determine correct answer'),1);
               return $result,.&show_grading_menu_form($symb);
           }
     }      }
     if (length($env{'form.upfile'}) < 2) {      if (length($env{'form.upfile'}) < 2) {
         $result.=&mt('[_1] Error: [_2] The file you attempted to upload, [_3] contained no information. Please check that you entered the correct filename.',          $result .=
      '<span class="LC_error">',              &Apache::lonhtmlcommon::confirm_success(
      '</span>',                  &mt('The file: [_1] you attempted to upload contained no information. Please check that you entered the correct filename.',
      '<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>');                          '<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>'),1);
         return $result.&show_grading_menu_form($symb);          return $result.&show_grading_menu_form($symb);
     }      }
   

Removed from v.1.596.2.12.2.24  
changed lines
  Added in v.1.596.2.12.2.25


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