--- loncom/interface/coursecatalog.pm 2007/01/08 15:54:56 1.15 +++ loncom/interface/coursecatalog.pm 2007/01/10 03:57:51 1.16 @@ -66,7 +66,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 +236,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 +259,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 +385,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 +405,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.

'); } } - $output .= &construct_data_table($knownuser,\%courses,$env{'form.coursenum'}); - $output .= &Apache::lonhtmlcommon::echo_form_input(['coursenum','state','catalogfilter','sortby']); + $output .= &construct_data_table($knownuser,\%courses,$details); + $output .= &Apache::lonhtmlcommon::echo_form_input(['coursenum','state','catalogfilter','sortby','showdetails']); return $output; } sub construct_data_table { my ($knownuser,$courses,$details,$usersections) = @_; my %sortname; - if ($details eq '') { + if (($details eq '') || ($env{'form.showdetails'})) { $sortname{'Code'} = 'code'; $sortname{'Title'} = 'title'; $sortname{'Owner'} = 'owner';