version 1.337, 2006/03/21 12:45:20
|
version 1.338, 2006/03/21 13:49:34
|
Line 2352 sub saveHandGrade {
|
Line 2352 sub saveHandGrade {
|
&handback_files($request,$symb,$stuname,$domain,$newflg,$new_part,\%newrecord); |
&handback_files($request,$symb,$stuname,$domain,$newflg,$new_part,\%newrecord); |
} |
} |
# 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 2391 sub saveHandGrade {
|
Line 2389 sub saveHandGrade {
|
|
|
sub handback_files { |
sub handback_files { |
my ($request,$symb,$stuname,$domain,$newflg,$new_part,$newrecord) = @_; |
my ($request,$symb,$stuname,$domain,$newflg,$new_part,$newrecord) = @_; |
&Apache::lonnet::logthis("inside the handback"); |
my $portfolio_root = &Apache::loncommon::propath($domain, |
my $output; |
$stuname). |
|
'/userfiles/portfolio'; |
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
|
|
foreach my $part_resp (sort(keys(%$handgrade))) { |
foreach my $part_resp (sort(keys(%$handgrade))) { |
my ($part_id, $resp_id) = split(/_/,$part_resp); |
my ($part_id, $resp_id) = split(/_/,$part_resp); |
if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) { |
if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) { |
Line 2402 sub handback_files {
|
Line 2400 sub handback_files {
|
my $file_counter = 1; |
my $file_counter = 1; |
while ($env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter}) { |
while ($env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter}) { |
my $fname=$env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'.filename'}; |
my $fname=$env{'form.'.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'.filename'}; |
$$newrecord{"resource.$new_part.$resp_id.handback"} = $env{'form.returndocorig'.$file_counter}; |
my ($directory,$answer_file) = |
|
($env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter} =~ /^(.*?)([^\/]*)$/); |
|
my ($answer_name,$answer_ver,$answer_ext) = |
|
&file_name_version_ext($answer_file); |
|
my @dir_list = &Apache::lonnet::dirlist($directory,$domain,$stuname,$portfolio_root); |
|
my $version = &get_next_version($answer_name, $answer_ext, \@dir_list); |
|
my $new_answer = &version_selected_portfile($domain, $stuname, $directory, $answer_file, $version); |
|
$$newrecord{"resource.$new_part.$resp_id.handback"} = $new_answer; |
|
|
# set the filename to match the submitted file name |
# set the filename to match the submitted file name |
$env{'form.'.$newflg.'_'.$part_resp.'_returndoc1.filename'} = $env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter}; |
$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,'', |
my $result=&Apache::lonnet::userfileupload($newflg.'_'.$part_resp.'_returndoc'.$file_counter,'', |
'portfolio',undef,undef,undef,$stuname,$domain); |
'portfolio',undef,undef,undef,$stuname,$domain); |
if ($result !~ m|^/uploaded/|) { |
if ($result !~ m|^/uploaded/|) { |
$request->print('<font color="red"> An errror occured ('.$result. |
$request->print('<font color="red"> An errror occured ('.$result. |
') while trying to upload '.&display_file().'</font><br />'); |
') while trying to upload '.&display_file().'</font><br />'); |
# $request->print(&done('Back')); |
# $request->print(&done('Back')); |
} |
} |
$request->print("<br />".$fname." will be the uploaded file name"); |
$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}); |
$request->print("<font color=\"red\">Will upload document </font>".$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter}); |
$file_counter++; |
$file_counter++; |
} |
} |
} |
} |
} |
} |
return ($output); |
return; |
} |
} |
|
|
sub get_submitted_files { |
sub get_submitted_files { |