--- loncom/interface/domainprefs.pm 2013/12/19 08:25:48 1.160.6.28 +++ loncom/interface/domainprefs.pm 2013/08/07 14:41:39 1.201 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.160.6.28 2013/12/19 08:25:48 raeburn Exp $ +# $Id: domainprefs.pm,v 1.201 2013/08/07 14:41:39 raeburn 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'}}; @@ -257,7 +259,7 @@ sub handler { help => 'Domain_Configuration_Quotas', header => [{col1 => 'User affiliation', col2 => 'Available tools', - col3 => 'Quotas, MB; (Authoring requires role)',}], + col3 => 'Quotas, Mb; (Authoring requires role)',}], }, 'autoenroll' => { text => 'Auto-enrollment settings', @@ -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,12 +416,7 @@ 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') { - $r->rflush(); - &devalidate_remote_domconfs($dom,$result); - } + &Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,\@roles); } elsif ($phase eq 'display') { my $js = &recaptcha_js(). &credits_js(); @@ -427,7 +438,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) { @@ -487,21 +498,21 @@ sub handler { } sub process_changes { - my ($r,$dom,$confname,$action,$roles,$values,$lastactref) = @_; + my ($r,$dom,$confname,$action,$roles,$values) = @_; my %domconfig; if (ref($values) eq 'HASH') { %domconfig = %{$values}; } my $output; if ($action eq 'login') { - $output = &modify_login($r,$dom,$confname,$lastactref,%domconfig); + $output = &modify_login($r,$dom,$confname,%domconfig); } elsif ($action eq 'rolecolors') { $output = &modify_rolecolors($r,$dom,$confname,$roles, - $lastactref,%domconfig); + %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); + $output = &modify_autoenroll($dom,%domconfig); } elsif ($action eq 'autoupdate') { $output = &modify_autoupdate($dom,%domconfig); } elsif ($action eq 'autocreate') { @@ -513,23 +524,25 @@ sub process_changes { } elsif ($action eq 'usermodification') { $output = &modify_usermodification($dom,%domconfig); } elsif ($action eq 'contacts') { - $output = &modify_contacts($dom,$lastactref,%domconfig); + $output = &modify_contacts($dom,%domconfig); } elsif ($action eq 'defaults') { - $output = &modify_defaults($dom,$lastactref,%domconfig); + $output = &modify_defaults($dom,$r); } elsif ($action eq 'scantron') { - $output = &modify_scantron($r,$dom,$confname,$lastactref,%domconfig); + $output = &modify_scantron($r,$dom,$confname,%domconfig); } elsif ($action eq 'coursecategories') { $output = &modify_coursecategories($dom,%domconfig); } 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 +571,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 +610,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 +701,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 +790,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 +799,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 .= ' @@ -1190,8 +1205,8 @@ sub print_rolecolors { sub role_defaults { my ($role,$bgs,$links,$images,$logintext) = @_; - my %defaults; - unless ((ref($bgs) eq 'ARRAY') && (ref($links) eq 'ARRAY') && (ref($images) eq 'ARRAY')) { + my %defaults; + unless ((ref($bgs) eq 'ARRAY') && (ref($links) eq 'ARRAY') && (ref($images) eq 'ARRAY')) { return %defaults; } my %defaultdesign = %Apache::loncommon::defaultdesign; @@ -1242,7 +1257,7 @@ sub display_color_options { $datatable .= ''. ' '. + ' value="'.$current_color.'" /> '. ' '; unless ($role eq 'login') { $datatable .= ''. @@ -1252,7 +1267,7 @@ sub display_color_options { } else { $datatable .= ' '; } - $current_color = $designs->{'fontmenu'} ? + $current_color = $designs->{'fontmenu'} ? $designs->{'fontmenu'} : $defaults->{'fontmenu'}; $datatable .= ''. ''.$choices->{$item}."\n"; + if ($designs->{'links'}{$item}) { $datatable.=' '; } @@ -1480,6 +1496,7 @@ sub login_text_colors { my $color = $designs->{'logintext'}{$item} ? $designs->{'logintext'}{$item} : $defaults->{'logintext'}{$item}; $color_menu .= '
'; + } $color_menu .= '
'; return $color_menu; @@ -1537,7 +1554,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 +1961,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 +2154,7 @@ sub print_autocreate { } } } - if ($settings->{'xmldc'} ne '') { + if ($settings->{'xmldc'} ne '') { $currhash{$settings->{'xmldc'}} = 1; } } else { @@ -2294,7 +2311,7 @@ sub print_contacts { my @contacts = ('adminemail','supportemail'); my (%checked,%to,%otheremails,%bccemails); my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail', - 'requestsmail','updatesmail','idconflictsmail'); + 'requestsmail','updatesmail'); foreach my $type (@mailings) { $otheremails{$type} = ''; } @@ -2331,21 +2348,21 @@ sub print_contacts { $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" '; $checked{'requestsmail'}{'adminemail'} = ' checked="checked" '; $checked{'updatesmail'}{'adminemail'} = ' checked="checked" '; - $checked{'idconflictsmail'}{'adminemail'} = ' checked="checked" '; } my ($titles,$short_titles) = &contact_titles(); my $rownum = 0; my $css_class; foreach my $item (@contacts) { + $rownum ++; $css_class = $rownum%2?' class="LC_odd_row"':''; $datatable .= ''. ''.$titles->{$item}. ''. ''; - $rownum ++; } foreach my $type (@mailings) { + $rownum ++; $css_class = $rownum%2?' class="LC_odd_row"':''; $datatable .= ''. ''. @@ -2368,21 +2385,7 @@ sub print_contacts { 'value="'.$bccemails{$type}.'" />'; } $datatable .= ''."\n"; - $rownum ++; } - my %choices; - $choices{'reporterrors'} = &mt('E-mail error reports to [_1]', - &Apache::loncommon::modal_link('http://loncapa.org/core.html', - &mt('LON-CAPA core group - MSU'),600,500)); - $choices{'reportupdates'} = &mt('E-mail record of completed LON-CAPA updates to [_1]', - &Apache::loncommon::modal_link('http://loncapa.org/core.html', - &mt('LON-CAPA core group - MSU'),600,500)); - my @toggles = ('reporterrors','reportupdates'); - my %defaultchecked = ('reporterrors' => 'on', - 'reportupdates' => 'on'); - (my $reports,$rownum) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, - \%choices,$rownum); - $datatable .= $reports; $$rowtotal += $rownum; return $datatable; } @@ -2523,7 +2526,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 +2981,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 +3012,7 @@ sub print_loadbalancing { ''. '

'; if ($lonhost eq '') { - $datatable .= ''; + $datatable .= ''; if (keys(%currbalancer) > 0) { $datatable .= &mt('Add balancer:'); } else { @@ -3025,7 +3028,7 @@ sub print_loadbalancing { next if ($currbalancer{$server}); $datatable .= ''."\n"; } - $datatable .= + $datatable .= ''."\n". ' '."\n"; } else { @@ -3064,7 +3067,7 @@ sub print_loadbalancing { if (exists($currbalancer{$spares[$i]})) { $disabled = ' disabled="disabled"'; } - $targettable .= + $targettable .= ''; @@ -3148,7 +3151,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 +3160,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 +3181,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 +3207,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 +3243,7 @@ sub loadbalance_rule_row { unless ($checked) { $default = ' selected="selected"'; } - $extra = + $extra = ': '; + $domdefaults{$item}.'"'.$size.' />'; } $datatable .= ''; $rownum ++; @@ -4439,7 +4424,7 @@ sub build_category_rows { if (ref($cats->[$depth]{$parent}) eq 'ARRAY') { my $numchildren = @{$cats->[$depth]{$parent}}; my $css_class = $itemcount%2?' class="LC_odd_row"':''; - $text .= ''; + $text .= '
'; my ($idxnum,$parent_name,$parent_item); my $higher = $depth - 1; if ($higher == 0) { @@ -4731,7 +4716,7 @@ sub usertype_update_row { } sub modify_login { - my ($r,$dom,$confname,$lastactref,%domconfig) = @_; + my ($r,$dom,$confname,%domconfig) = @_; my ($resulttext,$errors,$colchgtext,%changes,%colchanges,%newfile,%newurl, %curr_loginvia,%loginhash,@currlangs,@newlangs,$addedfile,%title,@offon); %title = ( coursecatalog => 'Display course catalog', @@ -4911,7 +4896,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 +4954,6 @@ sub modify_login { } if (keys(%changes) > 0 || $colchgtext) { &Apache::loncommon::devalidate_domconfig_cache($dom); - if (ref($lastactref) eq 'HASH') { - $lastactref->{'domainconfig'} = 1; - } $resulttext = &mt('Changes made:').'
      '; foreach my $item (sort(keys(%changes))) { if ($item eq 'loginvia') { @@ -5031,7 +5013,7 @@ sub modify_login { } } elsif ($item eq 'captcha') { if (ref($loginhash{'login'}) eq 'HASH') { - my $chgtxt; + my $chgtxt; if ($loginhash{'login'}{$item} eq 'notused') { $chgtxt .= &mt('No CAPTCHA validation in use for helpdesk form.'); } else { @@ -5104,7 +5086,7 @@ sub color_font_choices { } sub modify_rolecolors { - my ($r,$dom,$confname,$roles,$lastactref,%domconfig) = @_; + my ($r,$dom,$confname,$roles,%domconfig) = @_; my ($resulttext,%rolehash); $rolehash{'rolecolors'} = {}; if (ref($domconfig{'rolecolors'}) ne 'HASH') { @@ -5119,9 +5101,6 @@ sub modify_rolecolors { if ($putresult eq 'ok') { if (keys(%changes) > 0) { &Apache::loncommon::devalidate_domconfig_cache($dom); - if (ref($lastactref) eq 'HASH') { - $lastactref->{'domainconfig'} = 1; - } $resulttext = &display_colorchgs($dom,\%changes,$roles, $rolehash{'rolecolors'}); } else { @@ -5533,7 +5512,7 @@ sub publishlogo { # See if there is anything left unless ($fname) { return ('error: no uploaded file'); } $fname="$subdir/$fname"; - my $docroot=$r->dir_config('lonDocRoot'); + my $docroot=$r->dir_config('lonDocRoot'); my $filepath="$docroot/priv"; my $relpath = "$dom/$confname"; my ($fnamepath,$file,$fetchthumb); @@ -5553,7 +5532,7 @@ sub publishlogo { if ($file=~/\.(\w+)$/ && (&Apache::loncommon::fileembstyle($1) eq 'hdn')) { $output = - &mt('Invalid file extension ([_1]) - reserved for internal use.',$1); + &mt('Invalid file extension ([_1]) - reserved for LONCAPA use.',$1); } elsif ($file=~/\.(\w+)$/ && !defined(&Apache::loncommon::fileembstyle($1))) { $output = &mt('Unrecognized file extension ([_1]) - rename the file with a proper extension and re-upload.',$1); @@ -5802,7 +5781,7 @@ sub check_switchserver { } sub modify_quotas { - my ($dom,$action,$lastactref,%domconfig) = @_; + my ($dom,$action,%domconfig) = @_; my ($context,@usertools,@options,%validations,%titles,%confhash,%toolshash, %limithash,$toolregexp,%conditions,$resulttext,%changes); if ($action eq 'quotas') { @@ -5824,7 +5803,7 @@ sub modify_quotas { @usertools = ('aboutme','blog','webdav','portfolio'); %titles = &tool_titles(); } - my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); + my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); foreach my $key (keys(%env)) { if ($context eq 'requestcourses') { @@ -6023,11 +6002,9 @@ sub modify_quotas { if (keys(%changes) > 0) { my $cachetime = 24*60*60; &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); - if (ref($lastactref) eq 'HASH') { - $lastactref->{'domdefaults'} = 1; - } + $resulttext = &mt('Changes made:').'
        '; - unless (($context eq 'requestcourses') || + unless (($context eq 'requestcourses') || ($context eq 'requestauthor')) { if (ref($changes{'defaultquota'}) eq 'HASH') { $resulttext .= '
      • '.&mt('Portfolio default quotas').'
          '; @@ -6037,7 +6014,7 @@ sub modify_quotas { if ($type eq 'default') { $typetitle = $othertitle; } - $resulttext .= '
        • '.&mt('[_1] set to [_2] MB',$typetitle,$confhash{'defaultquota'}{$type}).'
        • '; + $resulttext .= '
        • '.&mt('[_1] set to [_2] Mb',$typetitle,$confhash{'defaultquota'}{$type}).'
        • '; } } $resulttext .= '
      • '; @@ -6050,7 +6027,7 @@ sub modify_quotas { if ($type eq 'default') { $typetitle = $othertitle; } - $resulttext .= '
      • '.&mt('[_1] set to [_2] MB',$typetitle,$confhash{'authorquota'}{$type}).'
      • '; + $resulttext .= '
      • '.&mt('[_1] set to [_2] Mb',$typetitle,$confhash{'authorquota'}{$type}).'
      • '; } } $resulttext .= '
      '; @@ -6061,7 +6038,7 @@ sub modify_quotas { my (%haschgs,%inconf); if ($context eq 'requestauthor') { %haschgs = %changes; - %inconf = %confhash; + %inconf = %confhash; } else { if (ref($changes{$item}) eq 'HASH') { %haschgs = %{$changes{$item}}; @@ -6075,7 +6052,7 @@ sub modify_quotas { &Apache::lonnet::usertools_access($env{'user.name'}, $env{'user.domain'}, $item,'reload',$context); - if (($context eq 'requestcourses') || + if (($context eq 'requestcourses') || ($context eq 'requestauthor')) { if ($env{'environment.canrequest.'.$item} ne $newacc) { $newenv{'environment.canrequest.'.$item} = $newacc; @@ -6168,7 +6145,7 @@ sub modify_quotas { } sub modify_autoenroll { - my ($dom,$lastactref,%domconfig) = @_; + my ($dom,%domconfig) = @_; my ($resulttext,%changes); my %currautoenroll; if (ref($domconfig{'autoenroll'}) eq 'HASH') { @@ -6236,9 +6213,6 @@ sub modify_autoenroll { if ($changes{'coowners'}) { $resulttext .= '
    • '.&mt("$title{'coowners'} set to $offon[$env{'form.autoassign_coowners'}]").'
    • '; &Apache::loncommon::devalidate_domconfig_cache($dom); - if (ref($lastactref) eq 'HASH') { - $lastactref->{'domainconfig'} = 1; - } } $resulttext .= '
    '; } else { @@ -6644,7 +6618,7 @@ sub modify_directorysrch { } else { $chgtext =~ s/\; $//; } - $resulttext .= + $resulttext .= '
  • '. &mt("Users from domain '[_1]' permitted to search the institutional directory set to: [_2]", ''.$dom.'',$chgtext). @@ -6690,7 +6664,7 @@ sub modify_directorysrch { } sub modify_contacts { - my ($dom,$lastactref,%domconfig) = @_; + my ($dom,%domconfig) = @_; my ($resulttext,%currsetting,%newsetting,%changes,%contacts_hash); if (ref($domconfig{'contacts'}) eq 'HASH') { foreach my $key (keys(%{$domconfig{'contacts'}})) { @@ -6700,8 +6674,7 @@ sub modify_contacts { my (%others,%to,%bcc); my @contacts = ('supportemail','adminemail'); my @mailings = ('errormail','packagesmail','helpdeskmail','lonstatusmail', - 'requestsmail','updatesmail','idconflictsmail'); - my @toggles = ('reporterrors','reportupdates'); + 'requestsmail','updatesmail'); foreach my $type (@mailings) { @{$newsetting{$type}} = &Apache::loncommon::get_env_multiple('form.'.$type); @@ -6723,11 +6696,6 @@ sub modify_contacts { $to{$item} = $env{'form.'.$item}; $contacts_hash{'contacts'}{$item} = $to{$item}; } - foreach my $item (@toggles) { - if ($env{'form.'.$item} =~ /^(0|1)$/) { - $contacts_hash{'contacts'}{$item} = $env{'form.'.$item}; - } - } if (keys(%currsetting) > 0) { foreach my $item (@contacts) { if ($to{$item} ne $currsetting{$item}) { @@ -6766,7 +6734,7 @@ sub modify_contacts { foreach my $item (@contacts) { if ($to{$item} ne $default{$item}) { $changes{$item} = 1; - } + } } foreach my $type (@mailings) { if ((@{$newsetting{$type}} != 1) || ($newsetting{$type}[0] ne $default{$type})) { @@ -6783,22 +6751,10 @@ sub modify_contacts { } } } - foreach my $item (@toggles) { - if (($env{'form.'.$item} == 1) && ($currsetting{$item} == 0)) { - $changes{$item} = 1; - } elsif ((!$env{'form.'.$item}) && - (($currsetting{$item} eq '') || ($currsetting{$item} == 1))) { - $changes{$item} = 1; - } - } my $putresult = &Apache::lonnet::put_dom('configuration',\%contacts_hash, $dom); if ($putresult eq 'ok') { if (keys(%changes) > 0) { - &Apache::loncommon::devalidate_domconfig_cache($dom); - if (ref($lastactref) eq 'HASH') { - $lastactref->{'domainconfig'} = 1; - } my ($titles,$short_titles) = &contact_titles(); $resulttext = &mt('Changes made:').'
      '; foreach my $item (@contacts) { @@ -6829,23 +6785,6 @@ sub modify_contacts { $resulttext .= ''; } } - my @offon = ('off','on'); - if ($changes{'reporterrors'}) { - $resulttext .= '
    • '. - &mt('E-mail error reports to [_1] set to "'. - $offon[$env{'form.reporterrors'}].'".', - &Apache::loncommon::modal_link('http://loncapa.org/core.html', - &mt('LON-CAPA core group - MSU'),600,500)). - '
    • '; - } - if ($changes{'reportupdates'}) { - $resulttext .= '
    • '. - &mt('E-mail record of completed LON-CAPA updates to [_1] set to "'. - $offon[$env{'form.reportupdates'}].'".', - &Apache::loncommon::modal_link('http://loncapa.org/core.html', - &mt('LON-CAPA core group - MSU'),600,500)). - '
    • '; - } $resulttext .= '
    '; } else { $resulttext = &mt('No changes made to contact information'); @@ -6873,7 +6812,7 @@ sub modify_usercreation { foreach my $item(@contexts) { if ($item eq 'selfcreate') { @{$cancreate{$item}} = &Apache::loncommon::get_env_multiple('form.can_createuser_'.$item); - my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); + my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); if (!((($domdefaults{'auth_def'} =~/^krb/) && ($domdefaults{'auth_arg_def'} ne '')) || ($domdefaults{'auth_def'} eq 'localauth'))) { if (ref($cancreate{$item}) eq 'ARRAY') { if (grep(/^login$/,@{$cancreate{$item}})) { @@ -7146,7 +7085,7 @@ sub modify_usercreation { if ($captchas{$cancreate{$type}}) { $chgtext .= &mt("Validation for self-creation screen set to $captchas{$cancreate{$type}}."); } else { - $chgtext .= &mt('Validation for self-creation screen set to unknown type.'); + $chgtext .= &mt('Validation for self-creation screen set to unknown type.'); } } } elsif ($type eq 'recaptchakeys') { @@ -7274,7 +7213,7 @@ sub process_captcha { $newsettings->{'captcha'} = 'original'; } if ($current->{'captcha'} ne $newsettings->{'captcha'}) { - if ($container eq 'cancreate') { + if ($container eq 'cancreate') { if (ref($changes->{'cancreate'}) eq 'ARRAY') { push(@{$changes->{'cancreate'}},'captcha'); } elsif (!defined($changes->{'cancreate'})) { @@ -7313,7 +7252,7 @@ sub process_captcha { $changes->{'cancreate'} = ['recaptchakeys']; } } else { - $changes->{'recaptchakeys'} = 1; + $changes->{'recaptchakeys'} = 1; } } return; @@ -7440,9 +7379,9 @@ sub modify_usermodification { } sub modify_defaults { - my ($dom,$lastactref,%domconfig) = @_; + my ($dom,$r) = @_; my ($resulttext,$mailmsgtxt,%newvalues,%changes,@errors); - my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); + my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def','portal_def'); my @authtypes = ('internal','krb4','krb5','localauth'); foreach my $item (@items) { @@ -7502,7 +7441,7 @@ sub modify_defaults { if ($putresult eq 'ok') { if (keys(%changes) > 0) { $resulttext = &mt('Changes made:').'
      '; - my $version = &Apache::lonnet::get_server_loncaparev($dom); + my $version = $r->dir_config('lonVersion'); my $mailmsgtext = "Changes made to domain settings in a LON-CAPA installation - domain: $dom (running version: $version) - dns_domain.tab needs to be updated with the following changes, to support legacy 2.4, 2.5 and 2.6 versions of LON-CAPA.\n\n"; foreach my $item (sort(keys(%changes))) { my $value = $env{'form.'.$item}; @@ -7525,21 +7464,9 @@ sub modify_defaults { $mailmsgtext .= "\n"; my $cachetime = 24*60*60; &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); - if (ref($lastactref) eq 'HASH') { - $lastactref->{'domdefaults'} = 1; - } if ($changes{'auth_def'} || $changes{'auth_arg_def'} || $changes{'lang_def'} || $changes{'datelocale_def'}) { - my $notify = 1; - if (ref($domconfig{'contacts'}) eq 'HASH') { - if ($domconfig{'contacts'}{'reportupdates'} == 0) { - $notify = 0; - } - } - if ($notify) { - &Apache::lonmsg::sendemail('installrecord@loncapa.org', - "LON-CAPA Domain Settings Change - $dom", - $mailmsgtext); - } + my $sysmail = $r->dir_config('lonSysEMail'); + &Apache::lonmsg::sendemail($sysmail,"LON-CAPA Domain Settings Change - $dom",$mailmsgtext); } } else { $resulttext = &mt('No changes made to default authentication/language/timezone settings'); @@ -7559,7 +7486,7 @@ sub modify_defaults { } sub modify_scantron { - my ($r,$dom,$confname,$lastactref,%domconfig) = @_; + my ($r,$dom,$confname,%domconfig) = @_; my ($resulttext,%confhash,%changes,$errors); my $custom = 'custom.tab'; my $default = 'default.tab'; @@ -7620,9 +7547,6 @@ sub modify_scantron { } $resulttext .= '
    '; &Apache::loncommon::devalidate_domconfig_cache($dom); - if (ref($lastactref) eq 'HASH') { - $lastactref->{'domainconfig'} = 1; - } } else { $resulttext = &mt('No changes made to bubblesheet format file'); } @@ -8013,7 +7937,7 @@ sub modify_helpsettings { $changes{$item} = 1; } } - if (($env{'form.'.$item} eq '0') || ($env{'form.'.$item} eq '1')) { + if (($env{'form.'.$item} eq '0') || ($env{'form.'.$item} eq '1')) { $helphash{'helpsettings'}{$item} = $env{'form.'.$item}; } } @@ -8046,7 +7970,7 @@ sub modify_helpsettings { } sub modify_coursedefaults { - my ($dom,$lastactref,%domconfig) = @_; + my ($dom,%domconfig) = @_; my ($resulttext,$errors,%changes,%defaultshash); my %defaultchecked = ('canuse_pdfforms' => 'off'); my @toggles = ('canuse_pdfforms'); @@ -8087,7 +8011,7 @@ sub modify_coursedefaults { } foreach my $item (@numbers) { my ($currdef,$newdef); - $newdef = $env{'form.'.$item}; + my $newdef = $env{'form.'.$item}; if ($item eq 'anonsurvey_threshold') { $currdef = $domconfig{'coursedefaults'}{$item}; $newdef =~ s/\D//g; @@ -8137,9 +8061,10 @@ sub modify_coursedefaults { my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, $dom); if ($putresult eq 'ok') { + my %domdefaults; if (keys(%changes) > 0) { - my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); if (($changes{'canuse_pdfforms'}) || ($changes{'coursecredits'}) || ($changes{'uploadquota'})) { + %domdefaults = &Apache::lonnet::get_domain_defaults($dom); if ($changes{'canuse_pdfforms'}) { $domdefaults{'canuse_pdfforms'}=$defaultshash{'coursedefaults'}{'canuse_pdfforms'}; } @@ -8160,9 +8085,6 @@ sub modify_coursedefaults { } my $cachetime = 24*60*60; &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); - if (ref($lastactref) eq 'HASH') { - $lastactref->{'domdefaults'} = 1; - } } $resulttext = &mt('Changes made:').'
      '; foreach my $item (sort(keys(%changes))) { @@ -8214,7 +8136,7 @@ sub modify_coursedefaults { } sub modify_usersessions { - my ($dom,$lastactref,%domconfig) = @_; + my ($dom,%domconfig) = @_; my @hostingtypes = ('version','excludedomain','includedomain'); my @offloadtypes = ('primary','default'); my %types = ( @@ -8231,7 +8153,7 @@ sub modify_usersessions { foreach my $prefix (@prefixes) { $defaultshash{'usersessions'}{$prefix} = {}; } - my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1); + my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); my $resulttext; my %iphost = &Apache::lonnet::get_iphost(); foreach my $prefix (@prefixes) { @@ -8407,9 +8329,6 @@ sub modify_usersessions { } my $cachetime = 24*60*60; &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); - if (ref($lastactref) eq 'HASH') { - $lastactref->{'domdefaults'} = 1; - } if (keys(%changes) > 0) { my %lt = &usersession_titles(); $resulttext = &mt('Changes made:').'
        '; @@ -8421,8 +8340,7 @@ sub modify_usersessions { foreach my $lonhost (sort(keys(%{$changes{$prefix}}))) { $resulttext .= '
      • '.$lonhost.' '; my $lonhostdom = &Apache::lonnet::host_domain($lonhost); - my $cachekey = &escape('spares').':'.&escape($lonhostdom); - &Apache::lonnet::remote_devalidate_cache($lonhost,[$cachekey]); + &Apache::lonnet::remote_devalidate_cache($lonhost,'spares',$lonhostdom); if (ref($changes{$prefix}{$lonhost}) eq 'HASH') { foreach my $type (@{$types{$prefix}}) { if ($changes{$prefix}{$lonhost}{$type}) { @@ -8512,7 +8430,7 @@ sub modify_loadbalancing { if ($balancer eq '') { next; } - if (!exists($servers{$balancer})) { + if (!exists($servers{$balancer})) { if (exists($currbalancer{$balancer})) { push(@{$changes{'delete'}},$balancer); } @@ -8563,14 +8481,14 @@ sub modify_loadbalancing { } } else { if (ref($defaultshash{'loadbalancing'}{$balancer}) eq 'HASH') { - foreach my $sparetype (@sparestypes) { + foreach my $sparetype (@sparestypes) { if (ref($defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}) eq 'ARRAY') { if (@{$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}} > 0) { $changes{'curr'}{$balancer}{'targets'} = 1; } } } - } + } } my $ishomedom; if (&Apache::lonnet::host_domain($balancer) eq $dom) { @@ -8579,7 +8497,7 @@ sub modify_loadbalancing { if (ref($alltypes) eq 'ARRAY') { foreach my $type (@{$alltypes}) { my $rule; - unless ((($type eq '_LC_external') || ($type eq '_LC_internetdom')) && + unless ((($type eq '_LC_external') || ($type eq '_LC_internetdom')) && (!$ishomedom)) { $rule = $env{'form.loadbalancing_rules_'.$i.'_'.$type}; } @@ -8604,17 +8522,17 @@ sub modify_loadbalancing { } my $putresult = &Apache::lonnet::put_dom('configuration', \%defaultshash,$dom); + if ($putresult eq 'ok') { if (keys(%changes) > 0) { if (ref($changes{'delete'}) eq 'ARRAY') { foreach my $balancer (sort(@{$changes{'delete'}})) { $resulttext .= '
      • '.&mt('Load Balancing discontinued for: [_1]',$balancer).'
      • '; - my $cachekey = &escape('loadbalancing').':'.&escape($dom); - &Apache::lonnet::remote_devalidate_cache($balancer,[$cachekey]); + &Apache::lonnet::remote_devalidate_cache($balancer,'loadbalancing',$dom); } } if (ref($changes{'add'}) eq 'ARRAY') { - foreach my $balancer (sort(@{$changes{'add'}})) { + foreach my $balancer (sort(@{$changes{'add'}})) { $resulttext .= '
      • '.&mt('Load Balancing enabled for: [_1]',$balancer); } } @@ -8655,19 +8573,17 @@ sub modify_loadbalancing { my $balancetext; if ($rule eq '') { $balancetext = $ruletitles{'default'}; - } elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer') || - ($rule eq 'balancer') || ($rule eq 'offloadedto')) { + } elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer')) { $balancetext = $ruletitles{$rule}; } else { $balancetext = &mt('offload to [_1]',$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type}); } - $resulttext .= '
      • '.&mt('Load Balancer: [_1] -- balancing for [_2] set to - "[_3]"',$balancer,$titles->{$type},$balancetext).'
      • '; + $resulttext .= '
      • '.&mt('Load Balancer: [_1] -- balancing for [_2] set to - "[_3]"',$balancer,$titles->{$type},$balancetext).'
      • '; } } } } - my $cachekey = &scape('loadbalancing').':'.&escape($dom); - &Apache::lonnet::remote_devalidate_cache($balancer,[$cachekey]); + &Apache::lonnet::remote_devalidate_cache($balancer,'loadbalancing',$dom); } } if ($resulttext ne '') { @@ -8755,7 +8671,7 @@ sub active_dc_picker { } } @domcoord = sort(@domcoord); - my $numdcs = scalar(@domcoord); + my $numdcs = scalar(@domcoord); my $rows = 0; my $table; if ($numdcs > 1) { @@ -8889,7 +8805,7 @@ sub lonbalance_targets_js { } &get_loadbalancers_config($servers,\%existing,\%currbalancer, \%currtargets,\%currrules); - my $balancers = join("','",sort(keys(%currbalancer))); + my $balancers = join("','",sort(keys(%currbalancer))); return <<"END";