--- loncom/homework/grades.pm 2002/10/17 14:35:34 1.57 +++ loncom/homework/grades.pm 2002/11/10 15:44:38 1.58 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.57 2002/10/17 14:35:34 matthew Exp $ +# $Id: grades.pm,v 1.58 2002/11/10 15:44:38 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -339,8 +339,9 @@ LISTJAVASCRIPT my $checklastsub = $ENV{'form.handgrade'} eq 'yes' ? '' : 'checked'; my $gradeTable='
'."\n". - ' View Problem: no '."\n". - ' yes
'."\n". + ' View Problem: no '."\n". + ' one student '."\n". + ' all students
'."\n". ' Submissions: '."\n"; if ($ENV{'form.handgrade'} eq 'yes') { $gradeTable.=' handgrade only'."\n"; @@ -795,6 +796,32 @@ SUBJAVASCRIPT } +sub show_problem { + my ($request,$symb,$uname,$udom,$removeform) = @_; + my $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom, + $ENV{'request.course.id'}); + if ($removeform) { + $rendered=~s|||g; + $rendered=~s|||g; + $rendered=~s|name="submit"|name="would_have_been_submit"|g; + } + my $companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom, + $ENV{'request.course.id'}); + if ($removeform) { + $companswer=~s|||g; + $companswer=~s|||g; + $rendered=~s|name="submit"|name="would_have_been_submit"|g; + } + my $result.='
'; + $result.='
'; + $result.=' View of the problem - '.$ENV{'form.fullname'}. + '
'.$rendered.'
'; + $result.='Correct answer:
'.$companswer; + $result.='
'; + $result.='

'; + $request->print($result); +} + # --------------------------- show submissions of a student, option to grade sub submission { my ($request,$counter,$total) = @_; @@ -809,7 +836,7 @@ sub submission { my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url))); if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; } my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : ''); - $ENV{'form.vProb'} = $ENV{'form.vProb'} ne '' ? $ENV{'form.vProb'} : 'yes'; +# $ENV{'form.vProb'} = $ENV{'form.vProb'} ne '' ? $ENV{'form.vProb'} : 'yes'; # header info if ($counter == 0) { @@ -820,18 +847,7 @@ sub submission { # option to display problem, only once else it cause problems # with the form later since the problem has a form. if ($ENV{'form.vProb'} eq 'yes') { - my $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom, - $ENV{'request.course.id'}); - my $companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom, - $ENV{'request.course.id'}); - my $result.='
'; - $result.='
'; - $result.=' View of the problem - '.$ENV{'form.fullname'}. - '
'.$rendered.'
'; - $result.='Correct answer:
'.$companswer; - $result.='
'; - $result.='

'; - $request->print($result); + &show_problem($request,$symb,$uname,$udom,0); } # kwclr is the only variable that is guaranteed to be non blank @@ -894,6 +910,11 @@ KEYWORDS } } + if ($ENV{'form.vProb'} eq 'all') { + $request->print('


'); + &show_problem($request,$symb,$uname,$udom,1); + } + my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); my ($partlist,$handgrade) = &response_type($url); @@ -1088,9 +1109,15 @@ KEYWORDS 'onChange="javascript:clearRadBox(this.form.RADVAL'.$counter.'_'.$partid. ',this.form.GD_BOX'.$counter.'_'.$partid. ',this.form.GD_SEL'.$counter.'_'.$partid. - ',this.form.stores'.$counter.'_'.$partid.')" />'."\n". - ''. - ''."  \n"; + ',this.form.stores'.$counter.'_'.$partid.')" >'."\n"; + if ($record{'resource.'.$partid.'.solved'} eq 'excused') { + $result.=''. + ''; + } else { + $result.=''. + ''; + } + $result.="  \n"; $result.=''; $result.=''."\n"; $request->print($result); @@ -1349,8 +1376,12 @@ sub saveHandGrade { my %newrecord; foreach (split(/:/,$ENV{'form.partlist'.$newflg})) { if ($ENV{'form.GD_SEL'.$newflg.'_'.$_} eq 'excused') { - $newrecord{'resource.'.$_.'.solved'} = 'excused' - if ($record{'resource.'.$_.'.solved'} ne 'excused'); + if ($record{'resource.'.$_.'.solved'} ne 'excused') { + $newrecord{'resource.'.$_.'.solved'} = 'excused'; + if (exists($record{'resource.'.$_.'.awarded'})) { + $newrecord{'resource.'.$_.'.awarded'} = ''; + } + } } else { my $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ? $ENV{'form.GD_BOX'.$newflg.'_'.$_} :