';
+ foreach my $type (@{$types},'default') {
+ if (defined($changes{'authorquota'}{$type})) {
+ my $typetitle = $usertypes->{$type};
+ if ($type eq 'default') {
+ $typetitle = $othertitle;
+ }
+ $resulttext .= '
'.&mt('[_1] set to [_2] Mb',$typetitle,$confhash{'authorquota'}{$type}).'
';
+ }
+ }
+ $resulttext .= '
';
+ }
}
my %newenv;
foreach my $item (@usertools) {
@@ -6021,7 +6164,7 @@ sub modify_quotas {
}
sub modify_autoenroll {
- my ($dom,%domconfig) = @_;
+ my ($dom,$lastactref,%domconfig) = @_;
my ($resulttext,%changes);
my %currautoenroll;
if (ref($domconfig{'autoenroll'}) eq 'HASH') {
@@ -6089,6 +6232,7 @@ sub modify_autoenroll {
if ($changes{'coowners'}) {
$resulttext .= '
'.&mt("$title{'coowners'} set to $offon[$env{'form.autoassign_coowners'}]").'
';
&Apache::loncommon::devalidate_domconfig_cache($dom);
+ $$lastactref = 'update';
}
$resulttext .= '';
} else {
@@ -6540,7 +6684,7 @@ sub modify_directorysrch {
}
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'}})) {
@@ -6550,7 +6694,8 @@ sub modify_contacts {
my (%others,%to,%bcc);
my @contacts = ('supportemail','adminemail');
my @mailings = ('errormail','packagesmail','helpdeskmail','lonstatusmail',
- 'requestsmail','updatesmail');
+ 'requestsmail','updatesmail','idconflictsmail');
+ my @toggles = ('reporterrors','reportupdates');
foreach my $type (@mailings) {
@{$newsetting{$type}} =
&Apache::loncommon::get_env_multiple('form.'.$type);
@@ -6572,6 +6717,11 @@ sub modify_contacts {
$to{$item} = $env{'form.'.$item};
$contacts_hash{'contacts'}{$item} = $to{$item};
}
+ foreach my $item (@toggles) {
+ if ($env{'form.'.$item} =~ /^(0|1)$/) {
+ $contacts_hash{'contacts'}{$item} = $env{'form.'.$item};
+ }
+ }
if (keys(%currsetting) > 0) {
foreach my $item (@contacts) {
if ($to{$item} ne $currsetting{$item}) {
@@ -6610,7 +6760,7 @@ sub modify_contacts {
foreach my $item (@contacts) {
if ($to{$item} ne $default{$item}) {
$changes{$item} = 1;
- }
+ }
}
foreach my $type (@mailings) {
if ((@{$newsetting{$type}} != 1) || ($newsetting{$type}[0] ne $default{$type})) {
@@ -6627,10 +6777,20 @@ sub modify_contacts {
}
}
}
+ foreach my $item (@toggles) {
+ if (($env{'form.'.$item} == 1) && ($currsetting{$item} == 0)) {
+ $changes{$item} = 1;
+ } elsif ((!$env{'form.'.$item}) &&
+ (($currsetting{$item} eq '') || ($currsetting{$item} == 1))) {
+ $changes{$item} = 1;
+ }
+ }
my $putresult = &Apache::lonnet::put_dom('configuration',\%contacts_hash,
$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:').'
';
foreach my $item (@contacts) {
@@ -6661,6 +6821,23 @@ sub modify_contacts {
$resulttext .= '';
}
}
+ my @offon = ('off','on');
+ if ($changes{'reporterrors'}) {
+ $resulttext .= '
'.
+ &mt('E-mail error reports to [_1] set to "'.
+ $offon[$env{'form.reporterrors'}].'".',
+ &Apache::loncommon::modal_link('http://loncapa.org/core.html',
+ &mt('LON-CAPA core group - MSU'),600,500)).
+ '
'.
+ &mt('E-mail record of completed LON-CAPA updates to [_1] set to "'.
+ $offon[$env{'form.reportupdates'}].'".',
+ &Apache::loncommon::modal_link('http://loncapa.org/core.html',
+ &mt('LON-CAPA core group - MSU'),600,500)).
+ '
';
+ }
$resulttext .= '
';
} else {
$resulttext = &mt('No changes made to contact information');
@@ -7255,7 +7432,7 @@ sub modify_usermodification {
}
sub modify_defaults {
- my ($dom,$r) = @_;
+ my ($dom,$r,%domconfig) = @_;
my ($resulttext,$mailmsgtxt,%newvalues,%changes,@errors);
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def','portal_def');
@@ -7341,8 +7518,17 @@ sub modify_defaults {
my $cachetime = 24*60*60;
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
if ($changes{'auth_def'} || $changes{'auth_arg_def'} || $changes{'lang_def'} || $changes{'datelocale_def'}) {
- my $sysmail = $r->dir_config('lonSysEMail');
- &Apache::lonmsg::sendemail($sysmail,"LON-CAPA Domain Settings Change - $dom",$mailmsgtext);
+ my $notify = 1;
+ if (ref($domconfig{'contacts'}) eq 'HASH') {
+ if ($domconfig{'contacts'}{'reportupdates'} == 0) {
+ $notify = 0;
+ }
+ }
+ if ($notify) {
+ &Apache::lonmsg::sendemail('installrecord@loncapa.org',
+ "LON-CAPA Domain Settings Change - $dom",
+ $mailmsgtext);
+ }
}
} else {
$resulttext = &mt('No changes made to default authentication/language/timezone settings');
@@ -7362,7 +7548,7 @@ sub modify_defaults {
}
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';
@@ -7423,6 +7609,7 @@ sub modify_scantron {
}
$resulttext .= '';
&Apache::loncommon::devalidate_domconfig_cache($dom);
+ $$lastactref = 'update';
} else {
$resulttext = &mt('No changes made to bubblesheet format file');
}
@@ -7850,6 +8037,13 @@ sub modify_coursedefaults {
my ($resulttext,$errors,%changes,%defaultshash);
my %defaultchecked = ('canuse_pdfforms' => 'off');
my @toggles = ('canuse_pdfforms');
+ my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial',
+ 'uploadquota_community');
+ my @types = ('official','unofficial','community');
+ my %staticdefaults = (
+ anonsurvey_threshold => 10,
+ uploadquota => 500,
+ );
$defaultshash{'coursedefaults'} = {};
@@ -7878,16 +8072,35 @@ sub modify_coursedefaults {
}
$defaultshash{'coursedefaults'}{$item} = $env{'form.'.$item};
}
- my $currdefresponder = $domconfig{'coursedefaults'}{'anonsurvey_threshold'};
- my $newdefresponder = $env{'form.anonsurvey_threshold'};
- $newdefresponder =~ s/\D//g;
- if ($newdefresponder eq '' || $newdefresponder < 1) {
- $newdefresponder = 1;
- }
- $defaultshash{'coursedefaults'}{'anonsurvey_threshold'} = $newdefresponder;
- if ($currdefresponder ne $newdefresponder) {
- unless ($currdefresponder eq '' && $newdefresponder == 10) {
- $changes{'anonsurvey_threshold'} = 1;
+ foreach my $item (@numbers) {
+ my ($currdef,$newdef);
+ $newdef = $env{'form.'.$item};
+ if ($item eq 'anonsurvey_threshold') {
+ $currdef = $domconfig{'coursedefaults'}{$item};
+ $newdef =~ s/\D//g;
+ if ($newdef eq '' || $newdef < 1) {
+ $newdef = 1;
+ }
+ $defaultshash{'coursedefaults'}{$item} = $newdef;
+ } else {
+ my ($type) = ($item =~ /^\Quploadquota_\E(\w+)$/);
+ if (ref($domconfig{'coursedefaults'}{'uploadquota'}) eq 'HASH') {
+ $currdef = $domconfig{'coursedefaults'}{'uploadquota'}{$type};
+ }
+ $newdef =~ s/[^\w.\-]//g;
+ $defaultshash{'coursedefaults'}{'uploadquota'}{$type} = $newdef;
+ }
+ if ($currdef ne $newdef) {
+ my $staticdef;
+ if ($item eq 'anonsurvey_threshold') {
+ unless (($currdef eq '') && ($newdef == $staticdefaults{$item})) {
+ $changes{$item} = 1;
+ }
+ } else {
+ unless (($currdef eq '') && ($newdef == $staticdefaults{'uploadquota'})) {
+ $changes{'uploadquota'} = 1;
+ }
+ }
}
}
my $officialcreds = $env{'form.official_credits'};
@@ -7913,7 +8126,7 @@ sub modify_coursedefaults {
if ($putresult eq 'ok') {
my %domdefaults;
if (keys(%changes) > 0) {
- if (($changes{'canuse_pdfforms'}) || ($changes{'coursecredits'})) {
+ if (($changes{'canuse_pdfforms'}) || ($changes{'coursecredits'}) || ($changes{'uploadquota'})) {
%domdefaults = &Apache::lonnet::get_domain_defaults($dom);
if ($changes{'canuse_pdfforms'}) {
$domdefaults{'canuse_pdfforms'}=$defaultshash{'coursedefaults'}{'canuse_pdfforms'};
@@ -7926,6 +8139,13 @@ sub modify_coursedefaults {
$defaultshash{'coursedefaults'}{'coursecredits'}{'unofficial'};
}
}
+ if ($changes{'uploadquota'}) {
+ if (ref($defaultshash{'coursedefaults'}{'uploadquota'}) eq 'HASH') {
+ foreach my $type (@types) {
+ $domdefaults{$type.'quota'}=$defaultshash{'coursedefaults'}{'uploadquota'}{$type};
+ }
+ }
+ }
my $cachetime = 24*60*60;
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
}
@@ -7939,6 +8159,17 @@ sub modify_coursedefaults {
}
} elsif ($item eq 'anonsurvey_threshold') {
$resulttext .= '
'.&mt('Responder count required for display of anonymous survey submissions set to [_1].',$defaultshash{'coursedefaults'}{'anonsurvey_threshold'}).'