--- loncom/homework/grades.pm 2003/07/28 18:04:39 1.126 +++ loncom/homework/grades.pm 2003/07/29 20:54:39 1.128 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.126 2003/07/28 18:04:39 ng Exp $ +# $Id: grades.pm,v 1.128 2003/07/29 20:54:39 ng Exp $ # # Copyright Michigan State University Board of Trustees # @@ -109,9 +109,8 @@ sub response_type { my ($responsetype,$part) = split(/_/,$_,2); my ($partid,$respid) = split(/_/,$part); $responsetype =~ s/response$//; # make it compatible w/ navmaps - should move to that!! -# my ($value) = &Apache::lonnet::EXT('resource.'.$part.'.handgrade',$symb); -# $handgrade{$part} = $responsetype.':'.($value eq 'yes' ? 'yes' : 'no'); #a bug $value is 'yes' regardless - $handgrade{$part} = $responsetype.':'.(($allkeys =~ /parameter_$part\_handgrade/) ? 'yes' : 'no'); + my ($value) = &Apache::lonnet::EXT('resource.'.$part.'.handgrade',$symb); + $handgrade{$part} = $responsetype.':'.($value eq 'yes' ? 'yes' : 'no'); next if ($seen{$partid} > 0); $seen{$partid}++; push @partlist,$partid; @@ -299,7 +298,7 @@ sub student_gradeStatus { my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); my %partstatus = (); foreach (@$partlist) { - my ($status,$foo) = split(/_/,$record{"resource.$_.solved"},2); + my ($status,undef) = split(/_/,$record{"resource.$_.solved"},2); $status = 'nothing' if ($status eq ''); $partstatus{$_} = $status; my $subkey = "resource.$_.submitted_by"; @@ -755,8 +754,7 @@ sub sub_page_js { for (i=0;i<=total;i++) { for (j=0;j"); pDoc.write("Message Central"); @@ -1029,6 +1024,7 @@ sub sub_page_kw_js { pDoc.write("

"); pDoc.write(""); pDoc.write(""); + pDoc.close(); } //====================== Script for keyword highlight options ============== @@ -1072,6 +1068,7 @@ sub sub_page_kw_js { hwdWin = window.open('', 'KeywordHighlightCentral', 'toolbar=no,location=no,scrollbars=no,width=400,height=300,screenx='+xpos+',screeny='+ypos); hwdWin.focus(); var hDoc = hwdWin.document; + hDoc.open('text/html','replace'); hDoc.write(""); hDoc.write("Highlight Central"); @@ -1120,6 +1117,7 @@ sub sub_page_kw_js { hDoc.write("

"); hDoc.write(""); hDoc.write(""); + hDoc.close(); } @@ -1769,17 +1767,14 @@ sub processHandGrade { } } $ctr = 0; - my ($partlist,$handgrade) = &response_type($ENV{'form.url'},$symb); @parsedlist = reverse @parsedlist if ($button eq 'Previous'); foreach my $student (@parsedlist) { my ($uname,$udom) = split(/:/,$student); if ($ENV{'form.submitonly'} eq 'yes') { - my (%status) = &student_gradeStatus($ENV{'form.url'},$symb,$udom,$uname,$partlist) ; + my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); my $statusflg = ''; - foreach (keys(%status)) { - $statusflg = 1 if ($status{$_} ne 'nothing'); - my ($foo,$partid,$foo1) = split(/\./); - $statusflg = '' if ($status{'resource.'.$partid.'.submitted_by'} ne ''); + foreach (split(/:/,$ENV{'form.partlist0'})){ + $statusflg = 1 if (exists ($record{'resource.'.$_.'.solved'})); } next if ($statusflg eq ''); }