--- loncom/interface/coursecatalog.pm 2012/10/04 13:41:10 1.71
+++ loncom/interface/coursecatalog.pm 2014/01/15 18:49:19 1.78
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler for displaying the course catalog interface
#
-# $Id: coursecatalog.pm,v 1.71 2012/10/04 13:41:10 bisitz Exp $
+# $Id: coursecatalog.pm,v 1.78 2014/01/15 18:49:19 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -66,13 +66,20 @@ sub handler {
}
my $formname = 'coursecatalog';
if ($env{'form.showdom'} ne '') {
+ $env{'form.showdom'} = &LONCAPA::clean_domain($env{'form.showdom'});
if (&Apache::lonnet::domain($env{'form.showdom'}) ne '') {
$codedom = $env{'form.showdom'};
+ } else {
+ $env{'form.showdom'} = '';
}
}
my $domdesc = &Apache::lonnet::domain($codedom,'description');
&Apache::lonhtmlcommon::clear_breadcrumbs();
+ if ($env{'form.catalog_maxdepth'} ne '') {
+ $env{'form.catalog_maxdepth'} =~ s{\D}{}g;
+ }
+
my %domconfig =
&Apache::lonnet::get_dom('configuration',['coursecategories'],$codedom);
my (@cats,@trails,%allitems,%idx,@jsarray,%subcathash,$cathash);
@@ -92,6 +99,7 @@ sub handler {
&course_details($r,$codedom,$formname,$domdesc,\@trails,\%allitems,\@codetitles);
} else {
my ($catlinks,$has_subcats,$selitem) = &category_breadcrumbs($codedom,@cats);
+ my $wasacctext = &get_wasactive_text();
my $catjs = <<"ENDSCRIPT";
function setCatDepth(depth) {
@@ -114,7 +122,36 @@ function setCourseId(caller) {
}
ENDSCRIPT
- $catjs .= &courselink_javascript();
+ $catjs .= &courselink_javascript();
+ if (&user_is_dc($codedom)) {
+ $catjs .= < ';
if ($env{'form.currcat_0'} eq 'communities::0') {
$output .= &mt('The courseID provided does not match a community in this domain.');
} 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.')
- .' '
- .&mt('No courses match the criteria you selected.')
- .'
');
- if ($env{'form.currcat_0'} eq 'communities::0') {
- $r->print(&mt('Detailed community information:'));
- } else {
- $r->print(&mt('Detailed course information:'));
- }
- $r->print('
'.
- &print_course_listing($codedom,undef,$trails,$allitems,undef,$codetitles).
- '
');
- $r->print('');
+ $r->print(
+ &Apache::lonhtmlcommon::breadcrumbs('Course/Community Catalog').
+ ''.
+ (($env{'form.currcat_0'} eq 'communities::0') ?
+ &mt('Detailed community information:') :
+ &mt('Detailed course information:')).
+ '
'.
+ &print_course_listing($codedom,undef,$trails,$allitems,undef,$codetitles).
+ '
'.
+ '');
return;
}
@@ -266,7 +302,10 @@ sub instcode_course_selector {
'';
if ($totcodes) {
if (($env{'form.state'} eq 'listing') && ($numtitles > 0)) {
- $add_entries{'onLoad'} = 'setElements()';
+ $add_entries{'onLoad'} = 'setElements();';
+ }
+ if (&user_is_dc($codedom)) {
+ $add_entries{'onLoad'} .= ' toggleStatuses();toggleWasActive();'
}
&cat_header($r,$codedom,$js,\%add_entries,$catlinks,$numtitles);
my $cat_maxdepth = $env{'form.catalog_maxdepth'};
@@ -303,7 +342,7 @@ sub instcode_course_selector {
sub cat_header {
my ($r,$codedom,$js,$add_entries,$catlinks,$numtitles) = @_;
my $start_page =
- &Apache::loncommon::start_page('Other',$js,
+ &Apache::loncommon::start_page('Course/Community Catalog',$js,
{ 'add_entries' => $add_entries, });
$r->print($start_page);
my $brtext = 'Course listing';
@@ -372,8 +411,6 @@ sub category_breadcrumbs {
if (($env{'form.currcat_0'} ne '') &&
($env{'form.currcat_0'} ne 'instcode::0')) {
$catlinks .= $crumbsymbol;
- } else {
- $catlinks .= '';
}
}
} else {
@@ -492,8 +529,13 @@ sub get_depth_values {
sub additional_filters {
my ($codedom,$has_subcats) = @_;
- my $output = '';
- if (($env{'form.currcat_0'} ne 'instcode::0') &&
+ my $is_dc = &user_is_dc($codedom);
+ my $output = '
'.
+ '';
return $output;
}
@@ -573,6 +713,40 @@ sub user_is_dc {
return;
}
+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);
@@ -647,11 +821,13 @@ sub print_course_listing {
$env{'form.coursenum'},
undef,undef,'.',1);
if (keys(%courses) == 0) {
+ $output = '