--- loncom/interface/coursecatalog.pm 2006/10/16 19:39:51 1.7 +++ loncom/interface/coursecatalog.pm 2006/10/17 18:11:46 1.8 @@ -42,6 +42,17 @@ sub handler { if ($r->header_only) { return OK; } + my %cookies=CGI::Cookie->parse($r->header_in('Cookie')); + my $lonid=$cookies{'lonID'}; + my $lonidsdir=$r->dir_config('lonIDsDir'); + my $handle; + if ($lonid) { + $handle=$lonid->value; + $handle=~s/\W//g; + } + if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) { + &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle); + } &Apache::lonacc::get_posted_cgi($r); &Apache::lonlocal::get_language_handle($r); &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['sortby']); @@ -50,7 +61,7 @@ sub handler { my $domdesc = $Apache::lonnet::domaindescription{$codedom}; &Apache::lonhtmlcommon::clear_breadcrumbs(); - if ($env{'form.coursenum'} ne '') { + if ($env{'form.coursenum'} ne '' && &user_is_known()) { &course_details($r,$codedom,$formname,$domdesc); } else { &course_selector($r,$codedom,$formname,$domdesc); @@ -369,7 +380,9 @@ sub print_course_listing { $output = &mt('No courses match the criteria you selected.'); return $output; } - $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.

'); + if (&user_is_known()) { + $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 .= &Apache::loncommon::start_data_table(). &Apache::loncommon::start_data_table_header_row(); @@ -389,13 +402,15 @@ sub print_course_listing { } $output .= ''; } - if ($env{'form.coursenum'} eq '') { - $output .= ' '; - } else { - $output .= + if (&user_is_known()) { + if ($env{'form.coursenum'} eq '') { + $output .= ' '; + } else { + $output .= ''.&mt('Default Access Dates for Students').''. ''.&mt('Student Counts').''. ''.&mt('Auto-enrollment of
registered students').''; + } } &Apache::loncommon::end_data_table_header_row(); my %courseinfo = &build_courseinfo_hash(%courses); @@ -573,13 +588,15 @@ sub courseinfo_row { } $output .= ''. ''.$ownerlast.''; - if ($env{'form.coursenum'} eq '') { - $output .= "".&mt('Show more details').''; - } else { - $output .= + if (&user_is_known()) { + if ($env{'form.coursenum'} eq '') { + $output .= "".&mt('Show more details').''; + } else { + $output .= ''.$accessdates.''. ''.$counts.''. ''.$autoenrollment.''; + } } return $output; } @@ -821,4 +838,13 @@ sub autoenroll_info { return $autoenrolldates; } +sub user_is_known { + my $known = 0; + if ($env{'user.name'} ne '' && $env{'user.name'} ne 'public' + && $env{'user.domain'} ne '' && $env{'user.domain'} ne 'public') { + $known = 1; + } + return $known; +} + 1;