--- loncom/interface/domainprefs.pm 2014/10/07 03:16:05 1.160.6.55 +++ loncom/interface/domainprefs.pm 2014/10/04 02:41:44 1.252 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.160.6.55 2014/10/07 03:16:05 raeburn Exp $ +# $Id: domainprefs.pm,v 1.252 2014/10/04 02:41:44 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -213,15 +213,15 @@ sub handler { 'quotas','autoenroll','autoupdate','autocreate', 'directorysrch','usercreation','usermodification', 'contacts','defaults','scantron','coursecategories', - 'serverstatuses','requestcourses','coursedefaults', - 'usersessions','loadbalancing','requestauthor', - 'selfenrollment','inststatus'],$dom); + 'serverstatuses','requestcourses','helpsettings', + 'coursedefaults','usersessions','loadbalancing', + 'requestauthor','selfenrollment','inststatus'],$dom); my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', 'autoupdate','autocreate','directorysrch','contacts', 'usercreation','selfcreation','usermodification','scantron', 'requestcourses','requestauthor','coursecategories', - 'serverstatuses','coursedefaults','selfenrollment', - 'usersessions'); + 'serverstatuses','helpsettings', + 'coursedefaults','selfenrollment','usersessions'); my %existing; if (ref($domconfig{'loadbalancing'}) eq 'HASH') { %existing = %{$domconfig{'loadbalancing'}}; @@ -409,10 +409,20 @@ sub handler { print => \&print_serverstatuses, modify => \&modify_serverstatuses, }, + 'helpsettings' => + {text => 'Help page settings', + help => 'Domain_Configuration_Help_Settings', + header => [{col1 => 'Help Settings (logged-in users)', + col2 => 'Value'}], + print => \&print_helpsettings, + modify => \&modify_helpsettings, + }, 'coursedefaults' => {text => 'Course/Community defaults', help => 'Domain_Configuration_Course_Defaults', - header => [{col1 => 'Defaults which can be overridden for each course by a DC', + header => [{col1 => 'Defaults which can be overridden in each course by a CC', + col2 => 'Value',}, + {col1 => 'Defaults which can be overridden for each course by a DC', col2 => 'Value',},], print => \&print_coursedefaults, modify => \&modify_coursedefaults, @@ -429,6 +439,14 @@ sub handler { print => \&print_selfenrollment, modify => \&modify_selfenrollment, }, + 'privacy' => + {text => 'User Privacy', + help => 'Domain_Configuration_User_Privacy', + header => [{col1 => 'Setting', + col2 => 'Value',}], + print => \&print_privacy, + modify => \&modify_privacy, + }, 'usersessions' => {text => 'User session hosting/offloading', help => 'Domain_Configuration_User_Sessions', @@ -613,6 +631,8 @@ sub process_changes { $output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig); } elsif ($action eq 'requestauthor') { $output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig); + } elsif ($action eq 'helpsettings') { + $output = &modify_helpsettings($r,$dom,$confname,%domconfig); } elsif ($action eq 'coursedefaults') { $output = &modify_coursedefaults($dom,$lastactref,%domconfig); } elsif ($action eq 'selfenrollment') { @@ -666,7 +686,7 @@ sub print_config_box { '; $rowtotal ++; if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') || - ($action eq 'usermodification') || ($action eq 'defaults') || + ($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') || ($action eq 'selfenrollment') || ($action eq 'usersessions')) { $output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal); } elsif ($action eq 'coursecategories') { @@ -721,7 +741,8 @@ sub print_config_box { $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); } $rowtotal ++; - } elsif (($action eq 'usermodification') || ($action eq 'defaults')) { + } elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') || + ($action eq 'defaults')) { $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); } elsif ($action eq 'login') { if ($numheaders == 3) { @@ -864,8 +885,6 @@ sub print_config_box { $output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); } elsif ($action eq 'helpsettings') { $output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal); - } elsif ($action eq 'coursedefaults') { - $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); } } $output .= ' @@ -3642,10 +3661,9 @@ sub print_loadbalancing { $disabled = ' disabled="disabled"'; } $targettable .= - ''; + ''; my $rem = $i%($numinrow); if ($rem == 0) { if (($i > 0) && ($i < $numspares-1)) { @@ -3735,7 +3753,7 @@ sub loadbalancing_rules { if (ref($currrules) eq 'HASH') { $current = $currrules->{$type}; } - if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) { + if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) { if ($dom ne &Apache::lonnet::host_domain($lonhost)) { $current = ''; } @@ -3787,7 +3805,7 @@ sub loadbalance_rule_row { my @rulenames; my %ruletitles = &offloadtype_text(); if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) { - @rulenames = ('balancer','offloadedto','specific'); + @rulenames = ('balancer','offloadedto'); } else { @rulenames = ('default','homeserver'); if ($type eq '_LC_external') { @@ -3798,7 +3816,7 @@ sub loadbalance_rule_row { push(@rulenames,'none'); } my $style = $targets_div_style; - if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) { + if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) { $style = $homedom_div_style; } my $space; @@ -3849,13 +3867,8 @@ sub loadbalance_rule_row { ' '; - if (($rulenames[$i] eq 'specific') && ($type =~ /_LC_ipchange/)) { - $output .= $ruletitles{'particular'}; - } else { - $output .= $ruletitles{$rulenames[$i]}; - } - $output .= ''.$extra.'
'."\n"; + ')"'.$checked.' /> '.$ruletitles{$rulenames[$i]}. + ''.$extra.'
'."\n"; } $output .= ''."\n"; return $output; @@ -3870,7 +3883,6 @@ sub offloadtype_text { 'none' => 'No offload', 'balancer' => 'Session hosted on Load Balancer, after re-authentication', 'offloadedto' => 'Session hosted on offload server, after re-authentication', - 'particular' => 'Session hosted (after re-auth) on server:', ); return %ruletitles; } @@ -5160,7 +5172,7 @@ sub serverstatus_pages { sub defaults_javascript { my ($settings) = @_; - return unless (ref($settings) eq 'HASH'); + return unless (ref($settings) eq 'HASH'); if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) { my $maxnum = scalar(@{$settings->{'inststatusorder'}}); if ($maxnum eq '') { @@ -6972,7 +6984,7 @@ sub modify_quotas { my $newpos = $env{'form.'.$itemid}; $newpos =~ s/\D+//g; foreach my $item ('subject','title','publisher','author') { - next if ((($item eq 'author') || ($item eq 'publisher')) && + next if ((($item eq 'author') || ($item eq 'publisher')) && ($type eq 'templates')); $confhash{$type}{$key}{$item} = $env{'form.'.$type.'_'.$item.'_'.$i}; if ($domconfig{$action}{$type}{$key}{$item} ne $confhash{$type}{$key}{$item}) { @@ -10668,7 +10680,6 @@ sub modify_loadbalancing { my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); my %servers = &Apache::lonnet::internet_dom_servers($dom); - my %libraryservers = &Apache::lonnet::get_servers($dom,'library'); my @sparestypes = ('primary','default'); my %typetitles = &sparestype_titles(); my $resulttext; @@ -10760,10 +10771,7 @@ sub modify_loadbalancing { $rule = $env{'form.loadbalancing_rules_'.$i.'_'.$type}; } if ($rule eq 'specific') { - my $specifiedhost = $env{'form.loadbalancing_singleserver_'.$i.'_'.$type}; - if (exists($servers{$specifiedhost})) { - $rule = $specifiedhost; - } + $rule = $env{'form.loadbalancing_singleserver_'.$i.'_'.$type}; } $defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type} = $rule; if (ref($currrules{$balancer}) eq 'HASH') { @@ -10800,7 +10808,6 @@ sub modify_loadbalancing { } if (ref($changes{'curr'}) eq 'HASH') { foreach my $balancer (sort(keys(%{$changes{'curr'}}))) { - $toupdate{$balancer} = 1; if (ref($changes{'curr'}{$balancer}) eq 'HASH') { if ($changes{'curr'}{$balancer}{'targets'}) { my %offloadstr; @@ -10837,37 +10844,14 @@ sub modify_loadbalancing { if ($rule eq '') { $balancetext = $ruletitles{'default'}; } elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer') || - ($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) { - if (($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) { + ($rule eq 'balancer') || ($rule eq 'offloadedto')) { + $balancetext = $ruletitles{$rule}; + if (($rule eq 'balancer') || ($rule eq 'offloadedto')) { foreach my $sparetype (@sparestypes) { if (ref($defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}) eq 'ARRAY') { map { $toupdate{$_} = 1; } (@{$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}}); } } - foreach my $item (@{$alltypes}) { - next if ($item =~ /^_LC_ipchange/); - my $hasrule = $defaultshash{'loadbalancing'}{$balancer}{'rules'}{$item}; - if ($hasrule eq 'homeserver') { - map { $toupdate{$_} = 1; } (keys(%libraryservers)); - } else { - unless (($hasrule eq 'default') || ($hasrule eq 'none') || ($hasrule eq 'externalbalancer')) { - if ($servers{$hasrule}) { - $toupdate{$hasrule} = 1; - } - } - } - } - if (($rule eq 'balancer') || ($rule eq 'offloadedto')) { - $balancetext = $ruletitles{$rule}; - } else { - my $receiver = $defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type}; - $balancetext = $ruletitles{'particular'}.' '.$receiver; - if ($receiver) { - $toupdate{$receiver}; - } - } - } else { - $balancetext = $ruletitles{$rule}; } } else { $balancetext = &mt('offload to [_1]',$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type});