--- loncom/interface/domainprefs.pm 2015/03/07 23:17:15 1.257 +++ loncom/interface/domainprefs.pm 2015/05/11 18:11:42 1.263 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.257 2015/03/07 23:17:15 raeburn Exp $ +# $Id: domainprefs.pm,v 1.263 2015/05/11 18:11:42 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2971,6 +2971,10 @@ sub print_coursedefaults { $deftimeout{$type} = $staticdefaults{'postsubmit'}; } } + } else { + foreach my $type (@types) { + $deftimeout{$type} = $staticdefaults{'postsubmit'}; + } } if (!$currdefresponder) { $currdefresponder = $staticdefaults{'anonsurvey_threshold'}; @@ -3015,7 +3019,7 @@ sub print_coursedefaults { next if ($type eq 'community'); $additional .= '
'.&mt($type).' '. ''. &mt('Nothing to set here, as the cluster to which this domain belongs only contains one server.'); @@ -3543,7 +3555,7 @@ sub current_offloads_to { } sub spares_row { - my ($dom,$servers,$spareid,$serverhomes,$altids,$rowtotal) = @_; + my ($dom,$servers,$spareid,$serverhomes,$altids,$curroffloadnow,$rowtotal) = @_; my $css_class; my $numinrow = 4; my $itemcount = 1; @@ -3563,12 +3575,21 @@ sub spares_row { } } next unless (ref($spareid->{$server}) eq 'HASH'); + my $checkednow; + if (ref($curroffloadnow) eq 'HASH') { + if ($curroffloadnow->{$server}) { + $checkednow = ' checked="checked"'; + } + } $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; $datatable .= ' | |
'.
&mt('[_1] when busy, offloads to:'
- ,''.$server.'').
+ ,''.$server.'').' '. + ''."\n". + ''. "\n"; my (%current,%canselect); my @choices = @@ -4695,11 +4716,8 @@ sub print_defaults { my $includeempty = 1; $datatable .= &Apache::loncommon::select_datelocale($item,$defaults{$item},undef,$includeempty); } elsif ($item eq 'lang_def') { - my %langchoices = &get_languages_hash(); - $langchoices{''} = 'No language preference'; - %langchoices = &Apache::lonlocal::texthash(%langchoices); - $datatable .= &Apache::loncommon::select_form($defaults{$item},$item, - \%langchoices); + my $includeempty = 1; + $datatable .= &Apache::loncommon::select_language($item,$defaults{$item},$includeempty); } else { my $size; if ($item eq 'portal_def') { @@ -4768,7 +4786,7 @@ sub print_defaults { $datatable .= ''; } $datatable .= ' '.&mt('Internal ID:'). - ''. + ''. ' '.&mt('(new)'). ' | '.
&mt('Name displayed:').
@@ -5305,7 +5323,7 @@ sub serverstatus_pages {
return ('userstatus','lonstatus','loncron','server-status','codeversions',
'checksums','clusterstatus','metadata_keywords','metadata_harvest',
'takeoffline','takeonline','showenv','toggledebug','ping','domconf',
- 'uniquecodes','diskusage');
+ 'uniquecodes','diskusage','coursecatalog');
}
sub defaults_javascript {
@@ -10927,7 +10945,23 @@ sub modify_usersessions {
$changes{'spares'}{$lonhost} = \%spareschg;
}
}
-
+ $defaultshash{'usersessions'}{'offloadnow'} = {};
+ my @offloadnow = &Apache::loncommon::get_env_multiple('form.offloadnow');
+ my @okoffload;
+ if (@offloadnow) {
+ foreach my $server (@offloadnow) {
+ if (&Apache::lonnet::hostname($server) ne '') {
+ unless (grep(/^\Q$server\E$/,@okoffload)) {
+ push(@okoffload,$server);
+ }
+ }
+ }
+ if (@okoffload) {
+ foreach my $lonhost (@okoffload) {
+ $defaultshash{'usersessions'}{'offloadnow'}{$lonhost} = 1;
+ }
+ }
+ }
if (ref($domconfig{'usersessions'}) eq 'HASH') {
if (ref($domconfig{'usersessions'}{'spares'}) eq 'HASH') {
if (ref($changes{'spares'}) eq 'HASH') {
@@ -10938,8 +10972,27 @@ sub modify_usersessions {
} else {
$savespares = 1;
}
+ if (ref($domconfig{'usersessions'}{'offloadnow'}) eq 'HASH') {
+ foreach my $lonhost (keys(%{$domconfig{'usersessions'}{'offloadnow'}})) {
+ unless ($defaultshash{'usersessions'}{'offloadnow'}{$lonhost}) {
+ $changes{'offloadnow'} = 1;
+ last;
+ }
+ }
+ unless ($changes{'offloadnow'}) {
+ foreach my $lonhost (keys(%{$defaultshash{'usersessions'}{'offloadnow'}})) {
+ unless ($domconfig{'usersessions'}{'offloadnow'}{$lonhost}) {
+ $changes{'offloadnow'} = 1;
+ last;
+ }
+ }
+ }
+ } elsif (@okoffload) {
+ $changes{'offloadnow'} = 1;
+ }
+ } elsif (@okoffload) {
+ $changes{'offloadnow'} = 1;
}
-
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,
@@ -10952,6 +11005,9 @@ sub modify_usersessions {
if (ref($defaultshash{'usersessions'}{'hosted'}) eq 'HASH') {
$domdefaults{'hostedsessions'} = $defaultshash{'usersessions'}{'hosted'};
}
+ if (ref($defaultshash{'usersessions'}{'offloadnow'}) eq 'HASH') {
+ $domdefaults{'offloadnow'} = $defaultshash{'usersessions'}{'offloadnow'};
+ }
}
my $cachetime = 24*60*60;
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
@@ -11020,6 +11076,21 @@ sub modify_usersessions {
$resulttext .= '';
}
}
+ if ($changes{'offloadnow'}) {
+ if (ref($defaultshash{'usersessions'}{'offloadnow'}) eq 'HASH') {
+ if (keys(%{$defaultshash{'usersessions'}{'offloadnow'}}) > 0) {
+ $resulttext .= '
|