[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /homework grades.pm
raeburn
raeburn at source.lon-capa.org
Mon Dec 30 10:31:01 EST 2013
raeburn Mon Dec 30 15:31:01 2013 EDT
Modified files: (Branch: version_2_11_X)
/loncom/homework grades.pm
Log:
- For 2.11
- Backport 1.710
-------------- next part --------------
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.596.2.12.2.24 loncom/homework/grades.pm:1.596.2.12.2.25
--- loncom/homework/grades.pm:1.596.2.12.2.24 Sat Dec 14 00:22:27 2013
+++ loncom/homework/grades.pm Mon Dec 30 15:31:00 2013
@@ -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 @@
}
my %coursedata=&Apache::lonnet::coursedescription($env{'form.domainid'}.'_'.$env{'form.courseid'});
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) {
- $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 {
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]',
- '<span class="LC_success">','</span>',(length($env{'form.upfile'})-1),
- '<span class="LC_filename">'.$result.'</span>'));
+ $r->print(
+ &Apache::lonhtmlcommon::confirm_success(&mt('Upload successful')).'<br />'.
+ &mt('Uploaded [_1] bytes of data into location: [_2]',
+ (length($env{'form.upfile'})-1),
+ '<span class="LC_filename">'.$result.'</span>'));
($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]',
- '<span class="LC_error">','</span>',$result,
+ $r->print(
+ &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>'));
}
}
@@ -8882,7 +8889,7 @@
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 @@
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 @@
}
}
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).
- '<br />'.&mt('A low percentage of matches results from one of the following:').'<ul>'.
- '<li>'.&mt('The file was uploaded to the wrong course').'</li>'.
- '<li>'.&mt('The data are 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>';
+ $output .= '<br />';
+ 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])',
+ '<b>'.$showpct.'</b>',$found_match_count)).'<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);
+ } 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 {
- $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;
}
@@ -9946,16 +9977,18 @@
$number++;
}
$result.="</p>\n";
- if ($number==0) {
- $result.='<span class="LC_error">'.&mt('No IDs found to determine correct answer').'</span>';
- 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.',
- '<span class="LC_error">',
- '</span>',
- '<span class="LC_filename">'.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').'</span>');
+ $result .=
+ &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);
return $result.&show_grading_menu_form($symb);
}
More information about the LON-CAPA-cvs
mailing list