version 1.101, 2019/07/23 01:30:35
|
version 1.103, 2021/04/29 17:45:22
|
Line 59 sub handler {
|
Line 59 sub handler {
|
|
|
my $serverdefdom = &Apache::lonnet::default_login_domain(); |
my $serverdefdom = &Apache::lonnet::default_login_domain(); |
my $codedom = $serverdefdom; |
my $codedom = $serverdefdom; |
|
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 138 sub handler {
|
Line 139 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 191 sub handler {
|
Line 192 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 253 sub handler {
|
Line 255 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 281 function setCatDepth(depth) {
|
Line 284 function setCatDepth(depth) {
|
} |
} |
document.coursecats.catalog_maxdepth.value = depth; |
document.coursecats.catalog_maxdepth.value = depth; |
} else { |
} else { |
document.coursecats.currcat_0.value = ''; |
document.coursecats.currcat_0.value = ''; |
document.coursecats.catalog_maxdepth.value = ''; |
document.coursecats.catalog_maxdepth.value = ''; |
} |
} |
document.coursecats.submit(); |
document.coursecats.submit(); |
Line 299 function setCourseId(caller) {
|
Line 302 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 623 sub validate_input {
|
Line 626 sub validate_input {
|
} elsif (ref($crscatsref) eq 'HASH') { |
} elsif (ref($crscatsref) eq 'HASH') { |
unless (exists($crscatsref->{$env{'form.'.$key}})) { |
unless (exists($crscatsref->{$env{'form.'.$key}})) { |
delete($env{'form.'.$key}); |
delete($env{'form.'.$key}); |
} else { |
|
delete($env{'form.'.$key}); |
|
} |
} |
} else { |
} else { |
delete($env{'form.'.$key}); |
delete($env{'form.'.$key}); |
Line 637 sub validate_input {
|
Line 638 sub validate_input {
|
sub get_instcode_allowable { |
sub get_instcode_allowable { |
my ($codedom,$possvalref) = @_; |
my ($codedom,$possvalref) = @_; |
return 1 unless (ref($possvalref) eq 'HASH'); |
return 1 unless (ref($possvalref) eq 'HASH'); |
my $caller = 'global'; |
my $instcats = &Apache::lonnet::get_dom_instcats($codedom); |
my %coursecodes = (); |
if (ref($instcats) eq 'HASH') { |
my %codes = (); |
if ((ref($instcats->{'codetitles'}) eq 'ARRAY') && (ref($instcats->{'codes'}) eq 'HASH')) { |
my @codetitles = (); |
my %codes = %{$instcats->{'codes'}}; |
my %cat_titles = (); |
my @codetitles = @{$instcats->{'codetitles'}}; |
my %cat_order = (); |
|
my $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom); |
|
if ($totcodes > 0) { |
|
if (&Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes, |
|
\%codes,\@codetitles,\%cat_titles,\%cat_order) eq 'ok') { |
|
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
my %local_to_standard; |
my %local_to_standard; |
for (my $i=0; $i<@codetitles; $i++) { |
for (my $i=0; $i<@codetitles; $i++) { |
Line 666 sub get_instcode_allowable {
|
Line 662 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 735 END
|
Line 731 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 771 END
|
Line 766 END
|
|
|
sub instcode_course_selector { |
sub instcode_course_selector { |
my ($r,$codedom,$formname,$domdesc,$catlinks,$catjs,$codetitles,$cattype,$canviewall) = @_; |
my ($r,$codedom,$formname,$domdesc,$catlinks,$catjs,$codetitles,$cattype,$canviewall) = @_; |
my %coursecodes = (); |
|
my %codes = (); |
|
my %cat_titles = (); |
my %cat_titles = (); |
my %cat_order = (); |
my %cat_order = (); |
my %cat_items; |
my %cat_items = (); |
my $caller = 'global'; |
|
my $format_reply; |
|
my %add_entries = (topmargin => "0", |
my %add_entries = (topmargin => "0", |
marginheight => "0",); |
marginheight => "0",); |
my ($jscript,$totcodes,$numtitles,$lasttitle) = |
my ($jscript,$totcodes,$numtitles,$lasttitle) = |
Line 1523 sub construct_data_table {
|
Line 1514 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 1845 sub count_students {
|
Line 1837 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 1892 sub courseinfo_row {
|
Line 1885 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; |
} |
} |
} |
} |