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

raeburn raeburn@source.lon-capa.org
Fri, 26 Dec 2008 22:24:43 -0000


raeburn		Fri Dec 26 22:24:43 2008 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  - List changes correctly if access for both named users and IP addresses changes. 
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.83 loncom/interface/domainprefs.pm:1.84
--- loncom/interface/domainprefs.pm:1.83	Fri Dec 26 21:48:43 2008
+++ loncom/interface/domainprefs.pm	Fri Dec 26 22:24:43 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.83 2008/12/26 21:48:43 raeburn Exp $
+# $Id: domainprefs.pm,v 1.84 2008/12/26 22:24:43 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1330,7 +1330,7 @@
                       '</label></span>&nbsp; ';
     }
     $datatable .= '<span class="LC_nobreak">('.&mt('overrides affiliation').
-                  ')</span</td></tr>';
+                  ')</span></td></tr>';
     $$rowtotal += $typecount;
     return $datatable;
 }
@@ -4980,11 +4980,15 @@
     my %changes;
     foreach my $type (@pages) {
         foreach my $setting ('namedusers','machines') {
-            my @current = ();
+            my (@current,@new);
             if (ref($currserverstatus{$type}) eq 'HASH') {
-                @current = split(/,/,$currserverstatus{$type}{$setting});
+                if ($currserverstatus{$type}{$setting} ne '') { 
+                    @current = split(/,/,$currserverstatus{$type}{$setting});
+                }
+            }
+            if ($newserverstatus{$type}{$setting} ne '') {
+                @new = split(/,/,$newserverstatus{$type}{$setting});
             }
-            my @new = split(/,/,$newserverstatus{$type}{$setting});
             if (@current > 0) {
                 if (@new > 0) {
                     foreach my $item (@current) {
@@ -4993,12 +4997,10 @@
                             last;
                         }
                     }
-                    if (!$changes{$type}{$setting}) {
-                        foreach my $item (@new) {
-                            if (!grep(/^\Q$item\E$/,@current)) {
-                                $changes{$type}{$setting} = 1;
-                                last;
-                            }
+                    foreach my $item (@new) {
+                        if (!grep(/^\Q$item\E$/,@current)) {
+                            $changes{$type}{$setting} = 1;
+                            last;
                         }
                     }
                 } else {
@@ -5016,15 +5018,16 @@
         if ($putresult eq 'ok') {
             $resulttext .= &mt('Changes made:').'<ul>';
             foreach my $type (@pages) {
-                if (defined($changes{$type})) {
+                if (ref($changes{$type}) eq 'HASH') {
                     $resulttext .= '<li>'.$titles->{$type}.'<ul>';
-                    if (defined($changes{$type}{'namedusers'})) {
+                    if ($changes{$type}{'namedusers'}) {
                         if ($newserverstatus{$type}{'namedusers'} eq '') {
                             $resulttext .= '<li>'.&mt("Access terminated for all specific (named) users").'</li>'."\n";
                         } else {
                             $resulttext .= '<li>'.&mt("Access available for the following specified users: ").$newserverstatus{$type}{'namedusers'}.'</li>'."\n";
                         }
-                    } elsif (defined($changes{$type}{'machines'})) {
+                    }
+                    if ($changes{$type}{'machines'}) {
                         if ($newserverstatus{$type}{'machines'} eq '') {
                             $resulttext .= '<li>'.&mt("Access terminated for all specific IP addresses").'</li>'."\n";
                         } else {