version 1.204, 2013/08/13 16:19:26
|
version 1.205, 2013/09/07 00:19:00
|
Line 416 sub handler {
|
Line 416 sub handler {
|
my $confname = $dom.'-domainconfig'; |
my $confname = $dom.'-domainconfig'; |
|
|
if ($phase eq 'process') { |
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') { |
} elsif ($phase eq 'display') { |
my $js = &recaptcha_js(). |
my $js = &recaptcha_js(). |
&credits_js(); |
&credits_js(); |
Line 498 sub handler {
|
Line 502 sub handler {
|
} |
} |
|
|
sub process_changes { |
sub process_changes { |
my ($r,$dom,$confname,$action,$roles,$values) = @_; |
my ($r,$dom,$confname,$action,$roles,$values,$lastactref) = @_; |
my %domconfig; |
my %domconfig; |
if (ref($values) eq 'HASH') { |
if (ref($values) eq 'HASH') { |
%domconfig = %{$values}; |
%domconfig = %{$values}; |
} |
} |
my $output; |
my $output; |
if ($action eq 'login') { |
if ($action eq 'login') { |
$output = &modify_login($r,$dom,$confname,%domconfig); |
$output = &modify_login($r,$dom,$confname,$lastactref,%domconfig); |
} elsif ($action eq 'rolecolors') { |
} elsif ($action eq 'rolecolors') { |
$output = &modify_rolecolors($r,$dom,$confname,$roles, |
$output = &modify_rolecolors($r,$dom,$confname,$roles, |
%domconfig); |
$lastactref,%domconfig); |
} elsif ($action eq 'quotas') { |
} elsif ($action eq 'quotas') { |
$output = &modify_quotas($dom,$action,%domconfig); |
$output = &modify_quotas($dom,$action,%domconfig); |
} elsif ($action eq 'autoenroll') { |
} elsif ($action eq 'autoenroll') { |
$output = &modify_autoenroll($dom,%domconfig); |
$output = &modify_autoenroll($dom,$lastactref,%domconfig); |
} elsif ($action eq 'autoupdate') { |
} elsif ($action eq 'autoupdate') { |
$output = &modify_autoupdate($dom,%domconfig); |
$output = &modify_autoupdate($dom,%domconfig); |
} elsif ($action eq 'autocreate') { |
} elsif ($action eq 'autocreate') { |
Line 524 sub process_changes {
|
Line 528 sub process_changes {
|
} elsif ($action eq 'usermodification') { |
} elsif ($action eq 'usermodification') { |
$output = &modify_usermodification($dom,%domconfig); |
$output = &modify_usermodification($dom,%domconfig); |
} elsif ($action eq 'contacts') { |
} elsif ($action eq 'contacts') { |
$output = &modify_contacts($dom,%domconfig); |
$output = &modify_contacts($dom,$lastactref,%domconfig); |
} elsif ($action eq 'defaults') { |
} elsif ($action eq 'defaults') { |
$output = &modify_defaults($dom,$r,%domconfig); |
$output = &modify_defaults($dom,$r,%domconfig); |
} elsif ($action eq 'scantron') { |
} elsif ($action eq 'scantron') { |
$output = &modify_scantron($r,$dom,$confname,%domconfig); |
$output = &modify_scantron($r,$dom,$confname,$lastactref,%domconfig); |
} elsif ($action eq 'coursecategories') { |
} elsif ($action eq 'coursecategories') { |
$output = &modify_coursecategories($dom,%domconfig); |
$output = &modify_coursecategories($dom,%domconfig); |
} elsif ($action eq 'serverstatuses') { |
} elsif ($action eq 'serverstatuses') { |
Line 4729 sub usertype_update_row {
|
Line 4733 sub usertype_update_row {
|
} |
} |
|
|
sub modify_login { |
sub modify_login { |
my ($r,$dom,$confname,%domconfig) = @_; |
my ($r,$dom,$confname,$lastactref,%domconfig) = @_; |
my ($resulttext,$errors,$colchgtext,%changes,%colchanges,%newfile,%newurl, |
my ($resulttext,$errors,$colchgtext,%changes,%colchanges,%newfile,%newurl, |
%curr_loginvia,%loginhash,@currlangs,@newlangs,$addedfile,%title,@offon); |
%curr_loginvia,%loginhash,@currlangs,@newlangs,$addedfile,%title,@offon); |
%title = ( coursecatalog => 'Display course catalog', |
%title = ( coursecatalog => 'Display course catalog', |
Line 4967 sub modify_login {
|
Line 4971 sub modify_login {
|
} |
} |
if (keys(%changes) > 0 || $colchgtext) { |
if (keys(%changes) > 0 || $colchgtext) { |
&Apache::loncommon::devalidate_domconfig_cache($dom); |
&Apache::loncommon::devalidate_domconfig_cache($dom); |
|
$$lastactref = 'update'; |
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
foreach my $item (sort(keys(%changes))) { |
foreach my $item (sort(keys(%changes))) { |
if ($item eq 'loginvia') { |
if ($item eq 'loginvia') { |
Line 5099 sub color_font_choices {
|
Line 5104 sub color_font_choices {
|
} |
} |
|
|
sub modify_rolecolors { |
sub modify_rolecolors { |
my ($r,$dom,$confname,$roles,%domconfig) = @_; |
my ($r,$dom,$confname,$roles,$lastactref,%domconfig) = @_; |
my ($resulttext,%rolehash); |
my ($resulttext,%rolehash); |
$rolehash{'rolecolors'} = {}; |
$rolehash{'rolecolors'} = {}; |
if (ref($domconfig{'rolecolors'}) ne 'HASH') { |
if (ref($domconfig{'rolecolors'}) ne 'HASH') { |
Line 5114 sub modify_rolecolors {
|
Line 5119 sub modify_rolecolors {
|
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
&Apache::loncommon::devalidate_domconfig_cache($dom); |
&Apache::loncommon::devalidate_domconfig_cache($dom); |
|
$$lastactref = 'update'; |
$resulttext = &display_colorchgs($dom,\%changes,$roles, |
$resulttext = &display_colorchgs($dom,\%changes,$roles, |
$rolehash{'rolecolors'}); |
$rolehash{'rolecolors'}); |
} else { |
} else { |
Line 6158 sub modify_quotas {
|
Line 6164 sub modify_quotas {
|
} |
} |
|
|
sub modify_autoenroll { |
sub modify_autoenroll { |
my ($dom,%domconfig) = @_; |
my ($dom,$lastactref,%domconfig) = @_; |
my ($resulttext,%changes); |
my ($resulttext,%changes); |
my %currautoenroll; |
my %currautoenroll; |
if (ref($domconfig{'autoenroll'}) eq 'HASH') { |
if (ref($domconfig{'autoenroll'}) eq 'HASH') { |
Line 6226 sub modify_autoenroll {
|
Line 6232 sub modify_autoenroll {
|
if ($changes{'coowners'}) { |
if ($changes{'coowners'}) { |
$resulttext .= '<li>'.&mt("$title{'coowners'} set to $offon[$env{'form.autoassign_coowners'}]").'</li>'; |
$resulttext .= '<li>'.&mt("$title{'coowners'} set to $offon[$env{'form.autoassign_coowners'}]").'</li>'; |
&Apache::loncommon::devalidate_domconfig_cache($dom); |
&Apache::loncommon::devalidate_domconfig_cache($dom); |
|
$$lastactref = 'update'; |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |
Line 6677 sub modify_directorysrch {
|
Line 6684 sub modify_directorysrch {
|
} |
} |
|
|
sub modify_contacts { |
sub modify_contacts { |
my ($dom,%domconfig) = @_; |
my ($dom,$lastactref,%domconfig) = @_; |
my ($resulttext,%currsetting,%newsetting,%changes,%contacts_hash); |
my ($resulttext,%currsetting,%newsetting,%changes,%contacts_hash); |
if (ref($domconfig{'contacts'}) eq 'HASH') { |
if (ref($domconfig{'contacts'}) eq 'HASH') { |
foreach my $key (keys(%{$domconfig{'contacts'}})) { |
foreach my $key (keys(%{$domconfig{'contacts'}})) { |
Line 6782 sub modify_contacts {
|
Line 6789 sub modify_contacts {
|
$dom); |
$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
|
&Apache::loncommon::devalidate_domconfig_cache($dom); |
|
$$lastactref = 'update'; |
my ($titles,$short_titles) = &contact_titles(); |
my ($titles,$short_titles) = &contact_titles(); |
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
foreach my $item (@contacts) { |
foreach my $item (@contacts) { |
Line 7539 sub modify_defaults {
|
Line 7548 sub modify_defaults {
|
} |
} |
|
|
sub modify_scantron { |
sub modify_scantron { |
my ($r,$dom,$confname,%domconfig) = @_; |
my ($r,$dom,$confname,$lastactref,%domconfig) = @_; |
my ($resulttext,%confhash,%changes,$errors); |
my ($resulttext,%confhash,%changes,$errors); |
my $custom = 'custom.tab'; |
my $custom = 'custom.tab'; |
my $default = 'default.tab'; |
my $default = 'default.tab'; |
Line 7600 sub modify_scantron {
|
Line 7609 sub modify_scantron {
|
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
&Apache::loncommon::devalidate_domconfig_cache($dom); |
&Apache::loncommon::devalidate_domconfig_cache($dom); |
|
$lastactref = 'update'; |
} else { |
} else { |
$resulttext = &mt('No changes made to bubblesheet format file'); |
$resulttext = &mt('No changes made to bubblesheet format file'); |
} |
} |
Line 9359 sub captcha_phrases {
|
Line 9369 sub captcha_phrases {
|
); |
); |
} |
} |
|
|
|
|
|
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; |
1; |