--- loncom/interface/coursecatalog.pm 2013/11/20 18:40:09 1.75 +++ loncom/interface/coursecatalog.pm 2014/04/28 22:12:55 1.84 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler for displaying the course catalog interface # -# $Id: coursecatalog.pm,v 1.75 2013/11/20 18:40:09 raeburn Exp $ +# $Id: coursecatalog.pm,v 1.84 2014/04/28 22:12:55 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -76,26 +76,149 @@ 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 %domconfig = &Apache::lonnet::get_dom('configuration',['coursecategories'],$codedom); - my (@cats,@trails,%allitems,%idx,@jsarray,%subcathash,$cathash); + my $knownuser = &user_is_known(); + + my ($cathash,$cattype); if (ref($domconfig{'coursecategories'}) eq 'HASH') { $cathash = $domconfig{'coursecategories'}{'cats'}; + if ($knownuser) { + $cattype = $domconfig{'coursecategories'}{'auth'}; + } else { + $cattype = $domconfig{'coursecategories'}{'unauth'}; + } } else { $cathash = {}; + $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) { + $r->print('
'; if ($env{'form.currcat_0'} eq 'communities::0') { $output .= &mt('The courseID provided does not match a community in this domain.'); } else { $output .= &mt('The courseID provided does not match a course in this domain.'); } + $output .= '
'; return $output; } } else { @@ -836,17 +989,13 @@ sub print_course_listing { %courses = &search_courselist($domain,$subcats); } if (keys(%courses) == 0) { + $output = ''; if ($env{'form.currcat_0'} eq 'communities::0') { - $output = - '
' - .&mt('No communities match the criteria you selected.') - .'
'; + $output .= &mt('No communities match the criteria you selected.'); } else { - $output = - '' - .&mt('No courses match the criteria you selected.') - .'
'; + $output .= &mt('No courses match the criteria you selected.'); } + $output .= ''; return $output; } if (($knownuser) && (!$env{'form.showdetails'}) && (!&user_is_dc($domain))) { @@ -856,10 +1005,8 @@ sub print_course_listing { } } my $now = time; - my %domconfig = - &Apache::lonnet::get_dom('configuration',['usercreation'],$domain); $output .= &construct_data_table($knownuser,$domain,\%courses,$details,undef, - $now,\%domconfig,$trails,$allitems); + $now,$trails,$allitems); $output .= "\n".'