--- loncom/interface/lonconfigsettings.pm 2022/02/01 23:13:19 1.56 +++ loncom/interface/lonconfigsettings.pm 2022/02/14 02:48:46 1.58 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: lonconfigsettings.pm,v 1.56 2022/02/01 23:13:19 raeburn Exp $ +# $Id: lonconfigsettings.pm,v 1.58 2022/02/14 02:48:46 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -237,6 +237,11 @@ $jscript } } } + my %servers = &Apache::lonnet::get_servers($dom,'library'); + foreach my $server (keys(%servers)) { + $onload .= "togglePrivKey(document.display,'$server');"; + } + $onload .= "toggleLTIEncKey(document.display);"; } if (grep(/^ltitools$/,@actions)) { $onload .= "toggleLTITools(document.display,'passback','add');". @@ -291,10 +296,27 @@ $jscript if (grep(/^linkprotection$/,@actions)) { if (ref($values) eq 'HASH') { if (ref($values->{'linkprotection'}) 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'}; + } my $posslti = scalar(keys(%{$values->{'linkprotection'}})); - for (my $i=0; $i<$posslti; $i++) { - if ($values->{'linkprotection'}->{'usable'}) { - $onload .= "toggleLTI(document.display,'$i','secret');"; + for (my $i=0; $i<=$posslti; $i++) { + my $num = $i; + if ($i == $posslti) { + $num = 'add'; + } + if (ref($values->{'linkprotection'}->{$i}) eq 'HASH') { + if ($values->{'linkprotection'}->{$i}->{'usable'}) { + $onload .= "toggleLTI(document.display,'$num','secret');"; + } + } + if ($ltiauth) { + $onload .= "toggleLTIReqUser(document.display,'requser','optional','1','block','$num');". + "toggleLTIReqUser(document.display,'mapuser','userfield','other','inline-block','$num');"; } } } @@ -506,6 +528,16 @@ 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,