--- loncom/homework/grades.pm 2010/05/22 01:01:03 1.574.2.12 +++ loncom/homework/grades.pm 2009/05/28 14:30:04 1.577 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.574.2.12 2010/05/22 01:01:03 raeburn Exp $ +# $Id: grades.pm,v 1.577 2009/05/28 14:30:04 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -97,15 +97,9 @@ sub ssi_print_error { # # --- Retrieve the parts from the metadata file.--- sub getpartlist { - my ($symb,$errorref) = @_; + my ($symb) = @_; my $navmap = Apache::lonnavmaps::navmap->new(); - unless (ref($navmap)) { - if (ref($errorref)) { - $$errorref = 'navmap'; - return; - } - } my $res = $navmap->getBySymb($symb); my $partlist = $res->parts(); my $url = $res->src(); @@ -150,15 +144,9 @@ sub nameUserString { #--- Get the partlist and the response type for a given problem. --- #--- Indicate if a response type is coded handgraded or not. --- sub response_type { - my ($symb,$response_error) = @_; + my ($symb) = shift; my $navmap = Apache::lonnavmaps::navmap->new(); - unless (ref($navmap)) { - if (ref($response_error)) { - $$response_error = 1; - } - return; - } my $res = $navmap->getBySymb($symb); my $partlist = $res->parts(); my %vPart = @@ -195,7 +183,8 @@ sub get_display_part { my ($partID,$symb)=@_; my $display=&Apache::lonnet::EXT('resource.'.$partID.'.display',$symb); if (defined($display) and $display ne '') { - $display.= " (id $partID)"; + $display.= ' (' + .&mt('Part ID: [_1]',$partID).')'; } else { $display=$partID; } @@ -205,17 +194,12 @@ sub get_display_part { #--- Show resource title #--- and parts and response type sub showResourceInfo { - my ($symb,$probTitle,$checkboxes,$res_error) = @_; + my ($symb,$probTitle,$checkboxes) = @_; my $col=3; if ($checkboxes) { $col=4; } my $result = '

'.&mt('Current Resource').': '.$probTitle.'

'."\n"; - my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error); - if (ref($res_error)) { - if ($$res_error) { - return; - } - } $result .=''; + my ($partlist,$handgrade,$responseType) = &response_type($symb); my %resptype = (); my $hdgrade='no'; my %partsseen; @@ -234,9 +218,9 @@ sub showResourceInfo { $partsseen{$partID}=1; } my $display_part=&get_display_part($partID,$symb); - $result.=''. - ''; + ''; # ''; } } @@ -771,7 +755,7 @@ sub verifyreceipt { my $title.= '

'. - &mt('Verifying Receipt No. [_1]',$receipt). + &mt('Verifying Receipt No. [_1]',$receipt). '

'."\n". '

'.&mt('Resource: [_1]',$env{'form.probTitle'}). '

'."\n"; @@ -783,13 +767,7 @@ sub verifyreceipt { if ($env{"course.$courseid.receiptalg"} eq 'receipt2' || $env{"course.$courseid.receiptalg"} eq 'receipt3') { $receiptparts=1; } my $parts=['0']; - if ($receiptparts) { - my $res_error; - ($parts)=&response_type($symb,\$res_error); - if ($res_error) { - return &navmap_errormsg(); - } - } + if ($receiptparts) { ($parts)=&response_type($symb); } my $header = &Apache::loncommon::start_data_table(). @@ -831,11 +809,11 @@ sub verifyreceipt { } } if ($matches == 0) { - $string = $title.&mt('No match found for the above receipt number.'); + $string = $title.&mt('No match found for the above receipt.'); } else { $string = &jscriptNform($symb).$title. '

'. - &mt('The above receipt number matches the following [numerate,_1,student].',$matches). + &mt('The above receipt matches the following [numerate,_1,student].',$matches). '

'. $header. $contents. @@ -1754,8 +1732,11 @@ sub gradeBox { } $line.=''."\n"; + + #&mt('',$display_part,$radio,$line); $result .= - ''; + ''. + $result.='
'.&mt('Part').': '.$display_part. + $result.=''.&mt('Part: [_1]',$display_part).''. ' '.$resID.''.&mt('Type').': '.$responsetype.'
'.&mt('Type: [_1]',$responsetype).'
'.&mt('Handgrade: [_1]',$handgrade).'
Part:[_1]Points:[_2]or[_3]'.&mt('Part').':'.$display_part.''.&mt('Points').':'.$radio.''.&mt('or').''.$line.''.&mt('Part:').''.$display_part.''.&mt('Points:').''.$radio.''.&mt('or').''.$line.'
'."\n"; $result.=''."\n". ''."\n". @@ -1765,19 +1746,15 @@ sub gradeBox { $$record{'resource.'.$partid.'.tries'}.'" />'."\n". ''."\n"; - my $res_error; - $result.=&handback_box($symb,$uname,$udom,$counter,$partid,$record,\$res_error); - if ($res_error) { - return &navmap_errormsg(); - } + $result.=&handback_box($symb,$uname,$udom,$counter,$partid,$record); return $result; } sub handback_box { - my ($symb,$uname,$udom,$counter,$partid,$record,$res_error) = @_; - my ($partlist,$handgrade,$responseType) = &response_type($symb,$res_error); + my ($symb,$uname,$udom,$counter,$partid,$record) = @_; + my ($partlist,$handgrade,$responseType) = &response_type($symb); my (@respids); - my @part_response_id = &flatten_responseType($responseType); + my @part_response_id = &flatten_responseType($responseType); foreach my $part_response_id (@part_response_id) { my ($part,$resp) = @{ $part_response_id }; if ($part eq $partid) { @@ -2070,12 +2047,7 @@ KEYWORDS } my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$udom,$uname); - my $res_error; - my ($partlist,$handgrade,$responseType) = &response_type($symb,\$res_error); - if ($res_error) { - $request->print(&navmap_errormsg()); - return; - } + my ($partlist,$handgrade,$responseType) = &response_type($symb); # Display student info $request->print(($counter == 0 ? '' : '
')); @@ -2142,9 +2114,11 @@ KEYWORDS } my $responsetype = $responseType->{$partid}->{$respid}; if (!exists($record{"resource.$partid.$respid.submission"})) { - $lastsubonly.="\n".'
Part: '. - $display_part.' ( ID '.$respid. - ' )   '. + $lastsubonly.="\n".'
'. + ''.&mt('Part: [_1]',$display_part).''. + ' '. + '('.&mt('Part ID: [_1]',$respid).')'. + '   '. ''.&mt('Nothing submitted - no attempts.').'

'; next; } @@ -2180,9 +2154,11 @@ KEYWORDS ($env{'form.lastSub'} eq 'hdgrade' && $$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) { my $display_part=&get_display_part($partid,$symb); - $lastsubonly.='
Part: '. - $display_part.' ( ID '.$respid. - ' )   '; + $lastsubonly.='
'. + ''.&mt('Part: [_1]',$display_part).''. + ' '. + '('.&mt('Part ID: [_1]',$respid).')'. + '   '; my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record); if (@$files) { $lastsubonly.='
'.&mt('Like all files provided by users, this file may contain viruses').'
'; @@ -2325,7 +2301,7 @@ KEYWORDS ''."\n"; my $nsel = ($env{'form.NTSTU'} ne '' ? $env{'form.NTSTU'} : '1'); $ntstu =~ s/