[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface domainprefs.pm
raeburn
raeburn at source.lon-capa.org
Mon Sep 9 21:52:36 EDT 2013
raeburn Tue Sep 10 01:52:36 2013 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface domainprefs.pm
Log:
- For 2.11
- Backport 1.205, 1.206.
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.160.6.23 loncom/interface/domainprefs.pm:1.160.6.24
--- loncom/interface/domainprefs.pm:1.160.6.23 Tue Aug 13 19:18:43 2013
+++ loncom/interface/domainprefs.pm Tue Sep 10 01:52:35 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.23 2013/08/13 19:18:43 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.24 2013/09/10 01:52:35 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -401,7 +401,11 @@
my $confname = $dom.'-domainconfig';
if ($phase eq 'process') {
- &Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,\@roles);
+ if (&Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,
+ \%prefs,\%domconfig,$confname,\@roles) eq 'update') {
+ $r->rflush();
+ &devalidate_remote_domconfs($dom);
+ }
} elsif ($phase eq 'display') {
my $js = &recaptcha_js().
&credits_js();
@@ -483,21 +487,21 @@
}
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);
} 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') {
@@ -509,11 +513,11 @@
} 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,%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') {
@@ -4710,7 +4714,7 @@
}
sub modify_login {
- my ($r,$dom,$confname,%domconfig) = @_;
+ my ($r,$dom,$confname,$lastactref,%domconfig) = @_;
my ($resulttext,$errors,$colchgtext,%changes,%colchanges,%newfile,%newurl,
%curr_loginvia,%loginhash, at currlangs, at newlangs,$addedfile,%title, at offon);
%title = ( coursecatalog => 'Display course catalog',
@@ -4948,6 +4952,7 @@
}
if (keys(%changes) > 0 || $colchgtext) {
&Apache::loncommon::devalidate_domconfig_cache($dom);
+ $$lastactref = 'update';
$resulttext = &mt('Changes made:').'<ul>';
foreach my $item (sort(keys(%changes))) {
if ($item eq 'loginvia') {
@@ -5080,7 +5085,7 @@
}
sub modify_rolecolors {
- my ($r,$dom,$confname,$roles,%domconfig) = @_;
+ my ($r,$dom,$confname,$roles,$lastactref,%domconfig) = @_;
my ($resulttext,%rolehash);
$rolehash{'rolecolors'} = {};
if (ref($domconfig{'rolecolors'}) ne 'HASH') {
@@ -5095,6 +5100,7 @@
if ($putresult eq 'ok') {
if (keys(%changes) > 0) {
&Apache::loncommon::devalidate_domconfig_cache($dom);
+ $$lastactref = 'update';
$resulttext = &display_colorchgs($dom,\%changes,$roles,
$rolehash{'rolecolors'});
} else {
@@ -6139,7 +6145,7 @@
}
sub modify_autoenroll {
- my ($dom,%domconfig) = @_;
+ my ($dom,$lastactref,%domconfig) = @_;
my ($resulttext,%changes);
my %currautoenroll;
if (ref($domconfig{'autoenroll'}) eq 'HASH') {
@@ -6207,6 +6213,7 @@
if ($changes{'coowners'}) {
$resulttext .= '<li>'.&mt("$title{'coowners'} set to $offon[$env{'form.autoassign_coowners'}]").'</li>';
&Apache::loncommon::devalidate_domconfig_cache($dom);
+ $$lastactref = 'update';
}
$resulttext .= '</ul>';
} else {
@@ -6658,7 +6665,7 @@
}
sub modify_contacts {
- my ($dom,%domconfig) = @_;
+ my ($dom,$lastactref,%domconfig) = @_;
my ($resulttext,%currsetting,%newsetting,%changes,%contacts_hash);
if (ref($domconfig{'contacts'}) eq 'HASH') {
foreach my $key (keys(%{$domconfig{'contacts'}})) {
@@ -6763,6 +6770,8 @@
$dom);
if ($putresult eq 'ok') {
if (keys(%changes) > 0) {
+ &Apache::loncommon::devalidate_domconfig_cache($dom);
+ $$lastactref = 'update';
my ($titles,$short_titles) = &contact_titles();
$resulttext = &mt('Changes made:').'<ul>';
foreach my $item (@contacts) {
@@ -7520,7 +7529,7 @@
}
sub modify_scantron {
- my ($r,$dom,$confname,%domconfig) = @_;
+ my ($r,$dom,$confname,$lastactref,%domconfig) = @_;
my ($resulttext,%confhash,%changes,$errors);
my $custom = 'custom.tab';
my $default = 'default.tab';
@@ -7581,6 +7590,7 @@
}
$resulttext .= '</ul>';
&Apache::loncommon::devalidate_domconfig_cache($dom);
+ $$lastactref = 'update';
} else {
$resulttext = &mt('No changes made to bubblesheet format file');
}
@@ -9340,4 +9350,20 @@
);
}
+sub devalidate_remote_domconfs {
+ my ($dom) = @_;
+ my $primary_id = &Apache::lonnet::domain($dom,'primary');
+ my $intdom = &Apache::lonnet::internet_dom($primary_id);
+ my %servers = &Apache::lonnet::internet_dom_servers($dom);
+ my %thismachine;
+ map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();
+ if (keys(%servers) > 1) {
+ foreach my $server (keys(%servers)) {
+ next if ($thismachine{$server});
+ &Apache::lonnet::remote_devalidate_cache($server,'domainconfig',$dom);
+ }
+ }
+ return;
+}
+
1;
More information about the LON-CAPA-cvs
mailing list