--- loncom/homework/essayresponse.pm 2011/07/26 17:14:51 1.115
+++ loncom/homework/essayresponse.pm 2014/12/04 20:43:23 1.120
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# essay (ungraded) style responses
#
-# $Id: essayresponse.pm,v 1.115 2011/07/26 17:14:51 raeburn Exp $
+# $Id: essayresponse.pm,v 1.120 2014/12/04 20:43:23 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -91,7 +91,7 @@ sub start_essayresponse {
'
';
+ ''.&HTML::Entities::encode($answer, '"<>&').'
';
}
return ''.$output.'
';
}
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;
@@ -397,8 +397,11 @@ sub file_submission {
my ($path,$filename) = ($file =~ m{^(.*/)([^/]+)$});
my $fullpath = '/userfiles/portfolio'.$path;
if (!exists($dirlist{$fullpath})) {
- my @list = &Apache::lonnet::dirlist($fullpath,$udom,$uname,1);
- $dirlist{$fullpath} = \@list;
+ my ($listref,$listerror) =
+ &Apache::lonnet::dirlist($fullpath,$udom,$uname,1);
+ if (ref($listref) eq 'ARRAY') {
+ $dirlist{$fullpath} = $listref;
+ }
}
if (ref($dirlist{$fullpath}) eq 'ARRAY') {
foreach my $dir_line (@{$dirlist{$fullpath}}) {
@@ -510,6 +513,20 @@ sub file_submission {
$$uploadedflag=1;
}
}
+ if ($context eq 'externalresponse') {
+ my @todelete = map { "/uploaded/$udom/$uname/portfolio".$_; } keys(%port_delete);
+ if (@tolock || @todelete) {
+ if (ref($info) eq 'HASH') {
+ if ($info->{'ip'}) {
+ my @adds;
+ if (@tolock) {
+ @adds = map { "/uploaded/$udom/$uname/portfolio".$_; } @tolock;
+ }
+ &Apache::lonnet::automated_portfile_access('ip',\@adds,\@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);