--- loncom/interface/lonsearchcourse.pm 2024/02/11 22:20:06 1.11
+++ loncom/interface/lonsearchcourse.pm 2025/02/04 03:07:44 1.15
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Course
#
-# $Id: lonsearchcourse.pm,v 1.11 2024/02/11 22:20:06 raeburn Exp $
+# $Id: lonsearchcourse.pm,v 1.15 2025/02/04 03:07:44 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -67,9 +67,10 @@ sub menu {
ENDCOURSESEARCH
$scrout.=&Apache::lonhtmlcommon::start_pick_box().
- &Apache::lonhtmlcommon::row_title($lt{'note'}).
+ &Apache::lonhtmlcommon::row_title('').
&Apache::lonhtmlcommon::textbox('courseexp',
- $env{'form.courseexp'},40).
+ $env{'form.courseexp'},40,'id="courseexp"').
&Apache::lonhtmlcommon::row_closure().
&Apache::lonhtmlcommon::row_title($lt{'options'}).
'
\n".
@@ -138,9 +139,9 @@ sub course_search {
my $c=$r->connection;
if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.".db",
&GDBM_READER(),0640)) {
- foreach (sort(keys(%hash))) {
- if ($c->aborted()) { last; }
- if (($_=~/^src\_(.+)$/)) {
+ foreach my $key (sort(keys(%hash))) {
+ last if ($c->aborted());
+ if ($key =~ /^src\_(.+)$/) {
my $rid = $1;
unless ($env{'request.role.adv'}) {
next if ($hash{'randomout_'.$rid} || $hash{'deeplinkout_'.$rid});
@@ -151,8 +152,8 @@ sub course_search {
(($listed eq 'absent') || ($listed eq 'grades')));
}
}
- my $symb=&make_symb($1);
- &checkonthis($r,$1,$hash{$_},0,&Apache::lonnet::gettitle($symb),
+ my $symb=&make_symb($rid);
+ &checkonthis($r,$rid,$hash{$key},0,&Apache::lonnet::gettitle($symb),
$fulltext,$symb,$target,@allwords);
}
}
@@ -296,18 +297,18 @@ sub checkonthis {
# Check also the dependencies of this one
my $dependencies=
&Apache::lonnet::metadata($url,'dependencies');
- foreach (split(/\,/,$dependencies)) {
- if (($_=~/^\/res\//) && (!$alreadyseen{$id})) {
- &checkonthis($r,$id,$_,$level+1,'',$fulltext,undef,$target,@allwords);
+ foreach my $item (split(/\,/,$dependencies)) {
+ if (($item =~ /^\/res\//) && (!$alreadyseen{$id})) {
+ &checkonthis($r,$id,$item,$level+1,'',$fulltext,undef,$target,@allwords);
}
}
}
sub checkwords {
my ($result,$applies,@allwords) = @_;
- foreach (@allwords) {
- if ($_=~/\w/) {
- if ($result=~/$_/si) {
+ foreach my $word (@allwords) {
+ if ($word =~ /\w/) {
+ if ($result =~ /$word/si) {
$applies++;
}
}