--- loncom/interface/lonconfigsettings.pm 2017/11/30 12:45:55 1.39
+++ loncom/interface/lonconfigsettings.pm 2022/02/15 04:28:01 1.59
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: lonconfigsettings.pm,v 1.39 2017/11/30 12:45:55 raeburn Exp $
+# $Id: lonconfigsettings.pm,v 1.59 2022/02/15 04:28:01 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -40,9 +40,9 @@ use Apache::courseclassifier();
use LONCAPA qw(:DEFAULT :match);
sub print_header {
- my ($r,$phase,$context,$jscript,$container,$instcode,$dom,$values) = @_;
+ my ($r,$phase,$context,$jscript,$container,$instcode,$dom,$confname,$values) = @_;
my ($pagetitle,$brcrumtitle,$action,$call_category_check,$instcode_check,
- $crstype,@actions,@code_order);
+ $linkprot_check,$crstype,@actions,@code_order);
if ($phase eq 'display') {
@actions = &Apache::loncommon::get_env_multiple('form.actions');
}
@@ -116,6 +116,85 @@ sub print_header {
ENDSCRIPT
}
}
+ if (($context eq 'course') && ($phase eq 'display') &&
+ (grep(/^linkprotection$/,@actions))) {
+ my $allowed;
+ my $home = &Apache::lonnet::homeserver($confname,$dom);
+ unless ($home eq 'no_host') {
+ my @ids=&Apache::lonnet::current_machine_ids();
+ foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
+ }
+ if ($allowed) {
+ my (@changeable,@settable);
+ if (ref($values->{'linkprotection'}) eq 'HASH') {
+ if (keys(%{$values->{'linkprotection'}})) {
+ my @current = sort { $a <=> $b } keys(%{$values->{'linkprotection'}});
+ if (@current) {
+ for (my $i=0; $i<@current; $i++) {
+ my $num = $current[$i];
+ if (ref($values->{'linkprotection'}->{$num}) eq 'HASH') {
+ if ($values->{'linkprotection'}->{$num}->{'usable'}) {
+ push(@changeable,$i);
+ } else {
+ push(@settable,$i);
+ }
+ }
+ }
+ }
+ }
+ }
+ my ($numrules,$intargjs);
+$linkprot_check .= <
'.$errors.'
'); + } } $r->print('');
my $footer_text = 'Back to configuration display';
@@ -391,7 +560,7 @@ sub display_settings {
if (ref($values) eq 'HASH') {
$instcode = $values->{'internal.coursecode'};
}
- &print_header($r,$phase,$context,$jscript,$container,$instcode,$dom,$values);
+ &print_header($r,$phase,$context,$jscript,$container,$instcode,$dom,$confname,$values);
my $divwidth = 900;
if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && (ref($values) eq 'HASH')) {
if (@actions > 0) {
@@ -438,13 +607,23 @@ sub display_settings {
$settings = $inststatus;
}
}
+ } elsif ($item eq 'lti') {
+ if (ref($values->{'ltisec'}) eq 'HASH') {
+ if (ref($values->{'lti'}) eq 'HASH') {
+ $settings = {%{$values->{'lti'}},%{$values->{'ltisec'}}};
+ } else {
+ $settings = $values->{'ltisec'};
+ }
+ } elsif (ref($values->{'lti'}) eq 'HASH') {
+ $settings = $values->{'lti'};
+ }
}
($output{$item},$rowtotal{$item}) =
&Apache::domainprefs::print_config_box($r,$dom,$confname,
$phase,$item,$prefs->{$item},$settings);
} else {
($output{$item},$rowtotal{$item}) =
- &Apache::courseprefs::print_config_box($r,$dom,$phase,
+ &Apache::courseprefs::print_config_box($r,$dom,$confname,$phase,
$item,$prefs->{$item},$values,$allitems,$crstype,$parm_permission);
}
$rowsum += $rowtotal{$item};
@@ -524,8 +703,8 @@ sub display_choices {
$thirddiv = 1;
}
}
- $r->print('
');
}
+ $r->print('