--- loncom/homework/grades.pm 2006/04/11 20:51:46 1.351
+++ loncom/homework/grades.pm 2006/05/30 00:01:28 1.357
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.351 2006/04/11 20:51:46 albertel Exp $
+# $Id: grades.pm,v 1.357 2006/05/30 00:01:28 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2442,23 +2442,32 @@ 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.' ');
+ } else {
+ my $subject = "File Handed Back by Instructor ";
+ my $message = "A file has been returned that was originally submitted in reponse to: ";
+ $message .= &Apache::lonnet::gettitle($symb);
+ $message .= " The returned file is named ".$save_file_name;
+ $message .= " and can be found in your portfolio space.";
+ &Apache::lonnet::logthis($message);
+ my $msgstatus = &Apache::lonmsg::user_normal_msg($stuname,$domain,
+ $subject.' [File Returned]',$message);
}
$request->print(" ".$fname." will be the uploaded file name");
- $request->print("Will upload document ".$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter});
+ $request->print(" ".$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter});
$file_counter++;
}
}
@@ -4831,7 +4840,7 @@ $warning
STUFF
}
- $r->print(" ".&show_grading_menu_form($symb)."