[LON-CAPA-cvs] cvs: loncom /auth lonlogin.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 28 Apr 2005 01:19:20 -0000


albertel		Wed Apr 27 21:19:20 2005 EDT

  Modified files:              
    /loncom/auth	lonlogin.pm 
  Log:
  - remove duplicate hostnames for the list of servers
  - order the list in alphabetical (by hostanme) order
  
  
Index: loncom/auth/lonlogin.pm
diff -u loncom/auth/lonlogin.pm:1.63 loncom/auth/lonlogin.pm:1.64
--- loncom/auth/lonlogin.pm:1.63	Thu Apr  7 02:56:21 2005
+++ loncom/auth/lonlogin.pm	Wed Apr 27 21:19:20 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Login Screen
 #
-# $Id: lonlogin.pm,v 1.63 2005/04/07 06:56:21 albertel Exp $
+# $Id: lonlogin.pm,v 1.64 2005/04/28 01:19:20 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -179,22 +179,36 @@
 
     if ($logtoken eq 'con_lost') {
         my $spares='';
-
-        foreach my $hostid (keys(%Apache::lonnet::spareid)) {
+	my $last;
+        foreach my $hostid (sort
+			    {
+				$Apache::lonnet::hostname{$a} cmp
+				    $Apache::lonnet::hostname{$b};
+			    }
+			    keys(%Apache::lonnet::spareid)) {
             next if ($hostid eq $lonhost);
+            next if ($last eq $Apache::lonnet::hostname{$hostid});
             $spares.='<br /><font size="+1"><a href="http://'.
                 $Apache::lonnet::hostname{$hostid}.
                 '/adm/login?domain='.$authdomain.'">'.
                 $Apache::lonnet::hostname{$hostid}.'</a>'.
                 ' (preferred)</font>'.$/;
+	    $last=$Apache::lonnet::hostname{$hostid};
         }
         $spares.= '<br />';
-        foreach my $hostid (keys(%Apache::lonnet::hostname)) {
+        foreach my $hostid (sort
+			    {
+				$Apache::lonnet::hostname{$a} cmp
+				    $Apache::lonnet::hostname{$b};
+			    }
+			    keys(%Apache::lonnet::hostname)) {
             next if ($hostid eq $lonhost || $Apache::lonnet::spareid{$hostid});
+            next if ($last eq $Apache::lonnet::hostname{$hostid});
             $spares.='<br /><a href="http://'.
                 $Apache::lonnet::hostname{$hostid}.
                 '/adm/login?domain='.$authdomain.'">'.
                 $Apache::lonnet::hostname{$hostid}.'</a>';
+	    $last=$Apache::lonnet::hostname{$hostid};
         }
 	$r->print(<<ENDTROUBLE);
 <html>