[LON-CAPA-cvs] cvs: loncom /publisher lonpublisher.pm
raeburn
raeburn at source.lon-capa.org
Wed Oct 16 14:28:19 EDT 2013
raeburn Wed Oct 16 18:28:19 2013 EDT
Modified files:
/loncom/publisher lonpublisher.pm
Log:
- Bug 6671. Detect dependencies in javascript used for Camtasia player.
- Appropriate <allow src="%%path%%"> appended to HTML file in authoring space,
at first publication step for files referenced in javascript object in text
within <script></script> via:
set.FlashPlayerSwf
set.MediaSrc
set.XMPSrc
set.ConfigurationSrc
set.PosterImageSrc
e.g., TSC.playerConfiguration.set.FlashPlayerSwf("somepath/file_controller.swf")
to support upload of Camtasia player directly to a course (Camtasia 8.1).
- Similar to changes in xml/scripttag.pm rev 1.169 vs. 1.166
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.285 loncom/publisher/lonpublisher.pm:1.286
--- loncom/publisher/lonpublisher.pm:1.285 Wed Oct 16 18:17:23 2013
+++ loncom/publisher/lonpublisher.pm Wed Oct 16 18:28:18 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Publication Handler
#
-# $Id: lonpublisher.pm,v 1.285 2013/10/16 18:17:23 raeburn Exp $
+# $Id: lonpublisher.pm,v 1.286 2013/10/16 18:28:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -790,10 +790,55 @@
}
if (!$endtag) { if ($token->[4]=~m:/>$:) { $endtag=' /'; }; }
$outstring.='<'.$tag.$newparmstring.$endtag.'>';
- if ($lctag eq 'm' || $lctag eq 'script' || $lctag eq 'answer'
- || $lctag eq 'display' || $lctag eq 'tex') {
+ if ($lctag eq 'm' || $lctag eq 'answer' || $lctag eq 'display' ||
+ $lctag eq 'tex') {
$outstring.=&get_all_text_unbalanced('/'.$lctag,\@parser);
- }
+ } elsif ($lctag eq 'script') {
+ if ($parms{'type'} eq 'loncapa/perl') {
+ $outstring.=&get_all_text_unbalanced('/'.$lctag,\@parser);
+ } else {
+ my $script = &get_all_text_unbalanced('/'.$lctag,\@parser);
+ if ($script =~ m{\.set\w+(Src|Swf)\(["']}i) {
+ my @srcs = split(/\.set/i,$script);
+ if (scalar(@srcs) > 1) {
+ foreach my $item (@srcs) {
+ if ($item =~ m{^(FlashPlayerSwf|MediaSrc|XMPSrc|ConfigurationSrc|PosterImageSrc)\((['"])(?:(?!\2).)+\2\)}is) {
+ my $srctype = $1;
+ my $quote = $2;
+ my ($url) = ($item =~ m{^\Q$srctype($quote\E([^$quote]+)\Q$quote)\E});
+ $url = &urlfixup($url);
+ unless ($url=~m{^(?:http|https|ftp)://}) {
+ $allow{&absoluteurl($url,$target)}=1;
+ if ($srctype eq 'ConfigurationSrc') {
+ if ($url =~ m{^(.+/)configuration_express\.xml$}) {
+#
+# Camtasia 8.1: express_show/spritesheet.png needed, and included in zip archive.
+# Not referenced directly in <main>.html or <main>_player.html files,
+# so add this file to %allow (where <main> is name user gave to file/archive).
+#
+ my $spritesheet = $1.'express_show/spritesheet.png';
+ $allow{&absoluteurl($spritesheet,$target)}=1;
+ }
+ } elsif ($srctype eq 'PosterImageSrc') {
+ if ($url =~ m{^(.+)_First_Frame\.png$}) {
+ my $prefix = $1;
+#
+# Camtasia 8.1: <main>_Thumbnails.png needed, and included in zip archive.
+# Not referenced directly in <main>.html or <main>_player.html files,
+# so add this file to %allow (where <main> is name user gave to file/archive).
+#
+ my $thumbnail = $prefix.'_Thumbnails.png';
+ $allow{&absoluteurl($thumbnail,$target)}=1;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ $outstring .= $script
+ }
+ }
} elsif ($token->[0] eq 'E') {
if ($token->[2]) {
unless ($token->[1] eq 'allow') {
More information about the LON-CAPA-cvs
mailing list