--- loncom/homework/grades.pm 2003/07/18 20:14:35 1.119 +++ loncom/homework/grades.pm 2003/07/21 13:32:49 1.121 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.119 2003/07/18 20:14:35 ng Exp $ +# $Id: grades.pm,v 1.121 2003/07/21 13:32:49 ng Exp $ # # Copyright Michigan State University Board of Trustees # @@ -197,6 +197,7 @@ COMMONJSFUNCTIONS #--- section, ids and fullnames for each user. sub getclasslist { my ($getsec,$filterlist) = @_; + $getsec = $getsec eq '' ? 'all' : $getsec; my $classlist=&Apache::loncoursedata::get_classlist(); # Bail out if we were unable to get the classlist return if (! defined($classlist)); @@ -707,9 +708,10 @@ sub sub_page_js { } function checkSolved(formname,id) { - if (eval("formname.solved"+id+".value") == "correct_by_student") { + if (eval("formname.solved"+id+".value") == "correct_by_student" && formname.overRideScore.value == 'no') { var reply = confirm("This problem has been graded correct by the computer. Do you want to change the score?"); if (!reply) {return "noupdate";} + formname.overRideScore.value = 'yes'; } return "update"; } @@ -720,9 +722,9 @@ sub sub_page_js { return; } -//=========== Check that a point is assigned for all the parts (essay grading only) ============ +//=========== Check that a point is assigned for all the parts ============ function checksubmit(formname,val,total,parttot) { - document.SCORE.gradeOpt.value = val; + formname.gradeOpt.value = val; if (val == "Save & Next") { for (i=0;i<=total;i++) { for (j=0;jprint('
'."\n". ''."\n". ''."\n". ''."\n". + ''."\n". ''."\n". ''."\n". + ''."\n". + ''."\n". ''."\n". ''."\n". ''."\n". @@ -1279,7 +1294,6 @@ KEYWORDS $request->print('


') if ($counter > 0); $request->print(&show_problem($request,$symb,$uname,$udom,1,1)); } - my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname); my ($partlist,$handgrade) = &response_type($url); @@ -1426,21 +1440,24 @@ KEYWORDS $last,'.submission', 'Apache::grades::keywords_highlight')); } + + $request->print(''."\n"); # return if view submission with no grading option if ($ENV{'form.showgrading'} eq '' || (!&canmodify($usec))) { - $request->print('
'."\n"); - $request->print(&show_grading_menu_form($symb,$url)) + my $toGrade.='  '."\n" if (&canmodify($usec)); + $toGrade.=''."\n"; + $toGrade.=&show_grading_menu_form($symb,$url) if (($ENV{'form.command'} eq 'submission') || ($ENV{'form.command'} eq 'processGroup' && $counter == $total)); + $request = print($toGrade); return; } - $result=''."\n". - ''."\n". - ''."\n"; - # essay grading options + # essay grading message center if ($ENV{'form.handgrade'} eq 'yes') { my ($lastname,$givenn) = split(/,/,$ENV{'form.fullname'}); my $msgfor = $givenn.' '.$lastname; @@ -1450,6 +1467,8 @@ KEYWORDS } $msgfor =~ s/\'/\\'/g; #' stupid emacs - no! javascript # $result.=''."\n". + $result=''."\n". + ''."\n"; $result.=' '. 'Compose Message to student'.(scalar(@col_fullnames) >= 1 ? 's' : '').'  '. @@ -1457,8 +1476,8 @@ KEYWORDS '/mailbkgrd.gif" width="14" height="10" name="mailicon'.$counter.'" />'."\n". '
 (Message will be sent when you click on Save & Next below.)'."\n" if ($ENV{'form.handgrade'} eq 'yes'); + $request->print($result); } - $request->print($result); my %seen = (); my @partlist; @@ -1483,8 +1502,7 @@ KEYWORDS # print end of form if ($counter == $total) { - my $endform='
'. - ''."\n"; + my $endform='
'."\n"; $endform.='  '."\n"; @@ -1554,7 +1572,6 @@ sub processHandGrade { my $button = $ENV{'form.gradeOpt'}; my $ngrade = $ENV{'form.NCT'}; my $ntstu = $ENV{'form.NTSTU'}; - if ($button eq 'Save & Next') { my $ctr = 0; while ($ctr < $ngrade) { @@ -1648,7 +1665,6 @@ sub processHandGrade { $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); } # Called by Save & Refresh from Highlight Attribute Window -# my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'0'); my (undef,undef,$fullname) = &getclasslist($ENV{'form.section'},'1'); if ($ENV{'form.refresh'} eq 'on') { my ($ctr,$total) = (0,0); @@ -1668,6 +1684,16 @@ sub processHandGrade { return ''; } +# Go directly to grade student - from submission or link from chart page + if ($button eq 'Grade Student') { + (undef,undef,$ENV{'form.handgrade'},undef,undef) = &showResourceInfo($url); + my $processUser = $ENV{'form.unamedom'.$ENV{'form.studentNo'}}; + ($ENV{'form.student'},$ENV{'form.userdom'}) = split(/:/,$processUser); + $ENV{'form.fullname'} = $$fullname{$processUser}; + &submission($request,0,0); + return ''; + } + # Get the next/previous one or group of students my $firststu = $ENV{'form.unamedom0'}; my $laststu = $ENV{'form.unamedom'.($ngrade-1)}; @@ -2779,7 +2805,8 @@ sub displayPage { if($curRes == $iterator->BEGIN_MAP) { $depth++; } if($curRes == $iterator->END_MAP) { $depth--; } - if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) { +# if (ref($curRes) && $curRes->is_problem() && !$curRes->randomout) { + if (ref($curRes) && $curRes->is_problem()) { my $parts = $curRes->parts(); my $title = $curRes->compTitle(); my $symbx = $curRes->symb();