--- loncom/interface/lonconfigsettings.pm 2017/10/13 20:37:34 1.37 +++ loncom/interface/lonconfigsettings.pm 2018/08/14 21:42:40 1.44 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: lonconfigsettings.pm,v 1.37 2017/10/13 20:37:34 raeburn Exp $ +# $Id: lonconfigsettings.pm,v 1.44 2018/08/14 21:42:40 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -40,7 +40,7 @@ use Apache::courseclassifier(); use LONCAPA qw(:DEFAULT :match); sub print_header { - my ($r,$phase,$context,$jscript,$container,$instcode,$dom) = @_; + my ($r,$phase,$context,$jscript,$container,$instcode,$dom,$values) = @_; my ($pagetitle,$brcrumtitle,$action,$call_category_check,$instcode_check, $crstype,@actions,@code_order); if ($phase eq 'display') { @@ -213,7 +213,43 @@ $jscript if (grep(/^contacts$/,@actions)) { my $customclass = 'LC_helpdesk_override'; my $optionsprefix = 'LC_options_helpdesk_'; - $onload = "toggleHelpdeskRow(document.display,'overrides','$customclass','$optionsprefix');"; + $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');"; + 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');"; + } + } + } + } + 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');"; + } + } + } } if ($onload) { my %loaditems = ( @@ -378,7 +414,7 @@ sub display_settings { if (ref($values) eq 'HASH') { $instcode = $values->{'internal.coursecode'}; } - &print_header($r,$phase,$context,$jscript,$container,$instcode,$dom); + &print_header($r,$phase,$context,$jscript,$container,$instcode,$dom,$values); my $divwidth = 900; if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && (ref($values) eq 'HASH')) { if (@actions > 0) {