Diff for /loncom/interface/domainprefs.pm between versions 1.160.6.26 and 1.207

version 1.160.6.26, 2013/09/29 06:55:58 version 1.207, 2013/09/10 17:43:58
Line 86  $dom,$settings,$rowtotal,$action. Line 86  $dom,$settings,$rowtotal,$action.
   
 $dom is the domain, $settings is a reference to a hash of current settings for  $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   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).  requestcourses or requestauthor).
   
 The print_quotas routine was orginally created to display/store information  The print_quotas routine was orginally created to display/store information
Line 211  sub handler { Line 211  sub handler {
                 'quotas','autoenroll','autoupdate','autocreate',                  'quotas','autoenroll','autoupdate','autocreate',
                 'directorysrch','usercreation','usermodification',                  'directorysrch','usercreation','usermodification',
                 'contacts','defaults','scantron','coursecategories',                  'contacts','defaults','scantron','coursecategories',
                 'serverstatuses','requestcourses','coursedefaults',                  'serverstatuses','requestcourses','helpsettings',
                 'usersessions','loadbalancing','requestauthor'],$dom);                  'coursedefaults','usersessions','loadbalancing',
                   'requestauthor'],$dom);
     my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll',      my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll',
                        'autoupdate','autocreate','directorysrch','contacts',                         'autoupdate','autocreate','directorysrch','contacts',
                        'usercreation','usermodification','scantron',                         'usercreation','usermodification','scantron',
                        'requestcourses','requestauthor','coursecategories',                         'requestcourses','requestauthor','coursecategories',
                        'serverstatuses','coursedefaults','usersessions');                         'serverstatuses','helpsettings',
                          'coursedefaults','usersessions');
     my %existing;      my %existing;
     if (ref($domconfig{'loadbalancing'}) eq 'HASH') {      if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
         %existing = %{$domconfig{'loadbalancing'}};          %existing = %{$domconfig{'loadbalancing'}};
Line 354  sub handler { Line 356  sub handler {
                               col3 => 'Specific IPs',                                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',                   {text => 'Course/Community defaults',
                   help => 'Domain_Configuration_Course_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',},],                                col2 => 'Value',},],
                  },                   },
           'privacy' => 
                    {text   => 'User Privacy',
                     help   => 'Domain_Configuration_User_Privacy',
                     header => [{col1 => 'Setting',
                                 col2 => 'Value',}],
                    },
         'usersessions' =>          'usersessions' =>
                  {text  => 'User session hosting/offloading',                   {text  => 'User session hosting/offloading',
                   help  => 'Domain_Configuration_User_Sessions',                    help  => 'Domain_Configuration_User_Sessions',
Line 426  sub handler { Line 442  sub handler {
         unless ($configuserok eq 'ok') {          unless ($configuserok eq 'ok') {
             &Apache::lonconfigsettings::print_header($r,$phase,$context);              &Apache::lonconfigsettings::print_header($r,$phase,$context);
             $r->print(&mt('The domain configuration user "[_1]" has yet to be created.',              $r->print(&mt('The domain configuration user "[_1]" has yet to be created.',
                           $confname).                             $confname).
                       '<br />'                        '<br />'
             );              );
             if ($switchserver) {              if ($switchserver) {
Line 525  sub process_changes { Line 541  sub process_changes {
         $output = &modify_quotas($dom,$action,%domconfig);          $output = &modify_quotas($dom,$action,%domconfig);
     } elsif ($action eq 'requestauthor') {      } elsif ($action eq 'requestauthor') {
         $output = &modify_quotas($dom,$action,%domconfig);          $output = &modify_quotas($dom,$action,%domconfig);
       } elsif ($action eq 'helpsettings') {
           $output = &modify_helpsettings($r,$dom,$confname,%domconfig);
     } elsif ($action eq 'coursedefaults') {      } elsif ($action eq 'coursedefaults') {
         $output = &modify_coursedefaults($dom,%domconfig);          $output = &modify_coursedefaults($dom,%domconfig);
     } elsif ($action eq 'usersessions') {      } elsif ($action eq 'usersessions') {
Line 557  sub print_config_box { Line 575  sub print_config_box {
     if ($numheaders > 1) {      if ($numheaders > 1) {
         my $colspan = '';          my $colspan = '';
         my $rightcolspan = '';          my $rightcolspan = '';
         if (($action eq 'rolecolors') || ($action eq 'coursecategories') ||          if (($action eq 'rolecolors') || ($action eq 'coursecategories') || 
             (($action eq 'login') && ($numheaders < 3))) {              (($action eq 'login') && ($numheaders < 3))) {
             $colspan = ' colspan="2"';              $colspan = ' colspan="2"';
         }          }
Line 596  sub print_config_box { Line 614  sub print_config_box {
             $output .= &print_usersessions('top',$dom,$settings,\$rowtotal);               $output .= &print_usersessions('top',$dom,$settings,\$rowtotal); 
         } elsif ($action eq 'rolecolors') {          } elsif ($action eq 'rolecolors') {
             $output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal);              $output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal);
           } elsif ($action eq 'coursedefaults') {
               $output .= &print_coursedefaults('top',$dom,$settings,\$rowtotal);
         }          }
         $output .= '          $output .= '
            </table>             </table>
Line 685  sub print_config_box { Line 705  sub print_config_box {
               <td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td>      </tr>'.                <td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td>      </tr>'.
                        &print_usersessions('bottom',$dom,$settings,\$rowtotal);                         &print_usersessions('bottom',$dom,$settings,\$rowtotal);
             $rowtotal ++;              $rowtotal ++;
           } elsif ($action eq 'coursedefaults') {
               $output .= &print_coursedefaults('bottom',$dom,$settings,\$rowtotal);
         } elsif ($action eq 'rolecolors') {          } elsif ($action eq 'rolecolors') {
             $output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).'              $output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).'
            </table>             </table>
Line 781  sub print_config_box { Line 803  sub print_config_box {
             $output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal);              $output .= &print_helpsettings($dom,$confname,$settings,\$rowtotal);
         } elsif ($action eq 'loadbalancing') {          } elsif ($action eq 'loadbalancing') {
             $output .= &print_loadbalancing($dom,$settings,\$rowtotal);              $output .= &print_loadbalancing($dom,$settings,\$rowtotal);
         } elsif ($action eq 'coursedefaults') {  
             $output .= &print_coursedefaults('bottom',$dom,$settings,\$rowtotal);  
         }          }
     }      }
     $output .= '      $output .= '
Line 1536  sub print_quotas { Line 1556  sub print_quotas {
     } elsif ($context eq 'requestauthor') {      } elsif ($context eq 'requestauthor') {
         @usertools = ('author');          @usertools = ('author');
         @options = ('norequest','approval','automatic');          @options = ('norequest','approval','automatic');
         %titles = &authorrequest_titles();          %titles = &authorrequest_titles(); 
     } else {      } else {
         @usertools = ('aboutme','blog','webdav','portfolio');          @usertools = ('aboutme','blog','webdav','portfolio');
         %titles = &tool_titles();          %titles = &tool_titles();
Line 1943  sub print_quotas { Line 1963  sub print_quotas {
   
 sub print_requestmail {  sub print_requestmail {
     my ($dom,$action,$settings,$rowtotal) = @_;      my ($dom,$action,$settings,$rowtotal) = @_;
     my ($now,$datatable,%currapp);      my ($now,$datatable,%currapp,$rows);
     $now = time;      $now = time;
     if (ref($settings) eq 'HASH') {      if (ref($settings) eq 'HASH') {
         if (ref($settings->{'notify'}) eq 'HASH') {          if (ref($settings->{'notify'}) eq 'HASH') {
Line 2136  sub print_autocreate { Line 2156  sub print_autocreate {
                 }                  }
             }              }
         }          }
         if ($settings->{'xmldc'} ne '') {          if ($settings->{'xmldc'} ne '') { 
             $currhash{$settings->{'xmldc'}} = 1;              $currhash{$settings->{'xmldc'}} = 1;
         }          }
     } else {      } else {
Line 2522  sub print_coursedefaults { Line 2542  sub print_coursedefaults {
         $datatable .= '</tr></table></td></tr>'."\n";          $datatable .= '</tr></table></td></tr>'."\n";
         $itemcount += 2;          $itemcount += 2;
         my $onclick = 'toggleCredits(this.form);';          my $onclick = 'toggleCredits(this.form);';
         my $display = 'none';          my $display = 'none';  
         if ($currusecredits) {          if ($currusecredits) {
             $display = 'block';              $display = 'block';
         }          }
Line 2977  sub print_loadbalancing { Line 2997  sub print_loadbalancing {
     }      }
     my ($othertitle,$usertypes,$types) =      my ($othertitle,$usertypes,$types) =
         &Apache::loncommon::sorted_inst_types($dom);          &Apache::loncommon::sorted_inst_types($dom);
     my $rownum = 8;      my $rownum = 6;
     if (ref($types) eq 'ARRAY') {      if (ref($types) eq 'ARRAY') {
         $rownum += scalar(@{$types});          $rownum += scalar(@{$types});
     }      }
Line 3008  sub print_loadbalancing { Line 3028  sub print_loadbalancing {
                       '<td rowspan="'.$rownum.'" valign="top">'.                        '<td rowspan="'.$rownum.'" valign="top">'.
                       '<p>';                        '<p>';
         if ($lonhost eq '') {          if ($lonhost eq '') {
             $datatable .= '<span class="LC_nobreak">';              $datatable .= '<span class="LC_nobreak">'; 
             if (keys(%currbalancer) > 0) {              if (keys(%currbalancer) > 0) {
                 $datatable .= &mt('Add balancer:');                  $datatable .= &mt('Add balancer:');
             } else {              } else {
Line 3024  sub print_loadbalancing { Line 3044  sub print_loadbalancing {
                 next if ($currbalancer{$server});                  next if ($currbalancer{$server});
                 $datatable .= '<option value="'.$server.'">'.$server.'</option>'."\n";                  $datatable .= '<option value="'.$server.'">'.$server.'</option>'."\n";
             }              }
             $datatable .=              $datatable .= 
                 '</select>'."\n".                  '</select>'."\n".
                 '<input type="hidden" name="loadbalancing_prevlonhost_'.$balnum.'" id="loadbalancing_prevlonhost_'.$balnum.'" value="" />&nbsp;</span>'."\n";                  '<input type="hidden" name="loadbalancing_prevlonhost_'.$balnum.'" id="loadbalancing_prevlonhost_'.$balnum.'" value="" />&nbsp;</span>'."\n";
         } else {          } else {
Line 3063  sub print_loadbalancing { Line 3083  sub print_loadbalancing {
                 if (exists($currbalancer{$spares[$i]})) {                  if (exists($currbalancer{$spares[$i]})) {
                     $disabled = ' disabled="disabled"';                      $disabled = ' disabled="disabled"';
                 }                  }
                 $targettable .=                  $targettable .= 
                     '<td><label><input type="checkbox" name="loadbalancing_target_'.$balnum.'_'.$sparetype.'"'.                      '<td><label><input type="checkbox" name="loadbalancing_target_'.$balnum.'_'.$sparetype.'"'.
                     $checked.$disabled.' value="'.$chkboxval.'" id="loadbalancing_target_'.$balnum.'_'.$sparetype.'_'.$i.'" onclick="checkOffloads('."this,'$balnum','$sparetype'".');" /><span id="loadbalancing_targettxt_'.$balnum.'_'.$sparetype.'_'.$i.'">&nbsp;'.$chkboxval.                      $checked.$disabled.' value="'.$chkboxval.'" id="loadbalancing_target_'.$balnum.'_'.$sparetype.'_'.$i.'" onclick="checkOffloads('."this,'$balnum','$sparetype'".');" /><span id="loadbalancing_targettxt_'.$balnum.'_'.$sparetype.'_'.$i.'">&nbsp;'.$chkboxval.
                     '</span></label></td>';                      '</span></label></td>';
Line 3147  sub loadbalancing_rules { Line 3167  sub loadbalancing_rules {
         $css_class,$balnum,$islast) = @_;          $css_class,$balnum,$islast) = @_;
     my $output;      my $output;
     my $num = 0;      my $num = 0;
     my ($alltypes,$othertypes,$titles) =      my ($alltypes,$othertypes,$titles) = 
         &loadbalancing_titles($dom,$intdom,$usertypes,$types);          &loadbalancing_titles($dom,$intdom,$usertypes,$types);
     if ((ref($alltypes) eq 'ARRAY') && (ref($titles) eq 'HASH'))  {      if ((ref($alltypes) eq 'ARRAY') && (ref($titles) eq 'HASH'))  {
         foreach my $type (@{$alltypes}) {          foreach my $type (@{$alltypes}) {
Line 3156  sub loadbalancing_rules { Line 3176  sub loadbalancing_rules {
             if (ref($currrules) eq 'HASH') {              if (ref($currrules) eq 'HASH') {
                 $current = $currrules->{$type};                  $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)) {                  if ($dom ne &Apache::lonnet::host_domain($lonhost)) {
                     $current = '';                      $current = '';
                 }                  }
Line 3177  sub loadbalancing_titles { Line 3197  sub loadbalancing_titles {
            '_LC_author'      => &mt('Users from [_1] with author role',$dom),             '_LC_author'      => &mt('Users from [_1] with author role',$dom),
            '_LC_internetdom' => &mt('Users not from [_1], but from [_2]',$dom,$intdom),             '_LC_internetdom' => &mt('Users not from [_1], but from [_2]',$dom,$intdom),
            '_LC_external'    => &mt('Users not from [_1]',$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') {      if (ref($types) eq 'ARRAY') {
         unshift(@alltypes,@{$types},'default');          unshift(@alltypes,@{$types},'default');
     }      }
Line 3205  sub loadbalancing_titles { Line 3223  sub loadbalancing_titles {
 sub loadbalance_rule_row {  sub loadbalance_rule_row {
     my ($type,$title,$current,$servers,$currbalancer,$lonhost,$dom,      my ($type,$title,$current,$servers,$currbalancer,$lonhost,$dom,
         $targets_div_style,$homedom_div_style,$css_class,$balnum,$num,$islast) = @_;          $targets_div_style,$homedom_div_style,$css_class,$balnum,$num,$islast) = @_;
     my @rulenames;      my @rulenames = ('default','homeserver');
     my %ruletitles = &offloadtype_text();      my %ruletitles = &offloadtype_text();
     if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) {      if ($type eq '_LC_external') {
         @rulenames = ('balancer','offloadedto');          push(@rulenames,'externalbalancer');
     } else {      } else {
         @rulenames = ('default','homeserver');          push(@rulenames,'specific');
         if ($type eq '_LC_external') {  
             push(@rulenames,'externalbalancer');  
         } else {  
             push(@rulenames,'specific');  
         }  
         push(@rulenames,'none');  
     }      }
       push(@rulenames,'none');
     my $style = $targets_div_style;      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;          $style = $homedom_div_style;
     }      }
     my $space;      my $space;
     if ($islast && $num == 1) {      if ($islast && $num == 1) {
         $space = '<div display="inline-block">&nbsp;</div>';          $space = '<div display="inline-block">&nbsp;</div>';
     }      }
     my $output =      my $output = 
         '<tr class="'.$css_class.'" id="balanceruletr_'.$balnum.'_'.$num.'"><td valign="top">'.$space.          '<tr class="'.$css_class.'" id="balanceruletr_'.$balnum.'_'.$num.'"><td valign="top">'.$space.
         '<div id="balanceruletitle_'.$balnum.'_'.$type.'" style="'.$style.'">'.$title.'</div></td>'."\n".          '<div id="balanceruletitle_'.$balnum.'_'.$type.'" style="'.$style.'">'.$title.'</div></td>'."\n".
         '<td valaign="top">'.$space.          '<td valaign="top">'.$space.
Line 3246  sub loadbalance_rule_row { Line 3259  sub loadbalance_rule_row {
                 unless ($checked) {                  unless ($checked) {
                     $default = ' selected="selected"';                      $default = ' selected="selected"';
                 }                  }
                 $extra =                  $extra = 
                     ':&nbsp;<select name="loadbalancing_singleserver_'.$balnum.'_'.$type.                      ':&nbsp;<select name="loadbalancing_singleserver_'.$balnum.'_'.$type.
                     '" id="loadbalancing_singleserver_'.$balnum.'_'.$type.                      '" id="loadbalancing_singleserver_'.$balnum.'_'.$type.
                     '" onchange="singleServerToggle('."'$balnum','$type'".')">'."\n".                      '" onchange="singleServerToggle('."'$balnum','$type'".')">'."\n".
Line 3284  sub offloadtype_text { Line 3297  sub offloadtype_text {
            'externalbalancer' => "Offloads to Load Balancer in user's domain",             'externalbalancer' => "Offloads to Load Balancer in user's domain",
            'specific'         => 'Offloads to specific server',             'specific'         => 'Offloads to specific server',
            'none'             => 'No offload',             'none'             => 'No offload',
            'balancer'         => 'Session hosted on Load Balancer, after re-authentication',  
            'offloadedto'      => 'Session hosted on offload server, after re-authentication',  
     );      );
     return %ruletitles;      return %ruletitles;
 }  }
Line 3351  sub authorrequest_titles { Line 3362  sub authorrequest_titles {
                                    automatic  => 'Automatic approval',                                     automatic  => 'Automatic approval',
                  );                   );
     return %titles;      return %titles;
 }  } 
   
 sub courserequest_conditions {  sub courserequest_conditions {
     my %conditions = &Apache::lonlocal::texthash (      my %conditions = &Apache::lonlocal::texthash (
Line 3590  sub captcha_choice { Line 3601  sub captcha_choice {
 #  #
 # Note: If reCAPTCHA is to be used for LON-CAPA servers in a domain, a domain coordinator should visit:  # Note: If reCAPTCHA is to be used for LON-CAPA servers in a domain, a domain coordinator should visit:
 # https://www.google.com/recaptcha and generate a Public and Private key. For domains with multiple  # https://www.google.com/recaptcha and generate a Public and Private key. For domains with multiple
 # servers a single key pair will be used for all servers, so the internet domain (e.g., yourcollege.edu)  # servers a single key pair will be used for all servers, so the internet domain (e.g., yourcollege.edu) 
 # specified for use with the key should be broad enough to accommodate all servers in the LON-CAPA domain.  # specified for use with the key should be broad enough to accommodate all servers in the LON-CAPA domain.
 #  #  
     $output .= '</td></tr>'."\n".      $output .= '</td></tr>'."\n".
                '<tr><td>'."\n".                 '<tr><td>'."\n".
                '<span class="LC_nobreak"><span id="'.$context.'_recaptchapubtxt">'.$pubtext.'</span>&nbsp;'."\n".                 '<span class="LC_nobreak"><span id="'.$context.'_recaptchapubtxt">'.$pubtext.'</span>&nbsp;'."\n".
Line 4902  sub modify_login { Line 4913  sub modify_login {
                     } else {                      } else {
                         my $puberror = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].",$newfile{$lang},$result);                          my $puberror = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].",$newfile{$lang},$result);
                         $errors .= '<li><span class="LC_error">'.$puberror.'</span></li>';                          $errors .= '<li><span class="LC_error">'.$puberror.'</span></li>';
                         if ((grep(/^\Q$lang\E$/,@currlangs)) &&                          if ((grep(/^\Q$lang\E$/,@currlangs)) && 
                             (!grep(/^\Q$lang\E$/,@delurls))) {                              (!grep(/^\Q$lang\E$/,@delurls))) {
   
                             $loginhash{'login'}{'helpurl'}{$lang} = $domconfig{'login'}{'helpurl'}{$lang};                              $loginhash{'login'}{'helpurl'}{$lang} = $domconfig{'login'}{'helpurl'}{$lang};
Line 5020  sub modify_login { Line 5031  sub modify_login {
                     }                      }
                 } elsif ($item eq 'captcha') {                  } elsif ($item eq 'captcha') {
                     if (ref($loginhash{'login'}) eq 'HASH') {                      if (ref($loginhash{'login'}) eq 'HASH') {
                         my $chgtxt;                          my $chgtxt; 
                         if ($loginhash{'login'}{$item} eq 'notused') {                          if ($loginhash{'login'}{$item} eq 'notused') {
                             $chgtxt .= &mt('No CAPTCHA validation in use for helpdesk form.');                              $chgtxt .= &mt('No CAPTCHA validation in use for helpdesk form.');
                         } else {                          } else {
Line 5520  sub publishlogo { Line 5531  sub publishlogo {
 # See if there is anything left  # See if there is anything left
     unless ($fname) { return ('error: no uploaded file'); }      unless ($fname) { return ('error: no uploaded file'); }
     $fname="$subdir/$fname";      $fname="$subdir/$fname";
     my $docroot=$r->dir_config('lonDocRoot');      my $docroot=$r->dir_config('lonDocRoot'); 
     my $filepath="$docroot/priv";      my $filepath="$docroot/priv";
     my $relpath = "$dom/$confname";      my $relpath = "$dom/$confname";
     my ($fnamepath,$file,$fetchthumb);      my ($fnamepath,$file,$fetchthumb);
Line 6012  sub modify_quotas { Line 6023  sub modify_quotas {
             &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);              &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
   
             $resulttext = &mt('Changes made:').'<ul>';              $resulttext = &mt('Changes made:').'<ul>';
             unless (($context eq 'requestcourses') ||              unless (($context eq 'requestcourses') || 
                     ($context eq 'requestauthor')) {                      ($context eq 'requestauthor')) {
                 if (ref($changes{'defaultquota'}) eq 'HASH') {                  if (ref($changes{'defaultquota'}) eq 'HASH') {
                     $resulttext .= '<li>'.&mt('Portfolio default quotas').'<ul>';                      $resulttext .= '<li>'.&mt('Portfolio default quotas').'<ul>';
Line 6046  sub modify_quotas { Line 6057  sub modify_quotas {
                 my (%haschgs,%inconf);                  my (%haschgs,%inconf);
                 if ($context eq 'requestauthor') {                  if ($context eq 'requestauthor') {
                     %haschgs = %changes;                      %haschgs = %changes;
                     %inconf = %confhash;                      %inconf = %confhash; 
                 } else {                  } else {
                     if (ref($changes{$item}) eq 'HASH') {                      if (ref($changes{$item}) eq 'HASH') {
                         %haschgs = %{$changes{$item}};                          %haschgs = %{$changes{$item}};
Line 6060  sub modify_quotas { Line 6071  sub modify_quotas {
                         &Apache::lonnet::usertools_access($env{'user.name'},                          &Apache::lonnet::usertools_access($env{'user.name'},
                                                           $env{'user.domain'},                                                            $env{'user.domain'},
                                                           $item,'reload',$context);                                                            $item,'reload',$context);
                     if (($context eq 'requestcourses') ||                      if (($context eq 'requestcourses') || 
                         ($context eq 'requestauthor')) {                          ($context eq 'requestauthor')) {
                         if ($env{'environment.canrequest.'.$item} ne $newacc) {                          if ($env{'environment.canrequest.'.$item} ne $newacc) {
                             $newenv{'environment.canrequest.'.$item} = $newacc;                              $newenv{'environment.canrequest.'.$item} = $newacc;
Line 6627  sub modify_directorysrch { Line 6638  sub modify_directorysrch {
                         } else {                          } else {
                             $chgtext =~ s/\; $//;                              $chgtext =~ s/\; $//;
                         }                          }
                         $resulttext .=                          $resulttext .= 
                             '<li>'.                              '<li>'.
                             &mt("Users from domain '[_1]' permitted to search the institutional directory set to: [_2]",                              &mt("Users from domain '[_1]' permitted to search the institutional directory set to: [_2]",
                                 '<span class="LC_cusr_emph">'.$dom.'</span>',$chgtext).                                  '<span class="LC_cusr_emph">'.$dom.'</span>',$chgtext).
Line 7127  sub modify_usercreation { Line 7138  sub modify_usercreation {
                             if ($captchas{$cancreate{$type}}) {                              if ($captchas{$cancreate{$type}}) {
                                 $chgtext .= &mt("Validation for self-creation screen set to $captchas{$cancreate{$type}}.");                                  $chgtext .= &mt("Validation for self-creation screen set to $captchas{$cancreate{$type}}.");
                             } else {                              } 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') {                      } elsif ($type eq 'recaptchakeys') {
Line 7255  sub process_captcha { Line 7266  sub process_captcha {
         $newsettings->{'captcha'} = 'original';          $newsettings->{'captcha'} = 'original';
     }      }
     if ($current->{'captcha'} ne $newsettings->{'captcha'}) {      if ($current->{'captcha'} ne $newsettings->{'captcha'}) {
         if ($container eq 'cancreate') {          if ($container eq 'cancreate') { 
             if (ref($changes->{'cancreate'}) eq 'ARRAY') {              if (ref($changes->{'cancreate'}) eq 'ARRAY') {
                 push(@{$changes->{'cancreate'}},'captcha');                  push(@{$changes->{'cancreate'}},'captcha');
             } elsif (!defined($changes->{'cancreate'})) {              } elsif (!defined($changes->{'cancreate'})) {
Line 7294  sub process_captcha { Line 7305  sub process_captcha {
                 $changes->{'cancreate'} = ['recaptchakeys'];                  $changes->{'cancreate'} = ['recaptchakeys'];
             }              }
         } else {          } else {
             $changes->{'recaptchakeys'} = 1;              $changes->{'recaptchakeys'} = 1; 
         }          }
     }      }
     return;      return;
Line 7989  sub modify_helpsettings { Line 8000  sub modify_helpsettings {
                     $changes{$item} = 1;                      $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};                  $helphash{'helpsettings'}{$item} = $env{'form.'.$item};
             }              }
         }          }
Line 8063  sub modify_coursedefaults { Line 8074  sub modify_coursedefaults {
         }          }
         foreach my $item (@numbers) {          foreach my $item (@numbers) {
             my ($currdef,$newdef);              my ($currdef,$newdef);
             $newdef = $env{'form.'.$item};              my $newdef = $env{'form.'.$item};
             if ($item eq 'anonsurvey_threshold') {              if ($item eq 'anonsurvey_threshold') {
                 $currdef = $domconfig{'coursedefaults'}{$item};                  $currdef = $domconfig{'coursedefaults'}{$item};
                 $newdef =~ s/\D//g;                  $newdef =~ s/\D//g;
Line 8482  sub modify_loadbalancing { Line 8493  sub modify_loadbalancing {
         if ($balancer eq '') {          if ($balancer eq '') {
             next;              next;
         }          }
         if (!exists($servers{$balancer})) {          if (!exists($servers{$balancer})) { 
             if (exists($currbalancer{$balancer})) {              if (exists($currbalancer{$balancer})) {
                 push(@{$changes{'delete'}},$balancer);                  push(@{$changes{'delete'}},$balancer);
             }              }
Line 8533  sub modify_loadbalancing { Line 8544  sub modify_loadbalancing {
             }              }
         } else {          } else {
             if (ref($defaultshash{'loadbalancing'}{$balancer}) eq 'HASH') {              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 (ref($defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}) eq 'ARRAY') {
                         if (@{$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}} > 0) {                          if (@{$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}} > 0) {
                             $changes{'curr'}{$balancer}{'targets'} = 1;                              $changes{'curr'}{$balancer}{'targets'} = 1;
                         }                          }
                     }                      }
                 }                  }
             }              }  
         }          }
         my $ishomedom;          my $ishomedom;
         if (&Apache::lonnet::host_domain($balancer) eq $dom) {          if (&Apache::lonnet::host_domain($balancer) eq $dom) {
Line 8549  sub modify_loadbalancing { Line 8560  sub modify_loadbalancing {
         if (ref($alltypes) eq 'ARRAY') {          if (ref($alltypes) eq 'ARRAY') {
             foreach my $type (@{$alltypes}) {              foreach my $type (@{$alltypes}) {
                 my $rule;                  my $rule;
                 unless ((($type eq '_LC_external') || ($type eq '_LC_internetdom')) &&                  unless ((($type eq '_LC_external') || ($type eq '_LC_internetdom')) && 
                          (!$ishomedom)) {                           (!$ishomedom)) {
                     $rule = $env{'form.loadbalancing_rules_'.$i.'_'.$type};                      $rule = $env{'form.loadbalancing_rules_'.$i.'_'.$type};
                 }                  }
Line 8574  sub modify_loadbalancing { Line 8585  sub modify_loadbalancing {
         }          }
         my $putresult = &Apache::lonnet::put_dom('configuration',          my $putresult = &Apache::lonnet::put_dom('configuration',
                                                  \%defaultshash,$dom);                                                   \%defaultshash,$dom);
    
         if ($putresult eq 'ok') {          if ($putresult eq 'ok') {
             if (keys(%changes) > 0) {              if (keys(%changes) > 0) {
                 if (ref($changes{'delete'}) eq 'ARRAY') {                  if (ref($changes{'delete'}) eq 'ARRAY') {
Line 8583  sub modify_loadbalancing { Line 8595  sub modify_loadbalancing {
                     }                      }
                 }                  }
                 if (ref($changes{'add'}) eq 'ARRAY') {                  if (ref($changes{'add'}) eq 'ARRAY') {
                     foreach my $balancer (sort(@{$changes{'add'}})) {                      foreach my $balancer (sort(@{$changes{'add'}})) {   
                         $resulttext .= '<li>'.&mt('Load Balancing enabled for: [_1]',$balancer);                          $resulttext .= '<li>'.&mt('Load Balancing enabled for: [_1]',$balancer);
                     }                      }
                 }                  }
Line 8624  sub modify_loadbalancing { Line 8636  sub modify_loadbalancing {
                                         my $balancetext;                                          my $balancetext;
                                         if ($rule eq '') {                                          if ($rule eq '') {
                                             $balancetext =  $ruletitles{'default'};                                              $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};                                              $balancetext =  $ruletitles{$rule};
                                         } else {                                          } else {
                                             $balancetext = &mt('offload to [_1]',$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type});                                              $balancetext = &mt('offload to [_1]',$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type});
                                         }                                          }
                                         $resulttext .= '<li>'.&mt('Load Balancer: [_1] -- balancing for [_2] set to - "[_3]"',$balancer,$titles->{$type},$balancetext).'</li>';                                          $resulttext .= '<li>'.&mt('Load Balancer: [_1] -- balancing for [_2] set to - "[_3]"',$balancer,$titles->{$type},$balancetext).'</li>';     
                                     }                                      }
                                 }                                  }
                             }                              }
Line 8723  sub active_dc_picker { Line 8734  sub active_dc_picker {
         }          }
     }      }
     @domcoord = sort(@domcoord);      @domcoord = sort(@domcoord);
     my $numdcs = scalar(@domcoord);      my $numdcs = scalar(@domcoord); 
     my $rows = 0;      my $rows = 0;
     my $table;      my $table;
     if ($numdcs > 1) {      if ($numdcs > 1) {
Line 8857  sub lonbalance_targets_js { Line 8868  sub lonbalance_targets_js {
     }      }
     &get_loadbalancers_config($servers,\%existing,\%currbalancer,      &get_loadbalancers_config($servers,\%existing,\%currbalancer,
                               \%currtargets,\%currrules);                                \%currtargets,\%currrules);
     my $balancers = join("','",sort(keys(%currbalancer)));      my $balancers = join("','",sort(keys(%currbalancer))); 
     return <<"END";      return <<"END";
   
 <script type="text/javascript">  <script type="text/javascript">
Line 8928  function showSpares(balancer,ishomedom,b Line 8939  function showSpares(balancer,ishomedom,b
             } else {              } else {
                 document.getElementById('balanceruletitle_'+balnum+'_'+insttypes[k]).style.display='none';                  document.getElementById('balanceruletitle_'+balnum+'_'+insttypes[k]).style.display='none';
                 document.getElementById('balancerule_'+balnum+'_'+insttypes[k]).style.display='none';                  document.getElementById('balancerule_'+balnum+'_'+insttypes[k]).style.display='none';
   
             }              }
         } else {          } else {
             document.getElementById('balanceruletitle_'+balnum+'_'+insttypes[k]).style.display='block';              document.getElementById('balanceruletitle_'+balnum+'_'+insttypes[k]).style.display='block';
Line 8939  function showSpares(balancer,ishomedom,b Line 8951  function showSpares(balancer,ishomedom,b
             var item = document.getElementById('loadbalancing_singleserver_'+balnum+'_'+insttypes[k]);              var item = document.getElementById('loadbalancing_singleserver_'+balnum+'_'+insttypes[k]);
             item.options.length = 0;              item.options.length = 0;
             item.options[0] = new Option("","",true,true);              item.options[0] = new Option("","",true,true);
             var idx = 0;              var idx = 0;  
             for (var m=0; m<alltargets.length; m++) {              for (var m=0; m<alltargets.length; m++) {
                 if ((currBalancers.indexOf(alltargets[m]) == -1) && (alltargets[m] != balancer)) {                  if ((currBalancers.indexOf(alltargets[m]) == -1) && (alltargets[m] != balancer)) {
                     idx ++;                      idx ++;
                     item.options[idx] = new Option(alltargets[m],alltargets[m],false,false);                      item.options[idx] = new Option(alltargets[m],alltargets[m],false,false);
                       
                 }                  }
             }              }
         }          }
Line 9356  sub captcha_phrases { Line 9369  sub captcha_phrases {
     );      );
 }  }
   
   
 sub devalidate_remote_domconfs {  sub devalidate_remote_domconfs {
     my ($dom) = @_;      my ($dom) = @_;
     my $primary_id = &Apache::lonnet::domain($dom,'primary');      my $primary_id = &Apache::lonnet::domain($dom,'primary');

Removed from v.1.160.6.26  
changed lines
  Added in v.1.207


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>