--- loncom/interface/coursecatalog.pm 2006/09/13 21:35:46 1.4 +++ loncom/interface/coursecatalog.pm 2006/12/05 02:55:51 1.11 @@ -28,11 +28,11 @@ use strict; use lib qw(/home/httpd/lib/perl); use Apache::Constants qw(:common); use Apache::loncommon; +use Apache::lonhtmlcommon; use Apache::lonnet; use Apache::lonlocal; -use Apache::lonsupportreq; +use Apache::courseclassifier; use Apache::lonacc; -use lib '/home/httpd/lib/perl/'; use LONCAPA; sub handler { @@ -42,11 +42,66 @@ 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) { + my $handle=&LONCAPA::clean_handle($lonid->value); + } + 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']); my $codedom = $Apache::lonnet::perlvar{'lonDefDomain'}; - my $ccode = ''; + my $formname = 'coursecatalog'; + my $domdesc = $Apache::lonnet::domaindescription{$codedom}; + + &Apache::lonhtmlcommon::clear_breadcrumbs(); + if ($env{'form.coursenum'} ne '' && &user_is_known()) { + &course_details($r,$codedom,$formname,$domdesc); + } else { + &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; +} + +sub course_details { + my ($r,$codedom,$formname,$domdesc) = @_; + my $output; + my %add_entries = (topmargin => "0", + marginheight => "0",); + my $start_page = + &Apache::loncommon::start_page('Course Catalog','', + { + 'add_entries' => \%add_entries, + 'no_inline_link' => 1,}); + $r->print($start_page); + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>"/adm/coursecatalog", + text=>"Select courses"}, + {href=>"javascript:document.$formname.submit()", + text=>"Course listing"}, + {text=>"Course details"}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Details')); + $r->print(''.&mt('Detailed course information:').''. + '