[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lon-capa-cvs
Subject:    [LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm
From:       raeburn via LON-CAPA-cvs <lon-capa-cvs () mail ! lon-capa ! org>
Date:       2021-05-28 1:26:02
Message-ID: cvsraeburn1622165162 () cvsserver
[Download RAW message or body]

raeburn		Fri May 28 01:26:02 2021 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  - Bug 6914
    Update domain config UI for WAF/Proxy for an institution with more than one
    LON-CAPA domain, in the case where different nodes belong to different 
    domains.   
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.382 loncom/interface/domainprefs.pm:1.383
--- loncom/interface/domainprefs.pm:1.382	Thu Apr 29 17:45:22 2021
+++ loncom/interface/domainprefs.pm	Fri May 28 01:26:02 2021
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.382 2021/04/29 17:45:22 raeburn Exp $
+# $Id: domainprefs.pm,v 1.383 2021/05/28 01:26:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7337,12 +7337,10 @@
         foreach my $domain (keys(%otherdoms)) {
             %{$values{$domain}} = ();
             my %config = \
                &Apache::lonnet::get_dom('configuration',['wafproxy'],$domain);
-            if (ref($config{$domain}) eq 'HASH') {
-                if (ref($config{$domain}{'wafproxy'}) eq 'HASH') {
-                    $aliases{$domain} = $config{$domain}{'wafproxy'}{'alias'};
-                    foreach my $item \
                ('remoteip','ipheader','trusted','vpnint','vpnext') {
-                        $values{$domain}{$item} = \
                $config{$domain}{'wafproxy'}{$item};
-                    }
+            if (ref($config{'wafproxy'}) eq 'HASH') {
+                $aliases{$domain} = $config{'wafproxy'}{'alias'};
+                foreach my $item ('remoteip','ipheader','trusted','vpnint','vpnext') \
{ +                    $values{$domain}{$item} = $config{'wafproxy'}{$item};
                 }
             }
         }
@@ -7354,22 +7352,25 @@
             $itemcount ++;
             my $dom_in_effect;
             my $aliasrows = '<tr>'.
-                            '<td class="LC_left_item">'.&mt('Hostname').':&nbsp;'.
-                            &Apache::lonnet::hostname($server).'</td>';
+                            '<td class="LC_left_item" style="vertical-align: \
baseline;">'. +                            &mt('Hostname').':&nbsp;'.
+                            \
'<i>'.&Apache::lonnet::hostname($server).'</i></td><td>&nbsp;</td>';  if \
($othercontrol{$server}) {  $dom_in_effect = $othercontrol{$server};
                 my $current;
-                if (ref($aliases{$othercontrol{$server}}) eq 'HASH') {
-                    $current = $aliases{$othercontrol{$server}{$server}};
+                if (ref($aliases{$dom_in_effect}) eq 'HASH') {
+                    $current = $aliases{$dom_in_effect}{$server};
                 }
+                $aliasrows .= '<td class="LC_left_item" style="vertical-align: \
baseline;">'. +                              &mt('Alias').':&nbsp';
                 if ($current) {
                     $aliasrows .= $current;
                 } else {
-                    $aliasrows .= &mt('None in effect');
+                    $aliasrows .= &mt('None');
                 }
-                $aliasrows .= '<td class="LC_left_item"><span class="LC_small">('.
-                              &mt('WAF/Reverse Proxy controlled by domain: [_1]',
-                                  \
'<b>'.$othercontrol{$server}.'</b>').'</span></td>'; +                $aliasrows .= \
'&nbsp;<span class="LC_small">('. +                              &mt('controlled by \
domain: [_1]', +                                  \
'<b>'.$dom_in_effect.'</b>').')</span></td>';  } else {
                 $dom_in_effect = $dom;
                 my $current;
@@ -7378,7 +7379,8 @@
                         $current = $aliases{$dom}{$server};
                     }
                 }
-                $aliasrows .= '<td class="LC_left_item">'.&mt('WAF/Reverse Proxy \
Alias').':&nbsp;'. +                $aliasrows .= '<td class="LC_left_item" \
style="vertical-align: baseline;">'. +                              \
                &mt('Alias').':&nbsp;'.
                               '<input type="text" name="wafproxy_alias_'.$server.'" \
'.  'value="'.$current.'" size="30" /></td>';
             }
@@ -7408,17 +7410,18 @@
                          '</table></td></tr>';
             $itemcount++;
         }
-        if (keys(%othercontrol)) {
-            foreach my $key (sort(keys(%othercontrol))) {
+        if (keys(%otherdoms)) {
+            foreach my $key (sort(keys(%otherdoms))) {
                 $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
-                $datatable = '<tr'.$css_class.'>'.
-                             '<td class="LC_left_item">'.&mt('Domain: \
                [_1]','<b>'.$key.'</b>').'</td>'.
-                             '<td class="LC_left_item"><table>'.$aliasinfo{$key}.
-                             '</table></td></tr>';
+                $datatable .= '<tr'.$css_class.'>'.
+                              '<td class="LC_left_item">'.&mt('Domain: \
[_1]','<b>'.$key.'</b>').'</td>'. +                              '<td \
class="LC_left_item"><table>'.$aliasinfo{$key}. +                              \
'</table></td></tr>';  $itemcount++;
             }
         }
     } else {
+        my %ip_methods = &remoteip_methods();
         if ($setdom) {
             $itemcount ++;
             $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
@@ -7467,7 +7470,6 @@
                           '<tr>'.
                           '<td valign="top">'.$lt{'remoteip'}.':&nbsp;'.
                           '<select name="wafproxy_remoteip" id="wafproxy_remoteip" \
                onchange="javascript:updateWAF();">';
-            my %ip_methods = &remoteip_methods();
             foreach my $option ('m','h','n') {
                 my $sel;
                 if ($option eq $curr_remotip) {
@@ -7515,7 +7517,7 @@
                 $itemcount ++;
                 $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
                 $datatable .= '<tr'.$css_class.'>'.
-                              '<td class="LC_left_item">'.&mt('Domain: \
[_1]',$domain).'</td>'. +                              '<td \
class="LC_left_item">'.&mt('Domain: [_1]','<b>'.$domain.'</b>').'</td>'.  '<td \
                class="LC_left_item"><table>';
                 foreach my $item \
('remoteip','ipheader','trusted','vpnint','vpnext','sslopt') {  my $showval = \
&mt('None'); @@ -7526,6 +7528,8 @@
                         $showval = $values{$domain}{$item};
                         if ($item eq 'ssl') {
                             $showval = $lt{'alltossl'};
+                        } elsif ($item eq 'remoteip') {
+                            $showval = $ip_methods{$values{$domain}{$item}};
                         }
                     }
                     $datatable .= '<tr>'.


_______________________________________________
LON-CAPA-cvs mailing list
LON-CAPA-cvs@mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic