version 1.336, 2006/03/19 21:38:55
|
version 1.337, 2006/03/21 12:45:20
|
Line 2273 sub saveHandGrade {
|
Line 2273 sub saveHandGrade {
|
my $usec = &Apache::lonnet::getsection($domain,$stuname, |
my $usec = &Apache::lonnet::getsection($domain,$stuname, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
if (!&canmodify($usec)) { return('not_allowed'); } |
if (!&canmodify($usec)) { return('not_allowed'); } |
my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$domain,$stuname); |
my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},$domain,$stuname); |
my @parts_graded; |
my @parts_graded; |
my %newrecord = (); |
my %newrecord = (); |
my ($pts,$wgt) = ('',''); |
my ($pts,$wgt) = ('',''); |
my %aggregate = (); |
my %aggregate = (); |
my $aggregateflag = 0; |
my $aggregateflag = 0; |
|
|
my @parts = split(/:/,$env{'form.partlist'.$newflg}); |
my @parts = split(/:/,$env{'form.partlist'.$newflg}); |
foreach my $new_part (@parts) { |
foreach my $new_part (@parts) { |
#collaborator may vary for different parts |
#collaborator ($submi may vary for different parts |
if ($submitter && $new_part ne $part) { next; } |
if ($submitter && $new_part ne $part) { next; } |
my $dropMenu = $env{'form.GD_SEL'.$newflg.'_'.$new_part}; |
my $dropMenu = $env{'form.GD_SEL'.$newflg.'_'.$new_part}; |
if ($dropMenu eq 'excused') { |
if ($dropMenu eq 'excused') { |
Line 2350 sub saveHandGrade {
|
Line 2349 sub saveHandGrade {
|
} |
} |
$newrecord{'resource.'.$new_part.'.regrader'}= |
$newrecord{'resource.'.$new_part.'.regrader'}= |
"$env{'user.name'}:$env{'user.domain'}"; |
"$env{'user.name'}:$env{'user.domain'}"; |
|
&handback_files($request,$symb,$stuname,$domain,$newflg,$new_part,\%newrecord); |
} |
} |
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
|
foreach my $part_resp (sort(keys(%$handgrade))) { |
|
my ($part_id, $resp_id) = split(/_/,$part_resp); |
|
if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) { |
|
# if multiple files are uploaded names will be 'returndoc2','returndoc3' |
|
my $file_counter = 1; |
|
while ($env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter}) { |
|
my $fname=$env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'.filename'}; |
|
$newrecord{"resource.$new_part.$resp_id.handback"} = $env{'form.returndocorig'.$file_counter}; |
|
# set the filename to match the submitted file name |
|
$env{'form.'.$newflg.'_'.$part_resp.'_returndoc1.filename'} = $env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter}; |
|
my $result=&Apache::lonnet::userfileupload($newflg.'_'.$part_resp.'_returndoc'.$file_counter,'', |
|
'portfolio',undef,undef,undef,$stuname,$domain); |
|
if ($result !~ m|^/uploaded/|) { |
|
$request->print('<font color="red"> An errror occured ('.$result. |
|
') while trying to upload '.&display_file().'</font><br />'); |
|
# $request->print(&done('Back')); |
|
} |
|
$request->print("<br />".$fname." will be the uploaded file name"); |
|
$request->print("<font color=\"red\">Will upload document</font>".$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter}); |
|
$file_counter++; |
|
} |
|
} |
|
} |
|
|
|
# unless problem has been graded, set flag to version the submitted files |
# unless problem has been graded, set flag to version the submitted files |
|
&Apache::lonnet::logthis("about to enter condition vflag"); |
unless ($record{'resource.'.$new_part.'.solved'} =~ /^correct_/ || |
unless ($record{'resource.'.$new_part.'.solved'} =~ /^correct_/ || |
$record{'resource.'.$new_part.'.solved'} eq 'incorrect_by_override' || |
$record{'resource.'.$new_part.'.solved'} eq 'incorrect_by_override' || |
$dropMenu eq 'reset status') |
$dropMenu eq 'reset status') |
{ |
{ |
|
&Apache::lonnet::logthis("pushing vflag"); |
push (@v_flag,$new_part); |
push (@v_flag,$new_part); |
} |
} |
} |
} |
Line 2393 sub saveHandGrade {
|
Line 2370 sub saveHandGrade {
|
} |
} |
&Apache::lonnet::cstore(\%newrecord,$symb, |
&Apache::lonnet::cstore(\%newrecord,$symb, |
$env{'request.course.id'},$domain,$stuname); |
$env{'request.course.id'},$domain,$stuname); |
|
|
my @ungraded_parts; |
my @ungraded_parts; |
foreach my $part (@parts) { |
foreach my $part (@parts) { |
if ( !defined($record{'resource.'.$part.'.awarded'}) |
if ( !defined($record{'resource.'.$part.'.awarded'}) |
Line 2413 sub saveHandGrade {
|
Line 2389 sub saveHandGrade {
|
return ('',$pts,$wgt); |
return ('',$pts,$wgt); |
} |
} |
|
|
|
sub handback_files { |
|
my ($request,$symb,$stuname,$domain,$newflg,$new_part,$newrecord) = @_; |
|
&Apache::lonnet::logthis("inside the handback"); |
|
my $output; |
|
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
|
|
|
foreach my $part_resp (sort(keys(%$handgrade))) { |
|
my ($part_id, $resp_id) = split(/_/,$part_resp); |
|
if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) { |
|
# if multiple files are uploaded names will be 'returndoc2','returndoc3' |
|
my $file_counter = 1; |
|
while ($env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter}) { |
|
my $fname=$env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'.filename'}; |
|
$$newrecord{"resource.$new_part.$resp_id.handback"} = $env{'form.returndocorig'.$file_counter}; |
|
# set the filename to match the submitted file name |
|
$env{'form.'.$newflg.'_'.$part_resp.'_returndoc1.filename'} = $env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter}; |
|
my $result=&Apache::lonnet::userfileupload($newflg.'_'.$part_resp.'_returndoc'.$file_counter,'', |
|
'portfolio',undef,undef,undef,$stuname,$domain); |
|
if ($result !~ m|^/uploaded/|) { |
|
$request->print('<font color="red"> An errror occured ('.$result. |
|
') while trying to upload '.&display_file().'</font><br />'); |
|
# $request->print(&done('Back')); |
|
} |
|
$request->print("<br />".$fname." will be the uploaded file name"); |
|
$request->print("<font color=\"red\">Will upload document</font>".$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter}); |
|
$file_counter++; |
|
} |
|
} |
|
} |
|
return ($output); |
|
} |
|
|
sub get_submitted_files { |
sub get_submitted_files { |
my ($udom,$uname,$partid,$respid,$record) = @_; |
my ($udom,$uname,$partid,$respid,$record) = @_; |
my @files; |
my @files; |