version 1.384, 2021/08/01 19:28:10
|
version 1.385, 2021/09/01 00:21:52
|
Line 857 sub print_config_box {
|
Line 857 sub print_config_box {
|
$output .= &proctoring_javascript($settings); |
$output .= &proctoring_javascript($settings); |
} elsif ($action eq 'wafproxy') { |
} elsif ($action eq 'wafproxy') { |
$output .= &wafproxy_javascript($dom); |
$output .= &wafproxy_javascript($dom); |
|
} elsif ($action eq 'autoupdate') { |
|
$output .= &autoupdate_javascript(); |
} |
} |
$output .= |
$output .= |
'<table class="LC_nested_outer"> |
'<table class="LC_nested_outer"> |
Line 3311 function toggleLTI(form,setting,item) {
|
Line 3313 function toggleLTI(form,setting,item) {
|
ENDSCRIPT |
ENDSCRIPT |
} |
} |
|
|
|
sub autoupdate_javascript { |
|
return <<"ENDSCRIPT"; |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
function toggleLastActiveDays(form) { |
|
var radioname = 'lastactive'; |
|
var divid = 'lastactive_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 == '1') { |
|
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 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), |
Line 3397 sub print_autoenroll {
|
Line 3434 sub print_autoenroll {
|
|
|
sub print_autoupdate { |
sub print_autoupdate { |
my ($position,$dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$settings,$rowtotal) = @_; |
my $datatable; |
my ($enable,$datatable); |
if ($position eq 'top') { |
if ($position eq 'top') { |
|
my %choices = &Apache::lonlocal::texthash ( |
|
run => 'Auto-update active?', |
|
classlists => 'Update information in classlists?', |
|
unexpired => 'Skip updates for users without active or future roles?', |
|
lastactive => 'Skip updates for inactive users?', |
|
); |
|
my $itemcount = 0; |
my $updateon = ' '; |
my $updateon = ' '; |
my $updateoff = ' checked="checked" '; |
my $updateoff = ' checked="checked" '; |
my $classlistson = ' '; |
|
my $classlistsoff = ' checked="checked" '; |
|
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if ($settings->{'run'} eq '1') { |
if ($settings->{'run'} eq '1') { |
$updateon = $updateoff; |
$updateon = $updateoff; |
$updateoff = ' '; |
$updateoff = ' '; |
} |
} |
if ($settings->{'classlists'} eq '1') { |
|
$classlistson = $classlistsoff; |
|
$classlistsoff = ' '; |
|
} |
|
} |
} |
my %title = ( |
$enable = '<tr class="LC_odd_row">'. |
run => 'Auto-update active?', |
'<td>'.$choices{'run'}.'</td>'. |
classlists => 'Update information in classlists?', |
'<td class="LC_left_item"><span class="LC_nobreak"><label>'. |
); |
|
$datatable = '<tr class="LC_odd_row">'. |
|
'<td>'.&mt($title{'run'}).'</td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="autoupdate_run"'. |
'<input type="radio" name="autoupdate_run"'. |
$updateon.' value="1" />'.&mt('Yes').'</label> '. |
$updateoff.' value="0" />'.&mt('No').'</label> '. |
'<label><input type="radio" name="autoupdate_run"'. |
'<label><input type="radio" name="autoupdate_run"'. |
$updateoff.'value="0" />'.&mt('No').'</label></span></td>'. |
$updateon.'value="1" />'.&mt('Yes').'</label></span></td>'. |
'</tr><tr>'. |
|
'<td>'.&mt($title{'classlists'}).'</td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak">'. |
|
'<label><input type="radio" name="classlists"'. |
|
$classlistson.' value="1" />'.&mt('Yes').'</label> '. |
|
'<label><input type="radio" name="classlists"'. |
|
$classlistsoff.'value="0" />'.&mt('No').'</label></span></td>'. |
|
'</tr>'; |
'</tr>'; |
$$rowtotal += 2; |
my @toggles = ('classlists','unexpired'); |
|
my %defaultchecked = ('classlists' => 'off', |
|
'unexpired' => 'off' |
|
); |
|
$$rowtotal ++; |
|
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
|
\%choices,$itemcount,'','','left','no'); |
|
$datatable = $enable.$datatable; |
|
$$rowtotal += $itemcount; |
|
my $lastactiveon = ' '; |
|
my $lastactiveoff = ' checked="checked" '; |
|
my $lastactivestyle = 'none'; |
|
my $lastactivedays; |
|
my $onclick = ' onclick="javascript:toggleLastActiveDays(this.form);"'; |
|
if (ref($settings) eq 'HASH') { |
|
if ($settings->{'lastactive'} =~ /^\d+$/) { |
|
$lastactiveon = $lastactiveoff; |
|
$lastactiveoff = ' '; |
|
$lastactivestyle = 'inline-block'; |
|
$lastactivedays = $settings->{'lastactive'}; |
|
} |
|
} |
|
my $css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'>'. |
|
'<td>'.$choices{'lastactive'}.'</td>'. |
|
'<td class="LC_left_item"><span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="lastactive"'. |
|
$lastactiveoff.'value="0"'.$onclick.' />'.&mt('No').'</label>'. |
|
' <label>'. |
|
'<input type="radio" name="lastactive"'. |
|
$lastactiveon.' value="1"'.$onclick.' />'.&mt('Yes').'</label>'. |
|
'<div id="lastactive_div" style="display:'.$lastactivestyle.';">'. |
|
': '.&mt('inactive = no activity in last [_1] days', |
|
'<input type="text" size="5" name="lastactivedays" value="'. |
|
$lastactivedays.'" />'). |
|
'</span></td>'. |
|
'</tr>'; |
|
$$rowtotal ++; |
} elsif ($position eq 'middle') { |
} elsif ($position eq 'middle') { |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my $numinrow = 3; |
my $numinrow = 3; |
Line 4561 sub helpdeskroles_access {
|
Line 4625 sub helpdeskroles_access {
|
|
|
sub radiobutton_prefs { |
sub radiobutton_prefs { |
my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick, |
my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick, |
$additional,$align) = @_; |
$additional,$align,$firstval) = @_; |
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') && |
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') && |
(ref($choices) eq 'HASH')); |
(ref($choices) eq 'HASH')); |
|
|
Line 4601 sub radiobutton_prefs {
|
Line 4665 sub radiobutton_prefs {
|
} else { |
} else { |
$datatable .= '<td class="LC_right_item">'; |
$datatable .= '<td class="LC_right_item">'; |
} |
} |
$datatable .= |
$datatable .= '<span class="LC_nobreak">'; |
'<span class="LC_nobreak">'. |
if ($firstval eq 'no') { |
'<label><input type="radio" name="'. |
$datatable .= |
$item.'" '.$checkedon{$item}.' value="1"'.$onclick.' />'.&mt('Yes'). |
'<label><input type="radio" name="'. |
'</label> <label><input type="radio" name="'.$item.'" '. |
$item.'" '.$checkedoff{$item}.' value="0"'.$onclick.' />'.&mt('No'). |
$checkedoff{$item}.' value="0"'.$onclick.' />'.&mt('No').'</label>'. |
'</label> <label><input type="radio" name="'.$item.'" '. |
'</span>'.$additional. |
$checkedon{$item}.' value="1"'.$onclick.' />'.&mt('Yes').'</label>'; |
'</td>'. |
} else { |
'</tr>'; |
$datatable .= |
|
'<label><input type="radio" name="'. |
|
$item.'" '.$checkedon{$item}.' value="1"'.$onclick.' />'.&mt('Yes'). |
|
'</label> <label><input type="radio" name="'.$item.'" '. |
|
$checkedoff{$item}.' value="0"'.$onclick.' />'.&mt('No').'</label>'; |
|
} |
|
$datatable .= '</span>'.$additional.'</td></tr>'; |
$itemcount ++; |
$itemcount ++; |
} |
} |
return ($datatable,$itemcount); |
return ($datatable,$itemcount); |
Line 14935 sub modify_autoupdate {
|
Line 15005 sub modify_autoupdate {
|
} |
} |
my @offon = ('off','on'); |
my @offon = ('off','on'); |
my %title = &Apache::lonlocal::texthash ( |
my %title = &Apache::lonlocal::texthash ( |
run => 'Auto-update:', |
run => 'Auto-update:', |
classlists => 'Updates to user information in classlists?' |
classlists => 'Updates to user information in classlists?', |
|
unexpired => 'Skip updates for users without active or future roles?', |
|
lastactive => 'Skip updates for inactive users?', |
); |
); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my %fieldtitles = &Apache::lonlocal::texthash ( |
my %fieldtitles = &Apache::lonlocal::texthash ( |
Line 14980 sub modify_autoupdate {
|
Line 15052 sub modify_autoupdate {
|
my %updatehash = ( |
my %updatehash = ( |
autoupdate => { run => $env{'form.autoupdate_run'}, |
autoupdate => { run => $env{'form.autoupdate_run'}, |
classlists => $env{'form.classlists'}, |
classlists => $env{'form.classlists'}, |
|
unexpired => $env{'form.unexpired'}, |
fields => {%fields}, |
fields => {%fields}, |
lockablenames => \@lockablenames, |
lockablenames => \@lockablenames, |
} |
} |
); |
); |
|
my $lastactivedays; |
|
if ($env{'form.lastactive'}) { |
|
$lastactivedays = $env{'form.lastactivedays'}; |
|
$lastactivedays =~ s/^\s+|\s+$//g; |
|
unless ($lastactivedays =~ /^\d+$/) { |
|
undef($lastactivedays); |
|
$env{'form.lastactive'} = 0; |
|
} |
|
} |
|
$updatehash{'autoupdate'}{'lastactive'} = $lastactivedays; |
foreach my $key (keys(%currautoupdate)) { |
foreach my $key (keys(%currautoupdate)) { |
if (($key eq 'run') || ($key eq 'classlists')) { |
if (($key eq 'run') || ($key eq 'classlists') || ($key eq 'unexpired') || ($key eq 'lastactive')) { |
if (exists($updatehash{autoupdate}{$key})) { |
if (exists($updatehash{autoupdate}{$key})) { |
if ($currautoupdate{$key} ne $updatehash{autoupdate}{$key}) { |
if ($currautoupdate{$key} ne $updatehash{autoupdate}{$key}) { |
$changes{$key} = 1; |
$changes{$key} = 1; |
Line 15031 sub modify_autoupdate {
|
Line 15114 sub modify_autoupdate {
|
$changes{'lockablenames'} = 1; |
$changes{'lockablenames'} = 1; |
} |
} |
} |
} |
|
unless (grep(/^unexpired$/,keys(%currautoupdate))) { |
|
if ($updatehash{'autoupdate'}{'unexpired'}) { |
|
$changes{'unexpired'} = 1; |
|
} |
|
} |
|
unless (grep(/^lastactive$/,keys(%currautoupdate))) { |
|
if ($updatehash{'autoupdate'}{'lastactive'} ne '') { |
|
$changes{'lastactive'} = 1; |
|
} |
|
} |
foreach my $item (@{$types},'default') { |
foreach my $item (@{$types},'default') { |
if (defined($fields{$item})) { |
if (defined($fields{$item})) { |
if (ref($currautoupdate{'fields'}) eq 'HASH') { |
if (ref($currautoupdate{'fields'}) eq 'HASH') { |
Line 15093 sub modify_autoupdate {
|
Line 15186 sub modify_autoupdate {
|
my $newvalue; |
my $newvalue; |
if ($key eq 'run') { |
if ($key eq 'run') { |
$newvalue = $offon[$env{'form.autoupdate_run'}]; |
$newvalue = $offon[$env{'form.autoupdate_run'}]; |
|
} elsif ($key eq 'lastactive') { |
|
$newvalue = $offon[$env{'form.lastactive'}]; |
|
unless ($lastactivedays eq '') { |
|
$newvalue .= '; '.&mt('inactive = no activity in last [quant,_1,day]',$lastactivedays); |
|
} |
} else { |
} else { |
$newvalue = $offon[$env{'form.'.$key}]; |
$newvalue = $offon[$env{'form.'.$key}]; |
} |
} |