--- loncom/interface/lonsyllabus.pm 2013/10/03 12:45:14 1.135 +++ loncom/interface/lonsyllabus.pm 2014/06/17 23:22:14 1.137 @@ -1,7 +1,7 @@ # The LearningOnline Network # Syllabus # -# $Id: lonsyllabus.pm,v 1.135 2013/10/03 12:45:14 raeburn Exp $ +# $Id: lonsyllabus.pm,v 1.137 2014/06/17 23:22:14 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -99,7 +99,7 @@ sub handler { my $minimal=$courseenv{'minimalsyllabus'}; if (($minimal =~/\w/) || ($uploaded =~/\w/)) { - my $item; + my ($item,$is_pdf); if ($minimal =~/\w/) { if ($external =~ m{\Q$minimal\E$}) { undef($external); @@ -110,6 +110,9 @@ sub handler { undef($external); } $item = $uploaded; + if ($item =~ /\.pdf$/i) { + $is_pdf = 1; + } } unless ($allowed && $forceedit) { my $file=&Apache::lonnet::filelocation("",$item); @@ -129,6 +132,9 @@ sub handler { if ($env{'form.only_body'}) { $args{'only_body'} = 1; } + if ($env{'request.use_absolute'}) { + $args{'use_absolute'} = $env{'request.use_absolute'}; + } $r->print(&Apache::loncommon::start_page("Syllabus",undef,\%args). $result. &Apache::loncommon::end_page()); @@ -157,7 +163,8 @@ sub handler { &mt('Print the syllabus directly from your web browser'). '\end{document}'); } else { - $r->print(&Apache::lonwrapper::wrapper($item)); + $r->print(&Apache::lonwrapper::wrapper($item,undef,$env{'request.use_absolute'}, + undef,$is_pdf,&mt('Syllabus'))); } } return OK; @@ -170,7 +177,13 @@ sub handler { ' \strut \\\\ '.&mt('Print the syllabus directly from your web browser'). '\end{document}'); } else { - $r->print(&Apache::lonwrapper::wrapper($external)); + my $is_ext = 1; + my $is_pdf; + if ($external =~ /\.pdf$/i) { + $is_pdf = 1; + } + $r->print(&Apache::lonwrapper::wrapper($external,undef,$env{'request.use_absolute'}, + $is_ext,$is_pdf,&mt('Syllabus'))); } return OK; } @@ -695,6 +708,10 @@ ENDSCRIPT onload => 'setTemplateBoxes();', ); $args->{'add_entries'} = \%loaditem; + } else { + if ($env{'request.use_absolute'}) { + $args->{'use_absolute'} = $env{'request.use_absolute'}; + } } if ($env{'form.only_body'}) { $args->{'only_body'} = 1; @@ -1503,7 +1520,7 @@ sub home_http_host { if ($home ne 'no_host') { my $protocol = $Apache::lonnet::protocol{$home}; $protocol = 'http' if ($protocol ne 'https'); - return $protocol.'://'.$home; + return $protocol.'://'.&Apache::lonnet::hostname($home); } return; }