--- loncom/interface/coursecatalog.pm 2008/05/29 04:29:33 1.28 +++ loncom/interface/coursecatalog.pm 2008/05/29 06:18:07 1.29 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler for displaying the course catalog interface # -# $Id: coursecatalog.pm,v 1.28 2008/05/29 04:29:33 raeburn Exp $ +# $Id: coursecatalog.pm,v 1.29 2008/05/29 06:18:07 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -350,7 +350,11 @@ sub category_breadcrumbs { my $currcat_str; if ($env{'form.catalog_maxdepth'} ne '') { $currdepth = $env{'form.catalog_maxdepth'}; - $deeper = $currdepth + 1; + if ($env{'form.currcat_'.$currdepth} eq '') { + $deeper = $currdepth; + } else { + $deeper = $currdepth + 1; + } } $currcat_str = ''; my $catlinks = ''.&mt('Catalog:').''; @@ -406,7 +410,13 @@ sub category_breadcrumbs { $env{'form.currcat_0'} = 'instcode::0'; } } else { - my ($cat,$container,$depth) = map { &unescape($_); } split(/:/,$env{'form.currcat_'.$currdepth}); + my ($cat,$container,$depth); + if ($env{'form.currcat_'.$currdepth} eq '') { + my $shallower = $currdepth - 1; + ($cat,$container,$depth) = map { &unescape($_); } split(/:/,$env{'form.currcat_'.$shallower}); + } else { + ($cat,$container,$depth) = map { &unescape($_); } split(/:/,$env{'form.currcat_'.$currdepth}); + } my $deeper = $depth +1; my $currcat = $cat; if ($cat eq 'instcode') { @@ -559,6 +569,10 @@ sub search_courselist { my ($domain) = @_; my $cat_maxdepth = $env{'form.catalog_maxdepth'}; my $filter = $env{'form.currcat_'.$cat_maxdepth}; + if (($filter eq '') && ($cat_maxdepth > 0)) { + my $shallower = $cat_maxdepth - 1; + $filter = $env{'form.currcat_'.$shallower}; + } my %courses; if ($filter ne '') { %courses = &Apache::lonnet::courseiddump($domain,'.',1,'.','.','.',