--- loncom/interface/lonconfigsettings.pm 2016/10/11 22:58:55 1.33 +++ loncom/interface/lonconfigsettings.pm 2017/07/26 19:45:45 1.34 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: lonconfigsettings.pm,v 1.33 2016/10/11 22:58:55 raeburn Exp $ +# $Id: lonconfigsettings.pm,v 1.34 2017/07/26 19:45:45 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) = @_; + my ($r,$phase,$context,$jscript,$container,$instcode,$dom) = @_; my ($pagetitle,$brcrumtitle,$action,$call_category_check,$instcode_check, $crstype,@actions,@code_order); if ($phase eq 'display') { @@ -177,11 +177,32 @@ $jscript $additem = {'add_entries' => \%loaditems,}; } elsif ($phase eq 'display') { if ($context eq 'domain') { + my $onload; if (grep(/^coursedefaults$/,@actions)) { + $onload = "toggleDisplay(document.display,'cloneinstcode');". + "toggleDisplay(document.display,'credits');". + "toggleDisplay(document.display,'studentsubmission');"; + } + if (grep(/^selfcreation$/,@actions)) { + my $prefix = 'cancreate_emailverified'; + my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); + if (ref($domdefaults{'inststatusguest'}) eq 'ARRAY') { + my $order = $domdefaults{'inststatusguest'}; + if (ref($order) eq 'ARRAY') { + foreach my $type (@{$order}) { + if (($type ne '') && ($type ne 'default')) { + my $name = $prefix.'_'.$type; + $onload .= "toggleDisplay(document.display,'$name');"; + } + } + } + } + $onload .= "toggleDisplay(document.display,'$prefix');". + "toggleDisplay(document.display,'emailoptions');". + } + if ($onload) { my %loaditems = ( - ' onload' => "toggleDisplay(document.display,'cloneinstcode');". - "toggleDisplay(document.display,'credits');". - "toggleDisplay(document.display,'studentsubmission');", + 'onload' => $onload; ); $additem = {'add_entries' => \%loaditems,}; } @@ -342,7 +363,7 @@ sub display_settings { if (ref($values) eq 'HASH') { $instcode = $values->{'internal.coursecode'}; } - &print_header($r,$phase,$context,$jscript,$container,$instcode); + &print_header($r,$phase,$context,$jscript,$container,$instcode,$dom); my $divwidth = 900; if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && (ref($values) eq 'HASH')) { if (@actions > 0) {