Diff for /loncom/interface/domainprefs.pm between versions 1.373 and 1.378

version 1.373, 2020/12/18 15:23:02 version 1.378, 2021/02/01 15:58:41
Line 263  sub handler { Line 263  sub handler {
     my @prefs_order = ('rolecolors','login','defaults','wafproxy','passwords','quotas',      my @prefs_order = ('rolecolors','login','defaults','wafproxy','passwords','quotas',
                        'autoenroll','autoupdate','autocreate','directorysrch',                         'autoenroll','autoupdate','autocreate','directorysrch',
                        'contacts','privacy','usercreation','selfcreation',                         'contacts','privacy','usercreation','selfcreation',
                        'usermodification','scantron','requestcourses','requestauthor'                         'usermodification','scantron','requestcourses','requestauthor',
                        'coursecategories','serverstatuses','helpsettings','coursedefaults',                         'coursecategories','serverstatuses','helpsettings','coursedefaults',
                        'ltitools','proctoring','selfenrollment','usersessions','ssl',                         'ltitools','proctoring','selfenrollment','usersessions','ssl',
                        'trust','lti');                         'trust','lti');
Line 3781  sub print_contacts { Line 3781  sub print_contacts {
                                                    \%choices,$rownum);                                                     \%choices,$rownum);
         $datatable .= $reports;          $datatable .= $reports;
     } elsif ($position eq 'lower') {      } elsif ($position eq 'lower') {
         $css_class = $rownum%2?' class="LC_odd_row"':'';          my (%current,%excluded,%weights);
         my ($threshold,$sysmail,%excluded,%weights);  
         my ($defaults,$names) = &Apache::loncommon::lon_status_items();          my ($defaults,$names) = &Apache::loncommon::lon_status_items();
         if ($lonstatus{'threshold'} =~ /^\d+$/) {          if ($lonstatus{'threshold'} =~ /^\d+$/) {
             $threshold = $lonstatus{'threshold'};              $current{'errorthreshold'} = $lonstatus{'threshold'};
         } else {          } else {
             $threshold = $defaults->{'threshold'};              $current{'errorthreshold'} = $defaults->{'threshold'};
         }          }
         if ($lonstatus{'sysmail'} =~ /^\d+$/) {          if ($lonstatus{'sysmail'} =~ /^\d+$/) {
             $sysmail = $lonstatus{'sysmail'};              $current{'errorsysmail'} = $lonstatus{'sysmail'};
         } else {          } else {
             $sysmail = $defaults->{'sysmail'};              $current{'errorsysmail'} = $defaults->{'sysmail'};
         }          }
         if (ref($lonstatus{'weights'}) eq 'HASH') {          if (ref($lonstatus{'weights'}) eq 'HASH') {
             foreach my $type ('E','W','N','U') {              foreach my $type ('E','W','N','U') {
Line 3812  sub print_contacts { Line 3811  sub print_contacts {
                 map {$excluded{$_} = 1; } @{$lonstatus{'excluded'}};                  map {$excluded{$_} = 1; } @{$lonstatus{'excluded'}};
             }              }
         }          }
         $datatable .= '<tr'.$css_class.'>'.          foreach my $item ('errorthreshold','errorsysmail') { 
                       '<td class="LC_left_item"><span class="LC_nobreak">'.              $css_class = $rownum%2?' class="LC_odd_row"':'';
                       $titles->{'errorthreshold'}.              $datatable .= '<tr'.$css_class.'>'.
                       '</span></td><td class="LC_left_item">'.                            '<td class="LC_left_item"><span class="LC_nobreak">'.
                       '<input type="text" name="errorthreshold" value="'.                            $titles->{$item}.
                       $threshold.'" size="5" /></td></tr>';                            '</span></td><td class="LC_left_item">'.
         $rownum ++;                            '<input type="text" name="'.$item.'" value="'.
                             $current{$item}.'" size="5" /></td></tr>';
               $rownum ++;
           }
         $css_class = $rownum%2?' class="LC_odd_row"':'';          $css_class = $rownum%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'>'.          $datatable .= '<tr'.$css_class.'>'.
                       '<td class="LC_left_item">'.                        '<td class="LC_left_item">'.
Line 3864  sub print_contacts { Line 3866  sub print_contacts {
         }          }
         $datatable .= '</tr></table></td></tr>';          $datatable .= '</tr></table></td></tr>';
         $rownum ++;          $rownum ++;
         $css_class = $rownum%2?' class="LC_odd_row"':'';  
         $datatable .= '<tr'.$css_class.'>'.  
                       '<td class="LC_left_item"><span class="LC_nobreak">'.  
                       $titles->{'errorsysmail'}.  
                       '</span></td><td class="LC_left_item">'.  
                       '<input type="text" name="errorsysmail" value="'.  
                       $sysmail.'" size="5" /></td></tr>';  
         $rownum ++;  
     } elsif ($position eq 'bottom') {      } elsif ($position eq 'bottom') {
         my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);          my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
         my (@posstypes,%usertypeshash);          my (@posstypes,%usertypeshash);
Line 7185  sub print_wafproxy { Line 7179  sub print_wafproxy {
     my $datatable;      my $datatable;
     my %servers = &Apache::lonnet::internet_dom_servers($dom);      my %servers = &Apache::lonnet::internet_dom_servers($dom);
     my (%othercontrol,%otherdoms,%aliases,%values,$setdom);      my (%othercontrol,%otherdoms,%aliases,%values,$setdom);
       my %lt = &wafproxy_titles();
     foreach my $server (sort(keys(%servers))) {      foreach my $server (sort(keys(%servers))) {
         my $serverhome = &Apache::lonnet::get_server_homeID($servers{$server});          my $serverhome = &Apache::lonnet::get_server_homeID($servers{$server});
         my $serverdom;          my $serverdom;
Line 7202  sub print_wafproxy { Line 7197  sub print_wafproxy {
                     if (ref($settings->{'alias'}) eq 'HASH') {                      if (ref($settings->{'alias'}) eq 'HASH') {
                         $aliases{$dom} = $settings->{'alias'};                          $aliases{$dom} = $settings->{'alias'};
                     }                      }
                     foreach my $item ('ipheader','trusted','exempt') {                      foreach my $item ('ipheader','trusted','vpnint','vpnext') {
                         $values{$dom}{$item} = $settings->{$item};                          $values{$dom}{$item} = $settings->{$item};
                     }                      }
                 }                  }
Line 7217  sub print_wafproxy { Line 7212  sub print_wafproxy {
             if (ref($config{$domain}) eq 'HASH') {              if (ref($config{$domain}) eq 'HASH') {
                 if (ref($config{$domain}{'wafproxy'}) eq 'HASH') {                  if (ref($config{$domain}{'wafproxy'}) eq 'HASH') {
                     $aliases{$domain} = $config{$domain}{'wafproxy'}{'alias'};                      $aliases{$domain} = $config{$domain}{'wafproxy'}{'alias'};
                     foreach my $item ('exempt','trusted','ipheader') {                      foreach my $item ('ipheader','trusted','vpnint','vpnext') {
                         $values{$domain}{$item} = $config{$domain}{'wafproxy'}{$item};                          $values{$domain}{$item} = $config{$domain}{'wafproxy'}{$item};
                     }                      }
                 }                  }
Line 7232  sub print_wafproxy { Line 7227  sub print_wafproxy {
             $datatable .= '<tr'.$css_class.'>'.              $datatable .= '<tr'.$css_class.'>'.
                           '<td>'.&mt('Hostname').':&nbsp;'.                            '<td>'.&mt('Hostname').':&nbsp;'.
                                 &Apache::lonnet::hostname($server).'</td>'.                                  &Apache::lonnet::hostname($server).'</td>'.
                           '<td>';                            '<td class="LC_right_item">';
             if ($othercontrol{$server}) {              if ($othercontrol{$server}) {
                 my $current;                  my $current;
                 if (ref($aliases{$othercontrol{$server}}) eq 'HASH') {                  if (ref($aliases{$othercontrol{$server}}) eq 'HASH') {
Line 7254  sub print_wafproxy { Line 7249  sub print_wafproxy {
                     }                      }
                 }                  }
                 $datatable .= '<input type="text" name="wafproxy_alias_'.$server.'" '.                  $datatable .= '<input type="text" name="wafproxy_alias_'.$server.'" '.
                               'value="'.$current.'" size="20" />';                                'value="'.$current.'" size="30" />';
             }              }
             $datatable .= '</td></tr>';              $datatable .= '</td></tr>';
         }          }
Line 7263  sub print_wafproxy { Line 7258  sub print_wafproxy {
             $itemcount ++;              $itemcount ++;
             $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';              $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
             $datatable .= '<tr'.$css_class.'>'.              $datatable .= '<tr'.$css_class.'>'.
                           '<td>'.&mt('Domain: [_1]','<b>'.$dom.'</b>').'<br /><br />'.                            '<td class="LC_left_item">'.&mt('Domain: [_1]','<b>'.$dom.'</b>').'<br /><br />'.
                           &mt('Format for comma separated IP blocks').':<br />'.                            &mt('Format for comma separated IP blocks').':<br />'.
                           &mt('A.B.C.D/N or A.B.C.D - E.F.G.H').'</td>'.                            &mt('A.B.C.D/N or A.B.C.D - E.F.G.H').'</td>'.
                           '<td class="LC_left_item"><table>';                            '<td class="LC_left_item"><table>';
             foreach my $item ('ipheader','trusted','exempt') {              foreach my $item ('ipheader','trusted','vpnint','vpnext') {
                 $datatable .= '<tr>'.                  $datatable .= '<tr>'.
                               '<td>'.$lt{$item}.':&nbsp;'.                                '<td valign="top">'.$lt{$item}.':&nbsp;';
                               '<input type="text" value="'.$values{$dom}{$item}.'" '.                  if ($item eq 'ipheader') {
                               'name="wafproxy_'.$item.'" /></td></tr>';                      $datatable .= '<input type="text" value="'.$values{$dom}{$item}.'" '.
                                     'name="wafproxy_'.$item.'" />';
    
                   } else {
                       $datatable .= '<textarea name="wafproxy_'.$item.'" rows="3" cols="80">'.
                                     $values{$dom}{$item}.'</textarea>';
                   }
                   $datatable .= '</td></tr>';
             }              }
             $datatable .= '</table></td></tr>';              $datatable .= '</table></td></tr>';
         }          }
Line 7280  sub print_wafproxy { Line 7282  sub print_wafproxy {
                 $itemcount ++;                  $itemcount ++;
                 $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';                  $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
                 $datatable .= '<tr'.$css_class.'>'.                  $datatable .= '<tr'.$css_class.'>'.
                               '<td>'.&mt('Domain: [_1]',$domain).                                '<td class="LC_left_item">'.&mt('Domain: [_1]',$domain).'</td>'.
                               '<table>';                                '<td class="LC_left_item"><table>';
                 foreach my $item ('ipheader','trusted','exempt') {                  foreach my $item ('ipheader','trusted','vpnint','vpnext') {
                     my $showval = &mt('None');                      my $showval = &mt('None');
                     if ($values{$domain}{$item}) {                      if ($values{$domain}{$item}) {
                         $showval = $values{$domain}{$item};                           $showval = $values{$domain}{$item}; 
Line 7300  sub print_wafproxy { Line 7302  sub print_wafproxy {
   
 sub wafproxy_titles {  sub wafproxy_titles {
     return &Apache::lonlocal::texthash(      return &Apache::lonlocal::texthash(
                exempt => 'Exempt IP range(s)',                 vpnint => 'Internal IP Range(s) for VPN sessions',
                  vpnext => 'IP Range for backend WAF connections',
                trusted => 'Trusted IP range(s)',                 trusted => 'Trusted IP range(s)',
                ipheader => 'Custom request header',                 ipheader => 'Custom request header',
            );             );
Line 8341  sub contact_titles { Line 8344  sub contact_titles {
                    'updatesmail'     => 'E-mail from nightly check of LON-CAPA module integrity/updates',                     'updatesmail'     => 'E-mail from nightly check of LON-CAPA module integrity/updates',
                    'idconflictsmail' => 'E-mail from bi-nightly check for multiple users sharing same student/employee ID',                     'idconflictsmail' => 'E-mail from bi-nightly check for multiple users sharing same student/employee ID',
                    'hostipmail'      => 'E-mail from nightly check of hostname/IP network changes',                     'hostipmail'      => 'E-mail from nightly check of hostname/IP network changes',
                    'errorthreshold'  => 'Error/warning threshold for status e-mail',                     'errorthreshold'  => 'Error count threshold for status e-mail to admin(s)',
                    'errorsysmail'    => 'Error threshold for e-mail to core group',                     'errorsysmail'    => 'Error count threshold for e-mail to developer group',
                    'errorweights'    => 'Weights used to compute error count',                     'errorweights'    => 'Weights used to compute error count',
                    'errorexcluded'   => 'Servers with unsent updates excluded from count',                     'errorexcluded'   => 'Servers with unsent updates excluded from count',
                  );                   );
Line 15196  sub modify_contacts { Line 15199  sub modify_contacts {
                 $contacts_hash{'contacts'}{'lonstatus'}{$item} = \@excluded;                  $contacts_hash{'contacts'}{'lonstatus'}{$item} = \@excluded;
             }              }
         } elsif ($item eq 'weights') {          } elsif ($item eq 'weights') {
             foreach my $type ('E','W','N') {              foreach my $type ('E','W','N','U') {
                 $env{'form.error'.$item.'_'.$type} =~ s/^\s+|\s+$//g;                  $env{'form.error'.$item.'_'.$type} =~ s/^\s+|\s+$//g;
                 if ($env{'form.error'.$item.'_'.$type} =~ /^\d+$/) {                  if ($env{'form.error'.$item.'_'.$type} =~ /^\d+$/) {
                     unless ($env{'form.error'.$item.'_'.$type} == $lonstatus_defs->{$type}) {                      unless ($env{'form.error'.$item.'_'.$type} == $lonstatus_defs->{$type}) {
Line 20713  sub modify_loadbalancing { Line 20716  sub modify_loadbalancing {
                             $resulttext .= '<li>'.&mt('Load Balancer: [_1] -- cookie use enabled',                              $resulttext .= '<li>'.&mt('Load Balancer: [_1] -- cookie use enabled',
                                                       $balancer).'</li>';                                                         $balancer).'</li>'; 
                         }                          }
                         if (keys(%toupdate)) {                      }
                             my %thismachine;                  }
                             my $updatedhere;                  if (keys(%toupdate)) {
                             my $cachetime = 60*60*24;                      my %thismachine;
                             map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();                      my $updatedhere;
                             foreach my $lonhost (keys(%toupdate)) {                      my $cachetime = 60*60*24;
                                 if ($thismachine{$lonhost}) {                      map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();
                                     unless ($updatedhere) {                      foreach my $lonhost (keys(%toupdate)) {
                                         &Apache::lonnet::do_cache_new('loadbalancing',$dom,                          if ($thismachine{$lonhost}) {
                                                                       $defaultshash{'loadbalancing'},                              unless ($updatedhere) {
                                                                       $cachetime);                                  &Apache::lonnet::do_cache_new('loadbalancing',$dom,
                                         $updatedhere = 1;                                                                $defaultshash{'loadbalancing'},
                                     }                                                                $cachetime);
                                 } else {                                  $updatedhere = 1;
                                     my $cachekey = &escape('loadbalancing').':'.&escape($dom);  
                                     &Apache::lonnet::remote_devalidate_cache($lonhost,[$cachekey]);  
                                 }  
                             }                              }
                           } else {
                               my $cachekey = &escape('loadbalancing').':'.&escape($dom);
                               &Apache::lonnet::remote_devalidate_cache($lonhost,[$cachekey]);
                         }                          }
                     }                      }
                 }                  }

Removed from v.1.373  
changed lines
  Added in v.1.378


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>