--- loncom/interface/coursecatalog.pm 2010/04/04 15:38:34 1.60 +++ loncom/interface/coursecatalog.pm 2011/11/21 15:42:59 1.69 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler for displaying the course catalog interface # -# $Id: coursecatalog.pm,v 1.60 2010/04/04 15:38:34 raeburn Exp $ +# $Id: coursecatalog.pm,v 1.69 2011/11/21 15:42:59 raeburn 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",); @@ -192,7 +193,7 @@ sub course_details { my $brtexttwo = 'Course details'; if ($env{'form.currcat_0'} eq 'communities::0') { $brtextone = 'Community listing'; - $brtextone = 'Community details'; + $brtexttwo = 'Community details'; } &Apache::lonhtmlcommon::add_breadcrumb ({href=>"javascript:document.$formname.submit()", @@ -206,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('
'. ''); @@ -248,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; @@ -261,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) { @@ -278,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{'form.interface'} eq 'textual') { - $onchange = 'this.form.submit()'; - } + my $onchange = 'this.form.submit()'; $r->print(''. ''; } else { - $output .= ''; + $output .= ''; } $selfenroll = 1; }
'.&mt('Domain:').''. &Apache::loncommon::select_dom_form($codedom,'showdom','',1,$onchange)); @@ -398,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"'; @@ -526,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 .= '
'. ''.&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 .= '