--- loncom/interface/domainprefs.pm 2013/09/29 00:49:28 1.209
+++ loncom/interface/domainprefs.pm 2013/12/22 20:59:51 1.214
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.209 2013/09/29 00:49:28 raeburn Exp $
+# $Id: domainprefs.pm,v 1.214 2013/12/22 20:59:51 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -86,7 +86,7 @@ $dom,$settings,$rowtotal,$action.
$dom is the domain, $settings is a reference to a hash of current settings for
the current context, $rowtotal is a reference to the scalar used to record the
-number of rows displayed on the page, and $action is the context (quotas,
+number of rows displayed on the page, and $action is the context (quotas,
requestcourses or requestauthor).
The print_quotas routine was orginally created to display/store information
@@ -259,7 +259,7 @@ sub handler {
help => 'Domain_Configuration_Quotas',
header => [{col1 => 'User affiliation',
col2 => 'Available tools',
- col3 => 'Quotas, Mb; (Authoring requires role)',}],
+ col3 => 'Quotas, MB; (Authoring requires role)',}],
},
'autoenroll' =>
{ text => 'Auto-enrollment settings',
@@ -416,10 +416,11 @@ sub handler {
my $confname = $dom.'-domainconfig';
if ($phase eq 'process') {
- if (&Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,
- \%prefs,\%domconfig,$confname,\@roles) eq 'update') {
+ my $result = &Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,
+ \%prefs,\%domconfig,$confname,\@roles);
+ if (ref($result) eq 'HASH') {
$r->rflush();
- &devalidate_remote_domconfs($dom);
+ &devalidate_remote_domconfs($dom,$result);
}
} elsif ($phase eq 'display') {
my $js = &recaptcha_js().
@@ -442,7 +443,7 @@ sub handler {
unless ($configuserok eq 'ok') {
&Apache::lonconfigsettings::print_header($r,$phase,$context);
$r->print(&mt('The domain configuration user "[_1]" has yet to be created.',
- $confname).
+ $confname).
'
'
);
if ($switchserver) {
@@ -514,7 +515,7 @@ sub process_changes {
$output = &modify_rolecolors($r,$dom,$confname,$roles,
$lastactref,%domconfig);
} elsif ($action eq 'quotas') {
- $output = &modify_quotas($dom,$action,%domconfig);
+ $output = &modify_quotas($dom,$action,$lastactref,%domconfig);
} elsif ($action eq 'autoenroll') {
$output = &modify_autoenroll($dom,$lastactref,%domconfig);
} elsif ($action eq 'autoupdate') {
@@ -530,7 +531,7 @@ sub process_changes {
} elsif ($action eq 'contacts') {
$output = &modify_contacts($dom,$lastactref,%domconfig);
} elsif ($action eq 'defaults') {
- $output = &modify_defaults($dom,$r,%domconfig);
+ $output = &modify_defaults($dom,$lastactref,%domconfig);
} elsif ($action eq 'scantron') {
$output = &modify_scantron($r,$dom,$confname,$lastactref,%domconfig);
} elsif ($action eq 'coursecategories') {
@@ -538,15 +539,15 @@ sub process_changes {
} elsif ($action eq 'serverstatuses') {
$output = &modify_serverstatuses($dom,%domconfig);
} elsif ($action eq 'requestcourses') {
- $output = &modify_quotas($dom,$action,%domconfig);
+ $output = &modify_quotas($dom,$action,$lastactref,%domconfig);
} elsif ($action eq 'requestauthor') {
- $output = &modify_quotas($dom,$action,%domconfig);
+ $output = &modify_quotas($dom,$action,$lastactref,%domconfig);
} elsif ($action eq 'helpsettings') {
$output = &modify_helpsettings($r,$dom,$confname,%domconfig);
} elsif ($action eq 'coursedefaults') {
- $output = &modify_coursedefaults($dom,%domconfig);
+ $output = &modify_coursedefaults($dom,$lastactref,%domconfig);
} elsif ($action eq 'usersessions') {
- $output = &modify_usersessions($dom,%domconfig);
+ $output = &modify_usersessions($dom,$lastactref,%domconfig);
} elsif ($action eq 'loadbalancing') {
$output = &modify_loadbalancing($dom,%domconfig);
}
@@ -575,7 +576,7 @@ sub print_config_box {
if ($numheaders > 1) {
my $colspan = '';
my $rightcolspan = '';
- if (($action eq 'rolecolors') || ($action eq 'coursecategories') ||
+ if (($action eq 'rolecolors') || ($action eq 'coursecategories') ||
(($action eq 'login') && ($numheaders < 3))) {
$colspan = ' colspan="2"';
}
@@ -794,7 +795,7 @@ sub print_config_box {
} elsif ($action eq 'contacts') {
$output .= &print_contacts($dom,$settings,\$rowtotal);
} elsif ($action eq 'defaults') {
- $output .= &print_defaults($dom,\$rowtotal);
+ $output .= &print_defaults($dom,$settings,\$rowtotal);
} elsif ($action eq 'scantron') {
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);
} elsif ($action eq 'serverstatuses') {
@@ -1556,7 +1557,7 @@ sub print_quotas {
} elsif ($context eq 'requestauthor') {
@usertools = ('author');
@options = ('norequest','approval','automatic');
- %titles = &authorrequest_titles();
+ %titles = &authorrequest_titles();
} else {
@usertools = ('aboutme','blog','webdav','portfolio');
%titles = &tool_titles();
@@ -2156,7 +2157,7 @@ sub print_autocreate {
}
}
}
- if ($settings->{'xmldc'} ne '') {
+ if ($settings->{'xmldc'} ne '') {
$currhash{$settings->{'xmldc'}} = 1;
}
} else {
@@ -2542,7 +2543,7 @@ sub print_coursedefaults {
$datatable .= ''."\n";
$itemcount += 2;
my $onclick = 'toggleCredits(this.form);';
- my $display = 'none';
+ my $display = 'none';
if ($currusecredits) {
$display = 'block';
}
@@ -3028,7 +3029,7 @@ sub print_loadbalancing {
'
'.
' ';
if ($lonhost eq '') {
- $datatable .= '';
+ $datatable .= '';
if (keys(%currbalancer) > 0) {
$datatable .= &mt('Add balancer:');
} else {
@@ -3044,7 +3045,7 @@ sub print_loadbalancing {
next if ($currbalancer{$server});
$datatable .= ''."\n";
}
- $datatable .=
+ $datatable .=
''."\n".
' '."\n";
} else {
@@ -3083,7 +3084,7 @@ sub print_loadbalancing {
if (exists($currbalancer{$spares[$i]})) {
$disabled = ' disabled="disabled"';
}
- $targettable .=
+ $targettable .=
' | | ';
@@ -3167,7 +3168,7 @@ sub loadbalancing_rules {
$css_class,$balnum,$islast) = @_;
my $output;
my $num = 0;
- my ($alltypes,$othertypes,$titles) =
+ my ($alltypes,$othertypes,$titles) =
&loadbalancing_titles($dom,$intdom,$usertypes,$types);
if ((ref($alltypes) eq 'ARRAY') && (ref($titles) eq 'HASH')) {
foreach my $type (@{$alltypes}) {
@@ -3246,7 +3247,7 @@ sub loadbalance_rule_row {
if ($islast && $num == 1) {
$space = '
';
}
- my $output =
+ my $output =
''.$space.
' '.$title.' | '."\n".
''.$space.
@@ -3266,7 +3267,7 @@ sub loadbalance_rule_row {
unless ($checked) {
$default = ' selected="selected"';
}
- $extra =
+ $extra =
': |
'."\n".
''."\n".
''.$pubtext.' '."\n".
@@ -3759,10 +3760,18 @@ sub print_usermodification {
}
sub print_defaults {
- my ($dom,$rowtotal) = @_;
+ my ($dom,$settings,$rowtotal) = @_;
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def',
'datelocale_def','portal_def');
- my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
+ my %defaults;
+ if (ref($settings) eq 'HASH') {
+ %defaults = %{$settings};
+ } else {
+ my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);
+ foreach my $item (@items) {
+ $defaults{$item} = $domdefaults{$item};
+ }
+ }
my $titles = &defaults_titles($dom);
my $rownum = 0;
my ($datatable,$css_class);
@@ -3786,7 +3795,7 @@ sub print_defaults {
my %authnames = &authtype_names();
foreach my $auth (@authtypes) {
my $checked = ' ';
- if ($domdefaults{$item} eq $auth) {
+ if ($defaults{$item} eq $auth) {
$checked = ' checked="checked" ';
}
$datatable .= ' |
';
$rownum ++;
@@ -4148,7 +4157,7 @@ sub print_coursecategories {
}
$datatable .= '';
}
- $datatable .= '';
+ $datatable .= ' | ';
if ($parent eq 'instcode' || $parent eq 'communities') {
$datatable .= ''
.$default_names{$parent}.'';
@@ -4178,7 +4187,8 @@ sub print_coursecategories {
$datatable .= ' | ';
} else {
$datatable .= $parent
- .'