--- loncom/homework/grades.pm 2003/07/11 12:54:07 1.110
+++ 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.110 2003/07/11 12:54:07 ng Exp $
+# $Id: grades.pm,v 1.116 2003/07/15 20:59:53 ng Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -41,6 +41,7 @@ use Apache::style;
use Apache::lonxml;
use Apache::lonnet;
use Apache::loncommon;
+use Apache::lonhtmlcommon;
use Apache::lonnavmaps;
use Apache::lonhomework;
use Apache::loncoursedata;
@@ -129,8 +130,8 @@ sub getclasslist {
my (undef,undef,$end,$start,$id,$section,$fullname,$status)=
@{$classlist->{$_}};
# filter students according to status selected
- if ($filterlist && $ENV{'form.status'} ne 'Any') {
- if ($ENV{'form.status'} ne $status) {
+ if ($filterlist && $ENV{'form.Status'} ne 'Any') {
+ if ($ENV{'form.Status'} ne $status) {
delete ($classlist->{$_});
next;
}
@@ -391,7 +392,7 @@ sub listStudents {
}
function reLoadList(formname) {
- if (formname.saveStatusOld.value == pullDownSelection(formname.status)) {return;}
+ if (formname.saveStatusOld.value == pullDownSelection(formname.Status)) {return;}
formname.command.value = 'submission';
formname.submit();
}
@@ -417,7 +418,7 @@ LISTJAVASCRIPT
my $checklastsub = $ENV{'form.handgrade'} eq 'yes' ? '' : 'checked';
my $gradeTable='
'.''."\n".
'';
$result.=' ';
- $result.=''."\n";
+ 'onClick="javascript:resetEntry('.$ctsparts.');" TARGET=_self>';
+# $result.=' '."\n";
#table listing all the students in a section/class
#header of table
@@ -1975,10 +1979,11 @@ sub viewgrades {
}
$result.= '
'."\n".
'
'.
- '
Fullname
Username
Domain
'."\n";
+ '
Fullname (Username)
'."\n";
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);
@@ -2009,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;
@@ -2023,8 +2029,8 @@ sub viewstudentgrade {
my %record=&Apache::lonnet::restore($symb,$courseid,$udom,$uname);
my $result='
';
@@ -2609,7 +2615,7 @@ LISTJAVASCRIPT
$result.=''."\n".
''."\n";
- $result.=' View Problems: no '."\n".
+ $result.=' View Problems Text: no '."\n".
' yes '." \n";
$result.=' Submission Details: '.
@@ -2618,7 +2624,7 @@ LISTJAVASCRIPT
' all details'."\n";
$result.=''."\n".
- ''."\n".
+ ''."\n".
''."\n".
''."\n".
''."\n".
@@ -2664,22 +2670,20 @@ 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 = $navmap->getIterator(undef, undef, undef, 1);
+ my $iterator = Apache::lonnavmaps::iterator->new($navmap, undef, undef, undef, undef, 1, undef, 1);
my $depth = 1;
- $iterator->next(); # ignore first BEGIN_MAP
my $curRes = $iterator->next();
my %symbx = ();
my @titles = ();
my $minder=0;
- while ($depth > 0) {
- if ($curRes == $iterator->BEGIN_MAP()) {$depth++;}
+ my $seenBeginMap = 0;
+ while ($depth > 0 || !$seenBeginMap) {
+ if ($curRes == $iterator->BEGIN_MAP()) {$depth++; $seenBeginMap = 1; }
if ($curRes == $iterator->END_MAP()) { $depth--; }
if (ref($curRes) && $curRes->is_map()) {
@@ -2785,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 ';
@@ -2809,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'}));
@@ -2818,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"}.'/'.
@@ -2871,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;
@@ -3338,12 +3361,17 @@ sub gradingmenu {
$request->print(<
- function checkChoice(formname) {
- var cmd = formname.command;
- formname.saveState.value = "saveCmd="+radioSelection(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) {
+ 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 (val < 5) formname.submit();
+ if (val == 5) {
if (!checkReceiptNo(formname,'notOK')) { return false;}
formname.submit();
}
@@ -3360,7 +3388,6 @@ sub gradingmenu {
formname.receipt.focus();
return false;
}
- formname.command[5].checked = true;
return true;
}
@@ -3404,8 +3431,8 @@ GRADINGMENUJS
$resptype = $responsetype;
$hdgrade = $handgrade if ($handgrade eq 'yes');
$result.='
'.
- ''.&Apache::lonhtmlcommon::StatusOptions($saveStatus,undef,1,undef);
+
+ if (ref($sections)) {
+ $result.=' (Section "no" implies the students were not assigned a section.) '
+ if (grep /no/,@$sections);
+ }
+ $result.='
';
+
+ $result.='
'.
+ ' '.
- 'Handgrade/View Submission for a student by page/sequence
'."\n".
+ 'One student for whole page/sequence/folder'."\n";
- '
'.
- '
'.
+ ' '.
- 'Grade by section or class
'."\n".
+ 'All students in section/course for current resource'."\n";
- '
'."\n".
- ' Select section: ';
-
- $result.='Student Status:';
-
- $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.='