';
@@ -566,6 +1057,8 @@ sub additional_filters {
my $selfenroll_text;
if ($env{'form.currcat_0'} eq 'communities::0') {
$selfenroll_text = &mt('Only show communities which currently allow self-enrollment (or will allow it in the future)');
+ } elsif ($env{'form.currcat_0'} eq 'placement::0') {
+ $selfenroll_text = &mt('Only show placement tests which currently allow self-enrollment (or will allow it in the future)');
} else {
$selfenroll_text = &mt('Only show courses which currently allow self-enrollment (or will allow it in the future)');
}
@@ -573,7 +1066,7 @@ sub additional_filters {
' ';
- if ($is_dc) {
+ if ($is_dc || $canviewall) {
my ($titlesref,$orderref) = &get_statustitles('filters');
my $showdetails_status;
if ($env{'form.showdetails'}) {
@@ -584,7 +1077,6 @@ sub additional_filters {
$showhidden_status = 'checked="checked" ';
}
my @currstatuses = &Apache::loncommon::get_env_multiple('form.showcounts');
- my $dc_title = &Apache::lonnet::plaintext('dc');
my ($details_text,$hidden_text,$statusdisplay,$cellborder);
my $wasactivedisplay = 'none';
if ($env{'form.showdetails'}) {
@@ -598,17 +1090,22 @@ sub additional_filters {
$cellborder = 'border-left: 0px';
}
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);
+ $details_text = &mt('Show full details for each community (domain staff only)');
+ $hidden_text = &mt('Include communities set to be hidden from catalog (domain staff only)');
+ } elsif ($env{'form.currcat_0'} eq 'placement::0') {
+ $details_text = &mt('Show full details for each placement test (domain staff only)');
+ $hidden_text = &mt('Include placement tests set to be hidden from catalog (domain staff only)');
} 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);
+ $details_text = &mt('Show full details for each course (domain staff only)');
+ $hidden_text = &mt('Include courses set to be hidden from catalog (domain staff only)');
+ }
+ if ($is_dc) {
+ $output .= ''.
+ ' '."\n";
}
$output .= ''.
- ' '."\n".
- ''.
' | '."\n".
@@ -714,6 +1211,22 @@ sub user_is_dc {
return;
}
+sub canview_all {
+ my ($knownuser,$codedom) = @_;
+ my $canviewall = 0;
+ my $page = 'coursecatalog';
+ if (&LONCAPA::lonauthcgi::can_view($page)) {
+ $canviewall = 1;
+ } elsif (&LONCAPA::lonauthcgi::check_ipbased_access($page)) {
+ $canviewall= 1;
+ } elsif (($knownuser) && ($codedom ne '')) {
+ if (&Apache::lonnet::allowed('dcd',$codedom)) {
+ $canviewall = 1;
+ }
+ }
+ return $canviewall;
+}
+
sub get_statustitles {
my ($caller) = @_;
my @status_order = ('Active','Future','Previous');
@@ -795,6 +1308,8 @@ sub search_courselist {
}
if ($env{'form.currcat_0'} eq 'communities::0') {
$typefilter = 'Community';
+ } elsif ($env{'form.currcat_0'} eq 'placement::0') {
+ $typefilter = 'Placement';
} else {
$typefilter = '.';
}
@@ -807,12 +1322,13 @@ sub search_courselist {
}
sub print_course_listing {
- my ($domain,$numtitles,$trails,$allitems,$subcats,$codetitles) = @_;
+ my ($domain,$numtitles,$trails,$allitems,$subcats,$codetitles,$canviewall,$hostname) = @_;
my $output;
my %courses;
my $knownuser = &user_is_known();
+ my $canviewall = &canview_all();
my $details = $env{'form.coursenum'};
- if (&user_is_dc($domain)) {
+ if (&user_is_dc($domain) || $canviewall) {
if ($env{'form.showdetails'}) {
$details = 1;
}
@@ -822,11 +1338,15 @@ sub print_course_listing {
$env{'form.coursenum'},
undef,undef,'.',1);
if (keys(%courses) == 0) {
+ $output = '';
if ($env{'form.currcat_0'} eq 'communities::0') {
$output .= &mt('The courseID provided does not match a community in this domain.');
- } else {
+ } elsif ($env{'form.currcat_0'} eq 'placement::0') {
+ $output .= &mt('The courseID provided does not match a placement test in this domain.');
+ } else {
$output .= &mt('The courseID provided does not match a course in this domain.');
}
+ $output .= '
';
return $output;
}
} else {
@@ -836,30 +1356,26 @@ sub print_course_listing {
%courses = &search_courselist($domain,$subcats);
}
if (keys(%courses) == 0) {
+ $output = '';
if ($env{'form.currcat_0'} eq 'communities::0') {
- $output =
- '
'
- .&mt('No communities match the criteria you selected.')
- .'
';
+ $output .= &mt('No communities match the criteria you selected.');
+ } elsif ($env{'form.currcat_0'} eq 'placement::0') {
+ $output .= &mt('No placement tests match the criteria you selected.');
} else {
- $output =
- ''
- .&mt('No courses match the criteria you selected.')
- .'
';
+ $output .= &mt('No courses match the criteria you selected.');
}
+ $output .= '';
return $output;
}
- if (($knownuser) && (!$env{'form.showdetails'}) && (!&user_is_dc($domain))) {
+ if (($knownuser) && (!$env{'form.showdetails'}) && (!&user_is_dc($domain)) && (!$canviewall)) {
$output = ''.&mt('Note for students:').' '
.&mt('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.')
.'
';
}
}
my $now = time;
- my %domconfig =
- &Apache::lonnet::get_dom('configuration',['usercreation'],$domain);
$output .= &construct_data_table($knownuser,$domain,\%courses,$details,undef,
- $now,\%domconfig,$trails,$allitems);
+ $now,$trails,$allitems,$canviewall,$hostname);
$output .= "\n".'