--- loncom/interface/coursecatalog.pm 2008/05/29 04:29:33 1.28 +++ loncom/interface/coursecatalog.pm 2008/06/20 13:45:12 1.31 @@ -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.31 2008/06/20 13:45:12 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -154,6 +154,9 @@ sub instcode_course_selector { my $totcodes = 0; my $jscript = ''; my ($numtitles,$lasttitle); + my %add_entries = (topmargin => "0", + marginheight => "0",); + my $js; $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom); if ($totcodes > 0) { $format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order); @@ -221,10 +224,8 @@ function setCourseId(caller) { }\n|; } } - my $js = ''; - my %add_entries = (topmargin => "0", - marginheight => "0",); + $js = ''; if (($env{'form.state'} eq 'listing') && ($numtitles > 0)) { $add_entries{'onLoad'} = 'setElements()'; } @@ -298,7 +299,13 @@ function setCourseId(caller) { $r->print('
'); } } else { - $r->print('
'.&mt('No official courses to display for [_1].',$domdesc)); + &cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles); + my $cat_maxdepth = $env{'form.catalog_maxdepth'}; + $r->print('
'. + ''. + ''. + ''); + $r->print('
'.&mt('No official courses to display for [_1].',$domdesc).'
'); } return $numtitles; } @@ -350,7 +357,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 +417,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 +576,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,'.','.','.', @@ -598,7 +619,9 @@ sub print_course_listing { return $output; } if ($knownuser && !$env{'form.showdetails'}) { - $output = &mt('Note for students: If you are officially enrolled in a course but the course is not listed in your LON-CAPA courses, click the "Show more details" link for the specific course and check the default access dates and/or automated enrollment settings.

'); + $output = ''.&mt('Note for students:').' ' + .&mt('If you are officially enrolled in a course but the course is not listed in your LON-CAPA courses, click the "Show more details" link for the specific course and check the default access dates and/or automated enrollment settings.') + .'

'; } } my $now = time;