--- loncom/interface/domainprefs.pm 2013/04/08 23:01:51 1.194 +++ loncom/interface/domainprefs.pm 2013/09/29 06:53:35 1.210 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.194 2013/04/08 23:01:51 raeburn Exp $ +# $Id: domainprefs.pm,v 1.210 2013/09/29 06:53:35 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 @@ -94,7 +94,8 @@ about default quota sizes for portfolio institutional affiliation in the domain (e.g., Faculty, Staff, Student etc.), but is now also used to manage availability of user tools: i.e., blogs, aboutme page, and portfolios, and the course request tool, -used by course owners to request creation of a course. +used by course owners to request creation of a course, and to display/store +default quota sizes for authoring spaces. Outputs: 1 @@ -254,11 +255,11 @@ sub handler { col2 => 'Value'}], }, 'quotas' => - { text => 'Blogs, personal web pages, webDAV, portfolios', + { text => 'Blogs, personal web pages, webDAV/quotas, portfolios', help => 'Domain_Configuration_Quotas', header => [{col1 => 'User affiliation', col2 => 'Available tools', - col3 => 'Portfolio quota',}], + col3 => 'Quotas, Mb; (Authoring requires role)',}], }, 'autoenroll' => { text => 'Auto-enrollment settings', @@ -415,7 +416,11 @@ sub handler { my $confname = $dom.'-domainconfig'; if ($phase eq 'process') { - &Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,\@roles); + if (&Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order, + \%prefs,\%domconfig,$confname,\@roles) eq 'update') { + $r->rflush(); + &devalidate_remote_domconfs($dom); + } } elsif ($phase eq 'display') { my $js = &recaptcha_js(). &credits_js(); @@ -437,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) { @@ -497,21 +502,21 @@ sub handler { } sub process_changes { - my ($r,$dom,$confname,$action,$roles,$values) = @_; + my ($r,$dom,$confname,$action,$roles,$values,$lastactref) = @_; my %domconfig; if (ref($values) eq 'HASH') { %domconfig = %{$values}; } my $output; if ($action eq 'login') { - $output = &modify_login($r,$dom,$confname,%domconfig); + $output = &modify_login($r,$dom,$confname,$lastactref,%domconfig); } elsif ($action eq 'rolecolors') { $output = &modify_rolecolors($r,$dom,$confname,$roles, - %domconfig); + $lastactref,%domconfig); } elsif ($action eq 'quotas') { $output = &modify_quotas($dom,$action,%domconfig); } elsif ($action eq 'autoenroll') { - $output = &modify_autoenroll($dom,%domconfig); + $output = &modify_autoenroll($dom,$lastactref,%domconfig); } elsif ($action eq 'autoupdate') { $output = &modify_autoupdate($dom,%domconfig); } elsif ($action eq 'autocreate') { @@ -523,11 +528,11 @@ sub process_changes { } elsif ($action eq 'usermodification') { $output = &modify_usermodification($dom,%domconfig); } elsif ($action eq 'contacts') { - $output = &modify_contacts($dom,%domconfig); + $output = &modify_contacts($dom,$lastactref,%domconfig); } elsif ($action eq 'defaults') { - $output = &modify_defaults($dom,$r); + $output = &modify_defaults($dom,$r,%domconfig); } elsif ($action eq 'scantron') { - $output = &modify_scantron($r,$dom,$confname,%domconfig); + $output = &modify_scantron($r,$dom,$confname,$lastactref,%domconfig); } elsif ($action eq 'coursecategories') { $output = &modify_coursecategories($dom,%domconfig); } elsif ($action eq 'serverstatuses') { @@ -570,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"'; } @@ -1141,17 +1146,7 @@ sub print_rolecolors { my %designhash = &Apache::loncommon::get_domainconf($dom); my %defaultdesign = %Apache::loncommon::defaultdesign; my (%is_custom,%designs); - my %defaults = ( - img => $defaultdesign{$role.'.img'}, - font => $defaultdesign{$role.'.font'}, - fontmenu => $defaultdesign{$role.'.fontmenu'}, - ); - foreach my $item (@bgs) { - $defaults{'bgs'}{$item} = $defaultdesign{$role.'.'.$item}; - } - foreach my $item (@links) { - $defaults{'links'}{$item} = $defaultdesign{$role.'.'.$item}; - } + my %defaults = &role_defaults($role,\@bgs,\@links,\@images); if (ref($settings) eq 'HASH') { if (ref($settings->{$role}) eq 'HASH') { if ($settings->{$role}->{'img'} ne '') { @@ -1212,6 +1207,44 @@ sub print_rolecolors { return $datatable; } +sub role_defaults { + my ($role,$bgs,$links,$images,$logintext) = @_; + my %defaults; + unless ((ref($bgs) eq 'ARRAY') && (ref($links) eq 'ARRAY') && (ref($images) eq 'ARRAY')) { + return %defaults; + } + my %defaultdesign = %Apache::loncommon::defaultdesign; + if ($role eq 'login') { + %defaults = ( + font => $defaultdesign{$role.'.font'}, + ); + if (ref($logintext) eq 'ARRAY') { + foreach my $item (@{$logintext}) { + $defaults{'logintext'}{$item} = $defaultdesign{$role.'.'.$item}; + } + } + foreach my $item (@{$images}) { + $defaults{'showlogo'}{$item} = 1; + } + } else { + %defaults = ( + img => $defaultdesign{$role.'.img'}, + font => $defaultdesign{$role.'.font'}, + fontmenu => $defaultdesign{$role.'.fontmenu'}, + ); + } + foreach my $item (@{$bgs}) { + $defaults{'bgs'}{$item} = $defaultdesign{$role.'.'.$item}; + } + foreach my $item (@{$links}) { + $defaults{'links'}{$item} = $defaultdesign{$role.'.'.$item}; + } + foreach my $item (@{$images}) { + $defaults{$item} = $defaultdesign{$role.'.'.$item}; + } + return %defaults; +} + sub display_color_options { my ($dom,$confname,$phase,$role,$itemcount,$choices,$is_custom,$defaults,$designs, $images,$bgs,$links,$alt_text,$rowtotal,$logintext) = @_; @@ -1228,7 +1261,7 @@ sub display_color_options { $datatable .= ''. ' '. + ' value="'.$current_color.'" /> '. ' '; unless ($role eq 'login') { $datatable .= ''. @@ -1238,7 +1271,7 @@ sub display_color_options { } else { $datatable .= ' '; } - $current_color = $designs->{'fontmenu'} ? + $current_color = $designs->{'fontmenu'} ? $designs->{'fontmenu'} : $defaults->{'fontmenu'}; $datatable .= ''. '
'. - &mt('Upload:'); + $datatable .= ' '. + &mt('Upload:').'
'; } } else { - $datatable .= '
'. - &mt('Upload:'); + $datatable .= ' '. + &mt('Upload:').'
'; } if ($switchserver) { $datatable .= &mt('Upload to library server: [_1]',$switchserver); @@ -1373,7 +1406,7 @@ sub display_color_options { ''; foreach my $item (@{$bgs}) { - $datatable .= '
'; + $datatable .= ''.$choices->{$item}; my $color = $designs->{'bgs'}{$item} ? $designs->{'bgs'}{$item} : $defaults->{'bgs'}{$item}; if ($designs->{'bgs'}{$item}) { $datatable .= ' '; @@ -1401,8 +1434,7 @@ sub display_color_options { ''; foreach my $item (@{$links}) { my $color = $designs->{'link'}{$item} ? $designs->{'link'}{$item} : $defaults->{'links'}{$item}; - $datatable .= ''; + '" size="5" />'.(' ' x 2). + ''.&mt('Authoring').': '. + ''; } $datatable .= ''; } @@ -1676,12 +1704,16 @@ sub print_quotas { } unless (($context eq 'requestcourses') || ($context eq 'requestauthor')) { $defaultquota = '20'; + $authorquota = '500'; if (ref($settings) eq 'HASH') { if (ref($settings->{'defaultquota'}) eq 'HASH') { $defaultquota = $settings->{'defaultquota'}->{'default'}; } elsif (defined($settings->{'default'})) { $defaultquota = $settings->{'default'}; } + if (ref($settings->{'authorquota'}) eq 'HASH') { + $authorquota = $settings->{'authorquota'}->{'default'}; + } } } $typecount ++; @@ -1792,15 +1824,19 @@ sub print_quotas { } $datatable .= ''; unless (($context eq 'requestcourses') || ($context eq 'requestauthor')) { - $datatable .= ''; + $defaultquota.'" size="5" />'.(' ' x2). + ''.&mt('Authoring').': '. + ''; } $datatable .= ''; $typecount ++; $css_class = $typecount%2?' class="LC_odd_row"':''; $datatable .= ''. - ''. @@ -1927,7 +1963,7 @@ sub print_quotas { sub print_requestmail { my ($dom,$action,$settings,$rowtotal) = @_; - my ($now,$datatable,%currapp,$rows); + my ($now,$datatable,%currapp); $now = time; if (ref($settings) eq 'HASH') { if (ref($settings->{'notify'}) eq 'HASH') { @@ -2120,7 +2156,7 @@ sub print_autocreate { } } } - if ($settings->{'xmldc'} ne '') { + if ($settings->{'xmldc'} ne '') { $currhash{$settings->{'xmldc'}} = 1; } } else { @@ -2277,7 +2313,7 @@ sub print_contacts { my @contacts = ('adminemail','supportemail'); my (%checked,%to,%otheremails,%bccemails); my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail', - 'requestsmail','updatesmail'); + 'requestsmail','updatesmail','idconflictsmail'); foreach my $type (@mailings) { $otheremails{$type} = ''; } @@ -2314,21 +2350,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 .= ''. ''; + $rownum ++; } foreach my $type (@mailings) { - $rownum ++; $css_class = $rownum%2?' class="LC_odd_row"':''; $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; } @@ -2428,9 +2478,14 @@ sub print_coursedefaults { my $itemcount = 1; my %choices = &Apache::lonlocal::texthash ( canuse_pdfforms => 'Course/Community users can create/upload PDF forms', + uploadquota => 'Default quota for files uploaded directly to course/community using Course Editor (MB)', anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys', coursecredits => 'Credits can be specified for courses', ); + my %staticdefaults = ( + anonsurvey_threshold => 10, + uploadquota => 500, + ); if ($position eq 'top') { %defaultchecked = ('canuse_pdfforms' => 'off'); @toggles = ('canuse_pdfforms'); @@ -2438,10 +2493,16 @@ sub print_coursedefaults { \%choices,$itemcount); } else { $css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; - my ($currdefresponder,$def_official_credits,$def_unofficial_credits); + my ($currdefresponder,$def_official_credits,$def_unofficial_credits,%curruploadquota); my $currusecredits = 0; + my @types = ('official','unofficial','community'); if (ref($settings) eq 'HASH') { $currdefresponder = $settings->{'anonsurvey_threshold'}; + if (ref($settings->{'uploadquota'}) eq 'HASH') { + foreach my $type (keys(%{$settings->{'uploadquota'}})) { + $curruploadquota{$type} = $settings->{'uploadquota'}{$type}; + } + } if (ref($settings->{'coursecredits'}) eq 'HASH') { $def_official_credits = $settings->{'coursecredits'}->{'official'}; $def_unofficial_credits = $settings->{'coursecredits'}->{'unofficial'}; @@ -2451,10 +2512,15 @@ sub print_coursedefaults { } } if (!$currdefresponder) { - $currdefresponder = 10; + $currdefresponder = $staticdefaults{'anonsurvey_threshold'}; } elsif ($currdefresponder < 1) { $currdefresponder = 1; } + foreach my $type (@types) { + if ($curruploadquota{$type} eq '') { + $curruploadquota{$type} = $staticdefaults{'uploadquota'}; + } + } $datatable .= ''."\n"; - $itemcount ++; + ''."\n". + ''. + ''."\n"; + $itemcount += 2; my $onclick = 'toggleCredits(this.form);'; - my $display = 'none'; + my $display = 'none'; if ($currusecredits) { $display = 'block'; } @@ -2920,7 +2997,7 @@ sub print_loadbalancing { } my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); - my $rownum = 6; + my $rownum = 8; if (ref($types) eq 'ARRAY') { $rownum += scalar(@{$types}); } @@ -2951,7 +3028,7 @@ sub print_loadbalancing { ''; @@ -3090,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}) { @@ -3099,7 +3176,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 = ''; } @@ -3120,8 +3197,10 @@ 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'); + my @alltypes = ('_LC_adv','_LC_author','_LC_internetdom','_LC_external','_LC_ipchangesso','_LC_ipchange'); if (ref($types) eq 'ARRAY') { unshift(@alltypes,@{$types},'default'); } @@ -3146,23 +3225,28 @@ 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 = ('default','homeserver'); + my @rulenames; my %ruletitles = &offloadtype_text(); - if ($type eq '_LC_external') { - push(@rulenames,'externalbalancer'); + if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) { + @rulenames = ('balancer','offloadedto'); } else { - push(@rulenames,'specific'); + @rulenames = ('default','homeserver'); + if ($type eq '_LC_external') { + push(@rulenames,'externalbalancer'); + } else { + push(@rulenames,'specific'); + } + push(@rulenames,'none'); } - 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; if ($islast && $num == 1) { $space = '
 
'; } - my $output = + my $output = ''."\n". ''."\n". ''. + $link. + ''. '
'."\n"; - + $datatable .= ''.$choices->{$item}."\n"; if ($designs->{'links'}{$item}) { $datatable.=' '; } @@ -1460,17 +1492,13 @@ sub login_header_options { } sub login_text_colors { - my ($img,$role,$logintext,$phase,$choices,$designs) = @_; + my ($img,$role,$logintext,$phase,$choices,$designs,$defaults) = @_; my $color_menu = ''; foreach my $item (@{$logintext}) { - my $link = &color_pick($phase,$role,$item,$choices->{$item},$designs->{'logintext'}{$item}); - $color_menu .= ''. - ''; + $color_menu .= ''; } $color_menu .= '
'.$link; - if ($designs->{'logintext'}{$item}) { - $color_menu .= '    '; - } - $color_menu .= '
 '.$choices->{$item}; + my $color = $designs->{'logintext'}{$item} ? $designs->{'logintext'}{$item} : $defaults->{'logintext'}{$item}; + $color_menu .= '

'; return $color_menu; @@ -1502,20 +1530,12 @@ sub image_changes { $role.'_del_'.$img.'" value="1" />'.&mt('Delete?'). ' '.&mt('Replace:').'
'; } else { - $output .= '
'.$logincolors.&mt('Upload:').'
'; + $output .= '
'.$logincolors.&mt('Upload:').'
'; } } return $output; } -sub color_pick { - my ($phase,$role,$item,$desc,$curcol) = @_; - my $link = ''.$desc.''; - return $link; -} - sub print_quotas { my ($dom,$settings,$rowtotal,$action) = @_; my $context; @@ -1524,7 +1544,7 @@ sub print_quotas { } else { $context = $action; } - my ($datatable,$defaultquota,@usertools,@options,%validations); + my ($datatable,$defaultquota,$authorquota,@usertools,@options,%validations); my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); my $typecount = 0; my ($css_class,%titles); @@ -1536,22 +1556,25 @@ 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(); } if (ref($types) eq 'ARRAY') { foreach my $type (@{$types}) { - my $currdefquota; + my ($currdefquota,$currauthorquota); unless (($context eq 'requestcourses') || ($context eq 'requestauthor')) { if (ref($settings) eq 'HASH') { if (ref($settings->{defaultquota}) eq 'HASH') { - $currdefquota = $settings->{defaultquota}->{$type}; + $currdefquota = $settings->{defaultquota}->{$type}; } else { $currdefquota = $settings->{$type}; } + if (ref($settings->{authorquota}) eq 'HASH') { + $currauthorquota = $settings->{authorquota}->{$type}; + } } } if (defined($usertypes->{$type})) { @@ -1665,10 +1688,15 @@ sub print_quotas { unless (($context eq 'requestcourses') || ($context eq 'requestauthor')) { $datatable .= - '
'. + ''. + ''.&mt('Portfolio').': '. ' Mb
'. + $datatable .= ''. + ''.&mt('Portfolio').': '. ' Mb
'.&mt('LON-CAPA Advanced Users').' '; + ''.&mt('LON-CAPA Advanced Users').'
'; if ($context eq 'requestcourses') { $datatable .= &mt('(overrides affiliation, if set)'). '
'.$titles->{$item}. ''. '
'. @@ -2351,7 +2387,21 @@ sub print_contacts { 'value="'.$bccemails{$type}.'" />'; } $datatable .= '
'. $choices{'anonsurvey_threshold'}. @@ -2462,10 +2528,21 @@ sub print_coursedefaults { ''. ''. - '
'. + $choices{'uploadquota'}. + ''. + ''; + foreach my $type (@types) { + $datatable .= ''; + } + $datatable .= '
'.&mt($type).'
'. + '
'. '

'; if ($lonhost eq '') { - $datatable .= ''; + $datatable .= ''; if (keys(%currbalancer) > 0) { $datatable .= &mt('Add balancer:'); } else { @@ -2967,7 +3044,7 @@ sub print_loadbalancing { next if ($currbalancer{$server}); $datatable .= ''."\n"; } - $datatable .= + $datatable .= ''."\n". ' '."\n"; } else { @@ -3006,7 +3083,7 @@ sub print_loadbalancing { if (exists($currbalancer{$spares[$i]})) { $disabled = ' disabled="disabled"'; } - $targettable .= + $targettable .= '

'.$space. '
'.$title.'
'.$space. @@ -3182,7 +3266,7 @@ sub loadbalance_rule_row { unless ($checked) { $default = ' selected="selected"'; } - $extra = + $extra = ': 
'."\n". ''.$pubtext.' '."\n". @@ -3876,8 +3963,8 @@ sub print_scantronformat { $datatable .= ''.&mt('Default in use:').'
'. ''; if ($scantronurl) { - $datatable .= ''. - &mt('Default bubblesheet format file').''; + $datatable .= &Apache::loncommon::modal_link($scantronurl,&mt('Default bubblesheet format file'),600,500, + undef,undef,undef,undef,'background-color:#ffffff'); } else { $datatable = &mt('File unavailable for display'); } @@ -3902,11 +3989,12 @@ sub print_scantronformat { } $datatable .= '
'.$errorstr.' '; } elsif ($scantronurl) { + my $link = &Apache::loncommon::modal_link($scantronurl,&mt('Custom bubblesheet format file'),600,500, + undef,undef,undef,undef,'background-color:#ffffff'); $datatable .= ''. - ''. - &mt('Custom bubblesheet format file').' '. &mt('Replace:').'
'; } @@ -4362,7 +4450,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) { @@ -4654,7 +4742,7 @@ sub usertype_update_row { } sub modify_login { - my ($r,$dom,$confname,%domconfig) = @_; + my ($r,$dom,$confname,$lastactref,%domconfig) = @_; my ($resulttext,$errors,$colchgtext,%changes,%colchanges,%newfile,%newurl, %curr_loginvia,%loginhash,@currlangs,@newlangs,$addedfile,%title,@offon); %title = ( coursecatalog => 'Display course catalog', @@ -4834,7 +4922,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}; @@ -4892,6 +4980,7 @@ sub modify_login { } if (keys(%changes) > 0 || $colchgtext) { &Apache::loncommon::devalidate_domconfig_cache($dom); + $$lastactref = 'update'; $resulttext = &mt('Changes made:').'
      '; foreach my $item (sort(keys(%changes))) { if ($item eq 'loginvia') { @@ -4951,7 +5040,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 { @@ -5012,7 +5101,7 @@ sub color_font_choices { links => "Link colors", images => "Images", font => "Font color", - fontmenu => "Font Menu", + fontmenu => "Font menu", pgbg => "Page", tabbg => "Header", sidebg => "Border", @@ -5024,7 +5113,7 @@ sub color_font_choices { } sub modify_rolecolors { - my ($r,$dom,$confname,$roles,%domconfig) = @_; + my ($r,$dom,$confname,$roles,$lastactref,%domconfig) = @_; my ($resulttext,%rolehash); $rolehash{'rolecolors'} = {}; if (ref($domconfig{'rolecolors'}) ne 'HASH') { @@ -5039,6 +5128,7 @@ sub modify_rolecolors { if ($putresult eq 'ok') { if (keys(%changes) > 0) { &Apache::loncommon::devalidate_domconfig_cache($dom); + $$lastactref = 'update'; $resulttext = &display_colorchgs($dom,\%changes,$roles, $rolehash{'rolecolors'}); } else { @@ -5064,24 +5154,45 @@ sub modify_colors { my @images; my $servadm = $r->dir_config('lonAdmEMail'); my $errors; + my %defaults; foreach my $role (@{$roles}) { if ($role eq 'login') { %choices = &login_choices(); @logintext = ('textcol','bgcol'); } else { %choices = &color_font_choices(); - $confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'}; } if ($role eq 'login') { @images = ('img','logo','domlogo','login'); @bgs = ('pgbg','mainbg','sidebg'); } else { @images = ('img'); - @bgs = ('pgbg','tabbg','sidebg'); + @bgs = ('pgbg','tabbg','sidebg'); + } + my %defaults = &role_defaults($role,\@bgs,\@links,\@images,\@logintext); + unless ($env{'form.'.$role.'_font'} eq $defaults{'font'}) { + $confhash->{$role}{'font'} = $env{'form.'.$role.'_font'}; + } + if ($role eq 'login') { + foreach my $item (@logintext) { + unless ($env{'form.'.$role.'_'.$item} eq $defaults{'logintext'}{$item}) { + $confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; + } + } + } else { + unless($env{'form.'.$role.'_fontmenu'} eq $defaults{'fontmenu'}) { + $confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'}; + } + } + foreach my $item (@bgs) { + unless ($env{'form.'.$role.'_'.$item} eq $defaults{'bgs'}{$item} ) { + $confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; + } } - $confhash->{$role}{'font'} = $env{'form.'.$role.'_font'}; - foreach my $item (@bgs,@links,@logintext) { - $confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; + foreach my $item (@links) { + unless ($env{'form.'.$role.'_'.$item} eq $defaults{'links'}{$item}) { + $confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item}; + } } my ($configuserok,$author_ok,$switchserver) = &config_check($dom,$confname,$servadm); @@ -5429,7 +5540,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); @@ -5449,19 +5560,19 @@ sub publishlogo { if ($file=~/\.(\w+)$/ && (&Apache::loncommon::fileembstyle($1) eq 'hdn')) { $output = - &mt('Invalid file extension ([_1]) - reserved for LONCAPA use.',$1); + &mt('Invalid file extension ([_1]) - reserved for internal 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); } elsif ($file=~/\.(\d+)\.(\w+)$/) { - $output = &mt('File name not allowed - rename the file to remove the number immediately before the file extension([_1]) and re-upload.',$2); + $output = &mt('Filename not allowed - rename the file to remove the number immediately before the file extension([_1]) and re-upload.',$2); } elsif (-d "$filepath/$file") { - $output = &mt('File name is a directory name - rename the file and re-upload'); + $output = &mt('Filename is a directory name - rename the file and re-upload'); } else { my $source = $filepath.'/'.$file; my $logfile; if (!open($logfile,">>$source".'.log')) { - return (&mt('No write permission to Construction Space')); + return (&mt('No write permission to Authoring Space')); } print $logfile "\n================= Publish ".localtime()." ================\n". @@ -5740,8 +5851,9 @@ sub modify_quotas { } else { if ($key =~ /^form\.quota_(.+)$/) { $confhash{'defaultquota'}{$1} = $env{$key}; - } - if ($key =~ /^form\.\Q$context\E_(.+)$/) { + } elsif ($key =~ /^form\.authorquota_(.+)$/) { + $confhash{'authorquota'}{$1} = $env{$key}; + } elsif ($key =~ /^form\.\Q$context\E_(.+)$/) { @{$toolshash{$1}} = &Apache::loncommon::get_env_multiple($key); } } @@ -5767,6 +5879,7 @@ sub modify_quotas { } } else { $confhash{'defaultquota'}{'default'} = $env{'form.defaultquota'}; + $confhash{'authorquota'}{'default'} = $env{'form.authorquota'}; } foreach my $item (@usertools) { foreach my $type (@{$types},'default','_LC_adv') { @@ -5854,6 +5967,17 @@ sub modify_quotas { } } } + if (ref($domconfig{'quotas'}{'authorquota'}) eq 'HASH') { + foreach my $key (keys(%{$domconfig{'quotas'}{'authorquota'}})) { + if (exists($confhash{'authorquota'}{$key})) { + if ($confhash{'authorquota'}{$key} ne $domconfig{'quotas'}{'authorquota'}{$key}) { + $changes{'authorquota'}{$key} = 1; + } + } else { + $confhash{'authorquota'}{$key} = $domconfig{'quotas'}{'authorquota'}{$key}; + } + } + } } if (ref($confhash{'defaultquota'}) eq 'HASH') { foreach my $key (keys(%{$confhash{'defaultquota'}})) { @@ -5872,6 +5996,21 @@ sub modify_quotas { } } } + if (ref($confhash{'authorquota'}) eq 'HASH') { + foreach my $key (keys(%{$confhash{'authorquota'}})) { + if (ref($domconfig{'quotas'}) eq 'HASH') { + if (ref($domconfig{'quotas'}{'authorquota'}) eq 'HASH') { + if (!exists($domconfig{'quotas'}{'authorquota'}{$key})) { + $changes{'authorquota'}{$key} = 1; + } + } else { + $changes{'authorquota'}{$key} = 1; + } + } else { + $changes{'authorquota'}{$key} = 1; + } + } + } } if ($context eq 'requestauthor') { @@ -5893,7 +6032,7 @@ sub modify_quotas { &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); $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').'
          '; @@ -5908,13 +6047,26 @@ sub modify_quotas { } $resulttext .= '
      • '; } + if (ref($changes{'authorquota'}) eq 'HASH') { + $resulttext .= '
      • '.&mt('Authoring space default quotas').'
          '; + foreach my $type (@{$types},'default') { + if (defined($changes{'authorquota'}{$type})) { + my $typetitle = $usertypes->{$type}; + if ($type eq 'default') { + $typetitle = $othertitle; + } + $resulttext .= '
        • '.&mt('[_1] set to [_2] Mb',$typetitle,$confhash{'authorquota'}{$type}).'
        • '; + } + } + $resulttext .= '
      • '; + } } my %newenv; foreach my $item (@usertools) { my (%haschgs,%inconf); if ($context eq 'requestauthor') { %haschgs = %changes; - %inconf = %confhash; + %inconf = %confhash; } else { if (ref($changes{$item}) eq 'HASH') { %haschgs = %{$changes{$item}}; @@ -5928,7 +6080,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; @@ -6021,7 +6173,7 @@ sub modify_quotas { } sub modify_autoenroll { - my ($dom,%domconfig) = @_; + my ($dom,$lastactref,%domconfig) = @_; my ($resulttext,%changes); my %currautoenroll; if (ref($domconfig{'autoenroll'}) eq 'HASH') { @@ -6089,6 +6241,7 @@ sub modify_autoenroll { if ($changes{'coowners'}) { $resulttext .= '
      • '.&mt("$title{'coowners'} set to $offon[$env{'form.autoassign_coowners'}]").'
      • '; &Apache::loncommon::devalidate_domconfig_cache($dom); + $$lastactref = 'update'; } $resulttext .= '
      '; } else { @@ -6494,7 +6647,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). @@ -6540,7 +6693,7 @@ sub modify_directorysrch { } sub modify_contacts { - my ($dom,%domconfig) = @_; + my ($dom,$lastactref,%domconfig) = @_; my ($resulttext,%currsetting,%newsetting,%changes,%contacts_hash); if (ref($domconfig{'contacts'}) eq 'HASH') { foreach my $key (keys(%{$domconfig{'contacts'}})) { @@ -6550,7 +6703,8 @@ sub modify_contacts { my (%others,%to,%bcc); my @contacts = ('supportemail','adminemail'); my @mailings = ('errormail','packagesmail','helpdeskmail','lonstatusmail', - 'requestsmail','updatesmail'); + 'requestsmail','updatesmail','idconflictsmail'); + my @toggles = ('reporterrors','reportupdates'); foreach my $type (@mailings) { @{$newsetting{$type}} = &Apache::loncommon::get_env_multiple('form.'.$type); @@ -6572,6 +6726,11 @@ 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}) { @@ -6610,7 +6769,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})) { @@ -6627,10 +6786,20 @@ 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); + $$lastactref = 'update'; my ($titles,$short_titles) = &contact_titles(); $resulttext = &mt('Changes made:').'
        '; foreach my $item (@contacts) { @@ -6661,6 +6830,23 @@ 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'); @@ -6961,7 +7147,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') { @@ -7089,7 +7275,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'})) { @@ -7128,7 +7314,7 @@ sub process_captcha { $changes->{'cancreate'} = ['recaptchakeys']; } } else { - $changes->{'recaptchakeys'} = 1; + $changes->{'recaptchakeys'} = 1; } } return; @@ -7255,7 +7441,7 @@ sub modify_usermodification { } sub modify_defaults { - my ($dom,$r) = @_; + my ($dom,$r,%domconfig) = @_; my ($resulttext,$mailmsgtxt,%newvalues,%changes,@errors); my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); my @items = ('auth_def','auth_arg_def','lang_def','timezone_def','datelocale_def','portal_def'); @@ -7341,8 +7527,17 @@ sub modify_defaults { my $cachetime = 24*60*60; &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); if ($changes{'auth_def'} || $changes{'auth_arg_def'} || $changes{'lang_def'} || $changes{'datelocale_def'}) { - my $sysmail = $r->dir_config('lonSysEMail'); - &Apache::lonmsg::sendemail($sysmail,"LON-CAPA Domain Settings Change - $dom",$mailmsgtext); + 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); + } } } else { $resulttext = &mt('No changes made to default authentication/language/timezone settings'); @@ -7362,7 +7557,7 @@ sub modify_defaults { } sub modify_scantron { - my ($r,$dom,$confname,%domconfig) = @_; + my ($r,$dom,$confname,$lastactref,%domconfig) = @_; my ($resulttext,%confhash,%changes,$errors); my $custom = 'custom.tab'; my $default = 'default.tab'; @@ -7423,6 +7618,7 @@ sub modify_scantron { } $resulttext .= '
    '; &Apache::loncommon::devalidate_domconfig_cache($dom); + $$lastactref = 'update'; } else { $resulttext = &mt('No changes made to bubblesheet format file'); } @@ -7813,7 +8009,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}; } } @@ -7850,6 +8046,13 @@ sub modify_coursedefaults { my ($resulttext,$errors,%changes,%defaultshash); my %defaultchecked = ('canuse_pdfforms' => 'off'); my @toggles = ('canuse_pdfforms'); + my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial', + 'uploadquota_community'); + my @types = ('official','unofficial','community'); + my %staticdefaults = ( + anonsurvey_threshold => 10, + uploadquota => 500, + ); $defaultshash{'coursedefaults'} = {}; @@ -7878,16 +8081,35 @@ sub modify_coursedefaults { } $defaultshash{'coursedefaults'}{$item} = $env{'form.'.$item}; } - my $currdefresponder = $domconfig{'coursedefaults'}{'anonsurvey_threshold'}; - my $newdefresponder = $env{'form.anonsurvey_threshold'}; - $newdefresponder =~ s/\D//g; - if ($newdefresponder eq '' || $newdefresponder < 1) { - $newdefresponder = 1; - } - $defaultshash{'coursedefaults'}{'anonsurvey_threshold'} = $newdefresponder; - if ($currdefresponder ne $newdefresponder) { - unless ($currdefresponder eq '' && $newdefresponder == 10) { - $changes{'anonsurvey_threshold'} = 1; + foreach my $item (@numbers) { + my ($currdef,$newdef); + $newdef = $env{'form.'.$item}; + if ($item eq 'anonsurvey_threshold') { + $currdef = $domconfig{'coursedefaults'}{$item}; + $newdef =~ s/\D//g; + if ($newdef eq '' || $newdef < 1) { + $newdef = 1; + } + $defaultshash{'coursedefaults'}{$item} = $newdef; + } else { + my ($type) = ($item =~ /^\Quploadquota_\E(\w+)$/); + if (ref($domconfig{'coursedefaults'}{'uploadquota'}) eq 'HASH') { + $currdef = $domconfig{'coursedefaults'}{'uploadquota'}{$type}; + } + $newdef =~ s/[^\w.\-]//g; + $defaultshash{'coursedefaults'}{'uploadquota'}{$type} = $newdef; + } + if ($currdef ne $newdef) { + my $staticdef; + if ($item eq 'anonsurvey_threshold') { + unless (($currdef eq '') && ($newdef == $staticdefaults{$item})) { + $changes{$item} = 1; + } + } else { + unless (($currdef eq '') && ($newdef == $staticdefaults{'uploadquota'})) { + $changes{'uploadquota'} = 1; + } + } } } my $officialcreds = $env{'form.official_credits'}; @@ -7913,7 +8135,7 @@ sub modify_coursedefaults { if ($putresult eq 'ok') { my %domdefaults; if (keys(%changes) > 0) { - if (($changes{'canuse_pdfforms'}) || ($changes{'coursecredits'})) { + 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'}; @@ -7926,6 +8148,13 @@ sub modify_coursedefaults { $defaultshash{'coursedefaults'}{'coursecredits'}{'unofficial'}; } } + if ($changes{'uploadquota'}) { + if (ref($defaultshash{'coursedefaults'}{'uploadquota'}) eq 'HASH') { + foreach my $type (@types) { + $domdefaults{$type.'quota'}=$defaultshash{'coursedefaults'}{'uploadquota'}{$type}; + } + } + } my $cachetime = 24*60*60; &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); } @@ -7939,6 +8168,17 @@ sub modify_coursedefaults { } } elsif ($item eq 'anonsurvey_threshold') { $resulttext .= '
  • '.&mt('Responder count required for display of anonymous survey submissions set to [_1].',$defaultshash{'coursedefaults'}{'anonsurvey_threshold'}).'
  • '; + } elsif ($item eq 'uploadquota') { + if (ref($defaultshash{'coursedefaults'}{'uploadquota'}) eq 'HASH') { + $resulttext .= '
  • '.&mt('Default quota for content uploaded to a course/community via Course Editor set as follows:').'
      '. + '
    • '.&mt('Official courses: [_1] MB',''.$defaultshash{'coursedefaults'}{'uploadquota'}{'official'}.'').'
    • '. + '
    • '.&mt('Unofficial courses: [_1] MB',''.$defaultshash{'coursedefaults'}{'uploadquota'}{'unofficial'}.'').'
    • '. + '
    • '.&mt('Communities: [_1] MB',''.$defaultshash{'coursedefaults'}{'uploadquota'}{'community'}.'').'
    • '. + '
    '. + '
  • '; + } else { + $resulttext .= '
  • '.&mt('Default quota for content uploaded via Course Editor remains default: [_1] MB',$staticdefaults{'uploadquota'}).'
  • '; + } } elsif ($item eq 'coursecredits') { if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') { if (($domdefaults{'officialcredits'} eq '') && @@ -8262,7 +8502,7 @@ sub modify_loadbalancing { if ($balancer eq '') { next; } - if (!exists($servers{$balancer})) { + if (!exists($servers{$balancer})) { if (exists($currbalancer{$balancer})) { push(@{$changes{'delete'}},$balancer); } @@ -8313,14 +8553,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) { @@ -8329,7 +8569,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}; } @@ -8354,7 +8594,6 @@ 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') { @@ -8364,7 +8603,7 @@ sub modify_loadbalancing { } } 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); } } @@ -8405,12 +8644,13 @@ sub modify_loadbalancing { my $balancetext; if ($rule eq '') { $balancetext = $ruletitles{'default'}; - } elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer')) { + } elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer') || + ($rule eq 'balancer') || ($rule eq 'offloadedto')) { $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).'
  • '; } } } @@ -8503,7 +8743,7 @@ sub active_dc_picker { } } @domcoord = sort(@domcoord); - my $numdcs = scalar(@domcoord); + my $numdcs = scalar(@domcoord); my $rows = 0; my $table; if ($numdcs > 1) { @@ -8637,7 +8877,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";