version 1.46, 2013/10/22 23:13:54
|
version 1.47, 2014/05/20 11:47:06
|
Line 40 use Apache::lonextresedit();
|
Line 40 use Apache::lonextresedit();
|
|
|
# ================================================================ Main Handler |
# ================================================================ Main Handler |
sub wrapper { |
sub wrapper { |
my ($url,$brcrum,$absolute,$is_ext) = @_; |
my ($url,$brcrum,$absolute,$is_ext,$is_pdf) = @_; |
|
|
my $forcereg; |
my $forcereg; |
unless ($env{'form.folderpath'}) { |
unless ($env{'form.folderpath'}) { |
Line 68 sub wrapper {
|
Line 68 sub wrapper {
|
my $endpage = &Apache::loncommon::end_page(); |
my $endpage = &Apache::loncommon::end_page(); |
|
|
if ($env{'browser.mobile'}) { |
if ($env{'browser.mobile'}) { |
return <<ENDFRAME; |
my $output = $startpage; |
$startpage |
if ($is_pdf) { |
<div style="overflow:scroll; -webkit-overflow-scrolling:touch;"> |
my $title = $env{'form.title'}; |
<iframe src="$url" height="100%" width="100%" frameborder="0"> |
if ($title eq '') { |
$lt{'noif'} $noiframe |
unless ($env{'request.enc'}) { |
</iframe> |
($title) = ($url =~ m{/([^/]+)$}); |
</div> |
$title =~ s/(\?[^\?]+)$//; |
$endpage |
} |
ENDFRAME |
} |
|
unless ($title eq '') { |
|
$output .= $title.'<br />'; |
|
} |
|
$output .= '<a href="'.$url.'">'.&mt('Link to PDF (for mobile devices)').'</a>'; |
|
} else { |
|
$output .= '<div style="overflow:scroll; -webkit-overflow-scrolling:touch;">'."\n". |
|
'<iframe src="$url" height="100%" width="100%" frameborder="0">'."\n". |
|
"$lt{'noif'} $noiframe\n". |
|
"</iframe>\n". |
|
"</div>\n"; |
|
$output .= '<iframe src="$url" height="100%" width="100%" frameborder="0">'."\n". |
|
"$lt{'noif'} $noiframe\n". |
|
'</iframe>'; |
|
} |
|
$output .= $endpage; |
|
return $output; |
} else { |
} else { |
my $script = &Apache::lonhtmlcommon::scripttag(<<SCRIPT); |
my $script = &Apache::lonhtmlcommon::scripttag(<<SCRIPT); |
\$(document).ready( function() { |
\$(document).ready( function() { |
Line 123 sub handler {
|
Line 139 sub handler {
|
return OK if $r->header_only; |
return OK if $r->header_only; |
|
|
my $url = $r->uri; |
my $url = $r->uri; |
my ($is_ext,$brcrum,$absolute); |
my ($is_ext,$brcrum,$absolute,$is_pdf); |
|
|
for ($url){ |
for ($url){ |
s|^/adm/wrapper||; |
s|^/adm/wrapper||; |
Line 132 sub handler {
|
Line 148 sub handler {
|
s|:|:|g; |
s|:|:|g; |
} |
} |
|
|
|
if ($url =~ /\.pdf$/i) { |
|
$is_pdf = 1; |
|
} |
|
|
if ($is_ext) { |
if ($is_ext) { |
my $hostname = $r->hostname(); |
my $hostname = $r->hostname(); |
my $lonhost = &Apache::lonnet::host_from_dns($hostname); |
my $lonhost = &Apache::lonnet::host_from_dns($hostname); |
Line 189 sub handler {
|
Line 209 sub handler {
|
# encrypt url if not external |
# encrypt url if not external |
&Apache::lonenc::check_encrypt(\$url) if $url !~ /^https?\:/ ; |
&Apache::lonenc::check_encrypt(\$url) if $url !~ /^https?\:/ ; |
|
|
$r->print( wrapper($url,$brcrum,$absolute,$is_ext) ); |
$r->print( wrapper($url,$brcrum,$absolute,$is_ext,$is_pdf) ); |
|
|
} # not just the menu |
} # not just the menu |
|
|
Line 216 described at http://www.lon-capa.org.
|
Line 236 described at http://www.lon-capa.org.
|
|
|
=over |
=over |
|
|
=item wrapper($url,$brcrum,$absolute,$is_ext) |
=item wrapper($url,$brcrum,$absolute,$is_ext,$is_pdf)) |
|
|
=over |
=over |
|
|
Line 252 in Firefox 23 and later, when serving fr
|
Line 272 in Firefox 23 and later, when serving fr
|
|
|
true if URL is for an external resource. |
true if URL is for an external resource. |
|
|
|
=item $is_pdf |
|
|
|
true if URL is for a PDF (based on file extension). |
|
|
=back |
=back |
|
|
Returns markup for the entire page. |
Returns markup for the entire page. |