version 1.281, 2013/01/15 18:21:31
|
version 1.290, 2014/07/27 11:14:36
|
Line 102 to publication space.
|
Line 102 to publication space.
|
Many of the undocumented subroutines implement various magical |
Many of the undocumented subroutines implement various magical |
parsing shortcuts. |
parsing shortcuts. |
|
|
=over 4 |
|
|
|
=cut |
=cut |
|
|
###################################################################### |
###################################################################### |
Line 149 my $lock;
|
Line 147 my $lock;
|
|
|
=pod |
=pod |
|
|
|
=over 4 |
|
|
=item B<metaeval> |
=item B<metaeval> |
|
|
Evaluates a string that contains metadata. This subroutine |
Evaluates a string that contains metadata. This subroutine |
Line 468 Currently undocumented
|
Line 468 Currently undocumented
|
######################################### |
######################################### |
######################################### |
######################################### |
sub set_allow { |
sub set_allow { |
my ($allow,$logfile,$target,$tag,$oldurl)=@_; |
my ($allow,$logfile,$target,$tag,$oldurl,$type)=@_; |
my $newurl=&urlfixup($oldurl,$target); |
my $newurl=&urlfixup($oldurl,$target); |
my $return_url=$oldurl; |
my $return_url=$oldurl; |
print $logfile 'GUYURL: '.$tag.':'.$oldurl.' - '.$newurl."\n"; |
print $logfile 'GUYURL: '.$tag.':'.$oldurl.' - '.$newurl."\n"; |
Line 480 sub set_allow {
|
Line 480 sub set_allow {
|
($newurl !~ /^mailto:/i) && |
($newurl !~ /^mailto:/i) && |
($newurl !~ /^(?:http|https|ftp):/i) && |
($newurl !~ /^(?:http|https|ftp):/i) && |
($newurl !~ /^\#/)) { |
($newurl !~ /^\#/)) { |
|
if (($type eq 'src') || ($type eq 'href')) { |
|
if ($newurl =~ /^([^?]+)\?[^?]*$/) { |
|
$newurl = $1; |
|
} |
|
} |
$$allow{&absoluteurl($newurl,$target)}=1; |
$$allow{&absoluteurl($newurl,$target)}=1; |
} |
} |
return $return_url; |
return $return_url; |
Line 723 sub fix_ids_and_indices {
|
Line 728 sub fix_ids_and_indices {
|
if ($key =~ /^$type$/i) { |
if ($key =~ /^$type$/i) { |
$parms{$key}=&set_allow(\%allow,$logfile, |
$parms{$key}=&set_allow(\%allow,$logfile, |
$target,$tag, |
$target,$tag, |
$parms{$key}); |
$parms{$key},$type); |
} |
} |
} |
} |
} |
} |
Line 790 sub fix_ids_and_indices {
|
Line 795 sub fix_ids_and_indices {
|
} |
} |
if (!$endtag) { if ($token->[4]=~m:/>$:) { $endtag=' /'; }; } |
if (!$endtag) { if ($token->[4]=~m:/>$:) { $endtag=' /'; }; } |
$outstring.='<'.$tag.$newparmstring.$endtag.'>'; |
$outstring.='<'.$tag.$newparmstring.$endtag.'>'; |
if ($lctag eq 'm' || $lctag eq 'script' || $lctag eq 'answer' |
if ($lctag eq 'm' || $lctag eq 'answer' || $lctag eq 'display' || |
|| $lctag eq 'display' || $lctag eq 'tex') { |
$lctag eq 'tex') { |
$outstring.=&get_all_text_unbalanced('/'.$lctag,\@parser); |
$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') { |
} elsif ($token->[0] eq 'E') { |
if ($token->[2]) { |
if ($token->[2]) { |
unless ($token->[1] eq 'allow') { |
unless ($token->[1] eq 'allow') { |
Line 1484 Returns:
|
Line 1534 Returns:
|
0: fail |
0: fail |
1: success |
1: success |
|
|
|
=back |
|
|
=cut |
=cut |
|
|
#'stupid emacs |
#'stupid emacs |
Line 1774 sub phasetwo {
|
Line 1826 sub phasetwo {
|
my $thissrcdir=$thissrc; |
my $thissrcdir=$thissrc; |
$thissrcdir=~s/\/[^\/]+$/\//; |
$thissrcdir=~s/\/[^\/]+$/\//; |
|
|
$r->print(&Apache::loncommon::head_subbox( |
$r->print( |
&Apache::lonhtmlcommon::start_funclist(). |
&Apache::lonhtmlcommon::actionbox([ |
&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="'.$thisdistarget.'">'. |
'<a href="'.$thisdistarget.'">'. |
&mt('View Published Version'). |
&mt('View Published Version'). |
'</a>'). |
'</a>', |
&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="'.$thissrc.'">'. |
'<a href="'.$thissrc.'">'. |
&mt('Back to Source'). |
&mt('Back to Source'). |
'</a>'). |
'</a>', |
&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="'.$thissrcdir.'">'. |
'<a href="'.$thissrcdir.'">'. |
&mt('Back to Source Directory'). |
&mt('Back to Source Directory'). |
'</a>'). |
'</a>']) |
&Apache::lonhtmlcommon::end_funclist()) |
|
); |
); |
} |
} |
return 1; |
return 1; |
Line 1885 sub publishdirectory {
|
Line 1933 sub publishdirectory {
|
my $thisdisresdir=$thisdisfn; |
my $thisdisresdir=$thisdisfn; |
$thisdisresdir=~s/^\/priv\//\/res\//; |
$thisdisresdir=~s/^\/priv\//\/res\//; |
my $resdir = $r->dir_config('lonDocRoot').$thisdisresdir; |
my $resdir = $r->dir_config('lonDocRoot').$thisdisresdir; |
$r->print(&Apache::lonhtmlcommon::start_pick_box() |
$r->print('<form name="pubdirpref" method="post" action="">' |
|
.&Apache::lonhtmlcommon::start_pick_box() |
.&Apache::lonhtmlcommon::row_title(&mt('Directory')) |
.&Apache::lonhtmlcommon::row_title(&mt('Directory')) |
.'<span class="LC_filename">'.$thisdisfn.'</span>' |
.'<span class="LC_filename">'.$thisdisfn.'</span>' |
.&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_closure() |
Line 1899 sub publishdirectory {
|
Line 1948 sub publishdirectory {
|
$r->print(&Apache::lonhtmlcommon::row_closure() |
$r->print(&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_title(&mt('Options')) |
.&Apache::lonhtmlcommon::row_title(&mt('Options')) |
); |
); |
$r->print('<form name="pubdirpref" method="post">'. |
$r->print(&hiddenfield('phase','two'). |
&hiddenfield('phase','two'). |
|
&hiddenfield('filename',$env{'form.filename'}). |
&hiddenfield('filename',$env{'form.filename'}). |
&checkbox('pubrec','include subdirectories'). |
&checkbox('pubrec','include subdirectories'). |
&checkbox('forcerepub','force republication of previously published files'). |
&checkbox('forcerepub','force republication of previously published files'). |
&checkbox('obsolete','make file(s) obsolete'). |
&checkbox('obsolete','make file(s) obsolete'). |
&checkbox('forceoverride','force directory level metadata over existing'). |
&checkbox('forceoverride','force directory level metadata over existing') |
'<br /><input type="submit" value="'.&mt('Publish Directory').'" /></form>'); |
); |
$r->print(&Apache::lonhtmlcommon::row_closure(1) |
$r->print(&Apache::lonhtmlcommon::row_closure(1) |
.&Apache::lonhtmlcommon::end_pick_box() |
.&Apache::lonhtmlcommon::end_pick_box() |
|
.'<br /><input type="submit" value="'.&mt('Publish Directory').'" /></form>' |
); |
); |
$lock=0; |
$lock=0; |
} else { |
} else { |
Line 1929 sub publishdirectory {
|
Line 1978 sub publishdirectory {
|
if ($filename=~/\.(\w+)$/) { $extension=$1; } |
if ($filename=~/\.(\w+)$/) { $extension=$1; } |
if ($cmode&$dirptr) { |
if ($cmode&$dirptr) { |
if (($filename!~/^\./) && ($env{'form.pubrec'})) { |
if (($filename!~/^\./) && ($env{'form.pubrec'})) { |
&publishdirectory($r,$docroot.$fn.'/'.$filename,$thisdisfn.'/'.$filename); |
&publishdirectory($r,$fn.'/'.$filename,$thisdisfn.'/'.$filename); |
} |
} |
} elsif ((&Apache::loncommon::fileembstyle($extension) ne 'hdn') && |
} elsif ((&Apache::loncommon::fileembstyle($extension) ne 'hdn') && |
($filename!~/^[\#\.]/) && ($filename!~/\~$/)) { |
($filename!~/^[\#\.]/) && ($filename!~/\~$/)) { |
Line 2147 sub handler {
|
Line 2196 sub handler {
|
# Breadcrumbs |
# Breadcrumbs |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::add_breadcrumb({ |
&Apache::lonhtmlcommon::add_breadcrumb({ |
'text' => 'Construction Space', |
'text' => 'Authoring Space', |
'href' => &Apache::loncommon::authorspace($fn), |
'href' => &Apache::loncommon::authorspace($fn), |
}); |
}); |
&Apache::lonhtmlcommon::add_breadcrumb({ |
&Apache::lonhtmlcommon::add_breadcrumb({ |
Line 2172 sub handler {
|
Line 2221 sub handler {
|
if ($fn=~/\/$/) { |
if ($fn=~/\/$/) { |
# -------------------------------------------------------- This is a directory |
# -------------------------------------------------------- This is a directory |
&publishdirectory($r,$docroot.$fn,$thisdisfn); |
&publishdirectory($r,$docroot.$fn,$thisdisfn); |
$r->print('<hr /><a href="'.$thisdisfn.'">'.&mt('Return to Directory').'</a>'); |
$r->print( |
|
'<br /><br />'. |
|
&Apache::lonhtmlcommon::actionbox([ |
|
'<a href="'.$thisdisfn.'">'.&mt('Return to Directory').'</a>'])); |
} else { |
} else { |
# ---------------------- Evaluate individual file, and then output information. |
# ---------------------- Evaluate individual file, and then output information. |
$fn=~/\.(\w+)$/; |
$fn=~/\.(\w+)$/; |
Line 2222 ENDCAPTION
|
Line 2274 ENDCAPTION
|
$r->print(&Apache::lonhtmlcommon::row_closure() |
$r->print(&Apache::lonhtmlcommon::row_closure() |
.&Apache::lonhtmlcommon::row_title(&mt('Diffs'))); |
.&Apache::lonhtmlcommon::row_title(&mt('Diffs'))); |
$r->print(<<ENDDIFF); |
$r->print(<<ENDDIFF); |
<a href='javascript:void(window.open("/adm/diff?filename=$thisdisfn&versiontwo=priv","cat","height=300,width=500,scrollbars=1,resizable=1,menubar=0,location=1"))'> |
<a href='javascript:void(window.open("/adm/diff?filename=$thisdisfn&versiontwo=priv","cat","height=300,width=500,scrollbars=1,resizable=1,menubar=0,location=1"))'> |
ENDDIFF |
ENDDIFF |
$r->print(&mt('Diffs with Current Version').'</a>'); |
$r->print(&mt('Diffs with Current Version').'</a>'); |
} |
} |
Line 2264 __END__
|
Line 2316 __END__
|
|
|
=back |
=back |
|
|
=back |
|
|
|
=cut |
=cut |
|
|