version 1.88.2.8, 2021/06/20 17:49:08
|
version 1.88.2.9, 2021/12/12 21:47:58
|
Line 58 sub handler {
|
Line 58 sub handler {
|
['sortby','showdom']); |
['sortby','showdom']); |
|
|
my $codedom = &Apache::lonnet::default_login_domain(); |
my $codedom = &Apache::lonnet::default_login_domain(); |
|
my $hostname = $r->hostname(); |
|
|
if (($env{'user.domain'} ne '') && ($env{'user.domain'} ne 'public')) { |
if (($env{'user.domain'} ne '') && ($env{'user.domain'} ne 'public')) { |
$codedom = $env{'user.domain'}; |
$codedom = $env{'user.domain'}; |
Line 124 sub handler {
|
Line 125 sub handler {
|
} |
} |
my $js = '<script type="text/javascript">'."\n". |
my $js = '<script type="text/javascript">'."\n". |
'// <![CDATA['."\n". |
'// <![CDATA['."\n". |
&courselink_javascript($r)."\n". |
&courselink_javascript($hostname)."\n". |
'// ]]>'."\n". |
'// ]]>'."\n". |
'</script>'."\n"; |
'</script>'."\n"; |
$r->print(&Apache::loncommon::start_page('Search for a Course/Community',$js)); |
$r->print(&Apache::loncommon::start_page('Search for a Course/Community',$js)); |
Line 177 sub handler {
|
Line 178 sub handler {
|
if ($courseinfo{$codedom.'_'.$cnum}{'showsyllabus'}) { |
if ($courseinfo{$codedom.'_'.$cnum}{'showsyllabus'}) { |
my $usehttp = 0; |
my $usehttp = 0; |
if (($ENV{'SERVER_PORT'} == 443) && ($courseinfo{$codedom.'_'.$cnum}{'extsyllplain'})) { |
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; |
$usehttp = 1; |
} |
} |
} |
} |
Line 239 sub handler {
|
Line 241 sub handler {
|
&validate_input($codedom,\@cats,\%maxd,$cathash); |
&validate_input($codedom,\@cats,\%maxd,$cathash); |
my ($numtitles,@codetitles); |
my ($numtitles,@codetitles); |
if (($env{'form.coursenum'} ne '') && ($knownuser)) { |
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 { |
} else { |
my ($catlinks,$has_subcats,$selitem) = &category_breadcrumbs($codedom,@cats); |
my ($catlinks,$has_subcats,$selitem) = &category_breadcrumbs($codedom,@cats); |
my $wasacctext = &get_wasactive_text(); |
my $wasacctext = &get_wasactive_text(); |
Line 285 function setCourseId(caller) {
|
Line 288 function setCourseId(caller) {
|
} |
} |
|
|
ENDSCRIPT |
ENDSCRIPT |
$catjs .= &courselink_javascript($r); |
$catjs .= &courselink_javascript($hostname); |
if (&user_is_dc($codedom) || $canviewall) { |
if (&user_is_dc($codedom) || $canviewall) { |
$catjs .= <<ENDTOGGJS |
$catjs .= <<ENDTOGGJS |
|
|
Line 320 ENDTOGGJS
|
Line 323 ENDTOGGJS
|
$catlinks,$catjs,\@codetitles,$cattype,$canviewall); |
$catlinks,$catjs,\@codetitles,$cattype,$canviewall); |
if ($env{'form.state'} eq 'listing') { |
if ($env{'form.state'} eq 'listing') { |
$r->print(&print_course_listing($codedom,$numtitles,undef,undef,undef, |
$r->print(&print_course_listing($codedom,$numtitles,undef,undef,undef, |
\@codetitles,$canviewall)); |
\@codetitles,$canviewall,$hostname)); |
} |
} |
} else { |
} else { |
my (%add_entries); |
my (%add_entries); |
Line 367 ENDJS
|
Line 370 ENDJS
|
} |
} |
if ($env{'form.state'} eq 'listing') { |
if ($env{'form.state'} eq 'listing') { |
$r->print(&print_course_listing($codedom,undef,\@trails,\%allitems,$subcats,\@codetitles, |
$r->print(&print_course_listing($codedom,undef,\@trails,\%allitems,$subcats,\@codetitles, |
$canviewall)); |
$canviewall,$hostname)); |
} |
} |
} |
} |
} |
} |
Line 643 sub get_instcode_allowable {
|
Line 646 sub get_instcode_allowable {
|
} |
} |
|
|
sub course_details { |
sub course_details { |
my ($r,$codedom,$formname,$domdesc,$trails,$allitems,$codetitles) = @_; |
my ($r,$codedom,$formname,$domdesc,$hostname,$trails,$allitems,$codetitles) = @_; |
my $output; |
my $output; |
my %add_entries = (topmargin => "0", |
my %add_entries = (topmargin => "0", |
marginheight => "0",); |
marginheight => "0",); |
my $js = '<script type="text/javascript">'."\n". |
my $js = '<script type="text/javascript">'."\n". |
&courselink_javascript($r).'</script>'."\n"; |
&courselink_javascript($hostname).'</script>'."\n"; |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Course/Community Catalog',$js, |
&Apache::loncommon::start_page('Course/Community Catalog',$js, |
{'add_entries' => \%add_entries, }); |
{'add_entries' => \%add_entries, }); |
Line 675 sub course_details {
|
Line 678 sub course_details {
|
&mt('Detailed community information:') : |
&mt('Detailed community information:') : |
&mt('Detailed course information:')). |
&mt('Detailed course information:')). |
'</h2>'. |
'</h2>'. |
&print_course_listing($codedom,undef,$trails,$allitems,undef,$codetitles). |
&print_course_listing($codedom,undef,$trails,$allitems,undef,$codetitles,undef,$hostname). |
'<br />'. |
'<br />'. |
'<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'. |
'<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'. |
&Apache::lonhtmlcommon::actionbox([ |
&Apache::lonhtmlcommon::actionbox([ |
Line 711 END
|
Line 714 END
|
} |
} |
|
|
sub courselink_javascript { |
sub courselink_javascript { |
my ($r) = @_; |
my ($hostname) = @_; |
my $hostname = $r->hostname(); |
|
return <<"END"; |
return <<"END"; |
|
|
function ToSyllabus(cdom,cnum,usehttp) { |
function ToSyllabus(cdom,cnum,usehttp) { |
Line 1289 sub search_courselist {
|
Line 1291 sub search_courselist {
|
} |
} |
|
|
sub print_course_listing { |
sub print_course_listing { |
my ($domain,$numtitles,$trails,$allitems,$subcats,$codetitles,$canviewall) = @_; |
my ($domain,$numtitles,$trails,$allitems,$subcats,$codetitles,$canviewall,$hostname) = @_; |
my $output; |
my $output; |
my %courses; |
my %courses; |
my $knownuser = &user_is_known(); |
my $knownuser = &user_is_known(); |
Line 1338 sub print_course_listing {
|
Line 1340 sub print_course_listing {
|
} |
} |
my $now = time; |
my $now = time; |
$output .= &construct_data_table($knownuser,$domain,\%courses,$details,undef, |
$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="">'. |
$output .= "\n".'<form name="linklaunch" method="post" action="">'. |
'<input type="hidden" name="backto" value="coursecatalog" />'. |
'<input type="hidden" name="backto" value="coursecatalog" />'. |
'<input type="hidden" name="courseid" value="" />'. |
'<input type="hidden" name="courseid" value="" />'. |
Line 1347 sub print_course_listing {
|
Line 1349 sub print_course_listing {
|
} |
} |
|
|
sub construct_data_table { |
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; |
my %sortname; |
if (($details eq '') || ($env{'form.showdetails'})) { |
if (($details eq '') || ($env{'form.showdetails'})) { |
$sortname{'Code'} = 'code'; |
$sortname{'Code'} = 'code'; |
Line 1492 sub construct_data_table {
|
Line 1495 sub construct_data_table {
|
foreach my $course (@{$Sortby{$item}}) { |
foreach my $course (@{$Sortby{$item}}) { |
$output.=&Apache::loncommon::start_data_table_row(); |
$output.=&Apache::loncommon::start_data_table_row(); |
$output.=&courseinfo_row($courseinfo{$course},$knownuser,$details, |
$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(); |
$output.=&Apache::loncommon::end_data_table_row(); |
} |
} |
} |
} |
Line 1812 sub count_students {
|
Line 1816 sub count_students {
|
} |
} |
|
|
sub courseinfo_row { |
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, |
my ($cdom,$cnum,$title,$ownerlast,$code,$owner,$seclist,$xlist_items, |
$accessdates,$showsyllabus,$counts,$autoenrollment,$output,$categories, |
$accessdates,$showsyllabus,$counts,$autoenrollment,$output,$categories, |
$extsyllplain); |
$extsyllplain); |
Line 1859 sub courseinfo_row {
|
Line 1864 sub courseinfo_row {
|
if ($showsyllabus) { |
if ($showsyllabus) { |
my $usehttp = 0; |
my $usehttp = 0; |
if (($ENV{'SERVER_PORT'} == 443) && ($extsyllplain)) { |
if (($ENV{'SERVER_PORT'} == 443) && ($extsyllplain)) { |
unless (&Apache::lonnet::uses_sts()) { |
unless ((&Apache::lonnet::uses_sts()) || |
|
(&Apache::lonnet::waf_allssl($hostname))) { |
$usehttp = 1; |
$usehttp = 1; |
} |
} |
} |
} |