--- loncom/homework/grades.pm 2006/02/27 19:40:21 1.320
+++ loncom/homework/grades.pm 2006/02/27 20:32:38 1.321
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.320 2006/02/27 19:40:21 albertel Exp $
+# $Id: grades.pm,v 1.321 2006/02/27 20:32:38 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1480,12 +1480,14 @@ sub handbackBox {
my $files=&get_submitted_files($udom,$uname,$partid,$respid,$record);
my $result;
if (@$files) {
- my $file_counter = 0;
+ my $file_counter = 1;
foreach my $file (@$files) {
- $result.=' Return commented document to student. '.$file_disp.' to student. '."\n";
- $result.='';
- $result.='
';
+ $result.='
';
+ $file_counter++;
}
}
return $result;
@@ -2316,25 +2318,22 @@ sub saveHandGrade {
$newrecord{'resource.'.$new_part.'.regrader'}=
"$env{'user.name'}:$env{'user.domain'}";
}
- if ($env{'form.part'.$new_part.'_returndoc1'}) {
- # if multiple files are uploaded names will be 'returndoc2','returndoc3'
-
- my $portfolio_root = &Apache::loncommon::propath($domain,
- $stuname).
- '/userfiles/portfolio';
- $request->print('
'.$portfolio_root.'
');
-
- # my $result=&Apache::lonnet::userfileupload('uploaddoc','',
- # 'portfolio'.$env{'form.currentpath'});
-
- my $file_counter = 1;
- my $respid = $env{'form.respid'};
- while ($env{'form.part'.$new_part.'_returndoc'.$file_counter}) {
- my $fname=$env{'form.returndoc'.$file_counter.'.filename'};
- $newrecord{"resource.$new_part.$respid.handback"} = $env{'form.returndocorig'.$file_counter};
- $request->print("
".$fname." will be the uploaded file name");
- $request->print("Will upload document".$env{'form.returndocorig'.$file_counter});
- $file_counter++;
+ my ($partlist,$handgrade,$responseType) = &response_type($url,$symb);
+ my $portfolio_root = &Apache::loncommon::propath($domain,
+ $stuname).
+ '/userfiles/portfolio';
+ foreach my $part_resp(sort(keys(%$handgrade))) {
+ my ($part_id, $resp_id) = split(/_/,$part_resp);
+ if ($env{'form.'.$part_resp.'_returndoc1'} && ($new_part eq $part_id)) {
+ # if multiple files are uploaded names will be 'returndoc2','returndoc3'
+ my $file_counter = 1;
+ while ($env{'form.'.$part_resp.'_returndoc'.$file_counter}) {
+ my $fname=$env{'form.returndoc'.$file_counter.'.filename'};
+ $newrecord{"resource.$new_part.$resp_id.handback"} = $env{'form.returndocorig'.$file_counter};
+ $request->print("
".$fname." will be the uploaded file name");
+ $request->print("Will upload document".$env{'form.returndocorig'.$file_counter});
+ $file_counter++;
+ }
}
}