[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface domainprefs.pm
raeburn
raeburn at source.lon-capa.org
Sat Feb 26 21:42:30 EST 2022
raeburn Sun Feb 27 02:42:30 2022 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface domainprefs.pm
Log:
- For 2.11
Backport 1.409
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.160.6.121 loncom/interface/domainprefs.pm:1.160.6.122
--- loncom/interface/domainprefs.pm:1.160.6.121 Wed Jan 19 20:56:06 2022
+++ loncom/interface/domainprefs.pm Sun Feb 27 02:42:30 2022
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.121 2022/01/19 20:56:06 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.122 2022/02/27 02:42:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -268,7 +268,9 @@
header => [{col1 => 'Setting',
col2 => 'Value'},
{col1 => 'Institutional user types',
- col2 => 'Name displayed'}],
+ col2 => 'Name displayed'},
+ {col1 => 'Mapping for missing usernames via standard log-in',
+ col2 => 'Rules in use'}],
print => \&print_defaults,
modify => \&modify_defaults,
},
@@ -822,7 +824,7 @@
if (($action eq 'autoupdate') || ($action eq 'usercreation') ||
($action eq 'selfcreation') || ($action eq 'selfenrollment') ||
($action eq 'usersessions') || ($action eq 'coursecategories') ||
- ($action eq 'contacts') || ($action eq 'passwords')) {
+ ($action eq 'contacts') || ($action eq 'passwords') || ($action eq 'defaults')) {
if ($action eq 'coursecategories') {
$output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal);
$colspan = ' colspan="2"';
@@ -876,8 +878,8 @@
}
$rowtotal ++;
} elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||
- ($action eq 'defaults') || ($action eq 'directorysrch') ||
- ($action eq 'helpsettings') || ($action eq 'wafproxy')) {
+ ($action eq 'directorysrch') || ($action eq 'helpsettings') ||
+ ($action eq 'wafproxy')) {
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
} elsif ($action eq 'scantron') {
$output .= $item->{'print'}->($r,'bottom',$dom,$confname,$settings,\$rowtotal);
@@ -7424,7 +7426,7 @@
'username' => 'new usernames',
'id' => 'IDs',
);
- unless ($type eq 'email') {
+ unless (($type eq 'email') || ($type eq 'unamemap')) {
my $css_class = $rowcount%2?' class="LC_odd_row"':'';
$output = '<tr '.$css_class.'>'.
'<td><span class="LC_nobreak">'.
@@ -7479,9 +7481,9 @@
} elsif ($colsleft == 1) {
$output .= '<td class="LC_left_item"> </td>';
}
- $output .= '</tr></table>';
- unless ($type eq 'email') {
- $output .= '</td></tr>';
+ $output .= '</tr>';
+ unless (($type eq 'email') || ($type eq 'unamemap')) {
+ $output .= '</table></td></tr>';
}
return $output;
}
@@ -7622,7 +7624,7 @@
$datatable .= '</td></tr>';
$rownum ++;
}
- } else {
+ } elsif ($position eq 'middle') {
my %defaults;
if (ref($settings) eq 'HASH') {
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) {
@@ -7672,6 +7674,22 @@
$rownum ++;
}
}
+ } else {
+ my ($unamemaprules,$ruleorder) =
+ &Apache::lonnet::inst_userrules($dom,'unamemap');
+ $css_class = $rownum%2?' class="LC_odd_row"':'';
+ if ((ref($unamemaprules) eq 'HASH') && (ref($ruleorder) eq 'ARRAY')) {
+ my $numinrow = 2;
+ $datatable .= '<tr'.$css_class.'><td>'.&mt('Available conversions').'</td><td><table>'.
+ &user_formats_row('unamemap',$settings,$unamemaprules,
+ $ruleorder,$numinrow).
+ '</table></td></tr>';
+ }
+ if ($datatable eq '') {
+ $datatable .= '<tr'.$css_class.'><td colspan="2">'.
+ &mt('No rules set for domain in customized localenroll.pm').
+ '</td></tr>';
+ }
}
$$rowtotal += $rownum;
return $datatable;
@@ -14583,6 +14601,41 @@
$newvalues{$item} = $staticdefaults{$item};
}
}
+ my ($unamemaprules,$ruleorder);
+ my @possunamemaprules = &Apache::loncommon::get_env_multiple('form.unamemap_rule');
+ if (@possunamemaprules) {
+ ($unamemaprules,$ruleorder) =
+ &Apache::lonnet::inst_userrules($dom,'unamemap');
+ if ((ref($unamemaprules) eq 'HASH') && (ref($ruleorder) eq 'ARRAY')) {
+ if (@{$ruleorder} > 0) {
+ my %possrules;
+ map { $possrules{$_} = 1; } @possunamemaprules;
+ foreach my $rule (@{$ruleorder}) {
+ if ($possrules{$rule}) {
+ push(@{$newvalues{'unamemap_rule'}},$rule);
+ }
+ }
+ }
+ }
+ }
+ if (ref($domdefaults{'unamemap_rule'}) eq 'ARRAY') {
+ if (ref($newvalues{'unamemap_rule'}) eq 'ARRAY') {
+ my @rulediffs = &Apache::loncommon::compare_arrays($domdefaults{'unamemap_rule'},
+ $newvalues{'unamemap_rule'});
+ if (@rulediffs) {
+ $changes{'unamemap_rule'} = 1;
+ $domdefaults{'unamemap_rule'} = $newvalues{'unamemap_rule'};
+ }
+ } elsif (@{$domdefaults{'unamemap_rule'}} > 0) {
+ $changes{'unamemap_rule'} = 1;
+ delete($domdefaults{'unamemap_rule'});
+ }
+ } elsif (ref($newvalues{'unamemap_rule'}) eq 'ARRAY') {
+ if (@{$newvalues{'unamemap_rule'}} > 0) {
+ $changes{'unamemap_rule'} = 1;
+ $domdefaults{'unamemap_rule'} = $newvalues{'unamemap_rule'};
+ }
+ }
my %defaults_hash = (
defaults => \%newvalues,
);
@@ -14699,6 +14752,26 @@
$resulttext .= '<li>'.&mt('Institutional user status types deleted').'</li>';
}
}
+ } elsif ($item eq 'unamemap_rule') {
+ if (ref($newvalues{'unamemap_rule'}) eq 'ARRAY') {
+ my @rulenames;
+ if (ref($unamemaprules) eq 'HASH') {
+ foreach my $rule (@{$newvalues{'unamemap_rule'}}) {
+ if (ref($unamemaprules->{$rule}) eq 'HASH') {
+ push(@rulenames,$unamemaprules->{$rule}->{'name'});
+ }
+ }
+ }
+ if (@rulenames) {
+ $resulttext .= '<li>'.&mt('Mapping for missing usernames includes: [_1]',
+ '<ul><li>'.join('</li><li>', at rulenames).'</li></ul>').
+ '</li>';
+ } else {
+ $resulttext .= '<li>'.&mt('No mapping for missing usernames via standard log-in').'</li>';
+ }
+ } else {
+ $resulttext .= '<li>'.&mt('Mapping for missing usernames via standard log-in deleted').'</li>';
+ }
} else {
my $value = $env{'form.'.$item};
if ($value eq '') {
More information about the LON-CAPA-cvs
mailing list