--- loncom/interface/coursecatalog.pm 2008/06/20 13:45:12 1.31
+++ loncom/interface/coursecatalog.pm 2008/06/27 04:59:45 1.32
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler for displaying the course catalog interface
#
-# $Id: coursecatalog.pm,v 1.31 2008/06/20 13:45:12 bisitz Exp $
+# $Id: coursecatalog.pm,v 1.32 2008/06/27 04:59:45 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -100,7 +100,7 @@ ENDSCRIPT
}
}
}
- $r->print(&Apache::loncommon::end_page());
+ $r->print('
'.&Apache::loncommon::end_page());
return OK;
}
@@ -216,14 +216,47 @@ function setElements() {
$jscript .= qq|
function changeSort(caller) {
document.$formname.sortby.value = caller;
+ copy_filters();
document.$formname.submit();
}
function setCourseId(caller) {
- document.$formname.coursenum.value = caller;
- document.$formname.submit();
+ document.$formname.coursenum.value = caller;
+ copy_filters();
+ document.$formname.submit();
}\n|;
}
}
+ $jscript .= qq|
+function copy_filters() {
+ if (document.coursecats.showselfenroll.checked) {
+ document.$formname.showselfenroll.value = '1';
+ } else {
+ document.$formname.showselfenroll.value = '';
+ }
+|;
+ if (&user_is_dc($codedom)) {
+ $jscript .= qq|
+ if (document.coursecats.showhidden.checked) {
+ document.$formname.showhidden.value = '1';
+ } else {
+ document.$formname.showhidden.value = '';
+ }
+ if (document.coursecats.showdetails.checked) {
+ document.$formname.showdetails.value = '1';
+ } else {
+ document.$formname.showdetails.value = '';
+ }
+|;
+ }
+ $jscript .= qq|
+}
+
+function display_courses() {
+ copy_filters();
+ document.$formname.submit();
+}
+
+|;
$js = '';
if (($env{'form.state'} eq 'listing') && ($numtitles > 0)) {
@@ -232,11 +265,16 @@ function setCourseId(caller) {
&cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles);
my $cat_maxdepth = $env{'form.catalog_maxdepth'};
$r->print('
');
@@ -339,9 +362,29 @@ sub cat_header {
''.
- '
');
+ ' '.
+ '
');
return;
}
@@ -349,9 +392,14 @@ sub category_breadcrumbs {
my ($dom) = @_;
my %domconfig =
&Apache::lonnet::get_dom('configuration',['coursecategories'],$dom);
- my (@cats,@trails,%allitems,%idx,@jsarray);
- &Apache::loncommon::extract_categories($domconfig{'coursecategories'},\@cats,\@trails,
- \%allitems,\%idx,\@jsarray);
+ my (@cats,@trails,%allitems,%idx,@jsarray,$cathash);
+ if (ref($domconfig{'coursecategories'}) eq 'HASH') {
+ $cathash = $domconfig{'coursecategories'}{'cats'};
+ } else {
+ $cathash = {};
+ }
+ &Apache::loncommon::extract_categories($cathash,\@cats,\@trails,\%allitems,\%idx,
+ \@jsarray);
my $currdepth = 0;
my $deeper = 0;
my $currcat_str;
@@ -409,7 +457,7 @@ sub category_breadcrumbs {
$catlinks .= ''."\n";
}
$catlinks .= ''."\n".
- ' ';
+ ' ';
}
} else {
$catlinks .= &mt('Official courses (with institutional codes)').
@@ -439,7 +487,7 @@ sub category_breadcrumbs {
$catlinks .= ''."\n";
}
$catlinks .= ''."\n".
- ' ';
+ ' ';
}
}
$catlinks .= $currcat_str.'';
@@ -566,9 +614,14 @@ sub search_official_courselist {
$instcode = '.';
}
}
- my %courses = &Apache::lonnet::courseiddump($domain,'.',1,$instcode,'.','.',
- undef,undef,'Course',1,
- $env{'form.showselfenroll'});
+ my $showhidden;
+ if (&user_is_dc($domain)) {
+ $showhidden = $env{'form.showhidden'};
+ }
+ my %courses =
+ &Apache::lonnet::courseiddump($domain,'.',1,$instcode,'.','.',undef,undef,
+ 'Course',1,$env{'form.showselfenroll'},undef,
+ $showhidden,'coursecatalog');
return %courses;
}
@@ -582,9 +635,14 @@ sub search_courselist {
}
my %courses;
if ($filter ne '') {
- %courses = &Apache::lonnet::courseiddump($domain,'.',1,'.','.','.',
- undef,undef,'Course',1,
- $env{'form.showselfenroll'},$filter);
+ my $showhidden;
+ if (&user_is_dc($domain)) {
+ $showhidden = $env{'form.showhidden'};
+ }
+ %courses =
+ &Apache::lonnet::courseiddump($domain,'.',1,'.','.','.',undef,undef,
+ '.',1,$env{'form.showselfenroll'},
+ $filter,$showhidden,'coursecatalog');
}
return %courses;
}
@@ -618,7 +676,7 @@ sub print_course_listing {
$output = &mt('No courses match the criteria you selected.');
return $output;
}
- if ($knownuser && !$env{'form.showdetails'}) {
+ if (($knownuser) && (!$env{'form.showdetails'}) && (!&user_is_dc($domain))) {
$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.')
.'
';