version 1.146, 2011/08/01 19:46:49
|
version 1.147, 2011/08/01 23:33:43
|
Line 7124 sub modify_usersessions {
|
Line 7124 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, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
$dom); |
$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
Line 7138 sub modify_usersessions {
|
Line 7139 sub modify_usersessions {
|
} |
} |
my $cachetime = 24*60*60; |
my $cachetime = 24*60*60; |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
my %lt = &usersession_titles(); |
if (keys(%changes) > 0) { |
$resulttext = &mt('Changes made:').'<ul>'; |
my %lt = &usersession_titles(); |
foreach my $prefix (@prefixes) { |
$resulttext = &mt('Changes made:').'<ul>'; |
if (ref($changes{$prefix}) eq 'HASH') { |
foreach my $prefix (@prefixes) { |
$resulttext .= '<li>'.$lt{$prefix}.'<ul>'; |
if (ref($changes{$prefix}) eq 'HASH') { |
if ($prefix eq 'spares') { |
$resulttext .= '<li>'.$lt{$prefix}.'<ul>'; |
if (ref($changes{$prefix}) eq 'HASH') { |
if ($prefix eq 'spares') { |
foreach my $lonhost (sort(keys(%{$changes{$prefix}}))) { |
if (ref($changes{$prefix}) eq 'HASH') { |
$resulttext .= '<li><b>'.$lonhost.'</b> '; |
foreach my $lonhost (sort(keys(%{$changes{$prefix}}))) { |
if (ref($changes{$prefix}{$lonhost}) eq 'HASH') { |
$resulttext .= '<li><b>'.$lonhost.'</b> '; |
foreach my $type (@{$types{$prefix}}) { |
if (ref($changes{$prefix}{$lonhost}) eq 'HASH') { |
if ($changes{$prefix}{$lonhost}{$type}) { |
foreach my $type (@{$types{$prefix}}) { |
my $offloadto = &mt('None'); |
if ($changes{$prefix}{$lonhost}{$type}) { |
if (ref($defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}) eq 'ARRAY') { |
my $offloadto = &mt('None'); |
if (@{$defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}} > 0) { |
if (ref($defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}) eq 'ARRAY') { |
$offloadto = join(', ',@{$defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}}); |
if (@{$defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}} > 0) { |
|
$offloadto = join(', ',@{$defaultshash{'usersessions'}{'spares'}{$lonhost}{$type}}); |
|
} |
} |
} |
|
$resulttext .= &mt('[_1] set to: [_2].','<i>'.$lt{$type}.'</i>',$offloadto).(' 'x3); |
} |
} |
$resulttext .= &mt('[_1] set to: [_2]','<i>'.$lt{'type'}.'</i>',$offloadto).(' 'x3); |
|
} |
} |
} |
} |
|
$resulttext .= '</li>'; |
} |
} |
$resulttext .= '</li>'; |
|
} |
} |
} |
} else { |
} else { |
foreach my $type (@{$types{$prefix}}) { |
foreach my $type (@{$types{$prefix}}) { |
if (defined($changes{$prefix}{$type})) { |
if (defined($changes{$prefix}{$type})) { |
my $newvalue; |
my $newvalue; |
if (ref($defaultshash{'usersessions'}) eq 'HASH') { |
if (ref($defaultshash{'usersessions'}) eq 'HASH') { |
if (ref($defaultshash{'usersessions'}{$prefix})) { |
if (ref($defaultshash{'usersessions'}{$prefix})) { |
if ($type eq 'version') { |
if ($type eq 'version') { |
$newvalue = $defaultshash{'usersessions'}{$prefix}{$type}; |
$newvalue = $defaultshash{'usersessions'}{$prefix}{$type}; |
} elsif (ref($defaultshash{'usersessions'}{$prefix}{$type}) eq 'ARRAY') { |
} elsif (ref($defaultshash{'usersessions'}{$prefix}{$type}) eq 'ARRAY') { |
if (@{$defaultshash{'usersessions'}{$prefix}{$type}} > 0) { |
if (@{$defaultshash{'usersessions'}{$prefix}{$type}} > 0) { |
$newvalue = join(', ',@{$defaultshash{'usersessions'}{$prefix}{$type}}); |
$newvalue = join(', ',@{$defaultshash{'usersessions'}{$prefix}{$type}}); |
} |
} |
} |
} |
} |
} |
} |
} |
if ($newvalue eq '') { |
if ($newvalue eq '') { |
if ($type eq 'version') { |
if ($type eq 'version') { |
$resulttext .= '<li>'.&mt('[_1] set to: off',$lt{$type}).'</li>'; |
$resulttext .= '<li>'.&mt('[_1] set to: off',$lt{$type}).'</li>'; |
} else { |
|
$resulttext .= '<li>'.&mt('[_1] set to: none',$lt{$type}).'</li>'; |
|
} |
} else { |
} else { |
$resulttext .= '<li>'.&mt('[_1] set to: none',$lt{$type}).'</li>'; |
if ($type eq 'version') { |
} |
$newvalue .= ' '.&mt('(or later)'); |
} else { |
} |
if ($type eq 'version') { |
$resulttext .= '<li>'.&mt('[_1] set to: [_2].',$lt{$type},$newvalue).'</li>'; |
$newvalue .= ' '.&mt('(or later)'); |
|
} |
} |
$resulttext .= '<li>'.&mt('[_1] set to: [_2].',$lt{$type},$newvalue).'</li>'; |
|
} |
} |
} |
} |
} |
} |
|
$resulttext .= '</ul>'; |
} |
} |
$resulttext .= '</ul>'; |
|
} |
} |
|
$resulttext .= '</ul>'; |
|
} else { |
|
$resulttext = $nochgmsg; |
} |
} |
$resulttext .= '</ul>'; |
|
} else { |
} else { |
$resulttext = '<span class="LC_error">'. |
$resulttext = '<span class="LC_error">'. |
&mt('An error occurred: [_1]',$putresult).'</span>'; |
&mt('An error occurred: [_1]',$putresult).'</span>'; |
} |
} |
} else { |
} else { |
$resulttext = &mt('No changes made to settings for user session hosting/offloading.'); |
$resulttext = $nochgmsg; |
} |
} |
return $resulttext; |
return $resulttext; |
} |
} |