--- loncom/interface/domainprefs.pm 2013/07/02 19:04:36 1.197
+++ loncom/interface/domainprefs.pm 2013/09/07 00:19:00 1.205
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.197 2013/07/02 19:04:36 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 @@ sub handler {
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 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);
} 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 @@ 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,$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') {
@@ -1142,17 +1146,7 @@ sub print_rolecolors {
my %designhash = &Apache::loncommon::get_domainconf($dom);
my %defaultdesign = %Apache::loncommon::defaultdesign;
my (%is_custom,%designs);
- my %defaults = (
- img => $defaultdesign{$role.'.img'},
- font => $defaultdesign{$role.'.font'},
- fontmenu => $defaultdesign{$role.'.fontmenu'},
- );
- foreach my $item (@bgs) {
- $defaults{'bgs'}{$item} = $defaultdesign{$role.'.'.$item};
- }
- foreach my $item (@links) {
- $defaults{'links'}{$item} = $defaultdesign{$role.'.'.$item};
- }
+ my %defaults = &role_defaults($role,\@bgs,\@links,\@images);
if (ref($settings) eq 'HASH') {
if (ref($settings->{$role}) eq 'HASH') {
if ($settings->{$role}->{'img'} ne '') {
@@ -1213,6 +1207,44 @@ sub print_rolecolors {
return $datatable;
}
+sub role_defaults {
+ my ($role,$bgs,$links,$images,$logintext) = @_;
+ my %defaults;
+ unless ((ref($bgs) eq 'ARRAY') && (ref($links) eq 'ARRAY') && (ref($images) eq 'ARRAY')) {
+ return %defaults;
+ }
+ my %defaultdesign = %Apache::loncommon::defaultdesign;
+ if ($role eq 'login') {
+ %defaults = (
+ font => $defaultdesign{$role.'.font'},
+ );
+ if (ref($logintext) eq 'ARRAY') {
+ foreach my $item (@{$logintext}) {
+ $defaults{'logintext'}{$item} = $defaultdesign{$role.'.'.$item};
+ }
+ }
+ foreach my $item (@{$images}) {
+ $defaults{'showlogo'}{$item} = 1;
+ }
+ } else {
+ %defaults = (
+ img => $defaultdesign{$role.'.img'},
+ font => $defaultdesign{$role.'.font'},
+ fontmenu => $defaultdesign{$role.'.fontmenu'},
+ );
+ }
+ foreach my $item (@{$bgs}) {
+ $defaults{'bgs'}{$item} = $defaultdesign{$role.'.'.$item};
+ }
+ foreach my $item (@{$links}) {
+ $defaults{'links'}{$item} = $defaultdesign{$role.'.'.$item};
+ }
+ foreach my $item (@{$images}) {
+ $defaults{$item} = $defaultdesign{$role.'.'.$item};
+ }
+ return %defaults;
+}
+
sub display_color_options {
my ($dom,$confname,$phase,$role,$itemcount,$choices,$is_custom,$defaults,$designs,
$images,$bgs,$links,$alt_text,$rowtotal,$logintext) = @_;
@@ -1229,7 +1261,7 @@ sub display_color_options {
$datatable .= '
'.
@@ -1239,7 +1271,7 @@ sub display_color_options {
} else {
$datatable .= ' ';
}
- $current_color = $designs->{'fontmenu'} ?
+ $current_color = $designs->{'fontmenu'} ?
$designs->{'fontmenu'} : $defaults->{'fontmenu'};
$datatable .= ''.
' '.
- &mt('Upload:');
+ $datatable .= ' '.
+ &mt('Upload:').' ';
}
} else {
- $datatable .= ' '.
- &mt('Upload:');
+ $datatable .= ' '.
+ &mt('Upload:').' ';
}
if ($switchserver) {
$datatable .= &mt('Upload to library server: [_1]',$switchserver);
@@ -1374,7 +1406,7 @@ sub display_color_options {
'';
foreach my $item (@{$bgs}) {
- $datatable .= '';
+ $datatable .= ' '.$choices->{$item};
my $color = $designs->{'bgs'}{$item} ? $designs->{'bgs'}{$item} : $defaults->{'bgs'}{$item};
if ($designs->{'bgs'}{$item}) {
$datatable .= ' ';
@@ -1402,8 +1434,7 @@ sub display_color_options {
'';
foreach my $item (@{$links}) {
my $color = $designs->{'link'}{$item} ? $designs->{'link'}{$item} : $defaults->{'links'}{$item};
- $datatable .= ''."\n";
-
+ $datatable .= ' '.$choices->{$item}."\n";
if ($designs->{'links'}{$item}) {
$datatable.=' ';
}
@@ -1461,17 +1492,13 @@ sub login_header_options {
}
sub login_text_colors {
- my ($img,$role,$logintext,$phase,$choices,$designs) = @_;
+ my ($img,$role,$logintext,$phase,$choices,$designs,$defaults) = @_;
my $color_menu = ' ';
return $color_menu;
@@ -1503,20 +1530,12 @@ sub image_changes {
$role.'_del_'.$img.'" value="1" />'.&mt('Delete?').
' '.&mt('Replace:').' ';
} else {
- $output .= ' '.$logincolors.&mt('Upload:').' ';
+ $output .= ' '.$logincolors.&mt('Upload:').' ';
}
}
return $output;
}
-sub color_pick {
- my ($phase,$role,$item,$desc,$curcol) = @_;
- my $link = ''.$desc.' ';
- return $link;
-}
-
sub print_quotas {
my ($dom,$settings,$rowtotal,$action) = @_;
my $context;
@@ -2294,7 +2313,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} = '';
}
@@ -2331,21 +2350,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 .= ''.
''.
@@ -2368,7 +2387,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;
}
@@ -2445,9 +2478,14 @@ sub print_coursedefaults {
my $itemcount = 1;
my %choices = &Apache::lonlocal::texthash (
canuse_pdfforms => 'Course/Community users can create/upload PDF forms',
+ uploadquota => 'Default quota for files uploaded directly to course/community using Course Editor (MB)',
anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys',
coursecredits => 'Credits can be specified for courses',
);
+ my %staticdefaults = (
+ anonsurvey_threshold => 10,
+ uploadquota => 500,
+ );
if ($position eq 'top') {
%defaultchecked = ('canuse_pdfforms' => 'off');
@toggles = ('canuse_pdfforms');
@@ -2455,10 +2493,16 @@ sub print_coursedefaults {
\%choices,$itemcount);
} else {
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
- my ($currdefresponder,$def_official_credits,$def_unofficial_credits);
+ my ($currdefresponder,$def_official_credits,$def_unofficial_credits,%curruploadquota);
my $currusecredits = 0;
+ my @types = ('official','unofficial','community');
if (ref($settings) eq 'HASH') {
$currdefresponder = $settings->{'anonsurvey_threshold'};
+ if (ref($settings->{'uploadquota'}) eq 'HASH') {
+ foreach my $type (keys(%{$settings->{'uploadquota'}})) {
+ $curruploadquota{$type} = $settings->{'uploadquota'}{$type};
+ }
+ }
if (ref($settings->{'coursecredits'}) eq 'HASH') {
$def_official_credits = $settings->{'coursecredits'}->{'official'};
$def_unofficial_credits = $settings->{'coursecredits'}->{'unofficial'};
@@ -2468,10 +2512,15 @@ sub print_coursedefaults {
}
}
if (!$currdefresponder) {
- $currdefresponder = 10;
+ $currdefresponder = $staticdefaults{'anonsurvey_threshold'};
} elsif ($currdefresponder < 1) {
$currdefresponder = 1;
}
+ foreach my $type (@types) {
+ if ($curruploadquota{$type} eq '') {
+ $curruploadquota{$type} = $staticdefaults{'uploadquota'};
+ }
+ }
$datatable .=
''.
$choices{'anonsurvey_threshold'}.
@@ -2479,8 +2528,19 @@ sub print_coursedefaults {
' '.
' '.
- ' '."\n";
- $itemcount ++;
+ ''."\n".
+ ''.
+ $choices{'uploadquota'}.
+ ' '.
+ ''.
+ ' '."\n";
+ $itemcount += 2;
my $onclick = 'toggleCredits(this.form);';
my $display = 'none';
if ($currusecredits) {
@@ -3259,6 +3319,7 @@ sub contact_titles {
'lonstatusmail' => 'E-mail from nightly status check (warnings/errors)',
'requestsmail' => 'E-mail from course requests requiring approval',
'updatesmail' => 'E-mail from nightly check of LON-CAPA module integrity/updates',
+ 'idconflictsmail' => 'E-mail from bi-nightly check for multiple users sharing same student/employee ID',
);
my %short_titles = &Apache::lonlocal::texthash (
adminemail => 'Admin E-mail address',
@@ -3893,8 +3954,8 @@ sub print_scantronformat {
$datatable .= ''.&mt('Default in use:').' '.
'';
if ($scantronurl) {
- $datatable .= ''.
- &mt('Default bubblesheet format file').' ';
+ $datatable .= &Apache::loncommon::modal_link($scantronurl,&mt('Default bubblesheet format file'),600,500,
+ undef,undef,undef,undef,'background-color:#ffffff');
} else {
$datatable = &mt('File unavailable for display');
}
@@ -3919,11 +3980,12 @@ sub print_scantronformat {
}
$datatable .= ' '.$errorstr.' ';
} elsif ($scantronurl) {
+ my $link = &Apache::loncommon::modal_link($scantronurl,&mt('Custom bubblesheet format file'),600,500,
+ undef,undef,undef,undef,'background-color:#ffffff');
$datatable .= ' '.
- ''.
- &mt('Custom bubblesheet format file').' '.
- ' '.&mt('Delete?').' '.
+ $link.
+ ' '.&mt('Delete?').' '.
' '.
&mt('Replace:').' ';
}
@@ -4379,7 +4441,7 @@ sub build_category_rows {
if (ref($cats->[$depth]{$parent}) eq 'ARRAY') {
my $numchildren = @{$cats->[$depth]{$parent}};
my $css_class = $itemcount%2?' class="LC_odd_row"':'';
- $text .= '';
+ $text .= '';
my ($idxnum,$parent_name,$parent_item);
my $higher = $depth - 1;
if ($higher == 0) {
@@ -4671,7 +4733,7 @@ sub usertype_update_row {
}
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,@currlangs,@newlangs,$addedfile,%title,@offon);
%title = ( coursecatalog => 'Display course catalog',
@@ -4909,6 +4971,7 @@ sub modify_login {
}
if (keys(%changes) > 0 || $colchgtext) {
&Apache::loncommon::devalidate_domconfig_cache($dom);
+ $$lastactref = 'update';
$resulttext = &mt('Changes made:').'';
foreach my $item (sort(keys(%changes))) {
if ($item eq 'loginvia') {
@@ -5029,7 +5092,7 @@ sub color_font_choices {
links => "Link colors",
images => "Images",
font => "Font color",
- fontmenu => "Font Menu",
+ fontmenu => "Font menu",
pgbg => "Page",
tabbg => "Header",
sidebg => "Border",
@@ -5041,7 +5104,7 @@ sub color_font_choices {
}
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') {
@@ -5056,6 +5119,7 @@ sub modify_rolecolors {
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 {
@@ -5081,24 +5145,45 @@ sub modify_colors {
my @images;
my $servadm = $r->dir_config('lonAdmEMail');
my $errors;
+ my %defaults;
foreach my $role (@{$roles}) {
if ($role eq 'login') {
%choices = &login_choices();
@logintext = ('textcol','bgcol');
} else {
%choices = &color_font_choices();
- $confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'};
}
if ($role eq 'login') {
@images = ('img','logo','domlogo','login');
@bgs = ('pgbg','mainbg','sidebg');
} else {
@images = ('img');
- @bgs = ('pgbg','tabbg','sidebg');
+ @bgs = ('pgbg','tabbg','sidebg');
+ }
+ my %defaults = &role_defaults($role,\@bgs,\@links,\@images,\@logintext);
+ unless ($env{'form.'.$role.'_font'} eq $defaults{'font'}) {
+ $confhash->{$role}{'font'} = $env{'form.'.$role.'_font'};
+ }
+ if ($role eq 'login') {
+ foreach my $item (@logintext) {
+ unless ($env{'form.'.$role.'_'.$item} eq $defaults{'logintext'}{$item}) {
+ $confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item};
+ }
+ }
+ } else {
+ unless($env{'form.'.$role.'_fontmenu'} eq $defaults{'fontmenu'}) {
+ $confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'};
+ }
+ }
+ foreach my $item (@bgs) {
+ unless ($env{'form.'.$role.'_'.$item} eq $defaults{'bgs'}{$item} ) {
+ $confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item};
+ }
}
- $confhash->{$role}{'font'} = $env{'form.'.$role.'_font'};
- foreach my $item (@bgs,@links,@logintext) {
- $confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item};
+ foreach my $item (@links) {
+ unless ($env{'form.'.$role.'_'.$item} eq $defaults{'links'}{$item}) {
+ $confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item};
+ }
}
my ($configuserok,$author_ok,$switchserver) =
&config_check($dom,$confname,$servadm);
@@ -6079,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') {
@@ -6147,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 {
@@ -6598,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'}})) {
@@ -6608,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);
@@ -6630,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}) {
@@ -6668,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})) {
@@ -6685,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) {
@@ -6719,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)).
+ ' ';
+ }
+ if ($changes{'reportupdates'}) {
+ $resulttext .= ''.
+ &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');
@@ -7313,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');
@@ -7399,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');
@@ -7420,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';
@@ -7481,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');
}
@@ -7908,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'} = {};
@@ -7936,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);
+ my $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'};
@@ -7971,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'};
@@ -7984,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);
}
@@ -7997,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'}).' ';
+ } elsif ($item eq 'uploadquota') {
+ if (ref($defaultshash{'coursedefaults'}{'uploadquota'}) eq 'HASH') {
+ $resulttext .= ''.&mt('Default quota for content uploaded to a course/community via Course Editor set as follows:').''.
+ ''.&mt('Official courses: [_1] MB',''.$defaultshash{'coursedefaults'}{'uploadquota'}{'official'}.' ').' '.
+ ''.&mt('Unofficial courses: [_1] MB',''.$defaultshash{'coursedefaults'}{'uploadquota'}{'unofficial'}.' ').' '.
+ ''.&mt('Communities: [_1] MB',''.$defaultshash{'coursedefaults'}{'uploadquota'}{'community'}.' ').' '.
+ ' '.
+ ' ';
+ } else {
+ $resulttext .= ''.&mt('Default quota for content uploaded via Course Editor remains default: [_1] MB',$staticdefaults{'uploadquota'}).' ';
+ }
} elsif ($item eq 'coursecredits') {
if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') {
if (($domdefaults{'officialcredits'} eq '') &&
@@ -9196,4 +9369,21 @@ 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;