--- loncom/interface/domainprefs.pm 2019/08/27 23:27:07 1.160.6.101
+++ loncom/interface/domainprefs.pm 2021/01/01 15:33:55 1.160.6.106
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.101 2019/08/27 23:27:07 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.106 2021/01/01 15:33:55 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -718,6 +718,7 @@ sub print_config_box {
if ($numheaders > 1) {
my $colspan = '';
my $rightcolspan = '';
+ my $leftnobr = '';
if (($action eq 'rolecolors') || ($action eq 'defaults') ||
($action eq 'directorysrch') ||
(($action eq 'login') && ($numheaders < 4))) {
@@ -726,12 +727,15 @@ sub print_config_box {
if ($action eq 'usersessions') {
$rightcolspan = ' colspan="3"';
}
+ if ($action eq 'passwords') {
+ $leftnobr = ' LC_nobreak';
+ }
$output .= '
-
'.&mt($item->{'header'}->[0]->{'col1'}).'
+
'.&mt($item->{'header'}->[0]->{'col1'}).'
'.&mt($item->{'header'}->[0]->{'col2'}).'
';
$rowtotal ++;
@@ -790,7 +794,7 @@ sub print_config_box {
-
'.&mt($item->{'header'}->[2]->{'col1'}).'
+
'.&mt($item->{'header'}->[2]->{'col1'}).'
'.&mt($item->{'header'}->[2]->{'col2'}).'
'."\n";
if ($action eq 'coursecategories') {
@@ -4299,7 +4303,7 @@ sub print_passwords {
$datatable .= ''.
- ' ';
+ ' ';
}
}
my $checkedcase;
@@ -4403,7 +4407,7 @@ sub print_passwords {
&mt('(If you use the same account ... reset a password from this page.)').'
'.
&mt('Include custom text:');
if ($customurl) {
- my $link = &Apache::loncommon::modal_link($customurl,&mt('Custom text file'),600,500,
+ my $link = &Apache::loncommon::modal_link($customurl,&mt('custom text'),600,500,
undef,undef,undef,undef,'background-color:#ffffff');
$datatable .= ' '.$link.
''.
- ' ';
+ ' ';
}
}
my $checked;
@@ -4649,13 +4653,18 @@ sub print_usersessions {
if ($position eq 'top') {
if (keys(%serverhomes) > 1) {
my %spareid = ¤t_offloads_to($dom,$settings,\%servers);
- my $curroffloadnow;
+ my ($curroffloadnow,$curroffloadoth);
if (ref($settings) eq 'HASH') {
if (ref($settings->{'offloadnow'}) eq 'HASH') {
$curroffloadnow = $settings->{'offloadnow'};
}
+ if (ref($settings->{'offloadoth'}) eq 'HASH') {
+ $curroffloadoth = $settings->{'offloadoth'};
+ }
}
- $datatable .= &spares_row($dom,\%servers,\%spareid,\%serverhomes,\%altids,$curroffloadnow,$rowtotal);
+ my $other_insts = scalar(keys(%by_location));
+ $datatable .= &spares_row($dom,\%servers,\%spareid,\%serverhomes,\%altids,
+ $other_insts,$curroffloadnow,$curroffloadoth,$rowtotal);
} else {
$datatable .= '
'.
&mt('Nothing to set here, as the cluster to which this domain belongs only contains one server.');
@@ -4905,7 +4914,8 @@ sub current_offloads_to {
}
sub spares_row {
- my ($dom,$servers,$spareid,$serverhomes,$altids,$curroffloadnow,$rowtotal) = @_;
+ my ($dom,$servers,$spareid,$serverhomes,$altids,$other_insts,
+ $curroffloadnow,$curroffloadoth,$rowtotal) = @_;
my $css_class;
my $numinrow = 4;
my $itemcount = 1;
@@ -4925,12 +4935,17 @@ sub spares_row {
}
}
next unless (ref($spareid->{$server}) eq 'HASH');
- my $checkednow;
+ my ($checkednow,$checkedoth);
if (ref($curroffloadnow) eq 'HASH') {
if ($curroffloadnow->{$server}) {
$checkednow = ' checked="checked"';
}
}
+ if (ref($curroffloadoth) eq 'HASH') {
+ if ($curroffloadoth->{$server}) {
+ $checkedoth = ' checked="checked"';
+ }
+ }
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
$datatable .= '
@@ -4939,8 +4954,15 @@ sub spares_row {
,''.$server.'').' '.
''."\n".
''.
+ ' '.&mt('Switch any active user on next access').''.
"\n";
+ if ($other_insts) {
+ $datatable .= ' '.
+ ''."\n".
+ ''.
+ "\n";
+ }
my (%current,%canselect);
my @choices =
&possible_newspares($server,$spareid->{$server},$serverhomes,$altids);
@@ -7370,8 +7392,8 @@ function warnIntPass(field) {
alert('$intalert{passnum}');
}
}
+ field.value = '';
}
- field.value = '';
}
}
}
@@ -7524,7 +7546,7 @@ sub initialize_categories {
.''
.''
.' '
- .&mt('Add category').'
>'.&mt('Name:')
+ .&mt('Add category').'
'.&mt('Name:')
.' '
.'
';
return $datatable;
@@ -10941,7 +10963,7 @@ sub modify_passwords {
if ($current{'resetlink'} ne $linklife) {
$changes{'reset'} = 1;
}
- } elsif (!exists($domconfig{passwords})) {
+ } elsif (!ref($domconfig{passwords}) eq 'HASH') {
if ($staticdefaults{'resetlink'} ne $linklife) {
$changes{'reset'} = 1;
}
@@ -10962,7 +10984,7 @@ sub modify_passwords {
if (@diffs > 0) {
$changes{'reset'} = 1;
}
- } elsif (!exists($domconfig{passwords})) {
+ } elsif (!ref($domconfig{passwords}) eq 'HASH') {
my @diffs = &Apache::loncommon::compare_arrays($staticdefaults{'resetcase'},\@casesens);
if (@diffs > 0) {
$changes{'reset'} = 1;
@@ -10974,7 +10996,7 @@ sub modify_passwords {
if ($current{'resetprelink'} ne $newvalues{'resetprelink'}) {
$changes{'reset'} = 1;
}
- } elsif (!exists($domconfig{passwords})) {
+ } elsif (!ref($domconfig{passwords}) eq 'HASH') {
if ($staticdefaults{'resetprelink'} ne $newvalues{'resetprelink'}) {
$changes{'reset'} = 1;
}
@@ -11001,7 +11023,7 @@ sub modify_passwords {
} else {
$changes{'reset'} = 1;
}
- } elsif (!exists($domconfig{passwords})) {
+ } elsif (!ref($domconfig{passwords}) eq 'HASH') {
my @diffs = &Apache::loncommon::compare_arrays($staticdefaults{'resetpostlink'}{$type},\@postlink);
if (@diffs > 0) {
$changes{'reset'} = 1;
@@ -11023,7 +11045,7 @@ sub modify_passwords {
if (@diffs > 0) {
$changes{'reset'} = 1;
}
- } elsif (!exists($domconfig{passwords})) {
+ } elsif (!ref($domconfig{passwords}) eq 'HASH') {
my @diffs = &Apache::loncommon::compare_arrays($staticdefaults{'resetemail'},\@resetemail);
if (@diffs > 0) {
$changes{'reset'} = 1;
@@ -11130,6 +11152,8 @@ sub modify_passwords {
if ($staticdefaults{$rule} ne $newvalues{$rule}) {
$changes{'rules'} = 1;
}
+ } else {
+ $changes{'rules'} = 1;
}
} elsif (exists($current{$rule})) {
$changes{'rules'} = 1;
@@ -11178,7 +11202,7 @@ sub modify_passwords {
}
}
}
- } elsif (!exists($domconfig{passwords})) {
+ } elsif (!(ref($domconfig{passwords}) eq 'HASH')) {
foreach my $item ('by','for') {
if (@{$crsownerchg{$item}} > 0) {
$changes{'crsownerchg'} = 1;
@@ -11208,9 +11232,11 @@ sub modify_passwords {
$resulttext .= '
'.&mt('CAPTCHA validation set to use: original CAPTCHA').'
'.&mt('[_1] set to [_2]',$titles{$rule},$confighash{'passwords'}{$rule}).'
';
}
}
+ if (ref($confighash{'passwords'}{'chars'}) eq 'ARRAY') {
+ if (@{$confighash{'passwords'}{'chars'}} > 0) {
+ my %rulenames = &Apache::lonlocal::texthash(
+ uc => 'At least one upper case letter',
+ lc => 'At least one lower case letter',
+ num => 'At least one number',
+ spec => 'At least one non-alphanumeric',
+ );
+ my $needed = '