';
return ($catlinks,$has_subcats,$selitem);
}
+sub main_category_selector {
+ my (@cats) = @_;
+ my $maincatlinks = ''."\n";
+ if (ref($cats[0]) eq 'ARRAY') {
+ if (@{$cats[0]} > 1) {
+ my $selected = '';
+ if ($env{'form.currcat_0'} eq '') {
+ $selected = ' selected="selected"';
+ }
+ $maincatlinks .=
+ ''."\n";
+ }
+ for (my $i=0; $i<@{$cats[0]}; $i++) {
+ my $name = $cats[0][$i];
+ my $item = &escape($name).'::0';
+ my $selected;
+ if ($env{'form.currcat_0'} eq $item) {
+ $selected = ' selected="selected"';
+ }
+ $maincatlinks .= ''."\n";
+ }
+ $maincatlinks .= ''."\n";
+ }
+ return $maincatlinks;
+}
+
sub get_depth_values {
my $currdepth = 0;
my $deeper = 0;
@@ -475,10 +507,15 @@ sub additional_filters {
if ($env{'form.showselfenroll'}) {
$show_selfenroll_status = 'checked="checked" ';
}
+ my $selfenroll_text;
+ if ($env{'form.currcat_0'} eq 'communities::0') {
+ $selfenroll_text = &mt('Only show communities which allow self-enrollment');
+ } else {
+ $selfenroll_text = &mt('Only show courses which allow self-enrollment');
+ }
$output .= '
'.
'
';
if (&user_is_dc($codedom)) {
my $showdetails_status;
@@ -490,14 +527,20 @@ sub additional_filters {
$showhidden_status = 'checked="checked" ';
}
my $dc_title = &Apache::lonnet::plaintext('dc');
+ my ($details_text,$hidden_text);
+ if ($env{'form.currcat_0'} eq 'communities::0') {
+ $details_text = &mt('Show full details for each community ([_1] only)',$dc_title);
+ $hidden_text = &mt('Include communities set to be hidden from catalog ([_1] only)',$dc_title);
+ } else {
+ $details_text = &mt('Show full details for each course ([_1] only)',$dc_title);
+ $hidden_text = &mt('Include courses set to be hidden from catalog ([_1] only)',$dc_title);
+ }
$output .= '
'."\n".
''."\n".'
'.
''."\n".'
';
}
$output .= '
';
@@ -558,13 +601,18 @@ sub search_courselist {
} else {
$filterstr = $filter;
}
- my $showhidden;
+ my ($showhidden,$typefilter);
if (&user_is_dc($domain)) {
$showhidden = $env{'form.showhidden'};
}
+ if ($env{'form.currcat_0'} eq 'communities::0') {
+ $typefilter = 'Community';
+ } else {
+ $typefilter = '.';
+ }
%courses =
&Apache::lonnet::courseiddump($domain,'.',1,'.','.','.',undef,undef,
- '.',1,$env{'form.showselfenroll'},
+ $typefilter,1,$env{'form.showselfenroll'},
$filterstr,$showhidden,'coursecatalog');
}
return %courses;
@@ -596,7 +644,11 @@ sub print_course_listing {
%courses = &search_courselist($domain,$subcats);
}
if (keys(%courses) == 0) {
- $output = &mt('No courses match the criteria you selected.');
+ if ($env{'form.currcat_0'} eq 'communities::0') {
+ $output = &mt('No communities match the criteria you selected.');
+ } else {
+ $output = &mt('No courses match the criteria you selected.');
+ }
return $output;
}
if (($knownuser) && (!$env{'form.showdetails'}) && (!&user_is_dc($domain))) {