--- loncom/interface/coursecatalog.pm 2010/08/20 03:59:11 1.53.4.6 +++ loncom/interface/coursecatalog.pm 2012/10/04 13:41:10 1.71 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler for displaying the course catalog interface # -# $Id: coursecatalog.pm,v 1.53.4.6 2010/08/20 03:59:11 raeburn Exp $ +# $Id: coursecatalog.pm,v 1.71 2012/10/04 13:41:10 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -87,8 +87,9 @@ sub handler { } &Apache::loncommon::extract_categories($cathash,\@cats,\@trails,\%allitems, \%idx,\@jsarray,$subcats); + my ($numtitles,@codetitles); if ($env{'form.coursenum'} ne '' && &user_is_known()) { - &course_details($r,$codedom,$formname,$domdesc,\@trails,\%allitems); + &course_details($r,$codedom,$formname,$domdesc,\@trails,\%allitems,\@codetitles); } else { my ($catlinks,$has_subcats,$selitem) = &category_breadcrumbs($codedom,@cats); my $catjs = <<"ENDSCRIPT"; @@ -114,12 +115,12 @@ function setCourseId(caller) { ENDSCRIPT $catjs .= &courselink_javascript(); - my $numtitles; if ($env{'form.currcat_0'} eq 'instcode::0') { $numtitles = &instcode_course_selector($r,$codedom,$formname,$domdesc, - $catlinks,$catjs); + $catlinks,$catjs,\@codetitles); if ($env{'form.state'} eq 'listing') { - $r->print(&print_course_listing($codedom,$numtitles)); + $r->print(&print_course_listing($codedom,$numtitles,undef,undef,undef, + \@codetitles)); } } else { my (%add_entries); @@ -164,7 +165,7 @@ ENDJS $display_button.'" />

'); } if ($env{'form.state'} eq 'listing') { - $r->print(&print_course_listing($codedom,undef,\@trails,\%allitems,$subcats)); + $r->print(&print_course_listing($codedom,undef,\@trails,\%allitems,$subcats,\@codetitles)); } } } @@ -173,7 +174,7 @@ ENDJS } sub course_details { - my ($r,$codedom,$formname,$domdesc,$trails,$allitems) = @_; + my ($r,$codedom,$formname,$domdesc,$trails,$allitems,$codetitles) = @_; my $output; my %add_entries = (topmargin => "0", marginheight => "0",); @@ -181,9 +182,7 @@ sub course_details { &courselink_javascript().''."\n"; my $start_page = &Apache::loncommon::start_page('Course/Community Catalog',$js, - { - 'add_entries' => \%add_entries, - 'no_inline_link' => 1,}); + {'add_entries' => \%add_entries, }); $r->print($start_page); if ($env{'form.numtitles'} > 0) { &Apache::lonhtmlcommon::add_breadcrumb @@ -208,7 +207,7 @@ sub course_details { $r->print(&mt('Detailed course information:')); } $r->print('

'. - &print_course_listing($codedom,undef,$trails,$allitems). + &print_course_listing($codedom,undef,$trails,$allitems,undef,$codetitles). '

'); $r->print('
'. ''); @@ -250,10 +249,9 @@ END } sub instcode_course_selector { - my ($r,$codedom,$formname,$domdesc,$catlinks,$catjs) = @_; + my ($r,$codedom,$formname,$domdesc,$catlinks,$catjs,$codetitles) = @_; my %coursecodes = (); my %codes = (); - my @codetitles = (); my %cat_titles = (); my %cat_order = (); my %cat_items; @@ -263,7 +261,7 @@ sub instcode_course_selector { marginheight => "0",); my ($jscript,$totcodes,$numtitles,$lasttitle) = &Apache::courseclassifier::instcode_selectors_data($codedom,$formname, - \%cat_items,\@codetitles,\%cat_titles,\%cat_order); + \%cat_items,$codetitles,\%cat_titles,\%cat_order); my $js = ''; if ($totcodes) { @@ -280,12 +278,11 @@ sub instcode_course_selector { if ($numtitles > 0) { $r->print(''.&mt('Choose which course(s) to list.').'
'. &Apache::courseclassifier::build_instcode_selectors($numtitles, - $lasttitle,\%cat_items,\@codetitles,\%cat_titles,\%cat_order)); + $lasttitle,\%cat_items,$codetitles,\%cat_titles,\%cat_order)); } $r->print(''."\n". ''."\n". ''."\n". - ''."\n". ''. 'print(&Apache::lonhtmlcommon::breadcrumbs('Course/Community Catalog')); - my $onchange; - unless (($env{'browser.interface'} eq 'textual') || ($env{'form.interface'} eq 'textual')) { - $onchange = 'this.form.submit()'; - } + my $onchange = 'this.form.submit()'; $r->print(''. ''; - } else { + } else { $output .= - ''. + ''. ''. ''; } @@ -1024,7 +1022,13 @@ sub courseinfo_row { if (($info->{'selfenroll_start'} > 0) && ($info->{'selfenroll_start'} > $now)) { $output .= ''; } else { - $output .= ''; + $output .= ''; } $selfenroll = 1; }
'.&mt('Domain:').''. &Apache::loncommon::select_dom_form($codedom,'showdom','',1,$onchange)); @@ -387,7 +379,7 @@ sub category_breadcrumbs { } else { $catlinks .= &mt('Official courses (with institutional codes)'); $env{'form.currcat_0'} = 'instcode::0'; - $currcat_str .= ''; + $currcat_str .= ''; } if ($deeper) { for (my $i=1; $i<=$deeper; $i++) { @@ -402,7 +394,7 @@ sub category_breadcrumbs { $catlinks .= ''; for (my $j=0; $j<@{$cats[$shallower]{$container}}; $j++) { my $name = $cats[$shallower]{$container}[$j]; - my $item = &escape($name).':'.$container.':'.$shallower; + my $item = &escape($name).':'.&escape($container).':'.$shallower; my $selected = ''; if ($item eq $env{'form.currcat_'.$shallower}) { $selected = ' selected="selected"'; @@ -530,9 +522,9 @@ sub additional_filters { } my $selfenroll_text; if ($env{'form.currcat_0'} eq 'communities::0') { - $selfenroll_text = &mt('Only show communities which allow self-enrollment'); + $selfenroll_text = &mt('Only show communities which currently allow self-enrollment (or will allow it in the future)'); } else { - $selfenroll_text = &mt('Only show courses which allow self-enrollment'); + $selfenroll_text = &mt('Only show courses which currently allow self-enrollment (or will allow it in the future)'); } $output .= '
'. ''.$accessdates.''.$accessdates.''.$accessdates.''.$counts.''.$autoenrollment.''.&mt('Starts: [_1]',''.$showstart.'').'
'.&mt('Ends: [_1]',''.$showend.'').'
'.&mt('Enroll in course').''.&mt('Enroll in course').'
'; + if ($info->{'selfenroll_end'} == 0) { + $output .= &mt('Available permanently'); + } elsif ($info->{'selfenroll_end'} > $now) { + $output .= &mt('Self-enrollment ends: [_1]',''.$showend.''); + } + $output .= '