--- loncom/interface/coursecatalog.pm 2013/12/24 19:15:10 1.76 +++ loncom/interface/coursecatalog.pm 2019/08/02 00:24:02 1.88.2.7 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler for displaying the course catalog interface # -# $Id: coursecatalog.pm,v 1.76 2013/12/24 19:15:10 raeburn Exp $ +# $Id: coursecatalog.pm,v 1.88.2.7 2019/08/02 00:24:02 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -38,6 +38,7 @@ use Apache::lonlocal; use Apache::courseclassifier; use Apache::lonacc; use LONCAPA; +use LONCAPA::lonauthcgi; sub handler { my ($r) = @_; @@ -76,26 +77,168 @@ sub handler { my $domdesc = &Apache::lonnet::domain($codedom,'description'); &Apache::lonhtmlcommon::clear_breadcrumbs(); - if ($env{'form.catalog_maxdepth'} ne '') { - $env{'form.catalog_maxdepth'} =~ s{\D}{}g; + my $crscats = &Apache::lonnet::get_dom_cats($codedom); + my %domdefaults = &Apache::lonnet::get_domain_defaults($codedom); + my $knownuser = &user_is_known(); + my $canviewall = &canview_all($knownuser,$codedom); + + my ($cathash,$cattype); + if (ref($crscats) eq 'HASH') { + %{$cathash} = %{$crscats}; + } else { + $cathash = {}; + } + if ($knownuser || $canviewall) { + $cattype = $domdefaults{'catauth'}; + } else { + $cattype = $domdefaults{'catunauth'}; + } + if ($cattype eq '') { + $cattype = 'std'; + } + if ($cattype eq 'none') { + $r->print(&Apache::loncommon::start_page('Course/Community Catalog')); + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>"/adm/coursecatalog", + text=>"Course/Community Catalog"}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course/Community Catalog')); + if ($knownuser || $canviewall) { + $r->print('