--- loncom/homework/essayresponse.pm 2019/02/19 14:24:38 1.118.2.1 +++ loncom/homework/essayresponse.pm 2014/12/04 15:41:30 1.119 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # essay (ungraded) style responses # -# $Id: essayresponse.pm,v 1.118.2.1 2019/02/19 14:24:38 raeburn Exp $ +# $Id: essayresponse.pm,v 1.119 2014/12/04 15:41:30 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -210,30 +210,16 @@ sub end_essayresponse { &escape($crsid)); my $essayurl= &Apache::lonnet::declutter($ENV{'REQUEST_URI'}); - if ($essayurl eq 'lib/templates/simpleproblem.problem') { - my %crsinfo = &Apache::lonnet::coursedescription($crsid); - my $cdom = $crsinfo{'domain'}; - my $cnum = $crsinfo{'num'}; - my ($map,$id,$res) = &Apache::lonnet::decode_symb($symb); - if ($map =~ m{^\Quploaded/$cdom/$cnum/\E(default(?:|_\d+)\.(?:sequence|page))$}) { - my $apath = $1.'_'.$id; - $apath=~s/\W/\_/gs; - my $akey = join('.',&escape($name),&escape($domain)); - &Apache::lonnet::put('nohist_essay_'.$apath, - { $akey => $response },$cdom,$cnum); - } - } else { - my ($adom,$aname,$apath)= - ($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/); - $apath=&escape($apath); - $apath=~s/\W/\_/gs; - &Apache::lonnet::put('nohist_essay_'.$apath, - { $akey => $response },$adom,$aname); - } - } + my ($adom,$aname,$apath)= + ($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/); + $apath=&escape($apath); + $apath=~s/\W/\_/gs; + &Apache::lonnet::put('nohist_essay_'.$apath, + { $akey => $response },$adom,$aname); + } } } - } + } } elsif ($target eq 'edit') { $result.=&Apache::edit::end_table(); @@ -300,7 +286,7 @@ sub format_prior_response { } sub file_submission { - my ($part,$id,$award,$uploadedflag,$totalsize,$deletions)=@_; + my ($part,$id,$award,$uploadedflag,$totalsize,$deletions,$context,$info)=@_; my $files; my $jspart=$part; $jspart=~s/\./_/g; @@ -527,6 +513,16 @@ sub file_submission { $$uploadedflag=1; } } + if ($context eq 'externalresponse') { + my @todelete = keys(%port_delete); + if (@tolock || @todelete) { + if (ref($info) eq 'HASH') { + if ($info->{'ip'}) { + &Apache::lonnet::automated_portfile_access('ip',\@tolock,\@todelete,$info); + } + } + } + } &Apache::lonnet::unmark_as_readonly($udom,$uname,[$symb,$crsid]); &Apache::lonnet::mark_as_readonly($udom,$uname,[@tolock],[$symb,$crsid]); &Apache::lonnet::clear_selected_files($uname);