--- rat/map.pm 2009/02/12 11:35:10 1.13 +++ rat/map.pm 2012/07/21 21:20:19 1.14 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # routines for modyfing .sequence and .page files # -# $Id: map.pm,v 1.13 2009/02/12 11:35:10 raeburn Exp $ +# $Id: map.pm,v 1.14 2012/07/21 21:20:19 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -319,11 +319,11 @@ sub startfinish { # ------------------------------------------------------------------- Store map sub storemap { - my $realfn=shift; + my ($realfn,$useorig,$dotimeupdate) = @_; my $fn=$realfn; # unless this is forced to work from the original file, use a temporary file # instead - unless (shift) { + unless ($useorig) { $fn=$realfn.'.tmp'; unless (-e $fn) { copy($realfn,$fn); @@ -359,7 +359,7 @@ sub storemap { } $output=~s/http\&colon\;\/\///g; $env{'form.output'}=$output; - return &loadmap($fn,&savemap($fn,'')); + return &loadmap($fn,&savemap($fn,'',$dotimeupdate)); } # ------------------------------------------ Store and get parameters in global @@ -583,7 +583,7 @@ sub loadmap { # ----------------------------------------------------------- Saves map to disk sub savemap { - my ($fn,$errtext)=@_; + my ($fn,$errtext,$dotimeupdate)=@_; my $infotext=''; my %alltypes; my %allvalues; @@ -689,6 +689,19 @@ sub savemap { $errtext.='Could not write file '.$fn.'. Map not saved. '; } } + if ($dotimeupdate) { + unless ($errtext) { + if ($env{'request.course.id'}) { + my $now = time; + &Apache::lonnet::put('environment',{'internal.contentchange' => $now}, + $env{'course.'.$env{'request.course.id'}.'.domain'}, + $env{'course.'.$env{'request.course.id'}.'.num'}); + &Apache::lonnet::appenv( + {'course.'.$env{'request.course.id'}.'.internal.contentchange' => $now}); + &Apache::lonnet::do_cache_new('crschange',$env{'request.course.id'},$now,600); + } + } + } } else { # -------------------------------------------- Cannot write to that file, error $errtext.='Map not saved: The specified path does not exist. ';