[LON-CAPA-cvs] cvs: loncom(version_1_2_X) /interface lonsearchcat.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Wed, 02 Feb 2005 21:27:28 -0000
albertel Wed Feb 2 16:27:28 2005 EDT
Modified files: (Branch: version_1_2_X)
/loncom/interface lonsearchcat.pm
Log:
- backport 1.236
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.230.2.1 loncom/interface/lonsearchcat.pm:1.230.2.2
--- loncom/interface/lonsearchcat.pm:1.230.2.1 Wed Jan 19 15:22:36 2005
+++ loncom/interface/lonsearchcat.pm Wed Feb 2 16:27:28 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.230.2.1 2005/01/19 20:22:36 albertel Exp $
+# $Id: lonsearchcat.pm,v 1.230.2.2 2005/02/02 21:27:28 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -444,6 +444,7 @@
{ # Scope the course search to avoid global variables
#
# Variables For course search
+my %alreadyseen;
my %hash;
my $totalfound;
@@ -462,6 +463,7 @@
my $pretty_search_string = '<b>'.$ENV{'form.courseexp'}.'</b>';
my $search_string = $ENV{'form.courseexp'};
my @New_Words;
+ undef(%alreadyseen);
if ($ENV{'form.crsrelated'}) {
($search_string,@New_Words) = &related_version($ENV{'form.courseexp'});
if (@New_Words) {
@@ -504,6 +506,8 @@
sub checkonthis {
my ($r,$id,$url,$level,$title,$fulltext,$symb,@allwords)=@_;
+ $alreadyseen{$id}=1;
+ if (&Apache::loncommon::connection_aborted($r)) { return; }
$r->rflush();
my $result=$title.' ';
@@ -550,7 +554,7 @@
# Check also the dependencies of this one
my $dependencies=
&Apache::lonnet::metadata($url,'dependencies');
- foreach (split(/\,/,$dependencies)) {
+ foreach (split(/\,/,$dependencies) && (!$alreadyseen{$id})) {
if (($_=~/^\/res\//)) {
&checkonthis($r,$id,$_,$level+1,'',$fulltext,undef,@allwords);
}