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

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


raeburn		Fri Dec 26 22:27:25 2008 EDT

  Modified files:              (Branch: version_2_8_X)
    /loncom/interface	domainprefs.pm 
  Log:
  - Backport 1.83, 1.84.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.76.2.5 loncom/interface/domainprefs.pm:1.76.2.6
--- loncom/interface/domainprefs.pm:1.76.2.5	Fri Dec 26 16:34:43 2008
+++ loncom/interface/domainprefs.pm	Fri Dec 26 22:27:24 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.76.2.5 2008/12/26 16:34:43 raeburn Exp $
+# $Id: domainprefs.pm,v 1.76.2.6 2008/12/26 22:27:24 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1329,7 +1329,8 @@
                       '" value="_LC_adv" '.$checked.'/>'.$titles{$item}.
                       '</label></span>&nbsp; ';
     }
-    $datatable .= '('.&mt('overrides affiliation').')</td></tr>';
+    $datatable .= '<span class="LC_nobreak">('.&mt('overrides affiliation').
+                  ')</span></td></tr>';
     $$rowtotal += $typecount;
     return $datatable;
 }
@@ -4976,46 +4977,37 @@
     my %serverstatushash =  (
                                 serverstatuses => \%newserverstatus,
                             );
-    my $putresult = &Apache::lonnet::put_dom('configuration',\%serverstatushash,
-                                             $dom);
     my %changes;
     foreach my $type (@pages) {
-        if (ref($currserverstatus{$type}) eq 'HASH') {
-            my @currnamed = split(/,/,$currserverstatus{$type}{'namedusers'});
-            my @newusers = split(/,/,$newserverstatus{$type}{'namedusers'});
-            foreach my $item (@currnamed) {
-                if (!grep(/^\Q$item\E$/,@newusers)) {
-                    $changes{$type}{'namedusers'} = 1;
-                    last;
-                }
-            }
-            foreach my $item (@newusers) {
-                if (!grep(/^\Q$item\E$/,@currnamed)) {
-                    $changes{$type}{'namedusers'} = 1;
-                    last;
+        foreach my $setting ('namedusers','machines') {
+            my (@current,@new);
+            if (ref($currserverstatus{$type}) eq 'HASH') {
+                if ($currserverstatus{$type}{$setting} ne '') {
+                    @current = split(/,/,$currserverstatus{$type}{$setting});
                 }
             }
-            my @currmachines = split(/,/,$currserverstatus{$type}{'machines'});
-            my @newmachines = split(/,/,$newserverstatus{$type}{'machines'});
-            if (@currmachines > 0) {
-                if (@newmachines > 0) {
-                    foreach my $item (@currmachines) {
-                        if (!grep(/^\Q$item\E$/,@newmachines)) {
-                            $changes{$type}{'machines'} = 1;
+            if ($newserverstatus{$type}{$setting} ne '') {
+                @new = split(/,/,$newserverstatus{$type}{$setting});
+            }
+            if (@current > 0) {
+                if (@new > 0) {
+                    foreach my $item (@current) {
+                        if (!grep(/^\Q$item\E$/,@new)) {
+                            $changes{$type}{$setting} = 1;
                             last;
                         }
                     }
-                    foreach my $item (@newmachines) {
-                        if (!grep(/^\Q$item\E$/,@currmachines)) {
-                            $changes{$type}{'machines'} = 1;
+                    foreach my $item (@new) {
+                        if (!grep(/^\Q$item\E$/,@current)) {
+                            $changes{$type}{$setting} = 1;
                             last;
                         }
                     }
                 } else {
-                    $changes{$type}{'machines'} = 1;
+                    $changes{$type}{$setting} = 1;
                 }
-            } elsif (@newmachines > 0) {
-                $changes{$type}{'machines'} = 1; 
+            } elsif (@new > 0) {
+                $changes{$type}{$setting} = 1;
             }
         }
     }
@@ -5026,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 {