--- loncom/homework/grades.pm 2003/07/14 14:29:07 1.113
+++ loncom/homework/grades.pm 2003/07/15 20:59:53 1.116
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.113 2003/07/14 14:29:07 ng Exp $
+# $Id: grades.pm,v 1.116 2003/07/15 20:59:53 ng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -418,7 +418,7 @@ LISTJAVASCRIPT
my $checklastsub = $ENV{'form.handgrade'} eq 'yes' ? '' : 'checked';
my $gradeTable='
'."\n");
$request->print(&show_grading_menu_form($symb,$url))
if (($ENV{'form.command'} eq 'submission') ||
@@ -1388,7 +1394,7 @@ KEYWORDS
my ($partid,$respid) = split(/_/);
next if ($seen{$partid} > 0);
$seen{$partid}++;
- next if ($$handgrade{$_} =~ /:no$/);
+# next if ($$handgrade{$_} =~ /:no$/);
push @partlist,$partid;
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record));
@@ -1977,6 +1983,7 @@ sub viewgrades {
my (@parts) = sort(&getpartlist($url));
foreach my $part (@parts) {
my $display=&Apache::lonnet::metadata($url,$part.'.display');
+ next if ($display =~ /Number of Attempts/);
if (!$display) { $display = &Apache::lonnet::metadata($url,$part.'.name'); }
if ($display =~ /^Partial Credit Factor/) {
my ($partid) = &split_part_type($part);
@@ -2007,7 +2014,8 @@ sub viewgrades {
'onClick="javascript:submit();" TARGET=_self />'."\n";
if (scalar(%$fullname) eq 0) {
my $colspan=3+scalar(@parts);
- $result='There are no students in section "'.$ENV{'form.section'}.'" with enrollment status "'.$ENV{'form.Status'}.'" to modify or grade.';
+ $result='There are no students in section "'.$ENV{'form.section'}.
+ '" with enrollment status "'.$ENV{'form.Status'}.'" to modify or grade.';
}
$result.=&show_grading_menu_form($symb,$url);
return $result;
@@ -2047,13 +2055,13 @@ sub viewstudentgrade {
if ($status eq 'excused');
$result.=$optsel;
$result.="\n";
- } else {
- $result.=''.
- "\n";
- $result.='
'."\n";
}
}
$result.='';
@@ -2607,7 +2615,7 @@ LISTJAVASCRIPT
$result.=''."\n".
''."\n";
- $result.=' View Problems: no '."\n".
+ $result.=' View Problems Text: no '."\n".
' yes '." \n";
$result.=' Submission Details: '.
@@ -2662,13 +2670,11 @@ sub getSymbMap {
my ($request) = @_;
my $navmap = Apache::lonnavmaps::navmap-> new($ENV{'request.course.fn'}.'.db',
$ENV{'request.course.fn'}.'_parms.db',1, 1);
-
- #my $res = $navmap->firstResource(); # temp resource to access constants
$navmap->init();
# End navmap using boilerplate
- my $iterator = Apache::lonnavmaps::iterator->new($navmap, undef, undef, undef, 1, undef, 1);
+ my $iterator = Apache::lonnavmaps::iterator->new($navmap, undef, undef, undef, undef, 1, undef, 1);
my $depth = 1;
my $curRes = $iterator->next();
@@ -2676,7 +2682,7 @@ sub getSymbMap {
my @titles = ();
my $minder=0;
my $seenBeginMap = 0;
- while ($depth > 0 && !$seenBeginMap) {
+ while ($depth > 0 || !$seenBeginMap) {
if ($curRes == $iterator->BEGIN_MAP()) {$depth++; $seenBeginMap = 1; }
if ($curRes == $iterator->END_MAP()) { $depth--; }
@@ -2783,21 +2789,18 @@ sub displayPage {
if ($ENV{'form.vProb'} eq 'yes') {
$studentTable.=&show_problem($request,$symbx,$uname,$udom,1);
} else {
- my $companswer = &Apache::loncommon::get_student_answers(
- $symbx,$uname,$udom,$ENV{'request.course.id'});
+ my $companswer = &Apache::loncommon::get_student_answers($symbx,$uname,$udom,$ENV{'request.course.id'});
$companswer =~ s|||g;
-
# while ($companswer =~ /()/s) { #\n");
# }
-# $companswer =~ s/
/
/g;
+# $companswer =~ s|
|
|g;
$studentTable.=' '.$title.' Correct answer: '.$companswer;
}
my %record = &Apache::lonnet::restore($symbx,$ENV{'request.course.id'},$udom,$uname);
-
if ($ENV{'form.lastSub'} eq 'datesub') {
if ($record{'version'} eq '') {
$studentTable.=' No recorded submission for this problem ';
@@ -2807,6 +2810,10 @@ sub displayPage {
'
Date/Time
'.
'
Submission
'.
'
Status
';
+ my %responseType = ();
+ foreach my $partid (@{$parts}) {
+ $responseType{$partid} = $curRes->responseType($partid);
+ }
my ($version);
for ($version=1;$version<=$record{'version'};$version++) {
my $timestamp = scalar(localtime($record{$version.':timestamp'}));
@@ -2816,13 +2823,11 @@ sub displayPage {
foreach my $partid (@{$parts}) {
my @matchKey = grep /^resource\.$partid\..*?\.submission$/,@versionKeys;
next if ($record{"$version:resource.$partid.solved"} eq '');
-# next if ($record{"$version:resource.$partid.award"} eq 'APPROX_ANS' &&
-# $record{"$version:resource.$partid.solved"} eq '');
$displaySub[0].=(exists $record{$version.':'.$matchKey[0]}) ?
'Part '.$partid.' '.
($record{"$version:resource.$partid.tries"} eq '' ? 'Trial not counted' :
'Trial '.$record{"$version:resource.$partid.tries"}).' '.
- $record{$version.':'.$matchKey[0]}.' ' : '';
+ &cleanRecord($record{$version.':'.$matchKey[0]},$responseType{$partid}).' ' : '';
$displaySub[1].=(exists $record{"$version:resource.$partid.award"}) ?
'Part '.$partid.' '.
$record{"$version:resource.$partid.award"}.'/'.
@@ -2869,6 +2874,26 @@ sub displayPage {
return '';
}
+sub cleanRecord {
+ my ($answer,$response) = @_;
+ if ($response eq 'option') {
+ my (@IDs,@ans);
+ foreach (split(/\&/,&Apache::lonnet::unescape($answer))) {
+ my ($optionID,$ans) = split(/=/);
+ push @IDs,$optionID.'';
+ push @ans,$ans;
+ }
+ my $grayFont = '';
+ return '
'.
+ '
Answer
'.
+ (join '
',@ans).'
'.
+ '
'.$grayFont.'Option ID
'.$grayFont.
+ (join '
'.$grayFont,@IDs).'
'.
+ '
';
+ }
+ return $answer;
+}
+
sub updateGradeByPage {
my ($request) = shift;
@@ -3336,12 +3361,17 @@ sub gradingmenu {
$request->print(<
- function checkChoice(formname) {
- var cmd = formname.command;
- formname.saveState.value = "saveCmd="+radioSelection(cmd)+":saveSec="+pullDownSelection(formname.section)+
+ function checkChoice(formname,val,cmdx) {
+ if (val <= 2) {
+ var cmd = radioSelection(formname.radioChoice);
+ } else {
+ cmd = cmdx;
+ }
+ formname.command.value = cmd;
+ formname.saveState.value = "saveCmd="+cmd+":saveSec="+pullDownSelection(formname.section)+
":saveSub="+radioSelection(formname.submitonly)+":saveStatus="+pullDownSelection(formname.Status);
- if (cmd[0].checked || cmd[1].checked || cmd[2].checked || cmd[3].checked || cmd[4].checked) formname.submit();
- if (cmd[5].checked) {
+ if (val < 5) formname.submit();
+ if (val == 5) {
if (!checkReceiptNo(formname,'notOK')) { return false;}
formname.submit();
}
@@ -3358,7 +3388,6 @@ sub gradingmenu {
formname.receipt.focus();
return false;
}
- formname.command[5].checked = true;
return true;
}
@@ -3402,8 +3431,8 @@ GRADINGMENUJS
$resptype = $responsetype;
$hdgrade = $handgrade if ($handgrade eq 'yes');
$result.='
'."\n".
- ' Select section: ';
-
- $result.='Student Status:'.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,undef);
- $result.=' (Applies to the first three options only.)'."\n";
-
- if (ref($sections)) {
- $result.=' (Section "no" implies the students were not assigned a section.) '
- if (grep /no/,@$sections);
- }
- $result.='