--- loncom/interface/lonconfigsettings.pm 2024/08/22 20:18:08 1.21.4.13.2.12
+++ loncom/interface/lonconfigsettings.pm 2024/07/03 16:35:11 1.21.4.14
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: lonconfigsettings.pm,v 1.21.4.13.2.12 2024/08/22 20:18:08 raeburn Exp $
+# $Id: lonconfigsettings.pm,v 1.21.4.14 2024/07/03 16:35:11 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,12 +37,11 @@ use Apache::lonhtmlcommon();
use Apache::lonlocal;
use Apache::courseclassifier();
use LONCAPA qw(:DEFAULT :match);
-use File::Copy;
sub print_header {
- my ($r,$phase,$context,$jscript,$container,$instcode,$dom,$confname,$values) = @_;
+ my ($r,$phase,$context,$jscript,$container,$instcode,$dom) = @_;
my ($pagetitle,$brcrumtitle,$action,$call_category_check,$instcode_check,
- $linkprot_check,$ltitools_check,$crstype,@actions,@code_order);
+ $crstype,@actions,@code_order);
if ($phase eq 'display') {
@actions = &Apache::loncommon::get_env_multiple('form.actions');
}
@@ -116,23 +115,6 @@ sub print_header {
ENDSCRIPT
}
}
- if (($context eq 'course') && ((grep(/^linkprot$/,@actions)) ||
- (grep(/^ltitools$/,@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) {
- if (grep((/^linkprot$/,@actions))) {
- $linkprot_check = <isecret_js('linkprot',$dom,$values);
- }
- if (grep((/^ltitools$/,@actions))) {
- $ltitools_check = <isecret_js('ltitools',$dom,$values);
- }
- }
- }
}
}
my $alert = &mt('You must select at least one functionality type to display.');
@@ -163,21 +145,16 @@ function changePage(formname,newphase) {
return;
}
}
- '.$instcode_check.$call_category_check.$linkprot_check.$ltitools_check.'
+ '.$instcode_check.$call_category_check.'
formname.submit();
}'."\n";
if ($phase eq 'pickactions') {
- $js .= &Apache::lonhtmlcommon::color_picker();
+ $js .= &Apache::lonhtmlcommon::color_picker();
$js .=
&Apache::lonhtmlcommon::set_form_elements({actions => 'checkbox'})."\n";
} elsif ($phase eq 'display') {
- $js .= &Apache::lonhtmlcommon::color_picker();
+ $js .= &Apache::lonhtmlcommon::color_picker();
$js .= &color_pick_js()."\n";
- if ($context eq 'domain') {
- if (grep(/^(lti|ltitools)$/,@actions)) {
- $js .= <isec_javascript($dom)."\n";
- }
- }
}
$js .= &Apache::loncommon::viewport_size_js().'
@@ -237,54 +214,6 @@ $jscript
my $optionsprefix = 'LC_options_helpdesk_';
$onload .= "toggleHelpdeskRow(document.display,'overrides','$customclass','$optionsprefix');";
}
- if (grep(/^lti$/,@actions)) {
- $onload .= "toggleLTI(document.display,'user','add');".
- "toggleLTI(document.display,'crs','add');".
- "toggleLTI(document.display,'sec','add');".
- "toggleLTI(document.display,'lcauth','add');".
- "toggleLTI(document.display,'lcmenu','add');".
- "toggleLTI(document.display,'passback','add');".
- "toggleLTI(document.display,'callback','add');";
- if (ref($values) eq 'HASH') {
- if (ref($values->{'lti'}) eq 'HASH') {
- my $numlti = scalar(keys(%{$values->{'lti'}}));
- for (my $i=0; $i<$numlti; $i++) {
- $onload .= "toggleLTI(document.display,'user','$i');".
- "toggleLTI(document.display,'crs','$i');".
- "toggleLTI(document.display,'sec','$i');".
- "toggleLTI(document.display,'lcauth','$i');".
- "toggleLTI(document.display,'lcmenu','$i');".
- "toggleLTI(document.display,'passback','$i');".
- "toggleLTI(document.display,'callback','$i');";
- }
- }
- }
- my %servers = &Apache::lonnet::get_servers($dom,'library');
- foreach my $server (keys(%servers)) {
- $onload .= "togglePrivKey(document.display,'ltisec','$server');";
- }
- $onload .= "toggleLTIEncKey(document.display,'ltisec');";
- }
- if (grep(/^ltitools$/,@actions)) {
- $onload .= "toggleLTITools(document.display,'passback','add');".
- "toggleLTITools(document.display,'roster','add');".
- "toggleLTITools(document.display,'user','add');";
- if (ref($values) eq 'HASH') {
- if (ref($values->{'ltitools'}) eq 'HASH') {
- my $numltitools = scalar(keys(%{$values->{'ltitools'}}));
- for (my $i=0; $i<$numltitools; $i++) {
- $onload .= "toggleLTITools(document.display,'passback','$i');".
- "toggleLTITools(document.display,'roster','$i');".
- "toggleLTITools(document.display,'user','$i');";
- }
- }
- }
- my %servers = &Apache::lonnet::get_servers($dom,'library');
- foreach my $server (keys(%servers)) {
- $onload .= "togglePrivKey(document.display,'toolsec','$server');";
- }
- $onload .= "toggleLTIEncKey(document.display,'toolsec');";
- }
if (grep(/^wafproxy$/,@actions)) {
$onload .= "toggleWAF();checkWAF();updateWAF();";
}
@@ -310,81 +239,12 @@ $jscript
$additem = {'add_entries' => \%loaditems,};
}
} elsif ($context eq 'course') {
- my ($onload,$ishome,$crshome_checked);
+ my $onload;
if (grep(/^courseinfo$/,@actions)) {
if (@code_order) {
$onload = "courseSet('','load');toggleCloners(document.display.cloners_instcode);";
}
}
- if (grep(/^linkprot$/,@actions)) {
- if (ref($values) eq 'HASH') {
- if (ref($values->{'linkprot'}) eq 'HASH') {
- my $ltiauth;
- if (exists($env{'course.'.$env{'request.course.id'}.'.internal.ltiauth'})) {
- $ltiauth = $env{'course.'.$env{'request.course.id'}.'.internal.ltiauth'};
- } else {
- my %domdefs = &Apache::lonnet::get_domain_defaults($dom);
- $ltiauth = $domdefs{'crsltiauth'};
- }
- unless ($crshome_checked) {
- $ishome = &is_home();
- $crshome_checked = 1;
- }
- my $posslti = scalar(keys(%{$values->{'linkprot'}}));
- for (my $i=0; $i<=$posslti; $i++) {
- my $num = $i;
- if ($i == $posslti) {
- $num = 'add';
- }
- if (ref($values->{'linkprot'}->{$i}) eq 'HASH') {
- if ($values->{'linkprot'}->{$i}->{'usable'}) {
- $onload .= "toggleChgSecret(document.display,'$num','secret','linkprot');";
- }
- }
- $onload .= "toggleLinkProtExtra(document.display,'returnurl','divurlparam','1','inline-block','$num');".
- "toggleLinkProtExtra(document.display,'passback','passbackparam','1','inline-block','$num');";
- if ($ltiauth) {
- $onload .= "toggleLinkProtExtra(document.display,'requser','optional','1','block','$num');".
- "toggleLinkProtExtra(document.display,'mapuser','userfield','other','inline-block','$num');";
- }
- if ($ishome) {
- $onload .= "uncheckLinkProtMakeVis('linkprot','visible','$num');";
- }
- }
- }
- }
- }
- if (grep(/^ltitools$/,@actions)) {
- if (ref($values) eq 'HASH') {
- if (ref($values->{'ltitools'}) eq 'HASH') {
- unless ($crshome_checked) {
- $ishome = &is_home();
- $crshome_checked = 1;
- }
- my $possltitools = scalar(keys(%{$values->{'ltitools'}}));
- for (my $i=0; $i<=$possltitools; $i++) {
- my $num = $i;
- if ($i == $possltitools) {
- $num = 'add';
- }
- if (ref($values->{'ltitools'}->{$i}) eq 'HASH') {
- if ($values->{'ltitools'}->{$i}->{'usable'}) {
- $onload .= "toggleChgSecret(document.display,'$num','secret','ltitools');";
- }
- }
- if ($ishome) {
- $onload .= "uncheckLinkProtMakeVis('ltitools','visible','$num');";
- }
- }
- }
- }
- }
- if (grep(/^appearance$/,@actions)) {
- $onload .= "toggleExtRes();";
- }
- if (grep(/^localization$/,@actions)) {
- $onload .= "toggleTimeZone();";
- }
if (grep(/^grading$/,@actions)) {
$onload .= 'toggleGrading(document.display);toggleHiddenTotalsSec(document.display);';
}
@@ -410,126 +270,6 @@ $jscript
return;
}
-sub ltisecret_js {
- my ($name,$dom,$values) = @_;
- return unless (ref($values) eq 'HASH');
- my $js;
- if (($name eq 'linkprot') || ($name eq 'ltitools')) {
- my (@changeable,@settable);
- if (ref($values->{$name}) eq 'HASH') {
- if (keys(%{$values->{$name}})) {
- my @current = sort { $a <=> $b } keys(%{$values->{$name}});
- if (@current) {
- for (my $i=0; $i<@current; $i++) {
- my $num = $current[$i];
- if (ref($values->{$name}->{$num}) eq 'HASH') {
- if ($values->{$name}->{$num}->{'usable'}) {
- push(@changeable,$i);
- } else {
- push(@settable,$i);
- }
- }
- }
- }
- }
- }
- my ($numrules,$intargjs);
-$js .= <