--- loncom/interface/domainprefs.pm 2016/06/06 17:40:47 1.273 +++ loncom/interface/domainprefs.pm 2016/07/24 14:34:59 1.274 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.273 2016/06/06 17:40:47 raeburn Exp $ +# $Id: domainprefs.pm,v 1.274 2016/07/24 14:34:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2497,7 +2497,7 @@ ENDSCRIPT sub print_autoenroll { my ($dom,$settings,$rowtotal) = @_; my $autorun = &Apache::lonnet::auto_run(undef,$dom), - my ($defdom,$runon,$runoff,$coownerson,$coownersoff); + my ($defdom,$runon,$runoff,$coownerson,$coownersoff,$failsafe); if (ref($settings) eq 'HASH') { if (exists($settings->{'run'})) { if ($settings->{'run'} eq '0') { @@ -2531,6 +2531,9 @@ sub print_autoenroll { if (exists($settings->{'sender_domain'})) { $defdom = $settings->{'sender_domain'}; } + if (exists($settings->{'autofailsafe'})) { + $failsafe = $settings->{'autofailsafe'}; + } } else { if ($autorun) { $runon = ' checked="checked" '; @@ -2566,8 +2569,12 @@ sub print_autoenroll { $coownerson.' value="1" />'.&mt('Yes').' '. ''. - ''; - $$rowtotal += 3; + ''. + ''.&mt('Failsafe for no drops when institutional data missing').''. + ''. + ''; + $$rowtotal += 4; return $datatable; } @@ -8911,7 +8918,8 @@ sub modify_autoenroll { my $autorun = &Apache::lonnet::auto_run(undef,$dom), my %title = ( run => 'Auto-enrollment active', sender => 'Sender for notification messages', - coowners => 'Automatic assignment of co-ownership to instructors of record (institutional data)'); + coowners => 'Automatic assignment of co-ownership to instructors of record (institutional data)', + failsafe => 'Failsafe for no drops if institutional data missing for a section'); my @offon = ('off','on'); my $sender_uname = $env{'form.sender_uname'}; my $sender_domain = $env{'form.sender_domain'}; @@ -8921,11 +8929,17 @@ sub modify_autoenroll { $sender_domain = ''; } my $coowners = $env{'form.autoassign_coowners'}; + my $failsafe = $env{'form.autoenroll_failsafe'}; + $failsafe =~ s{^\s+|\s+$}{}g; + if ($failsafe =~ /\D/) { + undef($failsafe); + } my %autoenrollhash = ( autoenroll => { 'run' => $env{'form.autoenroll_run'}, 'sender_uname' => $sender_uname, 'sender_domain' => $sender_domain, 'co-owners' => $coowners, + 'autofailsafe' => $failsafe, } ); my $putresult = &Apache::lonnet::put_dom('configuration',\%autoenrollhash, @@ -8952,7 +8966,10 @@ sub modify_autoenroll { } } elsif ($coowners) { $changes{'coowners'} = 1; - } + } + if ($currautoenroll{'autofailsafe'} ne $failsafe) { + $changes{'autofailsafe'} = 1; + } if (keys(%changes) > 0) { $resulttext = &mt('Changes made:').''; } else { $resulttext = &mt('No changes made to auto-enrollment settings');