';
my $rem = $i%($numinrow);
if ($rem == 0) {
if (($i > 0) && ($i < $numspares-1)) {
@@ -3873,7 +3753,7 @@ sub loadbalancing_rules {
if (ref($currrules) eq 'HASH') {
$current = $currrules->{$type};
}
- if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) {
+ if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) {
if ($dom ne &Apache::lonnet::host_domain($lonhost)) {
$current = '';
}
@@ -3925,7 +3805,7 @@ sub loadbalance_rule_row {
my @rulenames;
my %ruletitles = &offloadtype_text();
if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) {
- @rulenames = ('balancer','offloadedto','specific');
+ @rulenames = ('balancer','offloadedto');
} else {
@rulenames = ('default','homeserver');
if ($type eq '_LC_external') {
@@ -3936,7 +3816,7 @@ sub loadbalance_rule_row {
push(@rulenames,'none');
}
my $style = $targets_div_style;
- if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) {
+ if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) {
$style = $homedom_div_style;
}
my $space;
@@ -3987,13 +3867,8 @@ sub loadbalance_rule_row {
' ';
- if (($rulenames[$i] eq 'specific') && ($type =~ /^_LC_ipchange/)) {
- $output .= $ruletitles{'particular'};
- } else {
- $output .= $ruletitles{$rulenames[$i]};
- }
- $output .= ''.$extra.' '."\n";
+ ')"'.$checked.' /> '.$ruletitles{$rulenames[$i]}.
+ ''.$extra.' '."\n";
}
$output .= '
'."\n";
return $output;
@@ -4008,7 +3883,6 @@ sub offloadtype_text {
'none' => 'No offload',
'balancer' => 'Session hosted on Load Balancer, after re-authentication',
'offloadedto' => 'Session hosted on offload server, after re-authentication',
- 'particular' => 'Session hosted (after re-auth) on server:',
);
return %ruletitles;
}
@@ -5298,7 +5172,7 @@ sub serverstatus_pages {
sub defaults_javascript {
my ($settings) = @_;
- return unless (ref($settings) eq 'HASH');
+ return unless (ref($settings) eq 'HASH');
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) {
my $maxnum = scalar(@{$settings->{'inststatusorder'}});
if ($maxnum eq '') {
@@ -5898,7 +5772,6 @@ sub modify_login {
}
my %servers = &Apache::lonnet::internet_dom_servers($dom);
- my %domservers = &Apache::lonnet::get_servers($dom);
my @loginvia_attribs = ('serverpath','custompath','exempt');
if (keys(%servers) > 1) {
foreach my $lonhost (keys(%servers)) {
@@ -5941,7 +5814,22 @@ sub modify_login {
$changes{'loginvia'}{$lonhost} = 1;
}
if ($item eq 'exempt') {
- $new = &check_exempt_addresses($new);
+ $new =~ s/^\s+//;
+ $new =~ s/\s+$//;
+ my @poss_ips = split(/\s*[,:]\s*/,$new);
+ my @okips;
+ foreach my $ip (@poss_ips) {
+ if ($ip =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {
+ if (($1 <= 255) && ($2 <= 255) && ($3 <= 255) && ($4 <= 255)) {
+ push(@okips,$ip);
+ }
+ }
+ }
+ if (@okips > 0) {
+ $new = join(',',@okips);
+ } else {
+ $new = '';
+ }
}
$loginhash{login}{loginvia}{$lonhost}{$item} = $new;
}
@@ -6053,85 +5941,6 @@ sub modify_login {
$errors .= '
'.$error.'
';
}
}
-
- my (%currheadtagurls,%currexempt,@newhosts,%newheadtagurls,%possexempt);
- if (ref($domconfig{'login'}) eq 'HASH') {
- if (ref($domconfig{'login'}{'headtag'}) eq 'HASH') {
- foreach my $lonhost (keys(%{$domconfig{'login'}{'headtag'}})) {
- if ($domservers{$lonhost}) {
- if (ref($domconfig{'login'}{'headtag'}{$lonhost}) eq 'HASH') {
- $currheadtagurls{$lonhost} = $domconfig{'login'}{'headtag'}{$lonhost}{'url'};
- $currexempt{$lonhost} = $domconfig{'login'}{'headtagexempt'}{$lonhost}{'exempt'}
- }
- }
- }
- }
- }
- my @delheadtagurls = &Apache::loncommon::get_env_multiple('form.loginheadtag_del');
- foreach my $lonhost (sort(keys(%domservers))) {
- if (grep(/^\Q$lonhost\E$/,@delheadtagurls)) {
- $changes{'headtag'}{$lonhost} = 1;
- } else {
- if ($env{'form.loginheadtagexempt_'.$lonhost}) {
- $possexempt{$lonhost} = &check_exempt_addresses($env{'form.loginheadtagexempt_'.$lonhost});
- }
- if ($env{'form.loginheadtag_'.$lonhost.'.filename'}) {
- push(@newhosts,$lonhost);
- } elsif ($currheadtagurls{$lonhost}) {
- $loginhash{'login'}{'headtag'}{$lonhost}{'url'} = $currheadtagurls{$lonhost};
- if ($currexempt{$lonhost}) {
- if ((!exists($possexempt{$lonhost})) || ($possexempt{$lonhost} ne $currexempt{$lonhost})) {
- $changes{'headtag'}{$lonhost} = 1;
- }
- } elsif ($possexempt{$lonhost}) {
- $changes{'headtag'}{$lonhost} = 1;
- }
- if ($possexempt{$lonhost}) {
- $loginhash{'login'}{'headtag'}{$lonhost}{'exempt'} = $possexempt{$lonhost};
- }
- }
- }
- }
- if (@newhosts) {
- my $error;
- my ($configuserok,$author_ok,$switchserver) = &config_check($dom,$confname,$servadm);
- if ($configuserok eq 'ok') {
- if ($switchserver) {
- $error = &mt("Upload of custom markup is not permitted to this server: [_1]",$switchserver);
- } elsif ($author_ok eq 'ok') {
- foreach my $lonhost (@newhosts) {
- my $formelem = 'loginheadtag_'.$lonhost;
- (my $result,$newheadtagurls{$lonhost}) = &publishlogo($r,'upload',$formelem,$dom,$confname,
- "login/headtag/$lonhost",'','',
- $env{'form.loginheadtag_'.$lonhost.'.filename'});
- if ($result eq 'ok') {
- $loginhash{'login'}{'headtag'}{$lonhost}{'url'} = $newheadtagurls{$lonhost};
- $changes{'headtag'}{$lonhost} = 1;
- if ($possexempt{$lonhost}) {
- $loginhash{'login'}{'headtag'}{$lonhost}{'exempt'} = $possexempt{$lonhost};
- }
- } else {
- my $puberror = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].",
- $newheadtagurls{$lonhost},$result);
- $errors .= '
'.$puberror.'
';
- if ((grep(/^\Q$lonhost\E$/,keys(%currheadtagurls))) &&
- (!grep(/^\Q$lonhost\E$/,@delheadtagurls))) {
- $loginhash{'login'}{'headtag'}{$lonhost} = $currheadtagurls{$lonhost};
- }
- }
- }
- } else {
- $error = &mt("Upload of custom markup file(s) failed because an author role could not be assigned to a Domain Configuration user ([_1]) in domain: [_2]. Error was: [_3].",$confname,$dom,$author_ok);
- }
- } else {
- $error = &mt("Upload of custom markup file(s) failed because a Domain Configuration user ([_1]) could not be created in domain: [_2]. Error was: [_3].",$confname,$dom,$configuserok);
- }
- if ($error) {
- &Apache::lonnet::logthis($error);
- $errors .= '
'.$error.'
';
- }
- }
-
&process_captcha('login',\%changes,$loginhash{'login'},$domconfig{'login'});
my $defaulthelpfile = '/adm/loginproblems.html';
@@ -6232,25 +6041,6 @@ sub modify_login {
}
}
}
- } elsif ($item eq 'headtag') {
- if (ref($changes{$item}) eq 'HASH') {
- foreach my $lonhost (sort(keys(%{$changes{$item}}))) {
- if (grep(/^\Q$lonhost\E$/,@delheadtagurls)) {
- $resulttext .= '
'.&mt('custom markup file removed for [_1]',$domservers{$lonhost}).'
'.&mt('Submit button(s) remain enabled on page after student makes submission.');
- } else {
- $resulttext .= '
'.&mt('Submit button(s) disabled on page after student makes submission').'; ';
- if (ref($defaultshash{'coursedefaults'}{'postsubmit'}) eq 'HASH') {
- $resulttext .= &mt('durations:').'
';
- $toupdate{$balancer} = 1;
+ my $cachekey = &escape('loadbalancing').':'.&escape($dom);
+ &Apache::lonnet::remote_devalidate_cache($balancer,[$cachekey]);
}
}
if (ref($changes{'add'}) eq 'ARRAY') {
foreach my $balancer (sort(@{$changes{'add'}})) {
$resulttext .= '
'.&mt('Load Balancing enabled for: [_1]',$balancer);
- $toupdate{$balancer} = 1;
}
}
if (ref($changes{'curr'}) eq 'HASH') {
foreach my $balancer (sort(keys(%{$changes{'curr'}}))) {
- $toupdate{$balancer} = 1;
if (ref($changes{'curr'}{$balancer}) eq 'HASH') {
if ($changes{'curr'}{$balancer}{'targets'}) {
my %offloadstr;
@@ -11192,38 +10843,8 @@ sub modify_loadbalancing {
if ($rule eq '') {
$balancetext = $ruletitles{'default'};
} elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer') ||
- ($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) {
- if (($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) {
- foreach my $sparetype (@sparestypes) {
- if (ref($defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}) eq 'ARRAY') {
- map { $toupdate{$_} = 1; } (@{$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}});
- }
- }
- foreach my $item (@{$alltypes}) {
- next if ($item =~ /^_LC_ipchange/);
- my $hasrule = $defaultshash{'loadbalancing'}{$balancer}{'rules'}{$item};
- if ($hasrule eq 'homeserver') {
- map { $toupdate{$_} = 1; } (keys(%libraryservers));
- } else {
- unless (($hasrule eq 'default') || ($hasrule eq 'none') || ($hasrule eq 'externalbalancer')) {
- if ($servers{$hasrule}) {
- $toupdate{$hasrule} = 1;
- }
- }
- }
- }
- if (($rule eq 'balancer') || ($rule eq 'offloadedto')) {
- $balancetext = $ruletitles{$rule};
- } else {
- my $receiver = $defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type};
- $balancetext = $ruletitles{'particular'}.' '.$receiver;
- if ($receiver) {
- $toupdate{$receiver};
- }
- }
- } else {
- $balancetext = $ruletitles{$rule};
- }
+ ($rule eq 'balancer') || ($rule eq 'offloadedto')) {
+ $balancetext = $ruletitles{$rule};
} else {
$balancetext = &mt('offload to [_1]',$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type});
}
@@ -11232,25 +10853,8 @@ sub modify_loadbalancing {
}
}
}
- if (keys(%toupdate)) {
- my %thismachine;
- my $updatedhere;
- my $cachetime = 60*60*24;
- map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();
- foreach my $lonhost (keys(%toupdate)) {
- if ($thismachine{$lonhost}) {
- unless ($updatedhere) {
- &Apache::lonnet::do_cache_new('loadbalancing',$dom,
- $defaultshash{'loadbalancing'},
- $cachetime);
- $updatedhere = 1;
- }
- } else {
- my $cachekey = &escape('loadbalancing').':'.&escape($dom);
- &Apache::lonnet::remote_devalidate_cache($lonhost,[$cachekey]);
- }
- }
- }
+ my $cachekey = &escape('loadbalancing').':'.&escape($dom);
+ &Apache::lonnet::remote_devalidate_cache($balancer,[$cachekey]);
}
}
if ($resulttext ne '') {
@@ -11950,9 +11554,6 @@ function toggleDisplay(domForm,caller) {
if (caller == 'emailoptions') {
optionsElement = domForm.cancreate_email;
}
- if (caller == 'studentsubmission') {
- optionsElement = domForm.postsubmit;
- }
if (optionsElement.length) {
var currval;
for (var i=0; i500 Internal Server Error
Internal Server Error
The server encountered an internal error or
misconfiguration and was unable to complete
your request.
Please contact the server administrator at
root@localhost to inform them of the time this error occurred,
and the actions you performed just before this error.
More information about this error may be available
in the server error log.