--- loncom/homework/grades.pm 2003/07/14 16:11:19 1.115 +++ 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.115 2003/07/14 16:11:19 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". - ' View Problem: no '."\n". + ' View Problem Text: no '."\n". ' one student '."\n". ' all students
'."\n". ' Submissions: '."\n"; @@ -1114,7 +1114,8 @@ sub submission { if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; } if (!&canview($usec)) { - $request->print('Unable to view requested student.('.$uname.$udom.$usec.$ENV{'request.course.id'}.')'); + $request->print('Unable to view requested student.('. + $uname.$udom.$usec.$ENV{'request.course.id'}.')'); $request->print(&show_grading_menu_form($symb,$url)); return; } @@ -1226,12 +1227,13 @@ KEYWORDS ''."\n" if ($ENV{'form.lastSub'} eq 'lastonly' || @@ -1352,7 +1357,8 @@ KEYWORDS } # return if view submission with no grading option - if ($ENV{'form.showgrading'} eq '' || (!&canmodify($usec))) { +# if ($ENV{'form.showgrading'} eq '' || (!&canmodify($usec))) { + if (!&canmodify($usec)) { $request->print('
'."\n"; $result.='Fullname: '.$ENV{'form.fullname'}. - '   Username: '.$uname.''. - '   Domain: '.$udom.'
'."\n"; + '   Username: '.$uname. + ($ENV{'user.domain'} eq $udom ? '' : ' ('.$udom.')').'
'."\n"; +# '   Domain: '.$udom.'
'."\n"; $result.=''."\n"; - # If this is handgraded, then check for collaborators + # If this is an essay-response part(handgraded), then check for collaborators my @col_fullnames; my ($classlist,$fullname); if ($ENV{'form.handgrade'} eq 'yes') { @@ -1321,7 +1323,8 @@ KEYWORDS my ($oname,$odom,$ocrsid,$oessay,$osim)=&most_similar($uname,$udom,$subval); if ($osim) { $osim=int($osim*100.0); - $similar='

Essay is '.$osim.'% similar to an essay by '.&Apache::loncommon::plainname($oname,$odom). + $similar='

Essay is '.$osim. + '% similar to an essay by '.&Apache::loncommon::plainname($oname,$odom). '

'. &keywords_highlight($oessay).'

'; } @@ -1331,7 +1334,9 @@ KEYWORDS ($record{"resource.$partid.$respid.uploadedurl"}? ' File uploaded by student Like all files provided by users, this file may contain virusses
':''). + '"> File uploaded by student '. + 'Like all files provided by users, '. + 'this file may contain virusses
':''). 'Answer:
'. &keywords_highlight($subval).'

 '.$similar.'

'."\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"; +# } 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: '. @@ -2781,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; $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
'; @@ -2805,6 +2810,10 @@ sub displayPage { ''. ''. ''; + 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'})); @@ -2812,16 +2821,13 @@ sub displayPage { my @versionKeys = split(/\:/,$record{$version.':keys'}); my @displaySub = (); foreach my $partid (@{$parts}) { - my $responseType = $curRes->responseType($partid); 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.' Type:'.$responseType.':endtype'. + '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"}.'/'. @@ -2868,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 '
Date/TimeSubmissionStatus 
'. + ''. + ''. + '
Answer'. + (join '',@ans).'
'.$grayFont.'Option ID'.$grayFont. + (join ''.$grayFont,@IDs).'
'; + } + return $answer; +} + sub updateGradeByPage { my ($request) = shift; @@ -3335,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(); } @@ -3357,7 +3388,6 @@ sub gradingmenu { formname.receipt.focus(); return false; } - formname.command[5].checked = true; return true; } @@ -3401,8 +3431,8 @@ GRADINGMENUJS $resptype = $responsetype; $hdgrade = $handgrade if ($handgrade eq 'yes'); $result.='Part '.(split(/_/))[0].''. - 'Type: '.$responsetype.''. - 'Handgrade: '.$handgrade.''; + 'Type: '.$responsetype.''; +# 'Handgrade: '.$handgrade.''; } $result.=''."\n"; @@ -3419,75 +3449,75 @@ GRADINGMENUJS ''."\n". ''."\n". ''."\n". + ''."\n". ''."\n". ''."\n"; - $result.='
'."\n". - '
'."\n". + $result.='
'."\n". + ''."\n". - '
'."\n". ' Select a Grading/Viewing Option
'."\n"; + '
'."\n"; - $result.=''. - ''; + + $result.=''."\n". + 'One student for whole page/sequence/folder'."\n"; - ''."\n". + 'All students in section/course for current resource'."\n"; - ''."\n". - ''."\n". + ($saveSub eq 'all' ? 'checked' : '').' /> everybody'."\n"; - ''."\n"; + $result.='
'. - ''."\n"; + if (ref($sections)) { + foreach (sort (@$sections)) {$result.=''."\n";} + } + $result.= '
'. + ' '. - 'Handgrade/View Submission for a student by page/sequence
'. - ' '. - 'Grade by section or class
'. - ($hdgrade eq 'yes' ? 'View/Grade essay response of' : 'View'). - ' an individual student --> For students who has: '. + $result.='
'. + ' '.'One or more students for current resource'. + '
            -->For students who has: '. ' submitted'. ' everybody
'. - ' '. - 'Upload scores from file

'. + ''. + '
'."\n"; + + $result.='
'; + + $result.=''; + $result.=''."\n"; $result.=''."\n"; + ' scantron forms'."\n"; if ((&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) && ($symb)) { $result.=''. - ''."\n"; } - $result.=''; - - $result.='
'. + ''. + ' scores from file
'. - ' '. - 'Grade scantron forms
'. - ' '. - 'Verify a submission receipt issued by this server--> Receipt no: '.unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}). + ''. + ' submission Receipt no: '.unpack("%32C*",$Apache::lonnet::perlvar{'lonHostID'}). '-'. '

'."\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.='

'. - ''."\n". - '
'."\n". + $result.='
'."\n". '
'."\n". '
'."\n"; return $result;