--- loncom/homework/grades.pm 2006/05/18 21:39:27 1.354
+++ loncom/homework/grades.pm 2006/05/28 16:47:02 1.355
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.354 2006/05/18 21:39:27 albertel Exp $
+# $Id: grades.pm,v 1.355 2006/05/28 16:47:02 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2442,20 +2442,20 @@ sub handback_files {
($env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter} =~ /^(.*?)([^\/]*)$/);
my ($answer_name,$answer_ver,$answer_ext) =
&file_name_version_ext($answer_file);
- $directory =~ /^.+$stuname\/portfolio(.*)/;
- my $portfolio_path = $1;
+ my ($portfolio_path) = ($directory =~ /^.+$stuname\/portfolio(.*)/);
my @dir_list = &Apache::lonnet::dirlist($portfolio_path,$domain,$stuname,$portfolio_root);
my $version = &get_next_version($answer_name, $answer_ext, \@dir_list);
my $new_answer = &version_selected_portfile($domain, $stuname, $portfolio_path, $answer_file, $version);
$$newrecord{"resource.$new_part.$resp_id.handback"} = $new_answer;
- # 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);
+ $version++;
+ # fix file name
+ my ($save_file_name) = (($directory.$answer_name.".$version.".$answer_ext) =~ /^.+\/${stuname}\/(.*)/);
+ my $result=&Apache::lonnet::finishuserfileupload($stuname,$domain,
+ $newflg.'_'.$part_resp.'_returndoc'.$file_counter,
+ $save_file_name);
if ($result !~ m|^/uploaded/|) {
$request->print(' An errror occured ('.$result.
- ') while trying to upload '.&display_file().'
');
- # $request->print(&done('Back'));
+ ') while trying to upload '.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'
');
}
$request->print("
".$fname." will be the uploaded file name");
$request->print(" ".$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter});