--- loncom/publisher/lonpublisher.pm 2011/11/14 00:20:31 1.277
+++ loncom/publisher/lonpublisher.pm 2013/10/16 18:28:18 1.286
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Publication Handler
#
-# $Id: lonpublisher.pm,v 1.277 2011/11/14 00:20:31 raeburn Exp $
+# $Id: lonpublisher.pm,v 1.286 2013/10/16 18:28:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -121,7 +121,6 @@ use HTML::LCParser;
use HTML::Entities;
use Encode::Encoder;
use Apache::lonxml;
-use Apache::loncacc;
use DBI;
use Apache::lonnet;
use Apache::loncommon();
@@ -791,10 +790,55 @@ sub fix_ids_and_indices {
}
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 .html or _player.html files,
+# so add this file to %allow (where 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: _Thumbnails.png needed, and included in zip archive.
+# Not referenced directly in .html or _player.html files,
+# so add this file to %allow (where 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') {
@@ -1017,6 +1061,11 @@ sub publish {
$outdep.= ' - '.&mt('Currently not available').
'';
} else {
+#
+# Store the fact that the dependency has been used by the target file
+# Unfortunately, usage is erroneously named sequsage in lonmeta.pm
+# The translation happens in lonmetadata.pm
+#
my %temphash=(&Apache::lonnet::declutter($target).'___'.
&Apache::lonnet::declutter($thisdep).'___usage'
=> time);
@@ -1770,21 +1819,17 @@ sub phasetwo {
my $thissrcdir=$thissrc;
$thissrcdir=~s/\/[^\/]+$/\//;
- $r->print(&Apache::loncommon::head_subbox(
- &Apache::lonhtmlcommon::start_funclist().
- &Apache::lonhtmlcommon::add_item_funclist(
+ $r->print(
+ &Apache::lonhtmlcommon::actionbox([
''.
&mt('View Published Version').
- '').
- &Apache::lonhtmlcommon::add_item_funclist(
+ '',
''.
&mt('Back to Source').
- '').
- &Apache::lonhtmlcommon::add_item_funclist(
+ '',
''.
&mt('Back to Source Directory').
- '').
- &Apache::lonhtmlcommon::end_funclist())
+ ''])
);
}
return 1;
@@ -1895,7 +1940,7 @@ sub publishdirectory {
$r->print(&Apache::lonhtmlcommon::row_closure()
.&Apache::lonhtmlcommon::row_title(&mt('Options'))
);
- $r->print('
');$r->rflush;
}
# ------------------------------------------------------------------- Link back
- $r->print("".&mt('Back to Metadata').'');
+ $r->print("".&mt('Back to Metadata').'');
$r->print(&Apache::loncommon::end_page());
return OK;
}
@@ -2078,7 +2123,7 @@ sub handler {
# -------------------------------------------------------------- Check filename
my $fn=&unescape($env{'form.filename'});
- ($cuname,$cudom)=&Apache::loncacc::constructaccess($fn);
+ ($cuname,$cudom)=&Apache::lonnet::constructaccess($fn);
# ----------------------------------------------------- Do we have permissions?
unless (($cuname) && ($cudom)) {
$r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}.
@@ -2143,7 +2188,7 @@ sub handler {
# Breadcrumbs
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb({
- 'text' => 'Construction Space',
+ 'text' => 'Authoring Space',
'href' => &Apache::loncommon::authorspace($fn),
});
&Apache::lonhtmlcommon::add_breadcrumb({
@@ -2154,7 +2199,6 @@ sub handler {
my $js='';
- print STDERR "fn is ||$fn||\n";
$r->print(&Apache::loncommon::start_page('Resource Publication',$js)
.&Apache::lonhtmlcommon::breadcrumbs()
.&Apache::loncommon::head_subbox(
@@ -2219,7 +2263,7 @@ ENDCAPTION
$r->print(&Apache::lonhtmlcommon::row_closure()
.&Apache::lonhtmlcommon::row_title(&mt('Diffs')));
$r->print(<
+
ENDDIFF
$r->print(&mt('Diffs with Current Version').'');
}