--- loncom/interface/lonsyllabus.pm 2017/02/18 23:39:16 1.142 +++ loncom/interface/lonsyllabus.pm 2019/05/02 02:12:19 1.146 @@ -1,7 +1,7 @@ # The LearningOnline Network # Syllabus # -# $Id: lonsyllabus.pm,v 1.142 2017/02/18 23:39:16 raeburn Exp $ +# $Id: lonsyllabus.pm,v 1.146 2019/05/02 02:12:19 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -177,7 +177,7 @@ sub handler { $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); } - $r->print(&Apache::lonwrapper::wrapper($item,$brcrum,$env{'request.use_absolute'}, + $r->print(&Apache::lonwrapper::wrapper($r,$item,$brcrum,$env{'request.use_absolute'}, undef,$is_pdf,undef,&mt('Syllabus'))); } } @@ -204,7 +204,7 @@ sub handler { $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); } - $r->print(&Apache::lonwrapper::wrapper($external,$brcrum,$env{'request.use_absolute'}, + $r->print(&Apache::lonwrapper::wrapper($r,$external,$brcrum,$env{'request.use_absolute'}, $is_ext,$is_pdf,undef,&mt('Syllabus'))); } return OK; @@ -306,12 +306,17 @@ sub handler { if ($allowed) { #---------------------------------- Print External URL Syllabus Info if editing if ($target ne 'tex') { + my $hostname = &Apache::lonnet::hostname($homeserver); my $protocol = $Apache::lonnet::protocol{$homeserver}; $protocol = 'http' if ($protocol ne 'https'); - my $link = $protocol.'://'.&Apache::lonnet::hostname($homeserver).$r->uri; + my $link = $r->uri; if (($protocol eq 'https') && ($external =~ m{^http://})) { - $link .= '?usehttp=1'; + unless (&Apache::lonnet::uses_sts()) { + $link .= '?usehttp=1'; + $protocol = 'http'; + } } + $link = $protocol.'://'.$hostname.$link; $r->print('
' .'' .'' @@ -747,6 +752,7 @@ ENDSCRIPT if ($env{'form.only_body'}) { $args->{'only_body'} = 1; } + $args->{'hostname'} = $r->hostname(); my $start_page = &Apache::loncommon::start_page("Syllabus", $rss_link.$js,$args); if ($start_page) { @@ -896,9 +902,10 @@ sub chooser { sub syllabus_file_info { my ($item,$cnum,$cdom,$lonhost,$context) = @_; + my $hostname = &Apache::lonnet::hostname($lonhost); my $protocol = $Apache::lonnet::protocol{$lonhost}; $protocol = 'http' if ($protocol ne 'https'); - my $absurl = $protocol.'://'.&Apache::lonnet::hostname($lonhost).$item; + my $absurl = $protocol.'://'.$hostname.$item; my ($filename) = ($item =~ m{([^/]+)$}); my $file=&Apache::lonnet::filelocation("",$item); my ($depbutton,$filetype,$editable); @@ -1571,9 +1578,10 @@ sub home_http_host { my ($cdom,$cnum) = @_; my $home=&Apache::lonnet::homeserver($cnum,$cdom); if ($home ne 'no_host') { + my $hostname = &Apache::lonnet::hostname($home); my $protocol = $Apache::lonnet::protocol{$home}; $protocol = 'http' if ($protocol ne 'https'); - return $protocol.'://'.&Apache::lonnet::hostname($home); + return $protocol.'://'.$hostname; } return; }