--- loncom/interface/coursecatalog.pm 2012/10/04 13:41:10 1.71
+++ loncom/interface/coursecatalog.pm 2014/03/17 18:20:32 1.80
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler for displaying the course catalog interface
#
-# $Id: coursecatalog.pm,v 1.71 2012/10/04 13:41:10 bisitz Exp $
+# $Id: coursecatalog.pm,v 1.80 2014/03/17 18:20:32 bisitz 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);
@@ -92,6 +99,7 @@ sub handler {
&course_details($r,$codedom,$formname,$domdesc,\@trails,\%allitems,\@codetitles);
} else {
my ($catlinks,$has_subcats,$selitem) = &category_breadcrumbs($codedom,@cats);
+ my $wasacctext = &get_wasactive_text();
my $catjs = <<"ENDSCRIPT";
function setCatDepth(depth) {
@@ -114,7 +122,36 @@ function setCourseId(caller) {
}
ENDSCRIPT
- $catjs .= &courselink_javascript();
+ $catjs .= &courselink_javascript();
+ if (&user_is_dc($codedom)) {
+ $catjs .= <
');
- 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('');
+ $r->print(
+ &Apache::lonhtmlcommon::breadcrumbs('Course/Community Catalog').
+ ''.
+ (($env{'form.currcat_0'} eq 'communities::0') ?
+ &mt('Detailed community information:') :
+ &mt('Detailed course information:')).
+ '
'.
+ &print_course_listing($codedom,undef,$trails,$allitems,undef,$codetitles).
+ '
'.
+ '');
return;
}
@@ -262,11 +298,17 @@ sub instcode_course_selector {
my ($jscript,$totcodes,$numtitles,$lasttitle) =
&Apache::courseclassifier::instcode_selectors_data($codedom,$formname,
\%cat_items,$codetitles,\%cat_titles,\%cat_order);
- my $js = '';
+ my $js = '';
if ($totcodes) {
if (($env{'form.state'} eq 'listing') && ($numtitles > 0)) {
- $add_entries{'onLoad'} = 'setElements()';
+ $add_entries{'onLoad'} = 'setElements();';
+ }
+ if (&user_is_dc($codedom)) {
+ $add_entries{'onLoad'} .= ' toggleStatuses();toggleWasActive();'
}
&cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles);
my $cat_maxdepth = $env{'form.catalog_maxdepth'};
@@ -288,7 +330,7 @@ sub instcode_course_selector {
'
');
} else {
- $js = '';
+ $js = '';
&cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles);
my $cat_maxdepth = $env{'form.catalog_maxdepth'};
$r->print('