--- loncom/interface/domainprefs.pm 2011/08/01 19:46:49 1.146
+++ loncom/interface/domainprefs.pm 2011/08/01 23:33:43 1.147
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.146 2011/08/01 19:46:49 raeburn Exp $
+# $Id: domainprefs.pm,v 1.147 2011/08/01 23:33:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -7124,7 +7124,8 @@ sub modify_usersessions {
}
}
- if (keys(%changes) > 0) {
+ my $nochgmsg = &mt('No changes made to settings for user session hosting/offloading.');
+ if ((keys(%changes) > 0) || ($savespares)) {
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,
$dom);
if ($putresult eq 'ok') {
@@ -7138,71 +7139,75 @@ sub modify_usersessions {
}
my $cachetime = 24*60*60;
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
- my %lt = &usersession_titles();
- $resulttext = &mt('Changes made:').'
';
- foreach my $prefix (@prefixes) {
- if (ref($changes{$prefix}) eq 'HASH') {
- $resulttext .= '- '.$lt{$prefix}.'
';
- if ($prefix eq 'spares') {
- if (ref($changes{$prefix}) eq 'HASH') {
- foreach my $lonhost (sort(keys(%{$changes{$prefix}}))) {
- $resulttext .= '- '.$lonhost.' ';
- if (ref($changes{$prefix}{$lonhost}) eq 'HASH') {
- foreach my $type (@{$types{$prefix}}) {
- if ($changes{$prefix}{$lonhost}{$type}) {
- my $offloadto = &mt('None');
- if (ref($defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}) eq 'ARRAY') {
- if (@{$defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}} > 0) {
- $offloadto = join(', ',@{$defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}});
+ if (keys(%changes) > 0) {
+ my %lt = &usersession_titles();
+ $resulttext = &mt('Changes made:').'
';
+ foreach my $prefix (@prefixes) {
+ if (ref($changes{$prefix}) eq 'HASH') {
+ $resulttext .= '- '.$lt{$prefix}.'
';
+ if ($prefix eq 'spares') {
+ if (ref($changes{$prefix}) eq 'HASH') {
+ foreach my $lonhost (sort(keys(%{$changes{$prefix}}))) {
+ $resulttext .= '- '.$lonhost.' ';
+ if (ref($changes{$prefix}{$lonhost}) eq 'HASH') {
+ foreach my $type (@{$types{$prefix}}) {
+ if ($changes{$prefix}{$lonhost}{$type}) {
+ my $offloadto = &mt('None');
+ if (ref($defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}) eq 'ARRAY') {
+ if (@{$defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}} > 0) {
+ $offloadto = join(', ',@{$defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}});
+ }
}
+ $resulttext .= &mt('[_1] set to: [_2].',''.$lt{$type}.'',$offloadto).(' 'x3);
}
- $resulttext .= &mt('[_1] set to: [_2]',''.$lt{'type'}.'',$offloadto).(' 'x3);
}
}
+ $resulttext .= '
';
}
- $resulttext .= '
';
}
- }
- } else {
- foreach my $type (@{$types{$prefix}}) {
- if (defined($changes{$prefix}{$type})) {
- my $newvalue;
- if (ref($defaultshash{'usersessions'}) eq 'HASH') {
- if (ref($defaultshash{'usersessions'}{$prefix})) {
- if ($type eq 'version') {
- $newvalue = $defaultshash{'usersessions'}{$prefix}{$type};
- } elsif (ref($defaultshash{'usersessions'}{$prefix}{$type}) eq 'ARRAY') {
- if (@{$defaultshash{'usersessions'}{$prefix}{$type}} > 0) {
- $newvalue = join(', ',@{$defaultshash{'usersessions'}{$prefix}{$type}});
+ } else {
+ foreach my $type (@{$types{$prefix}}) {
+ if (defined($changes{$prefix}{$type})) {
+ my $newvalue;
+ if (ref($defaultshash{'usersessions'}) eq 'HASH') {
+ if (ref($defaultshash{'usersessions'}{$prefix})) {
+ if ($type eq 'version') {
+ $newvalue = $defaultshash{'usersessions'}{$prefix}{$type};
+ } elsif (ref($defaultshash{'usersessions'}{$prefix}{$type}) eq 'ARRAY') {
+ if (@{$defaultshash{'usersessions'}{$prefix}{$type}} > 0) {
+ $newvalue = join(', ',@{$defaultshash{'usersessions'}{$prefix}{$type}});
+ }
}
}
}
- }
- if ($newvalue eq '') {
- if ($type eq 'version') {
- $resulttext .= '- '.&mt('[_1] set to: off',$lt{$type}).'
';
+ if ($newvalue eq '') {
+ if ($type eq 'version') {
+ $resulttext .= '- '.&mt('[_1] set to: off',$lt{$type}).'
';
+ } else {
+ $resulttext .= '- '.&mt('[_1] set to: none',$lt{$type}).'
';
+ }
} else {
- $resulttext .= '- '.&mt('[_1] set to: none',$lt{$type}).'
';
- }
- } else {
- if ($type eq 'version') {
- $newvalue .= ' '.&mt('(or later)');
+ if ($type eq 'version') {
+ $newvalue .= ' '.&mt('(or later)');
+ }
+ $resulttext .= '- '.&mt('[_1] set to: [_2].',$lt{$type},$newvalue).'
';
}
- $resulttext .= '- '.&mt('[_1] set to: [_2].',$lt{$type},$newvalue).'
';
}
}
}
+ $resulttext .= '
';
}
- $resulttext .= '
';
}
+ $resulttext .= '
';
+ } else {
+ $resulttext = $nochgmsg;
}
- $resulttext .= '';
} else {
$resulttext = ''.
&mt('An error occurred: [_1]',$putresult).'';
}
} else {
- $resulttext = &mt('No changes made to settings for user session hosting/offloading.');
+ $resulttext = $nochgmsg;
}
return $resulttext;
}