version 1.88.2.5, 2019/07/26 15:32:34
|
version 1.88.2.8, 2021/06/20 17:49:08
|
Line 124 sub handler {
|
Line 124 sub handler {
|
} |
} |
my $js = '<script type="text/javascript">'."\n". |
my $js = '<script type="text/javascript">'."\n". |
'// <![CDATA['."\n". |
'// <![CDATA['."\n". |
&courselink_javascript()."\n". |
&courselink_javascript($r)."\n". |
'// ]]>'."\n". |
'// ]]>'."\n". |
'</script>'."\n"; |
'</script>'."\n"; |
$r->print(&Apache::loncommon::start_page('Search for a Course/Community',$js)); |
$r->print(&Apache::loncommon::start_page('Search for a Course/Community',$js)); |
Line 175 sub handler {
|
Line 175 sub handler {
|
$courseinfo{$codedom.'_'.$cnum}{$item}); |
$courseinfo{$codedom.'_'.$cnum}{$item}); |
if ($item eq 'title') { |
if ($item eq 'title') { |
if ($courseinfo{$codedom.'_'.$cnum}{'showsyllabus'}) { |
if ($courseinfo{$codedom.'_'.$cnum}{'showsyllabus'}) { |
|
my $usehttp = 0; |
|
if (($ENV{'SERVER_PORT'} == 443) && ($courseinfo{$codedom.'_'.$cnum}{'extsyllplain'})) { |
|
unless (&Apache::lonnet::uses_sts()) { |
|
$usehttp = 1; |
|
} |
|
} |
$r->print(' <font size="-2">'. |
$r->print(' <font size="-2">'. |
'<a href="javascript:ToSyllabus('."'$codedom','$cnum'".')">'. |
'<a href="javascript:ToSyllabus('."'$codedom','$cnum','$usehttp'".')">'. |
&mt('Syllabus').'</a></font>'); |
&mt('Syllabus').'</a></font>'); |
} |
} |
} |
} |
Line 279 function setCourseId(caller) {
|
Line 285 function setCourseId(caller) {
|
} |
} |
|
|
ENDSCRIPT |
ENDSCRIPT |
$catjs .= &courselink_javascript(); |
$catjs .= &courselink_javascript($r); |
if (&user_is_dc($codedom) || $canviewall) { |
if (&user_is_dc($codedom) || $canviewall) { |
$catjs .= <<ENDTOGGJS |
$catjs .= <<ENDTOGGJS |
|
|
Line 370 ENDJS
|
Line 376 ENDJS
|
} |
} |
|
|
sub validate_input { |
sub validate_input { |
my ($codedom,$cats,$maxd,$configref) = @_; |
my ($codedom,$cats,$maxd,$crscatsref) = @_; |
my $currcat = ''; |
my $currcat = ''; |
my $depth = 0; |
my $depth = 0; |
if ($env{'form.catalog_maxdepth'} ne '') { |
if ($env{'form.catalog_maxdepth'} ne '') { |
Line 642 sub course_details {
|
Line 648 sub course_details {
|
my %add_entries = (topmargin => "0", |
my %add_entries = (topmargin => "0", |
marginheight => "0",); |
marginheight => "0",); |
my $js = '<script type="text/javascript">'."\n". |
my $js = '<script type="text/javascript">'."\n". |
&courselink_javascript().'</script>'."\n"; |
&courselink_javascript($r).'</script>'."\n"; |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Course/Community Catalog',$js, |
&Apache::loncommon::start_page('Course/Community Catalog',$js, |
{'add_entries' => \%add_entries, }); |
{'add_entries' => \%add_entries, }); |
Line 705 END
|
Line 711 END
|
} |
} |
|
|
sub courselink_javascript { |
sub courselink_javascript { |
|
my ($r) = @_; |
|
my $hostname = $r->hostname(); |
return <<"END"; |
return <<"END"; |
|
|
function ToSyllabus(cdom,cnum) { |
function ToSyllabus(cdom,cnum,usehttp) { |
if (cdom == '' || cdom == null) { |
if (cdom == '' || cdom == null) { |
return; |
return; |
} |
} |
Line 715 function ToSyllabus(cdom,cnum) {
|
Line 723 function ToSyllabus(cdom,cnum) {
|
return; |
return; |
} |
} |
document.linklaunch.action = "/public/"+cdom+"/"+cnum+"/syllabus"; |
document.linklaunch.action = "/public/"+cdom+"/"+cnum+"/syllabus"; |
|
if (usehttp == 1) { |
|
var hostname = '$hostname'; |
|
if (hostname != '') { |
|
document.linklaunch.action = 'http://'+hostname+document.linklaunch.action; |
|
} |
|
document.linklaunch.action += '?usehttp=1'; |
|
} |
document.linklaunch.submit(); |
document.linklaunch.submit(); |
} |
} |
|
|
Line 1454 sub construct_data_table {
|
Line 1469 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 1540 sub build_courseinfo_hash {
|
Line 1574 sub build_courseinfo_hash {
|
$cleandesc=~s/'/\\'/g; |
$cleandesc=~s/'/\\'/g; |
$cleandesc =~ s/^\s+//; |
$cleandesc =~ s/^\s+//; |
my ($cdom,$cnum)=split(/\_/,$course); |
my ($cdom,$cnum)=split(/\_/,$course); |
my ($instcode,$singleowner,$ttype,$selfenroll_types, |
my ($instcode,$singleowner,$ttype,$selfenroll_types,$extsyllplain, |
$selfenroll_start,$selfenroll_end,@owners,%ownernames,$categories); |
$selfenroll_start,$selfenroll_end,@owners,%ownernames,$categories); |
if (ref($courses->{$course}) eq 'HASH') { |
if (ref($courses->{$course}) eq 'HASH') { |
$descr = $courses->{$course}{'description'}; |
$descr = $courses->{$course}{'description'}; |
Line 1551 sub build_courseinfo_hash {
|
Line 1585 sub build_courseinfo_hash {
|
$selfenroll_start = $courses->{$course}{'selfenroll_start_date'}; |
$selfenroll_start = $courses->{$course}{'selfenroll_start_date'}; |
$selfenroll_end = $courses->{$course}{'selfenroll_end_date'}; |
$selfenroll_end = $courses->{$course}{'selfenroll_end_date'}; |
$categories = $courses->{$course}{'categories'}; |
$categories = $courses->{$course}{'categories'}; |
|
$extsyllplain = $courses->{$course}{'extsyllplain'}; |
push(@owners,$singleowner); |
push(@owners,$singleowner); |
if ($courses->{$course}{'co-owners'} ne '') { |
if ($courses->{$course}{'co-owners'} ne '') { |
foreach my $item (split(/,/,$courses->{$course}{'co-owners'})) { |
foreach my $item (split(/,/,$courses->{$course}{'co-owners'})) { |
Line 1594 sub build_courseinfo_hash {
|
Line 1629 sub build_courseinfo_hash {
|
$courseinfo{$course}{'selfenroll_start'} = $selfenroll_start; |
$courseinfo{$course}{'selfenroll_start'} = $selfenroll_start; |
$courseinfo{$course}{'selfenroll_end'} = $selfenroll_end; |
$courseinfo{$course}{'selfenroll_end'} = $selfenroll_end; |
$courseinfo{$course}{'categories'} = $categories; |
$courseinfo{$course}{'categories'} = $categories; |
|
$courseinfo{$course}{'extsyllplain'} = $extsyllplain; |
|
|
my %coursehash = &Apache::lonnet::dump('environment',$cdom,$cnum); |
my %coursehash = &Apache::lonnet::dump('environment',$cdom,$cnum); |
my @classids; |
my @classids; |
Line 1778 sub count_students {
|
Line 1814 sub count_students {
|
sub courseinfo_row { |
sub courseinfo_row { |
my ($info,$knownuser,$details,$countref,$now,$course,$trails,$allitems,$numbers,$canviewall) = @_; |
my ($info,$knownuser,$details,$countref,$now,$course,$trails,$allitems,$numbers,$canviewall) = @_; |
my ($cdom,$cnum,$title,$ownerlast,$code,$owner,$seclist,$xlist_items, |
my ($cdom,$cnum,$title,$ownerlast,$code,$owner,$seclist,$xlist_items, |
$accessdates,$showsyllabus,$counts,$autoenrollment,$output,$categories); |
$accessdates,$showsyllabus,$counts,$autoenrollment,$output,$categories, |
|
$extsyllplain); |
if (ref($info) eq 'HASH') { |
if (ref($info) eq 'HASH') { |
$cdom = $info->{'cdom'}; |
$cdom = $info->{'cdom'}; |
$cnum = $info->{'cnum'}; |
$cnum = $info->{'cnum'}; |
Line 1792 sub courseinfo_row {
|
Line 1829 sub courseinfo_row {
|
$counts = $info->{'counts'}; |
$counts = $info->{'counts'}; |
$autoenrollment = $info->{'autoenrollment'}; |
$autoenrollment = $info->{'autoenrollment'}; |
$showsyllabus = $info->{'showsyllabus'}; |
$showsyllabus = $info->{'showsyllabus'}; |
|
$extsyllplain = $info->{'extsyllplain'}; |
$categories = $info->{'categories'}; |
$categories = $info->{'categories'}; |
} else { |
} else { |
$output = '<td colspan="8">'.&mt('No information available for [_1].', |
$output = '<td colspan="8">'.&mt('No information available for [_1].', |
Line 1819 sub courseinfo_row {
|
Line 1857 sub courseinfo_row {
|
'<td>'.$xlist_items.'</td>'. |
'<td>'.$xlist_items.'</td>'. |
'<td>'.$title.' <font size="-2">'; |
'<td>'.$title.' <font size="-2">'; |
if ($showsyllabus) { |
if ($showsyllabus) { |
$output .= '<a href="javascript:ToSyllabus('."'$cdom','$cnum'".')">'.&mt('Syllabus').'</a>'; |
my $usehttp = 0; |
|
if (($ENV{'SERVER_PORT'} == 443) && ($extsyllplain)) { |
|
unless (&Apache::lonnet::uses_sts()) { |
|
$usehttp = 1; |
|
} |
|
} |
|
$output .= '<a href="javascript:ToSyllabus('."'$cdom','$cnum','$usehttp'".')">'.&mt('Syllabus').'</a>'; |
} else { |
} else { |
$output .= ' '; |
$output .= ' '; |
} |
} |
Line 1899 sub identify_sections {
|
Line 1943 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 1914 sub get_valid_classes {
|
Line 1964 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 1937 sub get_valid_classes {
|
Line 1988 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'}}); |
} |
} |