--- loncom/interface/coursecatalog.pm 2009/11/23 22:02:50 1.58
+++ loncom/interface/coursecatalog.pm 2013/11/21 16:34:23 1.58.4.9
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler for displaying the course catalog interface
#
-# $Id: coursecatalog.pm,v 1.58 2009/11/23 22:02:50 raeburn Exp $
+# $Id: coursecatalog.pm,v 1.58.4.9 2013/11/21 16:34:23 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -66,13 +66,20 @@ 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');
&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);
@@ -87,8 +94,9 @@ sub handler {
}
&Apache::loncommon::extract_categories($cathash,\@cats,\@trails,\%allitems,
\%idx,\@jsarray,$subcats);
+ my ($numtitles,@codetitles);
if ($env{'form.coursenum'} ne '' && &user_is_known()) {
- &course_details($r,$codedom,$formname,$domdesc,\@trails,\%allitems);
+ &course_details($r,$codedom,$formname,$domdesc,\@trails,\%allitems,\@codetitles);
} else {
my ($catlinks,$has_subcats,$selitem) = &category_breadcrumbs($codedom,@cats);
my $catjs = <<"ENDSCRIPT";
@@ -114,12 +122,12 @@ function setCourseId(caller) {
ENDSCRIPT
$catjs .= &courselink_javascript();
- my $numtitles;
if ($env{'form.currcat_0'} eq 'instcode::0') {
$numtitles = &instcode_course_selector($r,$codedom,$formname,$domdesc,
- $catlinks,$catjs);
+ $catlinks,$catjs,\@codetitles);
if ($env{'form.state'} eq 'listing') {
- $r->print(&print_course_listing($codedom,$numtitles));
+ $r->print(&print_course_listing($codedom,$numtitles,undef,undef,undef,
+ \@codetitles));
}
} else {
my (%add_entries);
@@ -164,7 +172,7 @@ ENDJS
$display_button.'" />
');
}
if ($env{'form.state'} eq 'listing') {
- $r->print(&print_course_listing($codedom,undef,\@trails,\%allitems,$subcats));
+ $r->print(&print_course_listing($codedom,undef,\@trails,\%allitems,$subcats,\@codetitles));
}
}
}
@@ -173,7 +181,7 @@ ENDJS
}
sub course_details {
- my ($r,$codedom,$formname,$domdesc,$trails,$allitems) = @_;
+ my ($r,$codedom,$formname,$domdesc,$trails,$allitems,$codetitles) = @_;
my $output;
my %add_entries = (topmargin => "0",
marginheight => "0",);
@@ -190,17 +198,33 @@ sub course_details {
({href=>"/adm/coursecatalog",
text=>"Course/Community Catalog"});
}
+ my $brtextone = 'Course listing';
+ my $brtexttwo = 'Course details';
+ if ($env{'form.currcat_0'} eq 'communities::0') {
+ $brtextone = 'Community listing';
+ $brtexttwo = 'Community details';
+ }
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:document.$formname.submit()",
- text=>"Course listing"},
- {text=>"Course details"});
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course/Community Catalog'));
- $r->print('
'.&mt('Detailed course information:').'
'.
- &print_course_listing($codedom,undef,$trails,$allitems).
+ text=>$brtextone},
+ {text=>$brtexttwo});
+ $r->print('
');
+ if ($env{'form.currcat_0'} eq 'communities::0') {
+ $r->print(&mt('Detailed community information:'));
+ } else {
+ $r->print(&mt('Detailed course information:'));
+ }
+ $r->print('
'.
+ &print_course_listing($codedom,undef,$trails,$allitems,undef,$codetitles).
'
');
$r->print('