--- rat/lonwrapper.pm 2011/11/07 20:06:29 1.41
+++ rat/lonwrapper.pm 2017/12/30 00:16:36 1.68
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Wrapper for external and binary files as standalone resources
#
-# $Id: lonwrapper.pm,v 1.41 2011/11/07 20:06:29 www Exp $
+# $Id: lonwrapper.pm,v 1.68 2017/12/30 00:16:36 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -33,36 +33,217 @@ use strict;
use Apache::Constants qw(:common);
use Apache::lonenc();
use Apache::lonnet;
+use Apache::lonlocal;
+use Apache::loncommon();
+use Apache::lonhtmlcommon();
+use Apache::lonextresedit();
+use Apache::lonexttool();
+use Apache::lonhomework();
+use LONCAPA qw(:DEFAULT :match);
+use HTML::Entities();
# ================================================================ Main Handler
sub wrapper {
- my $url = shift;
+ my ($url,$brcrum,$absolute,$is_ext,$is_pdf,$exttool,$linktext,$explanation,
+ $title,$width,$height) = @_;
- my $startpage = Apache::loncommon::start_page('Menu',undef,
- { 'force_register' =>1, 'bgcolor' => '#FFFFFF',}) ;
- my $endpage = Apache::loncommon::end_page();
-
- my $script = Apache::lonhtmlcommon::scripttag(<'."\n".
+ &Apache::lonhtmlcommon::set_due_date($resource_due);
+ }
+ }
+ } else {
+ if ($status eq 'SHOW_ANSWER') {
+ $result = &Apache::lonexttool::display_score().
+ &Apache::lonfeedback::list_discussion('tool','OPEN');
+ }
+ return &Apache::loncommon::start_page('Menu',undef,$args).
+ $result.
+ &Apache::loncommon::end_page();
+ }
+ }
+
+ my $startpage = &Apache::loncommon::start_page('Menu',undef,$args).$countdown.$donemsg;
+ my $endpage = &Apache::loncommon::end_page();
+
+ if (($env{'browser.mobile'}) || ($exttool eq 'window') || ($exttool eq 'tab')) {
+ my $output = $startpage;
+ if ($is_pdf) {
+ if ($title eq '') {
+ $title = $env{'form.title'};
+ if ($title eq '') {
+ unless ($env{'request.enc'}) {
+ ($title) = ($url =~ m{/([^/]+)$});
+ $title =~ s/(\?[^\?]+)$//;
+ }
+ }
+ }
+ unless ($title eq '') {
+ $output .= $title.'
';
+ }
+ $output .= ''.&mt('Link to PDF (for mobile devices)').'';
+ } elsif (($exttool eq 'window') || ($exttool eq 'tab')) {
+ if ($linktext eq '') {
+ $linktext = &mt('Launch External Tool');
+ }
+ $url = &HTML::Entities::encode($url,'"<>&');
+ if ($exttool eq 'tab') {
+ $output .= '