--- loncom/homework/grades.pm 2013/12/14 00:22:27 1.596.2.12.2.24
+++ loncom/homework/grades.pm 2013/12/30 15:31:00 1.596.2.12.2.25
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.596.2.12.2.24 2013/12/14 00:22:27 raeburn Exp $
+# $Id: grades.pm,v 1.596.2.12.2.25 2013/12/30 15:31:00 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -8844,23 +8844,30 @@ sub scantron_upload_scantron_data_save {
}
my %coursedata=&Apache::lonnet::coursedescription($env{'form.domainid'}.'_'.$env{'form.courseid'});
my $uploadedfile;
- $r->print('
'.&mt("Uploading file to [_1]",$coursedata{'description'}).'
');
+ $r->print(''.&mt("Uploading file to [_1]",$coursedata{'description'}).'
');
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.','','',''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').''));
+ $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.',
+ ''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').''),1));
} else {
my $result =
&Apache::lonnet::userfileupload('upfile','','scantron','','','',
$env{'form.courseid'},$env{'form.domainid'});
if ($result =~ m{^/uploaded/}) {
- $r->print(&mt('[_1]Success:[_2] Successfully uploaded [_3] bytes of data into location: [_4]',
- '','',(length($env{'form.upfile'})-1),
- ''.$result.''));
+ $r->print(
+ &Apache::lonhtmlcommon::confirm_success(&mt('Upload successful')).'
'.
+ &mt('Uploaded [_1] bytes of data into location: [_2]',
+ (length($env{'form.upfile'})-1),
+ ''.$result.''));
($uploadedfile) = ($result =~ m{/([^/]+)$});
$r->print(&validate_uploaded_scantron_file($env{'form.domainid'},
$env{'form.courseid'},$uploadedfile));
} else {
- $r->print(&mt('[_1]Error:[_2] An error ([_3]) occurred when attempting to upload the file, [_4]',
- '','',$result,
+ $r->print(
+ &Apache::lonhtmlcommon::confirm_success(&mt('Upload failed'),1).'
'.
+ &mt('An error ([_1]) occurred when attempting to upload the file: [_2]',
+ $result,
''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').''));
}
}
@@ -8882,7 +8889,7 @@ sub validate_uploaded_scantron_file {
my $output;
if (@lines) {
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 %idmap = &username_to_idmap($classlist);
foreach my $key (keys(%idmap)) {
@@ -8925,6 +8932,7 @@ sub validate_uploaded_scantron_file {
if (($max_match_format eq '') || ($percent_match > $max_match_pct)) {
$max_match_pct = $percent_match;
$max_match_format = $key;
+ $found_match_count = $counts{$key}{'found'};
$max_match_count = $counts{$key}{'total'};
}
}
@@ -8943,17 +8951,40 @@ sub validate_uploaded_scantron_file {
}
}
my $showpct = sprintf("%.0f",$max_match_pct).'%';
- $output .= '
'.&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]).',''.$showpct.'',''.$max_match_count.'',$format_descs).
- '
'.&mt('A low percentage of matches results from one of the following:').''.
- '- '.&mt('The file was uploaded to the wrong course').'
'.
- '- '.&mt('The data are not in the format expected for the domain: [_1]',
- ''.$cdom.'').'
'.
- '- '.&mt('Students did not bubble their IDs, or mis-bubbled them').'
'.
- '- '.&mt('The course roster is not up to date').'
'.
- '
';
+ $output .= '
';
+ if ($found_match_count == $max_match_count) {
+ # 100% matching entries
+ $output .= &Apache::lonhtmlcommon::confirm_success(
+ &mt('Comparison of student IDs: [_1] matching ([quant,_2,entry,entries])',
+ ''.$showpct.'',$found_match_count)).'
'.
+ &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]).',
+ ''.$showpct.'',''.$max_match_count.'',$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])',
+ ''.$showpct.'',$found_match_count,$max_match_count).'
'.
+ &mt('Not all entries could be matched!'),1).'
'.
+ &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]).',
+ ''.$showpct.'',''.$max_match_count.'',$format_descs).
+ ''.
+ &mt('A low percentage of matches results from one of the following:').
+ '
'.
+ '- '.&mt('The file was uploaded to the wrong course.').'
'.
+ '- '.&mt('The data is not in the format expected for the domain: [_1]',
+ ''.$cdom.'').'
'.
+ '- '.&mt('Students did not bubble their IDs, or mis-bubbled them').'
'.
+ '- '.&mt('The course roster is not up to date.').'
'.
+ '
';
+ }
}
} else {
- $output = ''.&mt('Uploaded file contained no data').'';
+ $output = ''.&mt('Uploaded file contained no data').'
';
}
return $output;
}
@@ -9946,16 +9977,18 @@ sub process_clicker_file {
$number++;
}
$result.="\n";
- if ($number==0) {
- $result.=''.&mt('No IDs found to determine correct answer').'';
- return $result.&show_grading_menu_form($symb);
- }
+ if ($number==0) {
+ $result .=
+ &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) {
- $result.=&mt('[_1] Error: [_2] The file you attempted to upload, [_3] contained no information. Please check that you entered the correct filename.',
- '',
- '',
- ''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'');
+ $result .=
+ &Apache::lonhtmlcommon::confirm_success(
+ &mt('The file: [_1] you attempted to upload contained no information. Please check that you entered the correct filename.',
+ ''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').''),1);
return $result.&show_grading_menu_form($symb);
}