--- loncom/homework/grades.pm 2019/01/28 21:36:53 1.756
+++ loncom/homework/grades.pm 2020/02/12 16:25:56 1.762
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.756 2019/01/28 21:36:53 raeburn Exp $
+# $Id: grades.pm,v 1.762 2020/02/12 16:25:56 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -48,6 +48,8 @@ use Apache::lonquickgrades;
use Apache::bridgetask();
use Apache::lontexconvert();
use String::Similarity;
+use HTML::Parser();
+use File::MMagic;
use LONCAPA;
use POSIX qw(floor);
@@ -4923,6 +4925,7 @@ LISTJAVASCRIPT
my $cdom = $env{"course.$env{'request.course.id'}.domain"};
my $cnum = $env{"course.$env{'request.course.id'}.num"};
my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'};
+ my $getgroup = $env{'form.group'} eq '' ? 'all' : $env{'form.group'};
my $result='
'.
&mt('Manual Grading by Page or Sequence').'
';
@@ -5012,7 +5015,7 @@ LISTJAVASCRIPT
'
'.&nameUserString('header').'
'.
&Apache::loncommon::end_data_table_header_row();
- my (undef,undef,$fullname) = &getclasslist($getsec,'1');
+ my (undef,undef,$fullname) = &getclasslist($getsec,'1',$getgroup);
my $ptr = 1;
foreach my $student (sort
{
@@ -5902,7 +5905,6 @@ sub scantron_selectphase {
$r->print('
');
- my $default_form_data=&defaultFormData($symb);
my $cdom= $env{'course.'.$env{'request.course.id'}.'.domain'};
my $cnum= $env{'course.'.$env{'request.course.id'}.'.num'};
my $alertmsg = &mt('Please use the browse button to select a file from your local directory.');
@@ -9111,7 +9113,9 @@ END
}
if ($count > 1) {
$formatextra = '
'.
- &scantron_scantab().'
';
+ ''.
+ &mt('Bubblesheet type:').' '.
+ &scantron_scantab().'';
$onclick = ' onclick="toggleScantab(this.form);"';
$formatjs = <<"END";
function toggleScantab(form) {
@@ -9126,7 +9130,7 @@ function toggleScantab(form) {
if (chosen == 'dat') {
document.getElementById(divid).style.display = 'none';
} else if (chosen == 'csv') {
- document.getElementById(divid).style.display = 'inline-block';
+ document.getElementById(divid).style.display = 'block';
}
}
}
@@ -9152,7 +9156,7 @@ END
} elsif (keys(%{$domconfig{'scantron'}{'config'}}) == 1) {
if (ref($domconfig{'scantron'}{'config'}{'csv'}{'fields'}) eq 'HASH') {
if (keys(%{$domconfig{'scantron'}{'config'}{'csv'}{'fields'}})) {
- $formattitle = &mt('Format of bubblesheet data file:');
+ $formattitle = &mt('Bubblesheet type');
$formatoptions = &scantron_scantab();
}
}
@@ -10294,6 +10298,22 @@ sub process_clicker_file {
''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').''),1);
return $result;
}
+ my $mimetype;
+ if ($env{'form.upfiletype'} eq 'iclicker') {
+ my $mm = new File::MMagic;
+ $mimetype = $mm->checktype_contents($env{'form.upfile'});
+ unless (($mimetype eq 'text/plain') || ($mimetype eq 'text/html')) {
+ $result.= '
'.
+ &Apache::lonhtmlcommon::confirm_success(
+ &mt('File format is neither csv (iclicker 6) nor xml (iclicker 7)'),1).'