version 1.354, 2006/05/18 21:39:27
|
version 1.360, 2006/06/12 00:34:45
|
Line 40 use Apache::lonmsg qw(:user_normal_msg);
|
Line 40 use Apache::lonmsg qw(:user_normal_msg);
|
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::lonlocal; |
use Apache::lonlocal; |
use String::Similarity; |
use String::Similarity; |
|
use lib '/home/httpd/lib/perl'; |
|
use LONCAPA; |
|
|
use POSIX qw(floor); |
use POSIX qw(floor); |
|
|
my %oldessays=(); |
my %oldessays=(); |
Line 1747 KEYWORDS
|
Line 1750 KEYWORDS
|
# |
# |
my (undef,undef,$essayurl) = &Apache::lonnet::decode_symb($symb); |
my (undef,undef,$essayurl) = &Apache::lonnet::decode_symb($symb); |
my ($adom,$aname,$apath)=($essayurl=~/^(\w+)\/(\w+)\/(.*)$/); |
my ($adom,$aname,$apath)=($essayurl=~/^(\w+)\/(\w+)\/(.*)$/); |
$apath=&Apache::lonnet::escape($apath); |
$apath=&escape($apath); |
$apath=~s/\W/\_/gs; |
$apath=~s/\W/\_/gs; |
%oldessays=&Apache::lonnet::dump('nohist_essay_'.$apath,$adom,$aname); |
%oldessays=&Apache::lonnet::dump('nohist_essay_'.$apath,$adom,$aname); |
} |
} |
Line 2427 sub saveHandGrade {
|
Line 2430 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) = @_; |
my $portfolio_root = &Apache::loncommon::propath($domain, |
my $portfolio_root = &propath($domain,$stuname).'/userfiles/portfolio'; |
$stuname). |
my ($partlist,$handgrade,$responseType) = &response_type($symb); |
'/userfiles/portfolio'; |
|
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 2442 sub handback_files {
|
Line 2443 sub handback_files {
|
($env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter} =~ /^(.*?)([^\/]*)$/); |
($env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter} =~ /^(.*?)([^\/]*)$/); |
my ($answer_name,$answer_ver,$answer_ext) = |
my ($answer_name,$answer_ver,$answer_ext) = |
&file_name_version_ext($answer_file); |
&file_name_version_ext($answer_file); |
$directory =~ /^.+$stuname\/portfolio(.*)/; |
my ($portfolio_path) = ($directory =~ /^.+$stuname\/portfolio(.*)/); |
my $portfolio_path = $1; |
|
my @dir_list = &Apache::lonnet::dirlist($portfolio_path,$domain,$stuname,$portfolio_root); |
my @dir_list = &Apache::lonnet::dirlist($portfolio_path,$domain,$stuname,$portfolio_root); |
my $version = &get_next_version($answer_name, $answer_ext, \@dir_list); |
my $version = &get_next_version($answer_name, $answer_ext, \@dir_list); |
my $new_answer = &version_selected_portfile($domain, $stuname, $portfolio_path, $answer_file, $version); |
my $new_answer = &version_selected_portfile($domain, $stuname, $portfolio_path, $answer_file, $version); |
$$newrecord{"resource.$new_part.$resp_id.handback"} = $new_answer; |
$$newrecord{"resource.$new_part.$resp_id.handback"} = $new_answer; |
# set the filename to match the submitted file name |
$version++; |
$env{'form.'.$newflg.'_'.$part_resp.'_returndoc1.filename'} = $env{'form.'.$newflg.'_'.$part_resp.'_origdoc'.$file_counter}; |
# fix file name |
my $result=&Apache::lonnet::userfileupload($newflg.'_'.$part_resp.'_returndoc'.$file_counter,'', |
my ($save_file_name) = (($directory.$answer_name.".$version.".$answer_ext) =~ /^.+\/${stuname}\/(.*)/); |
'portfolio',undef,undef,undef,$stuname,$domain); |
my $result=&Apache::lonnet::finishuserfileupload($stuname,$domain, |
|
$newflg.'_'.$part_resp.'_returndoc'.$file_counter, |
|
$save_file_name); |
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 '.$newflg.'_'.$part_resp.'_returndoc'.$file_counter.'</font><br />'); |
# $request->print(&done('Back')); |
} else { |
|
# mark the file as read only |
|
my @files = ($save_file_name); |
|
my @what = ($symb,'handback'); |
|
&Apache::lonnet::mark_as_readonly($domain,$stuname,\@files,\@what); |
|
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 is named: <br /><strong>".$save_file_name."</strong><br />"; |
|
$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("<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}); |
Line 2546 sub version_portfiles {
|
Line 2560 sub version_portfiles {
|
my $version_parts = join('|',@$v_flag); |
my $version_parts = join('|',@$v_flag); |
my @returned_keys; |
my @returned_keys; |
my $parts = join('|', @$parts_graded); |
my $parts = join('|', @$parts_graded); |
my $portfolio_root = &Apache::loncommon::propath($domain, |
my $portfolio_root = &propath($domain,$stu_name). |
$stu_name). |
'/userfiles/portfolio'; |
'/userfiles/portfolio'; |
|
foreach my $key (keys(%$record)) { |
foreach my $key (keys(%$record)) { |
my $new_portfiles; |
my $new_portfiles; |
if ($key =~ /^resource\.($version_parts)\./ && $key =~ /\.portfiles$/ ) { |
if ($key =~ /^resource\.($version_parts)\./ && $key =~ /\.portfiles$/ ) { |
Line 4219 sub scantron_filenames {
|
Line 4232 sub scantron_filenames {
|
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cname=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my @files=&Apache::lonnet::dirlist('userfiles',$cdom,$cname, |
my @files=&Apache::lonnet::dirlist('userfiles',$cdom,$cname, |
&Apache::loncommon::propath($cdom,$cname)); |
&propath($cdom,$cname)); |
my @possiblenames; |
my @possiblenames; |
foreach my $filename (sort(@files)) { |
foreach my $filename (sort(@files)) { |
($filename)=split(/&/,$filename); |
($filename)=split(/&/,$filename); |
Line 5093 sub scantron_validate_sequence {
|
Line 5106 sub scantron_validate_sequence {
|
my @resources= |
my @resources= |
$navmap->retrieveResources($map,\&scantron_filter_not_exam,1,0); |
$navmap->retrieveResources($map,\&scantron_filter_not_exam,1,0); |
if (@resources) { |
if (@resources) { |
$r->print("<p>".&mt('Some resource in the sequece currently are not set to exam mode. Grading these resources currently may not work correctly.')."</p>"); |
$r->print("<p>".&mt('Some resources in the sequence currently are not set to exam mode. Grading these resources currently may not work correctly.')."</p>"); |
return (1,$currentphase); |
return (1,$currentphase); |
} |
} |
} |
} |
Line 5247 function change_radio(field) {
|
Line 5260 function change_radio(field) {
|
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
my $href="/adm/pickcode?". |
my $href="/adm/pickcode?". |
"form=".&Apache::lonnet::escape("scantronupload"). |
"form=".&escape("scantronupload"). |
"&scantron_format=".&Apache::lonnet::escape($env{'form.scantron_format'}). |
"&scantron_format=".&escape($env{'form.scantron_format'}). |
"&scantron_CODElist=".&Apache::lonnet::escape($env{'form.scantron_CODElist'}). |
"&scantron_CODElist=".&escape($env{'form.scantron_CODElist'}). |
"&curCODE=".&Apache::lonnet::escape($$scan_record{'scantron.CODE'}). |
"&curCODE=".&escape($$scan_record{'scantron.CODE'}). |
"&scantron_selectfile=".&Apache::lonnet::escape($env{'form.scantron_selectfile'}); |
"&scantron_selectfile=".&escape($env{'form.scantron_selectfile'}); |
if ($env{'form.scantron_CODElist'} =~ /\S/) { |
if ($env{'form.scantron_CODElist'} =~ /\S/) { |
$r->print("<label><input type='radio' name='scantron_CODE_resolution' value='use_found' /> <a target='_blank' href='$href'>Select</a> a CODE from the list of all CODEs and use it.</label> Selected CODE is <input readonly='true' type='text' size='8' name='scantron_CODE_selectedvalue' onfocus=\"javascript:change_radio('use_found')\" onchange=\"javascript:change_radio('use_found')\" />"); |
$r->print("<label><input type='radio' name='scantron_CODE_resolution' value='use_found' /> <a target='_blank' href='$href'>Select</a> a CODE from the list of all CODEs and use it.</label> Selected CODE is <input readonly='true' type='text' size='8' name='scantron_CODE_selectedvalue' onfocus=\"javascript:change_radio('use_found')\" onchange=\"javascript:change_radio('use_found')\" />"); |
$r->print("\n<br />"); |
$r->print("\n<br />"); |