+$lt{'ifyo'}
+
+END
+}
+
sub courselink_javascript {
return <<"END";
@@ -250,7 +435,7 @@ END
}
sub instcode_course_selector {
- my ($r,$codedom,$formname,$domdesc,$catlinks,$catjs,$codetitles) = @_;
+ my ($r,$codedom,$formname,$domdesc,$catlinks,$catjs,$codetitles,$cattype,$canviewall) = @_;
my %coursecodes = ();
my %codes = ();
my %cat_titles = ();
@@ -263,19 +448,25 @@ sub instcode_course_selector {
my ($jscript,$totcodes,$numtitles,$lasttitle) =
&Apache::courseclassifier::instcode_selectors_data($codedom,$formname,
\%cat_items,$codetitles,\%cat_titles,\%cat_order);
- my $js = '';
+ my $js = '';
if ($totcodes) {
if (($env{'form.state'} eq 'listing') && ($numtitles > 0)) {
- $add_entries{'onLoad'} = 'setElements()';
+ $add_entries{'onload'} = 'setElements();';
+ }
+ if (&user_is_dc($codedom) || $canviewall) {
+ $add_entries{'onload'} .= ' toggleStatuses();toggleWasActive();'
}
- &cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles);
+ &cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles,$cattype);
my $cat_maxdepth = $env{'form.catalog_maxdepth'};
$r->print('
');
} else {
- $js = '';
- &cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles);
+ $js = '';
+ &cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles,$cattype);
my $cat_maxdepth = $env{'form.catalog_maxdepth'};
$r->print('');
}
@@ -380,8 +570,6 @@ sub category_breadcrumbs {
if (($env{'form.currcat_0'} ne '') &&
($env{'form.currcat_0'} ne 'instcode::0')) {
$catlinks .= $crumbsymbol;
- } else {
- $catlinks .= '';
}
}
} else {
@@ -499,9 +687,14 @@ sub get_depth_values {
}
sub additional_filters {
- my ($codedom,$has_subcats) = @_;
- my $output = '
';
- if (($env{'form.currcat_0'} ne 'instcode::0') &&
+ my ($codedom,$has_subcats,$canviewall) = @_;
+ my $is_dc = &user_is_dc($codedom);
+ my $output = '
';
+ if ($is_dc || $canviewall) {
+ $output .= '
'.
+ '';
return $output;
}
@@ -581,6 +873,56 @@ 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');
+ my %status_title;
+ if ($caller eq 'filters') {
+ %status_title = &Apache::lonlocal::texthash(
+ Previous => 'Show count for past access',
+ Active => 'Show count for current student access',
+ Future => 'Show count for future student access',
+ );
+ if ($env{'form.currcat_0'} eq 'communities::0') {
+ $status_title{'Active'} = 'Show count for current member access';
+ $status_title{'Future'} = 'Show count for future member access';
+ }
+ } else {
+ %status_title = &Apache::lonlocal::texthash(
+ Previous => 'Previous access',
+ Active => 'Current access',
+ Future => 'Future access',
+ );
+ }
+ return (\%status_title,\@status_order);
+}
+
+sub get_wasactive_text {
+ my $wasacctext = ' -- ';
+ if ($env{'form.currcat_0'} eq 'communities::0') {
+ $wasacctext .= &mt('where member access status was current ...');
+ } else {
+ $wasacctext .= &mt('where student access status was current ...');
+ }
+ return $wasacctext;
+}
+
sub search_official_courselist {
my ($domain,$numtitles,$codetitles) = @_;
my $instcode = &Apache::courseclassifier::instcode_search_str($domain,$numtitles,$codetitles);
@@ -640,12 +982,13 @@ sub search_courselist {
}
sub print_course_listing {
- my ($domain,$numtitles,$trails,$allitems,$subcats,$codetitles) = @_;
+ my ($domain,$numtitles,$trails,$allitems,$subcats,$codetitles,$canviewall) = @_;
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;
}
@@ -655,11 +998,13 @@ 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 {
+ } else {
$output .= &mt('The courseID provided does not match a course in this domain.');
}
+ $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.');
} 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.')
.'