--- loncom/interface/lonsyllabus.pm 2020/01/20 17:21:08 1.138.2.5.2.2 +++ loncom/interface/lonsyllabus.pm 2017/02/20 18:29:23 1.143 @@ -1,7 +1,7 @@ # The LearningOnline Network # Syllabus # -# $Id: lonsyllabus.pm,v 1.138.2.5.2.2 2020/01/20 17:21:08 raeburn Exp $ +# $Id: lonsyllabus.pm,v 1.143 2017/02/20 18:29:23 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -177,21 +177,14 @@ sub handler { $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); } - $r->print(&Apache::lonwrapper::wrapper($r,$item,$brcrum,$env{'request.use_absolute'}, - undef,$is_pdf,undef,'','',&mt('Syllabus'))); + $r->print(&Apache::lonwrapper::wrapper($item,$brcrum,$env{'request.use_absolute'}, + undef,$is_pdf,undef,&mt('Syllabus'))); } } return OK; } } elsif ($external=~/\w/) { unless ($allowed && $forceedit) { - if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public') && - ($ENV{'SERVER_PORT'} == 443) && ($external =~ m{^http://}) && !($env{'form.usehttp'})) { - unless (&Apache::lonnet::uses_sts()) { - &redirect_to_http($r); - return OK; - } - } if ($target eq 'tex') { $r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}). ' \strut \\\\ \textbf{'.&mt('Syllabus').'} \strut \\\\ '.$external.' '. @@ -211,8 +204,8 @@ sub handler { $brcrum = &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1); } - $r->print(&Apache::lonwrapper::wrapper($r,$external,$brcrum,$env{'request.use_absolute'}, - $is_ext,$is_pdf,undef,'','',&mt('Syllabus'))); + $r->print(&Apache::lonwrapper::wrapper($external,$brcrum,$env{'request.use_absolute'}, + $is_ext,$is_pdf,undef,&mt('Syllabus'))); } return OK; } @@ -313,10 +306,14 @@ 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.'://'.$hostname.$r->uri; + my $link = $r->uri; + if (($protocol eq 'https') && ($external =~ m{^http://})) { + $link .= '?usehttp=1'; + $protocol = 'http'; + } + $link = $protocol.'://'.&Apache::lonnet::hostname($homeserver).$link; $r->print('
' .'' .'' @@ -902,10 +899,9 @@ 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.'://'.$hostname.$item; + my $absurl = $protocol.'://'.&Apache::lonnet::hostname($lonhost).$item; my ($filename) = ($item =~ m{([^/]+)$}); my $file=&Apache::lonnet::filelocation("",$item); my ($depbutton,$filetype,$editable); @@ -1315,8 +1311,8 @@ sub save_changes { &mt('An error occurred storing the external URL: [_1]',$putres). '
'; } - $is_ext = $external; } + $is_ext = $external; } else { $output = '
'. &mt('External URL not saved -- invalid URL.'). @@ -1578,10 +1574,9 @@ 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.'://'.$hostname; + return $protocol.'://'.&Apache::lonnet::hostname($home); } return; } @@ -1721,17 +1716,5 @@ sub editbutton_js { ENDJS } -sub redirect_to_http { - my ($r) = @_; - &Apache::loncommon::content_type($r,'text/html'); - &Apache::loncommon::no_cache($r); - $r->send_http_header; - my $url = 'http://'.$r->hostname().$r->uri().'?usehttp=1'; - $r->print(&Apache::loncommon::start_page(undef,undef, - {'redirect' => [0,$url],}). - &Apache::loncommon::end_page()); - return; -} - 1; __END__