'.
&Apache::lonhtmlcommon::row_closure($closure);
}
@@ -217,16 +227,30 @@ sub end_essayresponse {
&escape($crsid));
my $essayurl=
&Apache::lonnet::declutter($ENV{'REQUEST_URI'});
- 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);
- }
+ 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);
+ }
+ }
}
}
- }
+ }
} elsif ($target eq 'edit') {
$result.=&Apache::edit::end_table();
@@ -318,7 +342,14 @@ sub file_submission {
if ($Apache::lonhomework::history{"resource.$part.$id.portfiles"} ||
$Apache::lonhomework::history{"resource.$part.$id.uploadedurl"}) {
if ($Apache::lonhomework::history{"resource.$part.$id.portfiles"}) {
- @portfiles = split(/,/,$Apache::lonhomework::history{"resource.$part.$id.portfiles"});
+ my @possfiles = split(/,/,$Apache::lonhomework::history{"resource.$part.$id.portfiles"});
+ foreach my $file (@possfiles) {
+ my ($path,$name) = ($file =~ m{^(.*/)([^/]+)$});
+ my ($origname,$version,$ext) = &Apache::lonnet::file_name_version_ext($name);
+ unless ($version) {
+ push(@portfiles,$file);
+ }
+ }
}
$uploadedurl = $Apache::lonhomework::history{"resource.$part.$id.uploadedurl"};
if (ref($deletions) eq 'ARRAY') {
@@ -534,7 +565,7 @@ sub file_submission {
my @todelete = map { "/uploaded/$udom/$uname/portfolio".$_; } keys(%port_delete);
if (@tolock || @todelete) {
if (ref($info) eq 'HASH') {
- if ($info->{'ip'}) {
+ if (($info->{'ip'}) && ($info->{'is_submit'})) {
my @adds;
if (@tolock) {
@adds = map { "/uploaded/$udom/$uname/portfolio".$_; } @tolock;