--- loncom/interface/domainprefs.pm 2013/10/16 23:57:49 1.160.6.27 +++ loncom/interface/domainprefs.pm 2013/09/10 17:43:58 1.207 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.160.6.27 2013/10/16 23:57:49 raeburn Exp $ +# $Id: domainprefs.pm,v 1.207 2013/09/10 17:43:58 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -86,7 +86,7 @@ $dom,$settings,$rowtotal,$action. $dom is the domain, $settings is a reference to a hash of current settings for the current context, $rowtotal is a reference to the scalar used to record the -number of rows displayed on the page, and $action is the context (quotas, +number of rows displayed on the page, and $action is the context (quotas, requestcourses or requestauthor). The print_quotas routine was orginally created to display/store information @@ -211,13 +211,15 @@ sub handler { 'quotas','autoenroll','autoupdate','autocreate', 'directorysrch','usercreation','usermodification', 'contacts','defaults','scantron','coursecategories', - 'serverstatuses','requestcourses','coursedefaults', - 'usersessions','loadbalancing','requestauthor'],$dom); + 'serverstatuses','requestcourses','helpsettings', + 'coursedefaults','usersessions','loadbalancing', + 'requestauthor'],$dom); my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', 'autoupdate','autocreate','directorysrch','contacts', 'usercreation','usermodification','scantron', 'requestcourses','requestauthor','coursecategories', - 'serverstatuses','coursedefaults','usersessions'); + 'serverstatuses','helpsettings', + 'coursedefaults','usersessions'); my %existing; if (ref($domconfig{'loadbalancing'}) eq 'HASH') { %existing = %{$domconfig{'loadbalancing'}}; @@ -354,12 +356,26 @@ sub handler { col3 => 'Specific IPs', }], }, - 'coursedefaults' => + 'helpsettings' => + {text => 'Help page settings', + help => 'Domain_Configuration_Help_Settings', + header => [{col1 => 'Help Settings (logged-in users)', + col2 => 'Value'}], + }, + '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',},], }, + 'privacy' => + {text => 'User Privacy', + help => 'Domain_Configuration_User_Privacy', + header => [{col1 => 'Setting', + col2 => 'Value',}], + }, 'usersessions' => {text => 'User session hosting/offloading', help => 'Domain_Configuration_User_Sessions', @@ -400,11 +416,10 @@ sub handler { my $confname = $dom.'-domainconfig'; if ($phase eq 'process') { - my $result = &Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order, - \%prefs,\%domconfig,$confname,\@roles); - if (ref($result) eq 'HASH') { + if (&Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order, + \%prefs,\%domconfig,$confname,\@roles) eq 'update') { $r->rflush(); - &devalidate_remote_domconfs($dom,$result); + &devalidate_remote_domconfs($dom); } } elsif ($phase eq 'display') { my $js = &recaptcha_js(). @@ -427,7 +442,7 @@ sub handler { unless ($configuserok eq 'ok') { &Apache::lonconfigsettings::print_header($r,$phase,$context); $r->print(&mt('The domain configuration user "[_1]" has yet to be created.', - $confname). + $confname). '
' ); if ($switchserver) { @@ -499,7 +514,7 @@ sub process_changes { $output = &modify_rolecolors($r,$dom,$confname,$roles, $lastactref,%domconfig); } elsif ($action eq 'quotas') { - $output = &modify_quotas($dom,$action,$lastactref,%domconfig); + $output = &modify_quotas($dom,$action,%domconfig); } elsif ($action eq 'autoenroll') { $output = &modify_autoenroll($dom,$lastactref,%domconfig); } elsif ($action eq 'autoupdate') { @@ -515,7 +530,7 @@ sub process_changes { } elsif ($action eq 'contacts') { $output = &modify_contacts($dom,$lastactref,%domconfig); } elsif ($action eq 'defaults') { - $output = &modify_defaults($dom,$lastactref,%domconfig); + $output = &modify_defaults($dom,$r,%domconfig); } elsif ($action eq 'scantron') { $output = &modify_scantron($r,$dom,$confname,$lastactref,%domconfig); } elsif ($action eq 'coursecategories') { @@ -523,13 +538,15 @@ sub process_changes { } elsif ($action eq 'serverstatuses') { $output = &modify_serverstatuses($dom,%domconfig); } elsif ($action eq 'requestcourses') { - $output = &modify_quotas($dom,$action,$lastactref,%domconfig); + $output = &modify_quotas($dom,$action,%domconfig); } elsif ($action eq 'requestauthor') { - $output = &modify_quotas($dom,$action,$lastactref,%domconfig); + $output = &modify_quotas($dom,$action,%domconfig); + } elsif ($action eq 'helpsettings') { + $output = &modify_helpsettings($r,$dom,$confname,%domconfig); } elsif ($action eq 'coursedefaults') { - $output = &modify_coursedefaults($dom,$lastactref,%domconfig); + $output = &modify_coursedefaults($dom,%domconfig); } elsif ($action eq 'usersessions') { - $output = &modify_usersessions($dom,$lastactref,%domconfig); + $output = &modify_usersessions($dom,%domconfig); } elsif ($action eq 'loadbalancing') { $output = &modify_loadbalancing($dom,%domconfig); } @@ -558,7 +575,7 @@ sub print_config_box { if ($numheaders > 1) { my $colspan = ''; my $rightcolspan = ''; - if (($action eq 'rolecolors') || ($action eq 'coursecategories') || + if (($action eq 'rolecolors') || ($action eq 'coursecategories') || (($action eq 'login') && ($numheaders < 3))) { $colspan = ' colspan="2"'; } @@ -597,6 +614,8 @@ sub print_config_box { $output .= &print_usersessions('top',$dom,$settings,\$rowtotal); } elsif ($action eq 'rolecolors') { $output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); + } elsif ($action eq 'coursedefaults') { + $output .= &print_coursedefaults('top',$dom,$settings,\$rowtotal); } $output .= ' @@ -686,6 +705,8 @@ sub print_config_box { '.&mt($item->{'header'}->[2]->{'col2'}).' '. &print_usersessions('bottom',$dom,$settings,\$rowtotal); $rowtotal ++; + } elsif ($action eq 'coursedefaults') { + $output .= &print_coursedefaults('bottom',$dom,$settings,\$rowtotal); } elsif ($action eq 'rolecolors') { $output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' @@ -773,7 +794,7 @@ sub print_config_box { } elsif ($action eq 'contacts') { $output .= &print_contacts($dom,$settings,\$rowtotal); } elsif ($action eq 'defaults') { - $output .= &print_defaults($dom,$settings,\$rowtotal); + $output .= &print_defaults($dom,\$rowtotal); } elsif ($action eq 'scantron') { $output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); } elsif ($action eq 'serverstatuses') { @@ -782,8 +803,6 @@ sub print_config_box { $output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal); } elsif ($action eq 'loadbalancing') { $output .= &print_loadbalancing($dom,$settings,\$rowtotal); - } elsif ($action eq 'coursedefaults') { - $output .= &print_coursedefaults('bottom',$dom,$settings,\$rowtotal); } } $output .= ' @@ -1537,7 +1556,7 @@ sub print_quotas { } elsif ($context eq 'requestauthor') { @usertools = ('author'); @options = ('norequest','approval','automatic'); - %titles = &authorrequest_titles(); + %titles = &authorrequest_titles(); } else { @usertools = ('aboutme','blog','webdav','portfolio'); %titles = &tool_titles(); @@ -1944,7 +1963,7 @@ sub print_quotas { sub print_requestmail { my ($dom,$action,$settings,$rowtotal) = @_; - my ($now,$datatable,%currapp); + my ($now,$datatable,%currapp,$rows); $now = time; if (ref($settings) eq 'HASH') { if (ref($settings->{'notify'}) eq 'HASH') { @@ -2137,7 +2156,7 @@ sub print_autocreate { } } } - if ($settings->{'xmldc'} ne '') { + if ($settings->{'xmldc'} ne '') { $currhash{$settings->{'xmldc'}} = 1; } } else { @@ -2523,7 +2542,7 @@ sub print_coursedefaults { $datatable .= ''."\n"; $itemcount += 2; my $onclick = 'toggleCredits(this.form);'; - my $display = 'none'; + my $display = 'none'; if ($currusecredits) { $display = 'block'; } @@ -2978,7 +2997,7 @@ sub print_loadbalancing { } my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); - my $rownum = 8; + my $rownum = 6; if (ref($types) eq 'ARRAY') { $rownum += scalar(@{$types}); } @@ -3009,7 +3028,7 @@ sub print_loadbalancing { ''. '

