version 1.398, 2021/12/24 11:07:42
|
version 1.399, 2021/12/28 02:04:35
|
Line 877 sub print_config_box {
|
Line 877 sub print_config_box {
|
$output .= &wafproxy_javascript($dom); |
$output .= &wafproxy_javascript($dom); |
} elsif ($action eq 'autoupdate') { |
} elsif ($action eq 'autoupdate') { |
$output .= &autoupdate_javascript(); |
$output .= &autoupdate_javascript(); |
|
} elsif ($action eq 'autoenroll') { |
|
$output .= &autoenroll_javascript(); |
} elsif ($action eq 'login') { |
} elsif ($action eq 'login') { |
$output .= &saml_javascript(); |
$output .= &saml_javascript(); |
} elsif ($action eq 'ipaccess') { |
} elsif ($action eq 'ipaccess') { |
Line 3688 function toggleLastActiveDays(form) {
|
Line 3690 function toggleLastActiveDays(form) {
|
ENDSCRIPT |
ENDSCRIPT |
} |
} |
|
|
|
sub autoenroll_javascript { |
|
return <<"ENDSCRIPT"; |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
function toggleFailsafe(form) { |
|
var radioname = 'autoenroll_failsafe'; |
|
var divid = 'autoenroll_failsafe_div'; |
|
var num = form.elements[radioname].length; |
|
if (num) { |
|
var setvis = ''; |
|
for (var i=0; i<num; i++) { |
|
if (form.elements[radioname][i].checked) { |
|
if ((form.elements[radioname][i].value == 'zero') || (form.elements[radioname][i].value == 'any')) { |
|
if (document.getElementById(divid)) { |
|
document.getElementById(divid).style.display = 'inline-block'; |
|
} |
|
setvis = 1; |
|
} |
|
break; |
|
} |
|
} |
|
if (!setvis) { |
|
if (document.getElementById(divid)) { |
|
document.getElementById(divid).style.display = 'none'; |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
// ]]> |
|
</script> |
|
|
|
ENDSCRIPT |
|
} |
|
|
sub saml_javascript { |
sub saml_javascript { |
return <<"ENDSCRIPT"; |
return <<"ENDSCRIPT"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 3801 ENDSCRIPT
|
Line 3838 ENDSCRIPT
|
sub print_autoenroll { |
sub print_autoenroll { |
my ($dom,$settings,$rowtotal) = @_; |
my ($dom,$settings,$rowtotal) = @_; |
my $autorun = &Apache::lonnet::auto_run(undef,$dom), |
my $autorun = &Apache::lonnet::auto_run(undef,$dom), |
my ($defdom,$runon,$runoff,$coownerson,$coownersoff,$failsafe); |
my ($defdom,$runon,$runoff,$coownerson,$coownersoff, |
|
$failsafe,$autofailsafe,$failsafesty,%failsafechecked); |
|
$failsafesty = 'none'; |
|
%failsafechecked = ( |
|
off => ' checked="checked"', |
|
); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (exists($settings->{'run'})) { |
if (exists($settings->{'run'})) { |
if ($settings->{'run'} eq '0') { |
if ($settings->{'run'} eq '0') { |
Line 3835 sub print_autoenroll {
|
Line 3877 sub print_autoenroll {
|
if (exists($settings->{'sender_domain'})) { |
if (exists($settings->{'sender_domain'})) { |
$defdom = $settings->{'sender_domain'}; |
$defdom = $settings->{'sender_domain'}; |
} |
} |
if (exists($settings->{'autofailsafe'})) { |
if (exists($settings->{'failsafe'})) { |
$failsafe = $settings->{'autofailsafe'}; |
$failsafe = $settings->{'failsafe'}; |
|
if ($failsafe eq 'zero') { |
|
$failsafechecked{'zero'} = ' checked="checked"'; |
|
$failsafechecked{'off'} = ''; |
|
$failsafesty = 'inline-block'; |
|
} elsif ($failsafe eq 'any') { |
|
$failsafechecked{'any'} = ' checked="checked"'; |
|
$failsafechecked{'off'} = ''; |
|
} |
|
$autofailsafe = $settings->{'autofailsafe'}; |
|
} elsif (exists($settings->{'autofailsafe'})) { |
|
$autofailsafe = $settings->{'autofailsafe'}; |
|
if ($autofailsafe ne '') { |
|
$failsafechecked{'zero'} = ' checked="checked"'; |
|
$failsafe = 'zero'; |
|
$failsafechecked{'off'} = ''; |
|
} |
} |
} |
} else { |
} else { |
if ($autorun) { |
if ($autorun) { |
Line 3876 sub print_autoenroll {
|
Line 3934 sub print_autoenroll {
|
'</tr><tr>'. |
'</tr><tr>'. |
'<td>'.&mt('Failsafe for no drops when institutional data missing').'</td>'. |
'<td>'.&mt('Failsafe for no drops when institutional data missing').'</td>'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<input type="text" name="autoenroll_failsafe"'. |
'<span class="LC_nobreak"><label><input type="radio name="autoenroll_failsafe" value="off" onclick="toggleFailsafe(this.form)" />'.&mt('Not in use').'</label></span><br />'. |
' value="'.$failsafe.'" size="4" /></span></td></tr>'; |
'<span class="LC_nobreak"><label><input type="radio name="autoenroll_failsafe" value="zero" onclick="toggleFailsafe(this.form)" />'.&mt('Retrieved section enrollment is zero').'</label></span><br />'. |
|
'<span class="LC_nobreak"><label><input type="radio name="autoenroll_failsafe" value="any" onclick="toggleFailsafe(this.form)" />'.&mt('Retrieved section enrollment is zero or greater').'</label></span>'. |
|
'<div class="LC_floatleft" style="display:'.$failsafesty.';" id="autoenroll_failsafe_div">'. |
|
'<span class="LC_nobreak">'. |
|
&mt('Threshold for number of students in section to drop: [_1]', |
|
'<input type="text" name="autoenroll_autofailsafe" value="'.$autofailsafe.'" size="4" />'). |
|
'</span></div></td></tr>'; |
$$rowtotal += 4; |
$$rowtotal += 4; |
return $datatable; |
return $datatable; |
} |
} |
Line 15918 sub modify_autoenroll {
|
Line 15982 sub modify_autoenroll {
|
my %title = ( run => 'Auto-enrollment active', |
my %title = ( run => 'Auto-enrollment active', |
sender => 'Sender for notification messages', |
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'); |
autofailsafe => 'Failsafe for no drops if institutional data missing for a section'); |
my @offon = ('off','on'); |
my @offon = ('off','on'); |
my $sender_uname = $env{'form.sender_uname'}; |
my $sender_uname = $env{'form.sender_uname'}; |
my $sender_domain = $env{'form.sender_domain'}; |
my $sender_domain = $env{'form.sender_domain'}; |
Line 15928 sub modify_autoenroll {
|
Line 15992 sub modify_autoenroll {
|
$sender_domain = ''; |
$sender_domain = ''; |
} |
} |
my $coowners = $env{'form.autoassign_coowners'}; |
my $coowners = $env{'form.autoassign_coowners'}; |
|
my $autofailsafe = $env{'form.autoenroll_autofailsafe'}; |
|
$autofailsafe =~ s{^\s+|\s+$}{}g; |
|
if ($autofailsafe =~ /\D/) { |
|
undef($autofailsafe); |
|
} |
my $failsafe = $env{'form.autoenroll_failsafe'}; |
my $failsafe = $env{'form.autoenroll_failsafe'}; |
$failsafe =~ s{^\s+|\s+$}{}g; |
unless (($failsafe eq 'zero') || ($failsafe eq 'any')) { |
if ($failsafe =~ /\D/) { |
$failsafe = 'off'; |
undef($failsafe); |
undef($autofailsafe); |
} |
} |
my %autoenrollhash = ( |
my %autoenrollhash = ( |
autoenroll => { 'run' => $env{'form.autoenroll_run'}, |
autoenroll => { 'run' => $env{'form.autoenroll_run'}, |
'sender_uname' => $sender_uname, |
'sender_uname' => $sender_uname, |
'sender_domain' => $sender_domain, |
'sender_domain' => $sender_domain, |
'co-owners' => $coowners, |
'co-owners' => $coowners, |
'autofailsafe' => $failsafe, |
'autofailsafe' => $autofailsafe, |
|
'failsafe' => $failsafe, |
} |
} |
); |
); |
my $putresult = &Apache::lonnet::put_dom('configuration',\%autoenrollhash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%autoenrollhash, |
Line 15966 sub modify_autoenroll {
|
Line 16036 sub modify_autoenroll {
|
} elsif ($coowners) { |
} elsif ($coowners) { |
$changes{'coowners'} = 1; |
$changes{'coowners'} = 1; |
} |
} |
if ($currautoenroll{'autofailsafe'} ne $failsafe) { |
if ($currautoenroll{'autofailsafe'} ne $autofailsafe) { |
$changes{'autofailsafe'} = 1; |
$changes{'autofailsafe'} = 1; |
} |
} |
|
if ($currautoenroll{'failsafe'} ne $failsafe) { |
|
$changes{'failsafe'} = 1; |
|
} |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
if ($changes{'run'}) { |
if ($changes{'run'}) { |
Line 15989 sub modify_autoenroll {
|
Line 16062 sub modify_autoenroll {
|
} |
} |
} |
} |
if ($changes{'autofailsafe'}) { |
if ($changes{'autofailsafe'}) { |
if ($failsafe ne '') { |
if ($autofailsafe ne '') { |
$resulttext .= '<li>'.&mt('Failsafe for no drops if institutional data missing for a section set to: [_1]',$failsafe).'</li>'; |
$resulttext .= '<li>'.&mt('Failsafe for no drops if institutional data missing for a section set to: [_1]',$autofailsafe).'</li>'; |
} else { |
} else { |
$resulttext .= '<li>'.&mt('Failsafe for no drops if institutional data missing for a section: deleted'); |
$resulttext .= '<li>'.&mt('Failsafe for no drops if institutional data missing for a section not in use').'</li>'; |
} |
} |
|
} |
|
if ($changes{'failsafe'}) { |
|
if ($failsafe eq 'off') { |
|
unless ($changes{'autofailsafe'}) { |
|
$resulttext .= '<li>'.&mt('Failsafe for no drops if institutional data missing for a section not in use').'</li>'; |
|
} |
|
} elsif ($failsafe eq 'zero') { |
|
$resulttext .= '<li>'.&mt('Failsafe applies if retrieved section enrollment is zero').'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Failsafe applies if retrieved section enrollment is zero or greater').'</li>'; |
|
} |
|
} |
|
if (($changes{'autofailsafe'}) || ($changes{'failsafe'})) { |
&Apache::lonnet::get_domain_defaults($dom,1); |
&Apache::lonnet::get_domain_defaults($dom,1); |
if (ref($lastactref) eq 'HASH') { |
if (ref($lastactref) eq 'HASH') { |
$lastactref->{'domdefaults'} = 1; |
$lastactref->{'domdefaults'} = 1; |