Diff for /rat/map.pm between versions 1.12 and 1.14

version 1.12, 2008/12/19 03:49:56 version 1.14, 2012/07/21 21:20:19
Line 319  sub startfinish { Line 319  sub startfinish {
 # ------------------------------------------------------------------- Store map  # ------------------------------------------------------------------- Store map
   
 sub storemap {  sub storemap {
     my $realfn=shift;      my ($realfn,$useorig,$dotimeupdate) = @_;
     my $fn=$realfn;      my $fn=$realfn;
 # unless this is forced to work from the original file, use a temporary file  # unless this is forced to work from the original file, use a temporary file
 # instead  # instead
     unless (shift) {      unless ($useorig) {
  $fn=$realfn.'.tmp';   $fn=$realfn.'.tmp';
  unless (-e $fn) {   unless (-e $fn) {
     copy($realfn,$fn);      copy($realfn,$fn);
Line 357  sub storemap { Line 357  sub storemap {
     $output.='<&>objcont<:>'.$i.'<:>'.$zombies[$i];      $output.='<&>objcont<:>'.$i.'<:>'.$zombies[$i];
         }          }
     }      }
     $output=~s/https?\&colon\;\/\///g;      $output=~s/http\&colon\;\/\///g;
     $env{'form.output'}=$output;      $env{'form.output'}=$output;
     return &loadmap($fn,&savemap($fn,''));      return &loadmap($fn,&savemap($fn,'',$dotimeupdate));
 }  }
   
 # ------------------------------------------ Store and get parameters in global  # ------------------------------------------ Store and get parameters in global
Line 583  sub loadmap { Line 583  sub loadmap {
 # ----------------------------------------------------------- Saves map to disk  # ----------------------------------------------------------- Saves map to disk
   
 sub savemap {  sub savemap {
     my ($fn,$errtext)=@_;      my ($fn,$errtext,$dotimeupdate)=@_;
     my $infotext='';      my $infotext='';
     my %alltypes;      my %alltypes;
     my %allvalues;      my %allvalues;
Line 616  sub savemap { Line 616  sub savemap {
  }   }
  $comp[1].='" external="true';   $comp[1].='" external="true';
     } else {      } else {
  if ($comp[1]=~/^https?\:\/\//) {   if ($comp[1]=~/^http\:\/\//) {
     $comp[1]=~s/^https?\:\/\/[^\/]*\//\//;      $comp[1]=~s/^http\:\/\/[^\/]*\//\//;
  }   }
     }      }
     $outstr.='<resource id="'.$parts[1].'" src="'      $outstr.='<resource id="'.$parts[1].'" src="'
Line 689  sub savemap { Line 689  sub savemap {
  $errtext.='Could not write file '.$fn.'.  Map not saved. ';   $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 {      } else {
 # -------------------------------------------- Cannot write to that file, error  # -------------------------------------------- Cannot write to that file, error
         $errtext.='Map not saved: The specified path does not exist. ';          $errtext.='Map not saved: The specified path does not exist. ';

Removed from v.1.12  
changed lines
  Added in v.1.14


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>