version 1.365, 2006/06/27 01:39:09
|
version 1.369, 2006/07/02 01:03:04
|
Line 1551 sub handback_box {
|
Line 1551 sub handback_box {
|
next if (!@$files); |
next if (!@$files); |
my $file_counter = 1; |
my $file_counter = 1; |
foreach my $file (@$files) { |
foreach my $file (@$files) { |
my ($file_path, $file_disp) = ($file =~ m|(.+/)(.+)$|); |
if ($file =~ /\/portfolio\//) { |
my ($name,$version,$ext) = &file_name_version_ext($file_disp); |
my ($file_path, $file_disp) = ($file =~ m|(.+/)(.+)$|); |
$file_disp = "$name.$ext"; |
my ($name,$version,$ext) = &file_name_version_ext($file_disp); |
$file = $file_path.$file_disp; |
$file_disp = "$name.$ext"; |
$result.=&mt('Return commented version of [_1] to student.', |
$file = $file_path.$file_disp; |
'<span class="LC_filename">'.$file_disp.'</span>'); |
$result.=&mt('Return commented version of [_1] to student.', |
$result.='<input type="file" name="'.$prefix.'returndoc'.$file_counter.'" />'."\n"; |
'<span class="LC_filename">'.$file_disp.'</span>'); |
$result.='<input type="hidden" name="'.$prefix.'origdoc'.$file_counter.'" value="'.$file.'" /><br />'; |
$result.='<input type="file" name="'.$prefix.'returndoc'.$file_counter.'" />'."\n"; |
$file_counter++; |
$result.='<input type="hidden" name="'.$prefix.'origdoc'.$file_counter.'" value="'.$file.'" /><br />'; |
|
$result.='(File will be uploaded when you click on Save & Next below.)<br />'; |
|
$file_counter++; |
|
} |
} |
} |
} |
} |
return $result; |
return $result; |
Line 2390 sub saveHandGrade {
|
Line 2393 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); |
|
} |
} |
# unless problem has been graded, set flag to version the submitted files |
# unless problem has been graded, set flag to version the submitted files |
unless ($record{'resource.'.$new_part.'.solved'} =~ /^correct_/ || |
unless ($record{'resource.'.$new_part.'.solved'} =~ /^correct_/ || |
Line 2408 sub saveHandGrade {
|
Line 2410 sub saveHandGrade {
|
my @changed_keys = &version_portfiles(\%record, \@parts_graded, |
my @changed_keys = &version_portfiles(\%record, \@parts_graded, |
$env{'request.course.id'}, $symb, $domain, $stuname, \@version_parts); |
$env{'request.course.id'}, $symb, $domain, $stuname, \@version_parts); |
@newrecord{@changed_keys} = @record{@changed_keys}; |
@newrecord{@changed_keys} = @record{@changed_keys}; |
|
foreach my $new_part (@version_parts) { |
|
&handback_files($request,$symb,$stuname,$domain,$newflg, |
|
$new_part,\%newrecord); |
|
} |
} |
} |
&Apache::lonnet::cstore(\%newrecord,$symb, |
&Apache::lonnet::cstore(\%newrecord,$symb, |
$env{'request.course.id'},$domain,$stuname); |
$env{'request.course.id'},$domain,$stuname); |
Line 2439 sub handback_files {
|
Line 2445 sub handback_files {
|
if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) { |
if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) { |
# if multiple files are uploaded names will be 'returndoc2','returndoc3' |
# if multiple files are uploaded names will be 'returndoc2','returndoc3' |
my $file_counter = 1; |
my $file_counter = 1; |
|
my $file_msg; |
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'}; |
my ($directory,$answer_file) = |
my ($directory,$answer_file) = |
Line 2461 sub handback_files {
|
Line 2468 sub handback_files {
|
my @files = ($save_file_name); |
my @files = ($save_file_name); |
my @what = ($symb,'handback'); |
my @what = ($symb,'handback'); |
&Apache::lonnet::mark_as_readonly($domain,$stuname,\@files,\@what); |
&Apache::lonnet::mark_as_readonly($domain,$stuname,\@files,\@what); |
$$newrecord{"resource.$new_part.$resp_id.handback"} = $save_file_name; |
if (exists($$newrecord{"resource.$new_part.$resp_id.handback"})) { |
my $subject = "File Handed Back by Instructor "; |
$$newrecord{"resource.$new_part.$resp_id.handback"}.=','; |
my $message = "A file has been returned that was originally submitted in reponse to: <br />"; |
} |
$message .= "<strong>".&Apache::lonnet::gettitle($symb)."</strong><br />"; |
$$newrecord{"resource.$new_part.$resp_id.handback"} .= $save_file_name; |
$message .= ' The returned file is named: <br /><strong><a href="/uploaded/'."$domain/$stuname/".$save_file_name.'">'.$save_file_name."</a></strong><br />"; |
$file_msg.= "\n".'<br /><span class="LC_filename"><a href="/uploaded/'."$domain/$stuname/".$save_file_name.'">'.$save_file_name."</a></span><br />"; |
$message .= " and can be found in your portfolio space."; |
|
my $url = (&Apache::lonnet::decode_symb($symb))[2]; |
|
$url = &Apache::lonnet::declutter($url); |
|
my $msgstatus = &Apache::lonmsg::user_normal_msg($stuname,$domain, |
|
$subject.' (File Returned) ['.$url.']',$message); |
|
} |
} |
$request->print("<br />".$fname." will be the uploaded file name"); |
$request->print("<br />".$fname." will be the uploaded file name"); |
$request->print(" ".$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter}); |
$request->print(" ".$env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter}); |
$file_counter++; |
$file_counter++; |
} |
} |
|
my $subject = "File Handed Back by Instructor "; |
|
my $message = "A file has been returned that was originally submitted in reponse to: <br />"; |
|
$message .= "<strong>".&Apache::lonnet::gettitle($symb)."</strong><br />"; |
|
$message .= ' The returned file(s) are named: '. $file_msg; |
|
$message .= " and can be found in your portfolio space."; |
|
my $url = (&Apache::lonnet::decode_symb($symb))[2]; |
|
$url = &Apache::lonnet::declutter($url); |
|
my $msgstatus = &Apache::lonmsg::user_normal_msg($stuname,$domain, |
|
$subject.' (File Returned) ['.$url.']',$message); |
|
|
} |
} |
} |
} |
return; |
return; |
Line 2567 sub version_portfiles {
|
Line 2580 sub version_portfiles {
|
my $new_portfiles; |
my $new_portfiles; |
if ($key =~ /^resource\.($version_parts)\./ && $key =~ /\.portfiles$/ ) { |
if ($key =~ /^resource\.($version_parts)\./ && $key =~ /\.portfiles$/ ) { |
my @versioned_portfiles; |
my @versioned_portfiles; |
my @portfiles = split(/,/,$$record{$key}); |
my @portfiles = split(/\s*,\s*/,$$record{$key}); |
foreach my $file (@portfiles) { |
foreach my $file (@portfiles) { |
&Apache::lonnet::unmark_as_readonly($domain,$stu_name,[$symb,$env{'request.course.id'}],$file); |
&Apache::lonnet::unmark_as_readonly($domain,$stu_name,[$symb,$env{'request.course.id'}],$file); |
my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*)$/); |
my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*)$/); |
Line 2579 sub version_portfiles {
|
Line 2592 sub version_portfiles {
|
if ($new_answer ne 'problem getting file') { |
if ($new_answer ne 'problem getting file') { |
push(@versioned_portfiles, $directory.$new_answer); |
push(@versioned_portfiles, $directory.$new_answer); |
&Apache::lonnet::mark_as_readonly($domain,$stu_name, |
&Apache::lonnet::mark_as_readonly($domain,$stu_name, |
['/portfolio'.$directory.$new_answer], |
[$directory.$new_answer], |
[$symb,$env{'request.course.id'},'graded']); |
[$symb,$env{'request.course.id'},'graded']); |
} |
} |
} |
} |