--- loncom/interface/domainprefs.pm 2017/10/15 18:51:15 1.160.6.84.2.4
+++ loncom/interface/domainprefs.pm 2017/10/17 12:58:53 1.160.6.84.2.5
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.84.2.4 2017/10/15 18:51:15 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.84.2.5 2017/10/17 12:58:53 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -5251,9 +5251,14 @@ sub loadbalancing_titles {
'_LC_ipchange' => &mt('Non-SSO users with IP mismatch'),
);
my @alltypes = ('_LC_adv','_LC_author','_LC_internetdom','_LC_external','_LC_ipchangesso','_LC_ipchange');
+ my @available;
if (ref($types) eq 'ARRAY') {
- unshift(@alltypes,@{$types},'default');
+ @available = @{$types};
}
+ unless (grep(/^default$/,@available)) {
+ push(@available,'default');
+ }
+ unshift(@alltypes,@available);
my %titles;
foreach my $type (@alltypes) {
if ($type =~ /^_LC_/) {
@@ -5629,6 +5634,7 @@ sub print_selfcreation {
my %radiohash;
my $numinrow = 4;
map { $radiohash{'cancreate_'.$_} = 1; } @selfcreate;
+ my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
if ($position eq 'top') {
my %choices = &Apache::lonlocal::texthash (
cancreate_login => 'Institutional Login',
@@ -5644,8 +5650,6 @@ sub print_selfcreation {
\%choices,$itemcount,$onclick);
$$rowtotal += $itemcount;
- my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
-
if (ref($usertypes) eq 'HASH') {
if (keys(%{$usertypes}) > 0) {
$datatable .= &insttypes_row($createsettings,$types,$usertypes,
@@ -5695,16 +5699,22 @@ sub print_selfcreation {
$$rowtotal ++;
} elsif ($position eq 'middle') {
my %domconf = &Apache::lonnet::get_dom('configuration',['usermodification'],$dom);
- my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
- $usertypes->{'default'} = $othertitle;
+ my @posstypes;
if (ref($types) eq 'ARRAY') {
- push(@{$types},'default');
- $usertypes->{'default'} = $othertitle;
- foreach my $status (@{$types}) {
- $datatable .= &modifiable_userdata_row('selfcreate',$status,$domconf{'usermodification'},
- $numinrow,$$rowtotal,$usertypes);
- $$rowtotal ++;
- }
+ @posstypes = @{$types};
+ }
+ unless (grep(/^default$/,@posstypes)) {
+ push(@posstypes,'default');
+ }
+ my %usertypeshash;
+ if (ref($usertypes) eq 'HASH') {
+ %usertypeshash = %{$usertypes};
+ }
+ $usertypeshash{'default'} = $othertitle;
+ foreach my $status (@posstypes) {
+ $datatable .= &modifiable_userdata_row('selfcreate',$status,$domconf{'usermodification'},
+ $numinrow,$$rowtotal,\%usertypeshash);
+ $$rowtotal ++;
}
} else {
my %choices = &Apache::lonlocal::texthash (
@@ -5722,29 +5732,33 @@ sub print_selfcreation {
my $onclick = "toggleDisplay(this.form,'emailoptions');";
my $additional = '
';
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
- my $usertypes = {};
- my $order = [];
- if ((ref($domdefaults{'inststatustypes'}) eq 'HASH') && (ref($domdefaults{'inststatusguest'}) eq 'ARRAY')) {
- $usertypes = $domdefaults{'inststatustypes'};
+ if (ref($domdefaults{'inststatusguest'}) eq 'ARRAY') {
$order = $domdefaults{'inststatusguest'};
}
+ my (@ordered,%usertypeshash);
if (ref($order) eq 'ARRAY') {
- push(@{$order},'default');
- if (@{$order} > 1) {
- $usertypes->{'default'} = &mt('Other users');
- $additional .= '
';
- foreach my $status (@{$order}) {
- $additional .= ''.$usertypes->{$status}.' | ';
- }
- $additional .= '
';
- foreach my $status (@{$order}) {
- $additional .= ''.&email_as_username($rowtotal,$processing,$status).' | ';
- }
- $additional .= '
';
- } else {
- $usertypes->{'default'} = &mt('All users');
- $additional .= &email_as_username($rowtotal,$processing);
+ @ordered = @{$order};
+ }
+ if (@ordered) {
+ unless (grep(/^default$/,@ordered)) {
+ push(@ordered,'default');
+ }
+ if (ref($usertypes) eq 'HASH') {
+ %usertypeshash = %{$usertypes};
+ }
+ $usertypeshash{'default'} = $othertitle;
+ $additional .= '
';
+ foreach my $status (@ordered) {
+ $additional .= ''.$usertypeshash{$status}.' | ';
+ }
+ $additional .= '
';
+ foreach my $status (@ordered) {
+ $additional .= ''.&email_as_username($rowtotal,$processing,$status).' | ';
}
+ $additional .= '
';
+ } else {
+ $usertypeshash{'default'} = $othertitle;
+ $additional .= &email_as_username($rowtotal,$processing);
}
$additional .= '
'."\n";
@@ -5755,12 +5769,10 @@ sub print_selfcreation {
$$rowtotal ++;
my ($infofields,$infotitles) = &Apache::loncommon::emailusername_info();
$numinrow = 1;
- if (ref($order) eq 'ARRAY') {
- foreach my $status (@{$order}) {
- $datatable .= &modifiable_userdata_row('cancreate','emailusername_'.$status,$settings,
- $numinrow,$$rowtotal,$usertypes,$infofields,$infotitles);
- $$rowtotal ++;
- }
+ foreach my $status (@ordered) {
+ $datatable .= &modifiable_userdata_row('cancreate','emailusername_'.$status,$settings,
+ $numinrow,$$rowtotal,\%usertypeshash,$infofields,$infotitles);
+ $$rowtotal ++;
}
my ($emailrules,$emailruleorder) =
&Apache::lonnet::inst_userrules($dom,'email');