[LON-CAPA-cvs] cvs: loncom /interface lonsearchcat.pm /lonnet/perl lonnet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 03 Mar 2007 01:54:14 -0000


albertel		Fri Mar  2 20:54:14 2007 EDT

  Modified files:              
    /loncom/interface	lonsearchcat.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - get_servers can take an array of valid domains
  
  
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.279 loncom/interface/lonsearchcat.pm:1.280
--- loncom/interface/lonsearchcat.pm:1.279	Fri Jan 19 09:23:23 2007
+++ loncom/interface/lonsearchcat.pm	Fri Mar  2 20:54:00 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.279 2007/01/19 14:23:23 raeburn Exp $
+# $Id: lonsearchcat.pm,v 1.280 2007/03/03 01:54:00 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1532,7 +1532,7 @@
             if ($field ne '') {
                 my $value = $env{'form.addedvalues_'.$i};
                 if ($value ne '') {
-                    $value =~ s/'/''/g;
+                    $value =~ s/'/''/g; #' stupid emacs
                     my ($error,$query) = 
                         &process_phrase_input($value,0,'pf.value');
                     if (!defined($error)) {
@@ -1673,11 +1673,9 @@
         foreach (sort @allowed_domains) {
             $pretty_domains_string .= "<b>".$_."</b> ";
         }
-        foreach (keys(%Apache::lonnet::libserv)) {
-            if (exists($domain_hash{$Apache::lonnet::hostdom{$_}})) {
-                push @$libraries_to_query,$_;
-            }
-        }
+	my %servers = &Apache::lonnet::get_servers(\@allowed_domains,
+						   'library');
+	$libraries_to_query = [keys(%servers)];
     }
     return ($libraries_to_query,
             $pretty_domains_string);
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.841 loncom/lonnet/perl/lonnet.pm:1.842
--- loncom/lonnet/perl/lonnet.pm:1.841	Fri Mar  2 20:33:10 2007
+++ loncom/lonnet/perl/lonnet.pm	Fri Mar  2 20:54:13 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.841 2007/03/03 01:33:10 albertel Exp $
+# $Id: lonnet.pm,v 1.842 2007/03/03 01:54:13 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7621,9 +7621,17 @@
 	my %possible_hosts = ($type eq 'library') ? %libserv
 	                                          : %hostname;
 	my %result;
-	while ( my ($host,$hostname) = each(%possible_hosts)) {
-	    if ($hostdom{$host} eq $domain) {
-		$result{$host} = $hostname;
+	if (ref($domain) eq 'ARRAY') {
+	    while ( my ($host,$hostname) = each(%possible_hosts)) {
+		if (grep(/\Q$hostdom{$host}\E/,@$domain)) {
+		    $result{$host} = $hostname;
+		}
+	    }
+	} else {
+	    while ( my ($host,$hostname) = each(%possible_hosts)) {
+		if ($hostdom{$host} eq $domain) {
+		    $result{$host} = $hostname;
+		}
 	    }
 	}
 	return %result;