[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm
raeburn
raeburn at source.lon-capa.org
Tue Jul 18 12:03:09 EDT 2017
raeburn Tue Jul 18 16:03:09 2017 EDT
Modified files:
/loncom/interface domainprefs.pm
Log:
- Bug 6854.
Addition of 'default' to status types, and (All Users or Other Users)
to usertypes in print_selfcreation() needs to be made to copies of
$types array ref and $usertypes hash ref to avoid affecting other routines
using loncommon::sorted_inst_types(() in the same request.
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.301 loncom/interface/domainprefs.pm:1.302
--- loncom/interface/domainprefs.pm:1.301 Mon Jun 5 21:12:05 2017
+++ loncom/interface/domainprefs.pm Tue Jul 18 16:03:08 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.301 2017/06/05 21:12:05 raeburn Exp $
+# $Id: domainprefs.pm,v 1.302 2017/07/18 16:03:08 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -5390,9 +5390,14 @@
'_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$/, at available)) {
+ push(@available,'default');
+ }
+ unshift(@alltypes, at available);
my %titles;
foreach my $type (@alltypes) {
if ($type =~ /^_LC_/) {
@@ -5770,6 +5775,7 @@
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',
@@ -5785,8 +5791,6 @@
\%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,
@@ -5836,16 +5840,22 @@
$$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$/, at 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 (
@@ -5863,29 +5873,34 @@
my $onclick = "toggleDisplay(this.form,'emailoptions');";
my $additional = '<div id="emailoptions" style="display: '.$display.'">';
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'};
+ my $order;
+ 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 .= '<table><tr>';
- foreach my $status (@{$order}) {
- $additional .= '<th>'.$usertypes->{$status}.'</th>';
- }
- $additional .= '</tr><tr>';
- foreach my $status (@{$order}) {
- $additional .= '<td>'.&email_as_username($rowtotal,$processing,$status).'</td>';
- }
- $additional .= '</tr></table>';
- } else {
- $usertypes->{'default'} = &mt('All users');
- $additional .= &email_as_username($rowtotal,$processing);
+ @ordered = @{$order};
+ }
+ if (@ordered) {
+ unless (grep(/^default$/, at ordered)) {
+ push(@ordered,'default');
+ }
+ if (ref($usertypes) eq 'HASH') {
+ %usertypeshash = %{$usertypes};
+ }
+ $usertypeshash{'default'} = $othertitle;
+ $additional .= '<table><tr>';
+ foreach my $status (@ordered) {
+ $additional .= '<th>'.$usertypeshash{$status}.'</th>';
}
+ $additional .= '</tr><tr>';
+ foreach my $status (@ordered) {
+ $additional .= '<td>'.&email_as_username($rowtotal,$processing,$status).'</td>';
+ }
+ $additional .= '</tr></table>';
+ } else {
+ $usertypeshash{'default'} = $othertitle;
+ $additional .= &email_as_username($rowtotal,$processing);
}
$additional .= '</div>'."\n";
@@ -5896,12 +5911,10 @@
$$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');
More information about the LON-CAPA-cvs
mailing list