version 1.2, 2006/08/29 21:20:05
|
version 1.5, 2006/09/25 00:16:56
|
Line 60 sub handler {
|
Line 60 sub handler {
|
my $totcodes = 0; |
my $totcodes = 0; |
my $jscript = ''; |
my $jscript = ''; |
my $formname = 'coursecatalog'; |
my $formname = 'coursecatalog'; |
|
my $domdesc = $Apache::lonnet::domaindescription{$codedom}; |
$totcodes = &Apache::lonsupportreq::retrieve_instcodes(\%coursecodes,$codedom,$totcodes); |
$totcodes = &Apache::lonsupportreq::retrieve_instcodes(\%coursecodes,$codedom,$totcodes); |
if ($totcodes > 0) { |
if ($totcodes > 0) { |
if ($ccode eq '') { |
if ($ccode eq '') { |
Line 108 function changeSort(caller) {
|
Line 109 function changeSort(caller) {
|
$r->print($start_page); |
$r->print($start_page); |
|
|
my $numtitles = @codetitles; |
my $numtitles = @codetitles; |
my $domdesc = $Apache::lonnet::domaindescription{$codedom}; |
|
$r->print('<h3>'.&mt('Display information about official [_1] classes for which LON-CAPA courses have been created:',$domdesc).'</h3>'); |
$r->print('<h3>'.&mt('Display information about official [_1] classes for which LON-CAPA courses have been created:',$domdesc).'</h3>'); |
$r->print(&mt('<b>Choose which course(s) to list.</b><br />')); |
$r->print(&mt('<b>Choose which course(s) to list.</b><br />')); |
$r->print('<form name="coursecatalog" method="post">'); |
$r->print('<form name="coursecatalog" method="post">'); |
Line 123 function changeSort(caller) {
|
Line 123 function changeSort(caller) {
|
my @items = (); |
my @items = (); |
my @longitems = (); |
my @longitems = (); |
if ($idlist{$codetitles[0]} =~ /","/) { |
if ($idlist{$codetitles[0]} =~ /","/) { |
@items = split/","/,$idlist{$codetitles[0]}; |
@items = split(/","/,$idlist{$codetitles[0]}); |
} else { |
} else { |
$items[0] = $idlist{$codetitles[0]}; |
$items[0] = $idlist{$codetitles[0]}; |
} |
} |
if (defined($idlist_titles{$codetitles[0]})) { |
if (defined($idlist_titles{$codetitles[0]})) { |
if ($idlist_titles{$codetitles[0]} =~ /","/) { |
if ($idlist_titles{$codetitles[0]} =~ /","/) { |
@longitems = split/","/,$idlist_titles{$codetitles[0]}; |
@longitems = split(/","/,$idlist_titles{$codetitles[0]}); |
} else { |
} else { |
$longitems[0] = $idlist_titles{$codetitles[0]}; |
$longitems[0] = $idlist_titles{$codetitles[0]}; |
} |
} |
Line 163 function changeSort(caller) {
|
Line 163 function changeSort(caller) {
|
} |
} |
} |
} |
$r->print('<br /><input type="hidden" name="state" value="listing" /><input type="hidden" name="sortby" value="" /><input type="submit" name="catalogfilter" value="'.&mt('Display courses').'" /></form>'); |
$r->print('<br /><input type="hidden" name="state" value="listing" /><input type="hidden" name="sortby" value="" /><input type="submit" name="catalogfilter" value="'.&mt('Display courses').'" /></form>'); |
|
} else { |
|
$r->print(&Apache::loncommon::start_page('Course Catalog','', |
|
{ |
|
'no_inline_link' => 1,})); |
|
$r->print('<br />'.&mt('No official courses to display for [_1].',$domdesc)); |
} |
} |
if ($env{'form.state'} eq 'listing') { |
if ($env{'form.state'} eq 'listing') { |
$r->print('<br /><br >'.&print_course_listing($codedom)); |
$r->print('<br /><br />'.&print_course_listing($codedom)); |
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
|
return OK; |
} |
} |
|
|
sub print_course_listing { |
sub print_course_listing { |
Line 220 sub print_course_listing {
|
Line 226 sub print_course_listing {
|
$cleandesc=~s/'/\\'/g; |
$cleandesc=~s/'/\\'/g; |
my ($cdom,$cnum)=split(/\_/,$course); |
my ($cdom,$cnum)=split(/\_/,$course); |
|
|
my ($desc,$instcode,$owner,$ttype) = split/:/,$courses{$course}; |
my ($desc,$instcode,$owner,$ttype) = split(/:/,$courses{$course}); |
$owner = &unescape($owner); |
$owner = &unescape($owner); |
my ($ownername,$ownerdom); |
my ($ownername,$ownerdom); |
if ($owner =~ /:/) { |
if ($owner =~ /:/) { |
Line 290 sub courseinfo_row {
|
Line 296 sub courseinfo_row {
|
my @classids; |
my @classids; |
my @crosslistings; |
my @crosslistings; |
$idx{'status'} = &Apache::loncoursedata::CL_STATUS(); |
$idx{'status'} = &Apache::loncoursedata::CL_STATUS(); |
my %status_title = &Apache::lonlocal::texthash ( |
my %status_title = &Apache::lonlocal::texthash( |
Expired => 'Previous access', |
Expired => 'Previous access', |
Active => 'Current access', |
Active => 'Current access', |
Future => 'Future access', |
Future => 'Future access', |
Line 300 sub courseinfo_row {
|
Line 306 sub courseinfo_row {
|
Active => 0, |
Active => 0, |
Future => 0, |
Future => 0, |
); |
); |
while (my ($student,$data) = each %$classlist) { |
while (my ($student,$data) = each(%$classlist)) { |
$student_count{$data->[$idx{'status'}]} ++; |
$student_count{$data->[$idx{'status'}]} ++; |
} |
} |
my $seclist = &identify_sections($coursehash{'internal.sectionnums'}); |
my $seclist = &identify_sections($coursehash{'internal.sectionnums'}); |
Line 387 sub identify_sections {
|
Line 393 sub identify_sections {
|
my ($seclist) = @_; |
my ($seclist) = @_; |
my @secnums; |
my @secnums; |
if ($seclist =~ /,/) { |
if ($seclist =~ /,/) { |
my @sections = split/,/,$seclist; |
my @sections = split(/,/,$seclist); |
foreach my $sec (@sections) { |
foreach my $sec (@sections) { |
$sec =~ s/:[^:]*$//; |
$sec =~ s/:[^:]*$//; |
push(@secnums,$sec); |
push(@secnums,$sec); |
Line 395 sub identify_sections {
|
Line 401 sub identify_sections {
|
} else { |
} else { |
if ($seclist =~ m/^([^:]+):/) { |
if ($seclist =~ m/^([^:]+):/) { |
my $sec = $1; |
my $sec = $1; |
if (!grep/^$sec$/,@secnums) { |
if (!grep(/^\Q$sec\E$/,@secnums)) { |
push (@secnums,$sec); |
push(@secnums,$sec); |
} |
} |
} |
} |
} |
} |
Line 415 sub get_valid_classes {
|
Line 421 sub get_valid_classes {
|
if ($seclist) { |
if ($seclist) { |
foreach my $sec (split(',',$seclist)) { |
foreach my $sec (split(',',$seclist)) { |
my $class = $crscode.$sec; |
my $class = $crscode.$sec; |
if (&Apache::lonnet::autovalidate_class_sec($cdom,$cnum,$owner, |
if (&Apache::lonnet::auto_validate_class_sec($cdom,$cnum,$owner, |
$class) eq 'ok') { |
$class) eq 'ok') { |
if (!grep(/^\Q$sec$\E/,@{$validations{'sections'}})) { |
if (!grep(/^\Q$sec$\E/,@{$validations{'sections'}})) { |
push (@{$validations{'sections'}},$sec); |
push(@{$validations{'sections'}},$sec); |
$totalitems ++; |
$totalitems ++; |
} |
} |
} |
} |
Line 426 sub get_valid_classes {
|
Line 432 sub get_valid_classes {
|
} |
} |
if ($xlist_items) { |
if ($xlist_items) { |
foreach my $item (split(',',$xlist_items)) { |
foreach my $item (split(',',$xlist_items)) { |
if (&Apache::lonnet::autovalidate_class_sec($cdom,$cnum,$owner, |
if (&Apache::lonnet::auto_validate_class_sec($cdom,$cnum,$owner, |
$item) eq 'ok') { |
$item) eq 'ok') { |
if (!grep(/^\Q$item$\E/,@{$validations{'xlists'}})) { |
if (!grep(/^\Q$item$\E/,@{$validations{'xlists'}})) { |
push (@{$validations{'xlists'}},$item); |
push(@{$validations{'xlists'}},$item); |
$totalitems ++; |
$totalitems ++; |
} |
} |
} |
} |