version 1.10, 2007/12/01 03:07:39
|
version 1.14, 2012/07/21 21:20:19
|
Line 265 sub pastetarget {
|
Line 265 sub pastetarget {
|
my $idx=&getresidx($url,$residx); |
my $idx=&getresidx($url,$residx); |
$insertorder[$#insertorder+1]=$idx; |
$insertorder[$#insertorder+1]=$idx; |
my $ext='false'; |
my $ext='false'; |
if ($url=~/^http\:\/\//) { $ext='true'; } |
if ($url=~/^https?\:\/\//) { $ext='true'; } |
$url=~s/\:/\:/g; |
$url=~s/\:/\:/g; |
$name=~s/\:/\:/g; |
$name=~s/\:/\:/g; |
$resources[$idx]=$name.':'.$url.':'.$ext.':normal:res'; |
$resources[$idx]=$name.':'.$url.':'.$ext.':normal:res'; |
Line 283 sub startfinish {
|
Line 283 sub startfinish {
|
# Remove all start and finish |
# Remove all start and finish |
foreach (@order) { |
foreach (@order) { |
my ($name,$url,$ext)=split(/\:/,$resources[$_]); |
my ($name,$url,$ext)=split(/\:/,$resources[$_]); |
if ($url=~/http\&colon\:\/\//) { $ext='true'; } |
if ($url=~/https?\&colon\:\/\//) { $ext='true'; } |
$resources[$_]=$name.':'.$url.':'.$ext.':normal:res'; |
$resources[$_]=$name.':'.$url.':'.$ext.':normal:res'; |
} |
} |
# Garbage collection |
# Garbage collection |
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 359 sub storemap {
|
Line 359 sub storemap {
|
} |
} |
$output=~s/http\&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 456 sub loadmap {
|
Line 456 sub loadmap {
|
$instr=join('',@content); |
$instr=join('',@content); |
} |
} |
if ($instr eq -2) { |
if ($instr eq -2) { |
$errtext.='Map not loaded: An error occured while trying to load the map.'; |
$errtext.='Map not loaded: An error occurred while trying to load the map.'; |
} elsif ($instr eq '-1') { |
} elsif ($instr eq '-1') { |
# Map doesn't exist |
# Map doesn't exist |
} elsif ($instr) { |
} elsif ($instr) { |
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 679 sub savemap {
|
Line 679 sub savemap {
|
my $result=&Apache::lonnet::finishuserfileupload($2,$1, |
my $result=&Apache::lonnet::finishuserfileupload($2,$1, |
'output',$3); |
'output',$3); |
if ($result != m|^/uploaded/|) { |
if ($result != m|^/uploaded/|) { |
$errtext.='Map not saved: A network error occured when trying to save the map. '; |
$errtext.='Map not saved: A network error occurred when trying to save the map. '; |
} |
} |
} else { |
} else { |
if (open(my $fh,">$fn")) { |
if (open(my $fh,">$fn")) { |
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. '; |