version 1.103, 2021/04/29 17:45:22
|
version 1.107, 2025/02/24 13:40:33
|
Line 337 ENDTOGGJS
|
Line 337 ENDTOGGJS
|
$catlinks,$catjs,\@codetitles,$cattype,$canviewall); |
$catlinks,$catjs,\@codetitles,$cattype,$canviewall); |
if ($env{'form.state'} eq 'listing') { |
if ($env{'form.state'} eq 'listing') { |
$r->print(&print_course_listing($codedom,$numtitles,undef,undef,undef, |
$r->print(&print_course_listing($codedom,$numtitles,undef,undef,undef, |
\@codetitles,$canviewall)); |
\@codetitles,$canviewall,$hostname)); |
} |
} |
} else { |
} else { |
my (%add_entries); |
my (%add_entries); |
Line 357 function check_selected() {
|
Line 357 function check_selected() {
|
} |
} |
ENDJS |
ENDJS |
} |
} |
$catjs = '<script type="text/javascript">'."\n".$catjs."\n".'</script>'; |
my $js = '<script type="text/javascript">'."\n". |
&cat_header($r,$codedom,$catjs,\%add_entries,$catlinks,undef,$cattype); |
'// <![CDATA['."\n". |
|
"$catjs\n". |
|
'// ]]>'."\n". |
|
'</script>'; |
|
&cat_header($r,$codedom,$js,\%add_entries,$catlinks,undef,$cattype); |
if ($env{'form.currcat_0'} ne '') { |
if ($env{'form.currcat_0'} ne '') { |
$r->print('<form name="'.$formname. |
$r->print('<form name="'.$formname. |
'" method="post" action="/adm/coursecatalog">'. |
'" method="post" action="/adm/coursecatalog">'. |
Line 386 ENDJS
|
Line 390 ENDJS
|
} |
} |
if ($env{'form.state'} eq 'listing') { |
if ($env{'form.state'} eq 'listing') { |
$r->print(&print_course_listing($codedom,undef,\@trails,\%allitems,$subcats,\@codetitles, |
$r->print(&print_course_listing($codedom,undef,\@trails,\%allitems,$subcats,\@codetitles, |
$canviewall)); |
$canviewall,$hostname)); |
} |
} |
} |
} |
} |
} |
Line 699 sub course_details {
|
Line 703 sub course_details {
|
$r->print( |
$r->print( |
&Apache::lonhtmlcommon::breadcrumbs('Course/Community Catalog'). |
&Apache::lonhtmlcommon::breadcrumbs('Course/Community Catalog'). |
'<h2>'.$textthree.'</h2>'. |
'<h2>'.$textthree.'</h2>'. |
&print_course_listing($codedom,undef,$trails,$allitems,undef,$codetitles). |
&print_course_listing($codedom,undef,$trails,$allitems,undef,$codetitles,undef,$hostname). |
'<br />'. |
'<br />'. |
'<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'. |
'<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'. |
&Apache::lonhtmlcommon::actionbox([ |
&Apache::lonhtmlcommon::actionbox([ |
Line 1322 sub search_courselist {
|
Line 1326 sub search_courselist {
|
} |
} |
|
|
sub print_course_listing { |
sub print_course_listing { |
my ($domain,$numtitles,$trails,$allitems,$subcats,$codetitles,$canviewall) = @_; |
my ($domain,$numtitles,$trails,$allitems,$subcats,$codetitles,$canviewall,$hostname) = @_; |
my $output; |
my $output; |
my %courses; |
my %courses; |
my $knownuser = &user_is_known(); |
my $knownuser = &user_is_known(); |
Line 1375 sub print_course_listing {
|
Line 1379 sub print_course_listing {
|
} |
} |
my $now = time; |
my $now = time; |
$output .= &construct_data_table($knownuser,$domain,\%courses,$details,undef, |
$output .= &construct_data_table($knownuser,$domain,\%courses,$details,undef, |
$now,$trails,$allitems,$canviewall); |
$now,$trails,$allitems,$canviewall,$hostname); |
$output .= "\n".'<form name="linklaunch" method="post" action="">'. |
$output .= "\n".'<form name="linklaunch" method="post" action="">'. |
'<input type="hidden" name="backto" value="coursecatalog" />'. |
'<input type="hidden" name="backto" value="coursecatalog" />'. |
'<input type="hidden" name="courseid" value="" />'. |
'<input type="hidden" name="courseid" value="" />'. |
Line 1384 sub print_course_listing {
|
Line 1388 sub print_course_listing {
|
} |
} |
|
|
sub construct_data_table { |
sub construct_data_table { |
my ($knownuser,$domain,$courses,$details,$usersections,$now,$trails,$allitems,$canviewall) = @_; |
my ($knownuser,$domain,$courses,$details,$usersections,$now, |
|
$trails,$allitems,$canviewall,$hostname) = @_; |
my %sortname; |
my %sortname; |
if (($details eq '') || ($env{'form.showdetails'})) { |
if (($details eq '') || ($env{'form.showdetails'})) { |
$sortname{'Code'} = 'code'; |
$sortname{'Code'} = 'code'; |
Line 1510 sub construct_data_table {
|
Line 1515 sub construct_data_table {
|
} |
} |
my $count = 1; |
my $count = 1; |
my $totalsec = 0; |
my $totalsec = 0; |
|
my %clutteredxlists; |
|
foreach my $course (keys(%courseinfo)) { |
|
if (ref($courseinfo{$course}) eq 'HASH') { |
|
if ($courseinfo{$course}{'xlist'} ne '') { |
|
my $crskey = $courseinfo{$course}{'cnum'}.':'.$courseinfo{$course}{'code'}; |
|
my @xlists = split(/,\s/,$courseinfo{$course}{'xlist'}); |
|
$clutteredxlists{$crskey} = \@xlists; |
|
} |
|
} |
|
} |
|
if (keys(%clutteredxlists)) { |
|
my %reformattedxlists = &Apache::lonnet::auto_instsec_reformat($domain,'declutter',\%clutteredxlists); |
|
foreach my $crskey (keys(%reformattedxlists)) { |
|
if (ref($reformattedxlists{$crskey}) eq 'ARRAY') { |
|
my $course = $domain.'_'.(split(/:/,$crskey))[0]; |
|
$courseinfo{$course}{'xlist'} = join(', ',@{$reformattedxlists{$crskey}}); |
|
} |
|
} |
|
} |
foreach my $item (@sorted_courses) { |
foreach my $item (@sorted_courses) { |
foreach my $course (@{$Sortby{$item}}) { |
foreach my $course (@{$Sortby{$item}}) { |
$output.=&Apache::loncommon::start_data_table_row(); |
$output.=&Apache::loncommon::start_data_table_row(); |
Line 1871 sub courseinfo_row {
|
Line 1895 sub courseinfo_row {
|
@cats = split('&',$categories); |
@cats = split('&',$categories); |
} |
} |
if ((ref($trails) eq 'ARRAY') && (ref($allitems) eq 'HASH')) { |
if ((ref($trails) eq 'ARRAY') && (ref($allitems) eq 'HASH')) { |
my @categories = map { $trails->[$allitems->{$_}]; } @cats; |
my @categories; |
|
foreach my $cat (@cats) { |
|
next if ($cat eq ''); |
|
if (($allitems->{$cat} ne '') && ($trails->[$allitems->{$cat}] ne '')) { |
|
push(@categories,$trails->[$allitems->{$cat}]); |
|
} |
|
} |
$categorylist = join('<br />',@categories); |
$categorylist = join('<br />',@categories); |
} |
} |
if ($categorylist eq '') { |
if ($categorylist eq '') { |
Line 1886 sub courseinfo_row {
|
Line 1916 sub courseinfo_row {
|
my $usehttp = 0; |
my $usehttp = 0; |
if (($ENV{'SERVER_PORT'} == 443) && ($extsyllplain)) { |
if (($ENV{'SERVER_PORT'} == 443) && ($extsyllplain)) { |
unless ((&Apache::lonnet::uses_sts()) || |
unless ((&Apache::lonnet::uses_sts()) || |
(&Apache::lonnet::waf_allssl(hostname))) { |
(&Apache::lonnet::waf_allssl($hostname))) { |
$usehttp = 1; |
$usehttp = 1; |
} |
} |
} |
} |
Line 1970 sub identify_sections {
|
Line 2000 sub identify_sections {
|
sub get_valid_classes { |
sub get_valid_classes { |
my ($seclist,$xlist_items,$crscode,$owners,$cdom,$cnum) = @_; |
my ($seclist,$xlist_items,$crscode,$owners,$cdom,$cnum) = @_; |
my $response; |
my $response; |
my (@sections,@xlists,%possclasses,%okclasses,%validations); |
my (@sections,@format_sections,@xlists,%possclasses,%okclasses,%validations); |
@{$validations{'sections'}} = (); |
@{$validations{'sections'}} = (); |
@{$validations{'xlists'}} = (); |
@{$validations{'xlists'}} = (); |
my $totalitems = 0; |
my $totalitems = 0; |
if ($seclist) { |
if ($seclist) { |
@sections = split(/,\s+/,$seclist); |
@sections = split(/,\s+/,$seclist); |
map { $possclasses{$crscode.$_} = 1; } @sections; |
my $crskey = $cnum.':'.$crscode; |
|
my %formattedsec = &Apache::lonnet::auto_instsec_reformat($cdom,'clutter', |
|
{$crskey => \@sections}); |
|
if (ref($formattedsec{$crskey}) eq 'ARRAY') { |
|
@format_sections = @{$formattedsec{$crskey}}; |
|
map { $possclasses{$crscode.$_} = 1; } @format_sections; |
|
} |
} |
} |
if ($xlist_items) { |
if ($xlist_items) { |
@xlists = split(/,\s+/,$xlist_items); |
@xlists = split(/,\s+/,$xlist_items); |
Line 1985 sub get_valid_classes {
|
Line 2021 sub get_valid_classes {
|
my %okclasses = &Apache::lonnet::auto_validate_instclasses($cdom,$cnum,$owners, |
my %okclasses = &Apache::lonnet::auto_validate_instclasses($cdom,$cnum,$owners, |
\%possclasses); |
\%possclasses); |
if (keys(%okclasses)) { |
if (keys(%okclasses)) { |
foreach my $sec (@sections) { |
for (my $i=0; $i<@sections; $i++) { |
if ($okclasses{$crscode.$sec}) { |
if ($okclasses{$crscode.$format_sections[$i]}) { |
if (!grep(/^\Q$sec$\E/,@{$validations{'sections'}})) { |
my $sec = $sections[$i]; |
|
if (!grep(/^\Q$sec\E$/,@{$validations{'sections'}})) { |
push(@{$validations{'sections'}},$sec); |
push(@{$validations{'sections'}},$sec); |
$totalitems ++; |
$totalitems ++; |
} |
} |
Line 2008 sub get_valid_classes {
|
Line 2045 sub get_valid_classes {
|
join(', ',@{$validations{'sections'}}).'<br />'; |
join(', ',@{$validations{'sections'}}).'<br />'; |
} |
} |
if (@{$validations{'xlists'}}) { |
if (@{$validations{'xlists'}}) { |
|
my $crskey = $cnum.':'.$crscode; |
|
my %reformattedxlists = |
|
&Apache::lonnet::auto_instsec_reformat($cdom,'declutter', |
|
{$crskey => $validations{'xlists'}}); |
|
if (ref($reformattedxlists{$crskey}) eq 'ARRAY') { |
|
$validations{'xlists'} = $reformattedxlists{$crskey}; |
|
} |
$response .= &mt('Courses:').' '. |
$response .= &mt('Courses:').' '. |
join(', ',@{$validations{'xlists'}}); |
join(', ',@{$validations{'xlists'}}); |
} |
} |