';
} elsif ($response eq 'match') {
my %answer=&Apache::lonnet::str2hash($answer);
@@ -286,10 +352,10 @@ sub cleanRecord {
$bottomrow.='
'.$grayFont.$foil.'
';
}
return '
'.
- '
Answer
'.$toprow.'
'.
- '
'.$grayFont.'Item ID
'.
+ '
'.&mt('Answer').'
'.$toprow.'
'.
+ '
'.$grayFont.&mt('Item ID').'
'.
$middlerow.'
'.
- '
'.$grayFont.'Option ID
'.
+ '
'.$grayFont.&mt('Option ID').'
'.
$bottomrow.'
'.'
';
} elsif ($response eq 'radiobutton') {
my %answer=&Apache::lonnet::str2hash($answer);
@@ -299,18 +365,18 @@ sub cleanRecord {
foreach my $foil (@$order) {
if (exists($answer{$foil})) {
if ($foil eq $correct) {
- $toprow.='
true
';
+ $toprow.='
'.&mt('true').'
';
} else {
- $toprow.='
true
';
+ $toprow.='
'.&mt('true').'
';
}
} else {
- $toprow.='
false
';
+ $toprow.='
'.&mt('false').'
';
}
$bottomrow.='
'.$grayFont.$foil.'
';
}
return '
'.
- '
Answer
'.$toprow.'
'.
- '
'.$grayFont.'Option ID
'.
+ '
'.&mt('Answer').'
'.$toprow.'
'.
+ '
'.$grayFont.&mt('Option ID').'
'.
$grayFont.$bottomrow.'
'.'
';
} elsif ($response eq 'essay') {
if (! exists ($env{'form.'.$symb})) {
@@ -362,7 +428,10 @@ sub cleanRecord {
$result.='';
return $result;
}
-
+ } elsif ( $response =~ m/(?:numerical|formula)/) {
+ $answer =
+ &Apache::loncommon::format_previous_attempt_value('submission',
+ $answer);
}
return $answer;
}
@@ -406,8 +475,10 @@ COMMONJSFUNCTIONS
#--- Dumps the class list with usernames,list of sections,
#--- section, ids and fullnames for each user.
sub getclasslist {
- my ($getsec,$filterlist) = @_;
+ my ($getsec,$filterlist,$getgroup) = @_;
my @getsec;
+ my @getgroup;
+ my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status'));
if (!ref($getsec)) {
if ($getsec ne '' && $getsec ne 'all') {
@getsec=($getsec);
@@ -416,10 +487,19 @@ sub getclasslist {
@getsec=@{$getsec};
}
if (grep(/^all$/,@getsec)) { undef(@getsec); }
+ if (!ref($getgroup)) {
+ if ($getgroup ne '' && $getgroup ne 'all') {
+ @getgroup=($getgroup);
+ }
+ } else {
+ @getgroup=@{$getgroup};
+ }
+ if (grep(/^all$/,@getgroup)) { undef(@getgroup); }
- my $classlist=&Apache::loncoursedata::get_classlist();
+ my ($classlist,$keylist)=&Apache::loncoursedata::get_classlist();
# Bail out if we were unable to get the classlist
return if (! defined($classlist));
+ &Apache::loncoursedata::get_group_memberships($classlist,$keylist);
#
my %sections;
my %fullnames;
@@ -436,18 +516,40 @@ sub getclasslist {
$classlist->{$student}->[&Apache::loncoursedata::CL_FULLNAME()];
my $status =
$classlist->{$student}->[&Apache::loncoursedata::CL_STATUS()];
+ my $group =
+ $classlist->{$student}->[&Apache::loncoursedata::CL_GROUP()];
# filter students according to status selected
- if ($filterlist && $env{'form.Status'} ne 'Any') {
- if ($env{'form.Status'} ne $status) {
- delete ($classlist->{$student});
+ if ($filterlist && (!($stu_status =~ /Any/))) {
+ if (!($stu_status =~ $status)) {
+ delete($classlist->{$student});
next;
}
}
+ # filter students according to groups selected
+ my @stu_groups = split(/,/,$group);
+ if (@getgroup) {
+ my $exclude = 1;
+ foreach my $grp (@getgroup) {
+ foreach my $stu_group (@stu_groups) {
+ if ($stu_group eq $grp) {
+ $exclude = 0;
+ }
+ }
+ if (($grp eq 'none') && !$group) {
+ $exclude = 0;
+ }
+ }
+ if ($exclude) {
+ delete($classlist->{$student});
+ }
+ }
$section = ($section ne '' ? $section : 'none');
if (&canview($section)) {
if (!@getsec || grep(/^\Q$section\E$/,@getsec)) {
$sections{$section}++;
- $fullnames{$student}=$fullname;
+ if ($classlist->{$student}) {
+ $fullnames{$student}=$fullname;
+ }
} else {
delete($classlist->{$student});
}
@@ -520,6 +622,7 @@ sub student_gradeStatus {
# Shows a student's view of problem and submission
sub jscriptNform {
my ($symb) = @_;
+ my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status'));
my $jscript='
+GRADINGMENUJS
+ &commonJSfunctions($request);
+ return $Str;
+}
+
+
+#--- Displays the submissions first page -------
+sub submit_options {
my ($request) = @_;
my ($symb)=&get_symb($request);
if (!$symb) {return '';}
@@ -6984,9 +7528,8 @@ sub gradingmenu {
GRADINGMENUJS
&commonJSfunctions($request);
- my $result='
Manual Grading/View Submission
';
my ($table,undef,$hdgrade) = &showResourceInfo($symb,$probTitle);
- $result.=$table;
+ my $result;
my (undef,$sections) = &getclasslist('all','0');
my $savedState = &savedState();
my $saveCmd = ($$savedState{'saveCmd'} eq '' ? 'submission' : $$savedState{'saveCmd'});
@@ -7003,88 +7546,104 @@ GRADINGMENUJS
''."\n".
''."\n";
- $result.='
'."\n".
- '
'."\n".
- ' Select a Grading/Viewing Option
'."\n".
- '
'."\n";
-
- $result.='
';
- $result.='
'."\n".
- ' '.&mt('Select Section').':
';
-
- $result.='
'.
- ''.
- ''.
- ''.
- ''.
- '
'."\n";
-
- $result.='
'.
- '
'."\n";
-
- $result.='
'.
- '
'."\n";
-
- $result.='
'.
- ''.
- '
'."\n";
-
- $result.='
';
-
- $result.='
';
- $result.='
'.
- ''.
- ' '.&mt('scores from file').'
'."\n";
-
- $result.='
'.
- ''.
- ' '.&mt('clicker file').'
'."\n";
-
- $result.='
'.
- ' scantron forms
'."\n";
-
- if ((&Apache::lonnet::allowed('mgr',$env{'request.course.id'})) && ($symb)) {
- $result.='
+ '.&mt('Grade Complete Folder for One Student').'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ';
return $result;
}
@@ -7118,9 +7677,10 @@ sub gather_clicker_ids {
# Set up a couple variables.
my $username_idx = &Apache::loncoursedata::CL_SNAME();
my $domain_idx = &Apache::loncoursedata::CL_SDOM();
+ my $status_idx = &Apache::loncoursedata::CL_STATUS();
foreach my $student (keys(%$classlist)) {
-
+ if ($classlist->{$student}->[$status_idx] ne 'Active') { next; }
my $username = $classlist->{$student}->[$username_idx];
my $domain = $classlist->{$student}->[$domain_idx];
my $clickers =
@@ -7257,9 +7817,9 @@ function sanitycheck() {
-
-
-
+
+
+
@@ -7362,6 +7922,8 @@ ENDHEADER
}
$result.=' '.&mt('Found [_1] question(s)',$number).' '.
''.
+ &mt('Awarding [_1] percent for corrion(s)',$number).' '.
+ ''.
&mt('Awarding [_1] percent for correct and [_2] percent for incorrect responses',
$env{'form.pcorrect'},$env{'form.pincorrect'}).
' ';
@@ -7381,8 +7943,21 @@ ENDHEADER
$result.="\n".'';
$correct_count++;
} elsif ($clicker_ids{$id}) {
- $result.="\n".'';
- $student_count++;
+ if ($clicker_ids{$id}=~/\,/) {
+# More than one user with the same clicker!
+ $result.="\n".&mt('Clicker registered more than once').": ".$id." ";
+ $result.="\n".''.
+ "";
+ foreach my $reguser (sort(split(/\,/,$clicker_ids{$id}))) {
+ $result.="';
+ }
+ $result.='';
+ $unknown_count++;
+ } else {
+# Good: found one and only one user with the right clicker
+ $result.="\n".'';
+ $student_count++;
+ }
} else {
$result.="\n".&mt('Unregistered Clicker')." ".$id." ";
$result.="\n".''.
@@ -7533,6 +8108,8 @@ ENDHEADER
my $id=$1;
if (($env{'form.uname'.$id}) && ($env{'form.udom'.$id})) {
$user=$env{'form.uname'.$id}.':'.$env{'form.udom'.$id};
+ } elsif ($env{'form.multi'.$id}) {
+ $user=$env{'form.multi'.$id};
}
}
if ($user) {
@@ -7577,7 +8154,6 @@ ENDHEADER
sub handler {
my $request=$_[0];
-
&reset_caches();
if ($env{'browser.mathml'}) {
&Apache::loncommon::content_type($request,'text/xml');
@@ -7590,9 +8166,12 @@ sub handler {
my $symb=&get_symb($request,1);
my @commands=&Apache::loncommon::get_env_multiple('form.command');
my $command=$commands[0];
+
if ($#commands > 0) {
&Apache::lonnet::logthis("grades got multiple commands ".join(':',@commands));
}
+
+
$request->print(&Apache::loncommon::start_page('Grading'));
if ($symb eq '' && $command eq '') {
if ($env{'user.adv'}) {
@@ -7633,7 +8212,9 @@ sub handler {
} elsif ($command eq 'processGroup' && $perm{'vgr'}) {
&processGroup($request);
} elsif ($command eq 'gradingmenu' && $perm{'vgr'}) {
- $request->print(&gradingmenu($request));
+ $request->print(&grading_menu($request));
+ } elsif ($command eq 'submit_options' && $perm{'vgr'}) {
+ $request->print(&submit_options($request));
} elsif ($command eq 'viewgrades' && $perm{'vgr'}) {
$request->print(&viewgrades($request));
} elsif ($command eq 'handgrade' && $perm{'mgr'}) {