[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm

raeburn raeburn@source.lon-capa.org
Tue, 06 Oct 2009 21:54:51 -0000


raeburn		Tue Oct  6 21:54:51 2009 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  - More complete information about changes to log-in page availability
    set via domain configuration.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.111 loncom/interface/domainprefs.pm:1.112
--- loncom/interface/domainprefs.pm:1.111	Tue Oct  6 18:24:29 2009
+++ loncom/interface/domainprefs.pm	Tue Oct  6 21:54:50 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.111 2009/10/06 18:24:29 jms Exp $
+# $Id: domainprefs.pm,v 1.112 2009/10/06 21:54:50 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3139,6 +3139,14 @@
                   newuser => 'Link for visitors to create a user account',
                   loginheader => 'Log-in box header');
     my @offon = ('off','on');
+    my %curr_loginvia;
+    if (ref($domconfig{login}) eq 'HASH') {
+        if (ref($domconfig{login}{loginvia}) eq 'HASH') {
+            foreach my $lonhost (keys(%{$domconfig{login}{loginvia}})) {
+                $curr_loginvia{$lonhost} = $domconfig{login}{loginvia}{$lonhost};
+            }
+        }
+    }
     my %loginhash;
     ($errors,%colchanges) = &modify_colors($r,$dom,$confname,['login'],
                                            \%domconfig,\%loginhash);
@@ -3155,10 +3163,15 @@
     my %servers = &Apache::lonnet::get_servers($dom);
     if (keys(%servers) > 1) {
         foreach my $lonhost (keys(%servers)) {
-            if ($env{'form.'.$lonhost.'_serverurl'} ne '') {
+            next if ($env{'form.'.$lonhost.'_serverurl'} eq $curr_loginvia{$lonhost});
+            next if ($env{'form.'.$lonhost.'_serverurl'} eq $lonhost);
+            if ($curr_loginvia{$lonhost} ne '') {
+                $loginhash{login}{loginvia}{$lonhost} = $env{'form.'.$lonhost.'_serverurl'};
+                $changes{'loginvia'}{$lonhost} = 1;
+            } else {
                 if (defined($servers{$env{'form.'.$lonhost.'_serverurl'}})) {
                     $loginhash{login}{loginvia}{$lonhost} = $env{'form.'.$lonhost.'_serverurl'};
-                    $changes{$item} = 1;
+                    $changes{'loginvia'}{$lonhost} = 1;
                 }
             }
         }
@@ -3210,6 +3223,18 @@
             foreach my $item (sort(keys(%changes))) {
                 if ($item eq 'loginheader') {
                     $resulttext .= '<li>'.&mt("$title{$item} set to $env{'form.loginheader'}").'</li>';
+                } elsif ($item eq 'loginvia') {
+                    if (ref($changes{$item}) eq 'HASH') {
+                        $resulttext .= '<li>'.&mt('Log-in page availability:').'<ul>';
+                        foreach my $lonhost (sort(keys(%{$changes{$item}}))) {
+                            if ($servers{$env{'form.'.$lonhost.'_serverurl'}} ne '') {
+                                $resulttext .= '<li>'.&mt('Server: [_1] log-in page now redirects to [_2]',$lonhost,$servers{$env{'form.'.$lonhost.'_serverurl'}}).'</li>';
+                            } else {
+                                $resulttext .= '<li>'.&mt('Server: [_1] now has standard log-in page.',$lonhost).'</li>';
+                            }
+                        }
+                        $resulttext .= '</ul></li>'; 
+                    }
                 } else {
                     $resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>';
                 }