version 1.167, 2013/09/26 22:03:36
|
version 1.168, 2013/09/30 13:44:16
|
Line 129 sub start_script {
|
Line 129 sub start_script {
|
if ($target ne "meta" && $target ne 'tex' && $target ne 'answer') { |
if ($target ne "meta" && $target ne 'tex' && $target ne 'answer') { |
$result = $token->[4]; |
$result = $token->[4]; |
$result.=$bodytext; |
$result.=$bodytext; |
if ($type eq "text/javascript") { |
my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1); |
my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1); |
my $url=&Apache::lonnet::hreflocation('',$env{'request.filename'}); |
my $url=&Apache::lonnet::hreflocation('',$env{'request.filename'}); |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
if ($src ne '') { |
if ($src =~ /\.js$/) { |
if ($src !~ m{^(/|https?://)}) { |
if ($src !~ m{^(/|https?://)}) { |
my $cleanhref = &Apache::londefdef::clean_docs_httpref($src,$url,$cdom,$cnum); |
my $cleanhref = &Apache::londefdef::clean_docs_httpref($src,$url,$cdom,$cnum); |
if ($cleanhref) { |
if ($cleanhref) { |
&Apache::lonxml::extlink($cleanhref); |
&Apache::lonxml::extlink($cleanhref); |
|
} |
|
} |
} |
} elsif (($src eq '') && ($bodytext ne '')) { |
} |
if ($url =~ m{^\Q/uploaded/$cdom/$cnum/docs/\E}) { |
} elsif (($type eq 'text/javascript') && ($bodytext ne '')) { |
if ($bodytext =~ m{\.set\w+(Src|Swf)\(["']}i) { |
if ($url =~ m{^\Q/uploaded/$cdom/$cnum/docs/\E}) { |
my @srcs = split(/\.set/,$bodytext); |
if ($bodytext =~ m{\.set\w+(Src|Swf)\(["']}i) { |
if (@srcs > 1) { |
my @srcs = split(/\.set/,$bodytext); |
foreach my $item (@srcs) { |
if (scalar(@srcs) > 1) { |
if ($item =~ m{^(?:FlashPlayerSwf|MediaSrc|XMPSrc|ConfigurationSrc|PosterImageSrc)\(['"])([^$1]+)$1\)}is) { |
foreach my $item (@srcs) { |
my $cleanhref = &Apache::londefdef::clean_docs_httpref($2,$url,$cdom,$cnum); |
if ($item =~ m{^(FlashPlayerSwf|MediaSrc|XMPSrc|ConfigurationSrc|PosterImageSrc)\((['"])(?:(?!\2).)+\2\)}is) { |
if ($cleanhref) { |
my $srctype = $1; |
&Apache::lonxml::extlink($cleanhref); |
my $quote = $2; |
} |
|
|
my ($fname) = ($item =~ m{^\Q$srctype($quote\E([^$quote]+)\Q$quote)\E}); |
|
my $cleanhref = &Apache::londefdef::clean_docs_httpref($fname,$url,$cdom,$cnum); |
|
if ($cleanhref) { |
|
&Apache::lonxml::extlink($cleanhref); |
} |
} |
} |
} |
} |
} |