--- loncom/homework/grades.pm 2006/02/13 22:11:51 1.312 +++ loncom/homework/grades.pm 2006/02/14 15:11:09 1.313 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.312 2006/02/13 22:11:51 banghart Exp $ +# $Id: grades.pm,v 1.313 2006/02/14 15:11:09 banghart Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1386,10 +1386,8 @@ SUBJAVASCRIPT #--- displays the grading box, used in essay type problem and grading by page/sequence sub gradeBox { my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_; - my $checkIcon = ''; - my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname); my $wgtmsg = ($wgt > 0 ? '(problem weight)' : 'problem weight assigned by computer'); @@ -1397,19 +1395,15 @@ sub gradeBox { my $score = ($$record{'resource.'.$partid.'.awarded'} eq '' ? '' : $$record{'resource.'.$partid.'.awarded'}*$wgt); my $result=''."\n"; - my $display_part=&get_display_part($partid,undef,$symb); - my %last_resets = &get_last_resets($symb,$env{'request.course.id'}, [$partid]); my $aggtries = $$record{'resource.'.$partid.'.tries'}; if ($last_resets{$partid}) { $aggtries = &get_num_tries($record,$last_resets{$partid},$partid); } - $result.=''."\n"; $result.='
'. 'Part: '.$display_part.' Points: '."\n"; - my $ctr = 0; $result.=''."\n"; # display radio buttons in a nice table 10 across while ($ctr<=$wgt) { @@ -1421,7 +1415,6 @@ sub gradeBox { $ctr++; } $result.='
'; - $result.='
 or '."\n"; - $result.=''."\n"; $result.='
'."\n"; + my $files=&get_submitted_files($udom,$uname,$partid,$counter,$record); + if (@$files) { + my $file_counter = 0; + foreach my $file (@$files) { + $result.=' Return commented document to student. '."\n"; + $result.=''; + $result.=''; + } + } + + return $result; } @@ -1792,31 +1796,23 @@ KEYWORDS $lastsubonly.='Part: '. $display_part.' ( ID '.$respid. ' )   '; - my @files; - if ($record{"resource.$partid.$respid.portfiles"}) { - my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio'; - foreach my $file (split(',',$record{"resource.$partid.$respid.portfiles"})) { - push(@files,$file_url.$file); - - &Apache::lonnet::logthis("found a portfolio file".$record{"resource.$partid.$respid.portfiles"}); - &Apache::lonnet::logthis("uploaded URL file".$record{"resource.$partid.$respid.uploadedurl"}); - } - } - if ($record{"resource.$partid.$respid.uploadedurl"}) { - push(@files,$record{"resource.$partid.$respid.uploadedurl"}); - } - if (@files) { + my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record); +# if ($record{"resource.$partid.$respid.portfiles"}) { +# my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio'; +# foreach my $file (split(',',$record{"resource.$partid.$respid.portfiles"})) { +# push(@files,$file_url.$file); +# } +# } +# if ($record{"resource.$partid.$respid.uploadedurl"}) { +# push(@files,$record{"resource.$partid.$respid.uploadedurl"}); +# } + if (@$files) { $lastsubonly.='
Like all files provided by users, this file may contain virusses
'; my $file_counter = 0; - foreach my $file (@files) { + foreach my $file (@$files) { $file_counter ++; &Apache::lonnet::allowuploaded('/adm/grades',$file); $lastsubonly.='
'.$file.''; - $lastsubonly.=' Return commented document to student. '."\n"; - $lastsubonly.=''; - $lastsubonly.=''; - } $lastsubonly.='
'; } @@ -2351,7 +2347,20 @@ sub saveHandGrade { } return ('',$pts,$wgt); } - +sub get_submitted_files { + my ($udom,$uname,$partid,$respid,$record) = @_; + my @files; + if ($$record{"resource.$partid.$respid.portfiles"}) { + my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio'; + foreach my $file (split(',',$$record{"resource.$partid.$respid.portfiles"})) { + push(@files,$file_url.$file); + } + } + if ($$record{"resource.$partid.$respid.uploadedurl"}) { + push(@files,$$record{"resource.$partid.$respid.uploadedurl"}); + } + return (\@files); +} # ----------- Provides number of tries since last reset. sub get_num_tries { my ($record,$last_reset,$part) = @_;