[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface coursecatalog.pm
raeburn
raeburn at source.lon-capa.org
Sun Dec 12 16:47:58 EST 2021
raeburn Sun Dec 12 21:47:58 2021 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface coursecatalog.pm
Log:
- For 2.11
Backport 1.103, 1.104
Index: loncom/interface/coursecatalog.pm
diff -u loncom/interface/coursecatalog.pm:1.88.2.8 loncom/interface/coursecatalog.pm:1.88.2.9
--- loncom/interface/coursecatalog.pm:1.88.2.8 Sun Jun 20 17:49:08 2021
+++ loncom/interface/coursecatalog.pm Sun Dec 12 21:47:58 2021
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler for displaying the course catalog interface
#
-# $Id: coursecatalog.pm,v 1.88.2.8 2021/06/20 17:49:08 raeburn Exp $
+# $Id: coursecatalog.pm,v 1.88.2.9 2021/12/12 21:47:58 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -58,6 +58,7 @@
['sortby','showdom']);
my $codedom = &Apache::lonnet::default_login_domain();
+ my $hostname = $r->hostname();
if (($env{'user.domain'} ne '') && ($env{'user.domain'} ne 'public')) {
$codedom = $env{'user.domain'};
@@ -124,7 +125,7 @@
}
my $js = '<script type="text/javascript">'."\n".
'// <![CDATA['."\n".
- &courselink_javascript($r)."\n".
+ &courselink_javascript($hostname)."\n".
'// ]]>'."\n".
'</script>'."\n";
$r->print(&Apache::loncommon::start_page('Search for a Course/Community',$js));
@@ -177,7 +178,8 @@
if ($courseinfo{$codedom.'_'.$cnum}{'showsyllabus'}) {
my $usehttp = 0;
if (($ENV{'SERVER_PORT'} == 443) && ($courseinfo{$codedom.'_'.$cnum}{'extsyllplain'})) {
- unless (&Apache::lonnet::uses_sts()) {
+ unless ((&Apache::lonnet::uses_sts()) ||
+ (&Apache::lonnet::waf_allssl($hostname))) {
$usehttp = 1;
}
}
@@ -239,7 +241,8 @@
&validate_input($codedom,\@cats,\%maxd,$cathash);
my ($numtitles, at codetitles);
if (($env{'form.coursenum'} ne '') && ($knownuser)) {
- &course_details($r,$codedom,$formname,$domdesc,\@trails,\%allitems,\@codetitles);
+ &course_details($r,$codedom,$formname,$domdesc,$hostname,\@trails,
+ \%allitems,\@codetitles);
} else {
my ($catlinks,$has_subcats,$selitem) = &category_breadcrumbs($codedom, at cats);
my $wasacctext = &get_wasactive_text();
@@ -285,7 +288,7 @@
}
ENDSCRIPT
- $catjs .= &courselink_javascript($r);
+ $catjs .= &courselink_javascript($hostname);
if (&user_is_dc($codedom) || $canviewall) {
$catjs .= <<ENDTOGGJS
@@ -320,7 +323,7 @@
$catlinks,$catjs,\@codetitles,$cattype,$canviewall);
if ($env{'form.state'} eq 'listing') {
$r->print(&print_course_listing($codedom,$numtitles,undef,undef,undef,
- \@codetitles,$canviewall));
+ \@codetitles,$canviewall,$hostname));
}
} else {
my (%add_entries);
@@ -367,7 +370,7 @@
}
if ($env{'form.state'} eq 'listing') {
$r->print(&print_course_listing($codedom,undef,\@trails,\%allitems,$subcats,\@codetitles,
- $canviewall));
+ $canviewall,$hostname));
}
}
}
@@ -643,12 +646,12 @@
}
sub course_details {
- my ($r,$codedom,$formname,$domdesc,$trails,$allitems,$codetitles) = @_;
+ my ($r,$codedom,$formname,$domdesc,$hostname,$trails,$allitems,$codetitles) = @_;
my $output;
my %add_entries = (topmargin => "0",
marginheight => "0",);
my $js = '<script type="text/javascript">'."\n".
- &courselink_javascript($r).'</script>'."\n";
+ &courselink_javascript($hostname).'</script>'."\n";
my $start_page =
&Apache::loncommon::start_page('Course/Community Catalog',$js,
{'add_entries' => \%add_entries, });
@@ -675,7 +678,7 @@
&mt('Detailed community information:') :
&mt('Detailed course information:')).
'</h2>'.
- &print_course_listing($codedom,undef,$trails,$allitems,undef,$codetitles).
+ &print_course_listing($codedom,undef,$trails,$allitems,undef,$codetitles,undef,$hostname).
'<br />'.
'<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'.
&Apache::lonhtmlcommon::actionbox([
@@ -711,8 +714,7 @@
}
sub courselink_javascript {
- my ($r) = @_;
- my $hostname = $r->hostname();
+ my ($hostname) = @_;
return <<"END";
function ToSyllabus(cdom,cnum,usehttp) {
@@ -1289,7 +1291,7 @@
}
sub print_course_listing {
- my ($domain,$numtitles,$trails,$allitems,$subcats,$codetitles,$canviewall) = @_;
+ my ($domain,$numtitles,$trails,$allitems,$subcats,$codetitles,$canviewall,$hostname) = @_;
my $output;
my %courses;
my $knownuser = &user_is_known();
@@ -1338,7 +1340,7 @@
}
my $now = time;
$output .= &construct_data_table($knownuser,$domain,\%courses,$details,undef,
- $now,$trails,$allitems,$canviewall);
+ $now,$trails,$allitems,$canviewall,$hostname);
$output .= "\n".'<form name="linklaunch" method="post" action="">'.
'<input type="hidden" name="backto" value="coursecatalog" />'.
'<input type="hidden" name="courseid" value="" />'.
@@ -1347,7 +1349,8 @@
}
sub construct_data_table {
- my ($knownuser,$domain,$courses,$details,$usersections,$now,$trails,$allitems,$canviewall) = @_;
+ my ($knownuser,$domain,$courses,$details,$usersections,$now,
+ $trails,$allitems,$canviewall,$hostname) = @_;
my %sortname;
if (($details eq '') || ($env{'form.showdetails'})) {
$sortname{'Code'} = 'code';
@@ -1492,7 +1495,8 @@
foreach my $course (@{$Sortby{$item}}) {
$output.=&Apache::loncommon::start_data_table_row();
$output.=&courseinfo_row($courseinfo{$course},$knownuser,$details,
- \$count,$now,$course,$trails,$allitems,\%numbers,$canviewall);
+ \$count,$now,$course,$trails,$allitems,
+ \%numbers,$canviewall,$hostname);
$output.=&Apache::loncommon::end_data_table_row();
}
}
@@ -1812,7 +1816,8 @@
}
sub courseinfo_row {
- my ($info,$knownuser,$details,$countref,$now,$course,$trails,$allitems,$numbers,$canviewall) = @_;
+ my ($info,$knownuser,$details,$countref,$now,$course,$trails,$allitems,
+ $numbers,$canviewall,$hostname) = @_;
my ($cdom,$cnum,$title,$ownerlast,$code,$owner,$seclist,$xlist_items,
$accessdates,$showsyllabus,$counts,$autoenrollment,$output,$categories,
$extsyllplain);
@@ -1859,7 +1864,8 @@
if ($showsyllabus) {
my $usehttp = 0;
if (($ENV{'SERVER_PORT'} == 443) && ($extsyllplain)) {
- unless (&Apache::lonnet::uses_sts()) {
+ unless ((&Apache::lonnet::uses_sts()) ||
+ (&Apache::lonnet::waf_allssl($hostname))) {
$usehttp = 1;
}
}
More information about the LON-CAPA-cvs
mailing list