'; if ($lonhost eq '') { - $datatable .= ''; + $datatable .= ''; if (keys(%currbalancer) > 0) { $datatable .= &mt('Add balancer:'); } else { @@ -3025,7 +3044,7 @@ sub print_loadbalancing { next if ($currbalancer{$server}); $datatable .= ''."\n"; } - $datatable .= + $datatable .= ''."\n". ' '."\n"; } else { @@ -3064,7 +3083,7 @@ sub print_loadbalancing { if (exists($currbalancer{$spares[$i]})) { $disabled = ' disabled="disabled"'; } - $targettable .= + $targettable .= ''; @@ -3148,7 +3167,7 @@ sub loadbalancing_rules { $css_class,$balnum,$islast) = @_; my $output; my $num = 0; - my ($alltypes,$othertypes,$titles) = + my ($alltypes,$othertypes,$titles) = &loadbalancing_titles($dom,$intdom,$usertypes,$types); if ((ref($alltypes) eq 'ARRAY') && (ref($titles) eq 'HASH')) { foreach my $type (@{$alltypes}) { @@ -3157,7 +3176,7 @@ sub loadbalancing_rules { if (ref($currrules) eq 'HASH') { $current = $currrules->{$type}; } - if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) { + if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) { if ($dom ne &Apache::lonnet::host_domain($lonhost)) { $current = ''; } @@ -3178,10 +3197,8 @@ sub loadbalancing_titles { '_LC_author' => &mt('Users from [_1] with author role',$dom), '_LC_internetdom' => &mt('Users not from [_1], but from [_2]',$dom,$intdom), '_LC_external' => &mt('Users not from [_1]',$intdom), - '_LC_ipchangesso' => &mt('SSO users from [_1], with IP mismatch',$dom), - '_LC_ipchange' => &mt('Non-SSO users with IP mismatch'), ); - my @alltypes = ('_LC_adv','_LC_author','_LC_internetdom','_LC_external','_LC_ipchangesso','_LC_ipchange'); + my @alltypes = ('_LC_adv','_LC_author','_LC_internetdom','_LC_external'); if (ref($types) eq 'ARRAY') { unshift(@alltypes,@{$types},'default'); } @@ -3206,28 +3223,23 @@ sub loadbalancing_titles { sub loadbalance_rule_row { my ($type,$title,$current,$servers,$currbalancer,$lonhost,$dom, $targets_div_style,$homedom_div_style,$css_class,$balnum,$num,$islast) = @_; - my @rulenames; + my @rulenames = ('default','homeserver'); my %ruletitles = &offloadtype_text(); - if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) { - @rulenames = ('balancer','offloadedto'); + if ($type eq '_LC_external') { + push(@rulenames,'externalbalancer'); } else { - @rulenames = ('default','homeserver'); - if ($type eq '_LC_external') { - push(@rulenames,'externalbalancer'); - } else { - push(@rulenames,'specific'); - } - push(@rulenames,'none'); + push(@rulenames,'specific'); } + push(@rulenames,'none'); my $style = $targets_div_style; - if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) { + if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) { $style = $homedom_div_style; } my $space; if ($islast && $num == 1) { $space = '

 
'; } - my $output = + my $output = ''.$space. '
'.$title.'
'."\n". ''.$space. @@ -3247,7 +3259,7 @@ sub loadbalance_rule_row { unless ($checked) { $default = ' selected="selected"'; } - $extra = + $extra = ': '; + $domdefaults{$item}.'"'.$size.' />'; } $datatable .= ''; $rownum ++; @@ -4911,7 +4913,7 @@ sub modify_login { } else { my $puberror = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].",$newfile{$lang},$result); $errors .= '
  • '.$puberror.'
  • '; - if ((grep(/^\Q$lang\E$/,@currlangs)) && + if ((grep(/^\Q$lang\E$/,@currlangs)) && (!grep(/^\Q$lang\E$/,@delurls))) { $loginhash{'login'}{'helpurl'}{$lang} = $domconfig{'login'}{'helpurl'}{$lang}; @@ -4969,9 +4971,7 @@ sub modify_login { } if (keys(%changes) > 0 || $colchgtext) { &Apache::loncommon::devalidate_domconfig_cache($dom); - if (ref($lastactref) eq 'HASH') { - $lastactref->{'domainconfig'} = 1; - } + $$lastactref = 'update'; $resulttext = &mt('Changes made:').'