--- loncom/interface/lonsearchcourse.pm 2020/09/22 11:23:08 1.5
+++ loncom/interface/lonsearchcourse.pm 2024/02/11 21:41:48 1.10
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Course
#
-# $Id: lonsearchcourse.pm,v 1.5 2020/09/22 11:23:08 raeburn Exp $
+# $Id: lonsearchcourse.pm,v 1.10 2024/02/11 21:41:48 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -136,8 +136,15 @@ sub course_search {
foreach (sort(keys(%hash))) {
if ($c->aborted()) { last; }
if (($_=~/^src\_(.+)$/)) {
- if ($hash{'randomout_'.$1} & !$env{'request.role.adv'}) {
- next;
+ my $rid = $1;
+ unless ($env{'request.role.adv'}) {
+ next if ($hash{'randomout_'.$rid} || $hash{'deeplinkout_'.$rid});
+ if (!$env{'request.deeplink.login'} && $hash{'deeplinkonly_'.$rid}) {
+ my ($value) = map { &unescape($_); } split(/:/,$hash{'deeplinkonly_'.$rid});
+ my ($state,$others,$listed) = split(/,/,$value);
+ next if (($state eq 'only') &&
+ (($listed eq 'absent') || ($listed eq 'grades')));
+ }
}
my $symb=&make_symb($1);
&checkonthis($r,$1,$hash{$_},0,&Apache::lonnet::gettitle($symb),
@@ -261,10 +268,18 @@ sub checkonthis {
}
my $href=$url;
if ($hash{'encrypted_'.$id} && !$env{'request.role.adv'}) {
- $href=&Apache::lonenc::encrypted($href)
- .'?symb='.&Apache::lonenc::encrypted($symb);
+ $href=&Apache::lonenc::encrypted($href);
+ if ($url =~ /\.sequence$/) {
+ $href .= '?navmap=1';
+ } else {
+ $href .= '?symb='.&Apache::lonenc::encrypted($symb);
+ }
} else {
- $href.='?symb='.&escape($symb);
+ if ($href =~ /\.sequence$/) {
+ $href .= '?navmap=1';
+ } else {
+ $href .= '?symb='.&escape($symb);
+ }
}
$r->print(''.($title?$title:$url).
'
');
@@ -329,10 +344,27 @@ sub handler {
}
$r->print(&Apache::lonhtmlcommon::breadcrumbs("$crstype Search"));
&Apache::lonnavdisplay::startContentScreen($r,'coursesearch');
- if ($env{'form.phase'} eq 'results') {
- &course_search($r);
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $clientip = &Apache::lonnet::get_requestor_ip($r);
+ my ($blocked,$blocktext) =
+ &Apache::loncommon::blocking_status('search',$clientip,$cnum,$cdom);
+ if ($blocked) {
+ my $checkrole = "cm./$cdom/$cnum";
+ if ($env{'request.course.sec'} ne '') {
+ $checkrole .= "/$env{'request.course.sec'}";
+ }
+ if ((&Apache::lonnet::allowed('evb',undef,undef,$checkrole)) &&
+ ($env{'request.role'} !~ m{^st\./$cdom/$cnum})) {
+ undef($blocked);
+ }
+ }
+ if ($blocked) {
+ $r->print($blocktext);
+ } elsif ($env{'form.phase'} eq 'results') {
+ &course_search($r);
} else {
- $r->print(&menu());
+ $r->print(&menu());
}
&Apache::lonnavdisplay::endContentScreen($r);
$r->print(&Apache::loncommon::end_page());