[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm lonconfigsettings.pm
raeburn
raeburn at source.lon-capa.org
Fri Sep 6 20:19:00 EDT 2013
raeburn Sat Sep 7 00:19:00 2013 EDT
Modified files:
/loncom/interface domainprefs.pm lonconfigsettings.pm
Log:
- Where modification to domain configuration results in devalidation
of a domain's cached domconfig on the current server:
- call new routine: &devalidate_remote_domconfs()
to devalidate the same cached information on the domain's other servers.
- uses lonnet::remote_devalidate_cache().
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.204 loncom/interface/domainprefs.pm:1.205
--- loncom/interface/domainprefs.pm:1.204 Tue Aug 13 16:19:26 2013
+++ loncom/interface/domainprefs.pm Sat Sep 7 00:19:00 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.204 2013/08/13 16:19:26 raeburn Exp $
+# $Id: domainprefs.pm,v 1.205 2013/09/07 00:19:00 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -416,7 +416,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();
@@ -498,21 +502,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') {
@@ -524,11 +528,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') {
@@ -4729,7 +4733,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',
@@ -4967,6 +4971,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') {
@@ -5099,7 +5104,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') {
@@ -5114,6 +5119,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 {
@@ -6158,7 +6164,7 @@
}
sub modify_autoenroll {
- my ($dom,%domconfig) = @_;
+ my ($dom,$lastactref,%domconfig) = @_;
my ($resulttext,%changes);
my %currautoenroll;
if (ref($domconfig{'autoenroll'}) eq 'HASH') {
@@ -6226,6 +6232,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 {
@@ -6677,7 +6684,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'}})) {
@@ -6782,6 +6789,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) {
@@ -7539,7 +7548,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';
@@ -7600,6 +7609,7 @@
}
$resulttext .= '</ul>';
&Apache::loncommon::devalidate_domconfig_cache($dom);
+ $lastactref = 'update';
} else {
$resulttext = &mt('No changes made to bubblesheet format file');
}
@@ -9359,4 +9369,21 @@
);
}
+
+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;
Index: loncom/interface/lonconfigsettings.pm
diff -u loncom/interface/lonconfigsettings.pm:1.25 loncom/interface/lonconfigsettings.pm:1.26
--- loncom/interface/lonconfigsettings.pm:1.25 Wed Apr 10 21:15:15 2013
+++ loncom/interface/lonconfigsettings.pm Sat Sep 7 00:19:00 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: lonconfigsettings.pm,v 1.25 2013/04/10 21:15:15 raeburn Exp $
+# $Id: lonconfigsettings.pm,v 1.26 2013/09/07 00:19:00 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -188,7 +188,7 @@
{href=>"javascript:changePage(document.$phase,'$phase')",
text=>"Updated"});
&print_header($r,$phase,$context,undef,$container);
- my $crstype;
+ my ($crstype,$lastact);
if ($context eq 'course') {
$crstype = &Apache::loncommon::course_type();
}
@@ -199,7 +199,7 @@
if ($context eq 'domain') {
$r->print('<h3>'.&mt($prefs->{$item}{'text'}).'</h3>'.
&Apache::domainprefs::process_changes($r,$dom,
- $confname,$item,$roles,$values));
+ $confname,$item,$roles,$values,\$lastact));
} else {
$changes{$item} = {};
&Apache::courseprefs::process_changes($dom,$item,$values,
@@ -244,6 +244,7 @@
}
&print_footer($r,$phase,'display',$footer_text,\@actions,$container);
$r->print('</p>');
+ return $lastact;
}
sub display_settings {
More information about the LON-CAPA-cvs
mailing list