--- loncom/interface/coursecatalog.pm 2013/01/23 15:23:19 1.72 +++ 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.72 2013/01/23 15:23:19 raeburn Exp $ +# $Id: coursecatalog.pm,v 1.84 2014/04/28 22:12:55 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -66,8 +66,11 @@ sub handler { } my $formname = 'coursecatalog'; if ($env{'form.showdom'} ne '') { + $env{'form.showdom'} = &LONCAPA::clean_domain($env{'form.showdom'}); if (&Apache::lonnet::domain($env{'form.showdom'}) ne '') { $codedom = $env{'form.showdom'}; + } else { + $env{'form.showdom'} = ''; } } my $domdesc = &Apache::lonnet::domain($codedom,'description'); @@ -75,20 +78,147 @@ sub handler { 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 { @@ -832,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))) { @@ -852,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".''.$lt{$item}.' | '. + ''.$lt{$item}.' | '. ' | '.$numbers{$item}.' | '. '
'.$lt{$status}.' | '. + ''.$lt{$status}.' | '. ' | '.$numbers{$status}.' | '. '
'.$lt{'cr_'.$status}.' | '. + ' | '.$creditsum{$status}.' |