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

raeburn raeburn at source.lon-capa.org
Sat Jan 21 16:51:57 EST 2017


raeburn		Sat Jan 21 21:51:57 2017 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	domainprefs.pm 
  Log:
  - For 2.11
    - Backport 1.284
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.160.6.75 loncom/interface/domainprefs.pm:1.160.6.76
--- loncom/interface/domainprefs.pm:1.160.6.75	Tue Oct 25 12:54:25 2016
+++ loncom/interface/domainprefs.pm	Sat Jan 21 21:51:56 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.160.6.75 2016/10/25 12:54:25 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.76 2017/01/21 21:51:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4019,6 +4019,9 @@
         my ($numspares, at spares) = &count_servers($lonhost,%servers);
         my @sparestypes = ('primary','default');
         my %typetitles = &sparestype_titles();
+        my %hostherechecked = (
+                                  no => ' checked="checked"',
+                              );
         foreach my $sparetype (@sparestypes) {
             my $targettable;
             for (my $i=0; $i<$numspares; $i++) {
@@ -4064,6 +4067,23 @@
                 $datatable .=  '<i>'.$typetitles{$sparetype}.'</i><br />'.
                                '<table><tr>'.$targettable.'</tr></table><br />';
             }
+            $hostherechecked{$sparetype} = '';
+            if (ref($currtargets{$lonhost}) eq 'HASH') {
+                if (ref($currtargets{$lonhost}{$sparetype}) eq 'ARRAY') {
+                    if (grep(/^\Q$lonhost\E$/,@{$currtargets{$lonhost}{$sparetype}})) {
+                        $hostherechecked{$sparetype} = ' checked="checked"';
+                        $hostherechecked{'no'} = '';
+                    }
+                }
+            }
+        }
+        $datatable .= &mt('Hosting on balancer itself').'<br />'.
+                      '<label><input type="radio" name="loadbalancing_target_'.$balnum.'_hosthere" value="no"'.
+                      $hostherechecked{'no'}.' />'.&mt('No').'</label><br />';
+        foreach my $sparetype (@sparestypes) {
+            $datatable .= '<label><input type="radio" name="loadbalancing_target_'.$balnum.'_hosthere" '.
+                          'value="'.$sparetype.'"'.$hostherechecked{$sparetype}.' /><i>'.$typetitles{$sparetype}.
+                          '</i></label><br />';
         }
         $datatable .= '</div></td></tr>'.
                       &loadbalancing_rules($dom,$intdom,$currrules{$lonhost},
@@ -11632,8 +11652,13 @@
                         push(@offloadto,$target);
                     }
                 }
-                $defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype} = \@offloadto;
             }
+            if ($env{'form.loadbalancing_target_'.$i.'_hosthere'} eq $sparetype) {
+                unless(grep(/^\Q$balancer\E$/, at offloadto)) {
+                    push(@offloadto,$balancer);
+                }
+            }
+            $defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype} = \@offloadto;
         }
         if (ref($currtargets{$balancer}) eq 'HASH') {
             foreach my $sparetype (@sparestypes) {




More information about the LON-CAPA-cvs mailing list