--- loncom/interface/coursecatalog.pm 2007/01/08 15:54:56 1.15
+++ loncom/interface/coursecatalog.pm 2007/01/12 21:07:37 1.17
@@ -1,3 +1,7 @@
+# The LearningOnline Network with CAPA
+# Handler for displaying the course catalog interface
+#
+# $Id: coursecatalog.pm,v 1.17 2007/01/12 21:07:37 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -66,7 +70,7 @@ sub handler {
&course_selector($r,$codedom,$formname,$domdesc);
if ($env{'form.state'} eq 'listing') {
$r->print('
'.&print_course_listing($codedom).' ');
- }
+ }
}
$r->print(&Apache::loncommon::end_page());
return OK;
@@ -236,6 +240,13 @@ function setCourseId(caller) {
''."\n".''."\n".
''
);
+ if (&user_is_dc($codedom)) {
+ my $showdetails_status;
+ if ($env{'form.showdetails'}) {
+ $showdetails_status = 'checked="checked" ';
+ }
+ $r->print('
'.&mt('Show full details for each course (DC only)').'
');
+ }
$r->print('');
if ($numtitles > 4) {
$r->print('
'.$codetitles[$numtitles-1].' '."\n".
@@ -252,6 +263,18 @@ function setCourseId(caller) {
return;
}
+sub user_is_dc {
+ my ($codedom) = @_;
+ if (exists($env{'user.role.dc./'.$codedom.'/'})) {
+ my $livedc = 1;
+ my $now = time;
+ my ($start,$end)=split(/\./,$env{'user.role.dc./'.$codedom.'/'});
+ if ($start && $start>$now) { $livedc = 0; }
+ if ($end && $end <$now) { $livedc = 0; }
+ return $livedc;
+ }
+ return;
+}
sub recurse_options {
my ($currkey,$currlist,$level,$cat,$cat_options,$data,$by_year,$by_sem,$by_dept) = @_;
@@ -366,6 +389,12 @@ sub print_course_listing {
my $output;
my %courses;
my $knownuser = &user_is_known();
+ my $details = $env{'form.coursenum'};
+ if (&user_is_dc($domain)) {
+ if ($env{'form.showdetails'}) {
+ $details = 1;
+ }
+ }
if ($env{'form.coursenum'} ne '') {
%courses = &Apache::lonnet::courseiddump($domain,'.',1,'.','.',
$env{'form.coursenum'},
@@ -380,19 +409,19 @@ sub print_course_listing {
$output = &mt('No courses match the criteria you selected.');
return $output;
}
- if ($knownuser) {
+ 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.