--- loncom/interface/domainprefs.pm 2013/08/07 14:41:39 1.201
+++ loncom/interface/domainprefs.pm 2013/12/23 13:20:31 1.215
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.201 2013/08/07 14:41:39 raeburn Exp $
+# $Id: domainprefs.pm,v 1.215 2013/12/23 13:20:31 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,7 +416,12 @@ sub handler {
my $confname = $dom.'-domainconfig';
if ($phase eq 'process') {
- &Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,\@roles);
+ 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,$result);
+ }
} elsif ($phase eq 'display') {
my $js = &recaptcha_js().
&credits_js();
@@ -438,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) {
@@ -498,21 +503,21 @@ sub handler {
}
sub process_changes {
- my ($r,$dom,$confname,$action,$roles,$values) = @_;
+ my ($r,$dom,$confname,$action,$roles,$values,$lastactref) = @_;
my %domconfig;
if (ref($values) eq 'HASH') {
%domconfig = %{$values};
}
my $output;
if ($action eq 'login') {
- $output = &modify_login($r,$dom,$confname,%domconfig);
+ $output = &modify_login($r,$dom,$confname,$lastactref,%domconfig);
} elsif ($action eq 'rolecolors') {
$output = &modify_rolecolors($r,$dom,$confname,$roles,
- %domconfig);
+ $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,%domconfig);
+ $output = &modify_autoenroll($dom,$lastactref,%domconfig);
} elsif ($action eq 'autoupdate') {
$output = &modify_autoupdate($dom,%domconfig);
} elsif ($action eq 'autocreate') {
@@ -524,25 +529,25 @@ sub process_changes {
} elsif ($action eq 'usermodification') {
$output = &modify_usermodification($dom,%domconfig);
} elsif ($action eq 'contacts') {
- $output = &modify_contacts($dom,%domconfig);
+ $output = &modify_contacts($dom,$lastactref,%domconfig);
} elsif ($action eq 'defaults') {
- $output = &modify_defaults($dom,$r);
+ $output = &modify_defaults($dom,$lastactref,%domconfig);
} elsif ($action eq 'scantron') {
- $output = &modify_scantron($r,$dom,$confname,%domconfig);
+ $output = &modify_scantron($r,$dom,$confname,$lastactref,%domconfig);
} elsif ($action eq 'coursecategories') {
$output = &modify_coursecategories($dom,%domconfig);
} 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);
}
@@ -571,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"';
}
@@ -790,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') {
@@ -1205,8 +1210,8 @@ sub print_rolecolors {
sub role_defaults {
my ($role,$bgs,$links,$images,$logintext) = @_;
- my %defaults;
- unless ((ref($bgs) eq 'ARRAY') && (ref($links) eq 'ARRAY') && (ref($images) eq 'ARRAY')) {
+ my %defaults;
+ unless ((ref($bgs) eq 'ARRAY') && (ref($links) eq 'ARRAY') && (ref($images) eq 'ARRAY')) {
return %defaults;
}
my %defaultdesign = %Apache::loncommon::defaultdesign;
@@ -1257,7 +1262,7 @@ sub display_color_options {
$datatable .= '
'.
' '.
+ ' value="'.$current_color.'" /> '.
' | ';
unless ($role eq 'login') {
$datatable .= ''.
@@ -1267,7 +1272,7 @@ sub display_color_options {
} else {
$datatable .= ' | ';
}
- $current_color = $designs->{'fontmenu'} ?
+ $current_color = $designs->{'fontmenu'} ?
$designs->{'fontmenu'} : $defaults->{'fontmenu'};
$datatable .= ''.
''.$choices->{$item}."\n";
-
if ($designs->{'links'}{$item}) {
$datatable.=' ';
}
@@ -1496,7 +1500,6 @@ sub login_text_colors {
my $color = $designs->{'logintext'}{$item} ? $designs->{'logintext'}{$item} : $defaults->{'logintext'}{$item};
$color_menu .= '
| ';
-
}
$color_menu .= '
';
return $color_menu;
@@ -1554,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();
@@ -1961,7 +1964,7 @@ sub print_quotas {
sub print_requestmail {
my ($dom,$action,$settings,$rowtotal) = @_;
- my ($now,$datatable,%currapp,$rows);
+ my ($now,$datatable,%currapp);
$now = time;
if (ref($settings) eq 'HASH') {
if (ref($settings->{'notify'}) eq 'HASH') {
@@ -2154,7 +2157,7 @@ sub print_autocreate {
}
}
}
- if ($settings->{'xmldc'} ne '') {
+ if ($settings->{'xmldc'} ne '') {
$currhash{$settings->{'xmldc'}} = 1;
}
} else {
@@ -2311,7 +2314,7 @@ sub print_contacts {
my @contacts = ('adminemail','supportemail');
my (%checked,%to,%otheremails,%bccemails);
my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail',
- 'requestsmail','updatesmail');
+ 'requestsmail','updatesmail','idconflictsmail');
foreach my $type (@mailings) {
$otheremails{$type} = '';
}
@@ -2348,21 +2351,21 @@ sub print_contacts {
$checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" ';
$checked{'requestsmail'}{'adminemail'} = ' checked="checked" ';
$checked{'updatesmail'}{'adminemail'} = ' checked="checked" ';
+ $checked{'idconflictsmail'}{'adminemail'} = ' checked="checked" ';
}
my ($titles,$short_titles) = &contact_titles();
my $rownum = 0;
my $css_class;
foreach my $item (@contacts) {
- $rownum ++;
$css_class = $rownum%2?' class="LC_odd_row"':'';
$datatable .= ''.
''.$titles->{$item}.
' | '.
' |
';
+ $rownum ++;
}
foreach my $type (@mailings) {
- $rownum ++;
$css_class = $rownum%2?' class="LC_odd_row"':'';
$datatable .= ''.
''.
@@ -2385,7 +2388,21 @@ sub print_contacts {
'value="'.$bccemails{$type}.'" />';
}
$datatable .= ' |
'."\n";
+ $rownum ++;
}
+ my %choices;
+ $choices{'reporterrors'} = &mt('E-mail error reports to [_1]',
+ &Apache::loncommon::modal_link('http://loncapa.org/core.html',
+ &mt('LON-CAPA core group - MSU'),600,500));
+ $choices{'reportupdates'} = &mt('E-mail record of completed LON-CAPA updates to [_1]',
+ &Apache::loncommon::modal_link('http://loncapa.org/core.html',
+ &mt('LON-CAPA core group - MSU'),600,500));
+ my @toggles = ('reporterrors','reportupdates');
+ my %defaultchecked = ('reporterrors' => 'on',
+ 'reportupdates' => 'on');
+ (my $reports,$rownum) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
+ \%choices,$rownum);
+ $datatable .= $reports;
$$rowtotal += $rownum;
return $datatable;
}
@@ -2526,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';
}
@@ -2981,7 +2998,7 @@ sub print_loadbalancing {
}
my ($othertitle,$usertypes,$types) =
&Apache::loncommon::sorted_inst_types($dom);
- my $rownum = 6;
+ my $rownum = 8;
if (ref($types) eq 'ARRAY') {
$rownum += scalar(@{$types});
}
@@ -3012,7 +3029,7 @@ sub print_loadbalancing {
''.
' ';
if ($lonhost eq '') {
- $datatable .= '';
+ $datatable .= '';
if (keys(%currbalancer) > 0) {
$datatable .= &mt('Add balancer:');
} else {
@@ -3028,7 +3045,7 @@ sub print_loadbalancing {
next if ($currbalancer{$server});
$datatable .= ''."\n";
}
- $datatable .=
+ $datatable .=
''."\n".
' '."\n";
} else {
@@ -3067,7 +3084,7 @@ sub print_loadbalancing {
if (exists($currbalancer{$spares[$i]})) {
$disabled = ' disabled="disabled"';
}
- $targettable .=
+ $targettable .=
' | | ';
@@ -3151,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}) {
@@ -3160,7 +3177,7 @@ sub loadbalancing_rules {
if (ref($currrules) eq 'HASH') {
$current = $currrules->{$type};
}
- if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) {
+ if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) {
if ($dom ne &Apache::lonnet::host_domain($lonhost)) {
$current = '';
}
@@ -3181,8 +3198,10 @@ sub loadbalancing_titles {
'_LC_author' => &mt('Users from [_1] with author role',$dom),
'_LC_internetdom' => &mt('Users not from [_1], but from [_2]',$dom,$intdom),
'_LC_external' => &mt('Users not from [_1]',$intdom),
+ '_LC_ipchangesso' => &mt('SSO users from [_1], with IP mismatch',$dom),
+ '_LC_ipchange' => &mt('Non-SSO users with IP mismatch'),
);
- my @alltypes = ('_LC_adv','_LC_author','_LC_internetdom','_LC_external');
+ my @alltypes = ('_LC_adv','_LC_author','_LC_internetdom','_LC_external','_LC_ipchangesso','_LC_ipchange');
if (ref($types) eq 'ARRAY') {
unshift(@alltypes,@{$types},'default');
}
@@ -3207,23 +3226,28 @@ sub loadbalancing_titles {
sub loadbalance_rule_row {
my ($type,$title,$current,$servers,$currbalancer,$lonhost,$dom,
$targets_div_style,$homedom_div_style,$css_class,$balnum,$num,$islast) = @_;
- my @rulenames = ('default','homeserver');
+ my @rulenames;
my %ruletitles = &offloadtype_text();
- if ($type eq '_LC_external') {
- push(@rulenames,'externalbalancer');
+ if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) {
+ @rulenames = ('balancer','offloadedto');
} else {
- push(@rulenames,'specific');
+ @rulenames = ('default','homeserver');
+ if ($type eq '_LC_external') {
+ push(@rulenames,'externalbalancer');
+ } else {
+ push(@rulenames,'specific');
+ }
+ push(@rulenames,'none');
}
- push(@rulenames,'none');
my $style = $targets_div_style;
- if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) {
+ if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) {
$style = $homedom_div_style;
}
my $space;
if ($islast && $num == 1) {
$space = '
';
}
- my $output =
+ my $output =
''.$space.
' '.$title.' | '."\n".
''.$space.
@@ -3243,7 +3267,7 @@ sub loadbalance_rule_row {
unless ($checked) {
$default = ' selected="selected"';
}
- $extra =
+ $extra =
': |
'."\n".
''."\n".
''.$pubtext.' '."\n".
@@ -3733,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);
@@ -3760,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 ++;
@@ -4122,7 +4157,7 @@ sub print_coursecategories {
}
$datatable .= '';
}
- $datatable .= '';
+ $datatable .= ' | ';
if ($parent eq 'instcode' || $parent eq 'communities') {
$datatable .= ''
.$default_names{$parent}.'';
@@ -4152,7 +4187,8 @@ sub print_coursecategories {
$datatable .= ' | ';
} else {
$datatable .= $parent
- .'