Diff for /loncom/interface/domainprefs.pm between versions 1.175 and 1.186

version 1.175, 2012/12/07 16:16:30 version 1.186, 2013/01/09 21:30:27
Line 45  described at http://www.lon-capa.org. Line 45  described at http://www.lon-capa.org.
 =head1 OVERVIEW  =head1 OVERVIEW
   
 Each institution using LON-CAPA will typically have a single domain designated   Each institution using LON-CAPA will typically have a single domain designated 
 for use by individuals affliated with the institution.  Accordingly, each domain  for use by individuals affiliated with the institution.  Accordingly, each domain
 may define a default set of logos and a color scheme which can be used to "brand"  may define a default set of logos and a color scheme which can be used to "brand"
 the LON-CAPA instance. In addition, an institution will typically have a language  the LON-CAPA instance. In addition, an institution will typically have a language
 and timezone which are used for the majority of courses.  and timezone which are used for the majority of courses.
Line 386  sub handler { Line 386  sub handler {
                               col2 => 'Rules'}],                                col2 => 'Rules'}],
                  },                   },
          'loadbalancing' =>           'loadbalancing' =>
                  {text  => 'Dedicated Load Balancer',                   {text  => 'Dedicated Load Balancer(s)',
                   help  => 'Domain_Configuration_Load_Balancing',                    help  => 'Domain_Configuration_Load_Balancing',
                   header => [{col1 => 'Balancers',                    header => [{col1 => 'Balancers',
                               col2 => 'Default destinations',                                col2 => 'Default destinations',
                               col3 => 'User affliation',                                col3 => 'User affiliation',
                               col4 => 'Overrides'},                                col4 => 'Overrides'},
                             ],                              ],
                  },                   },
Line 431  sub handler { Line 431  sub handler {
         }          }
         &Apache::lonconfigsettings::display_settings($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,$js);          &Apache::lonconfigsettings::display_settings($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,$js);
     } else {      } else {
   # check if domconfig user exists for the domain.
           my $servadm = $r->dir_config('lonAdmEMail');
           my ($configuserok,$author_ok,$switchserver) =
               &config_check($dom,$confname,$servadm);
           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).
                         '<br />'
               );
               if ($switchserver) {
                   $r->print(&mt('Ordinarily, that domain configuration user is created when the ./UPDATE script is run to install LON-CAPA for the first time.').
                             '<br />'.
                             &mt('However, that does not apply when new domains are added to a multi-domain server, and ./UPDATE has not been run recently.').
                             '<br />'.
                             &mt('The "[_1]" user can be created automatically when a Domain Coordinator visits the web-based "Set domain configuration" screen, in a session hosted on the primary library server.',$confname).
                             '<br />'.
                             &mt('To do that now, use the following link: [_1]',$switchserver)
                   );
               } else {
                   $r->print(&mt('To create that user from the command line run the ./UPDATE script found in the top level directory of the extracted LON-CAPA tarball.').
                             '<br />'.
                             &mt('Once that is done, you will be able to use the web-based "Set domain configuration" to configure the domain')
                   );
               }
               $r->print(&Apache::loncommon::end_page());
               return OK;
           }
         if (keys(%domconfig) == 0) {          if (keys(%domconfig) == 0) {
             my $primarylibserv = &Apache::lonnet::domain($dom,'primary');              my $primarylibserv = &Apache::lonnet::domain($dom,'primary');
             my @ids=&Apache::lonnet::current_machine_ids();              my @ids=&Apache::lonnet::current_machine_ids();
Line 815  sub print_login { Line 843  sub print_login {
                           '<td><select name="'.$lonhost.'_server">'.                            '<td><select name="'.$lonhost.'_server">'.
                           '<option value=""'.$direct.'>'.$choices{'directlogin'}.                            '<option value=""'.$direct.'>'.$choices{'directlogin'}.
                           '</option>';                            '</option>';
             foreach my $hostid (keys(%servers)) {              foreach my $hostid (sort(keys(%servers))) {
                 next if ($servers{$hostid} eq $servers{$lonhost});                  next if ($servers{$hostid} eq $servers{$lonhost});
                 my $selected = '';                  my $selected = '';
                 if (ref($disallowed{$lonhost}) eq 'HASH') {                  if (ref($disallowed{$lonhost}) eq 'HASH') {
Line 1190  sub display_color_options { Line 1218  sub display_color_options {
         $images,$bgs,$links,$alt_text,$rowtotal,$logintext) = @_;          $images,$bgs,$links,$alt_text,$rowtotal,$logintext) = @_;
     my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};      my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
     my $css_class = $itemcount%2?' class="LC_odd_row"':'';      my $css_class = $itemcount%2?' class="LC_odd_row"':'';
     my $js = "<script type='text/javascript'>\n";      my $datatable = '<tr'.$css_class.'>'.
     $js   .= &Apache::lonhtmlcommon::color_picker();  
     my $js = "\n</script>\n";  
     my $datatable = $js .  '<tr'.$css_class.'>'.  
         '<td>'.$choices->{'font'}.'</td>';          '<td>'.$choices->{'font'}.'</td>';
     if (!$is_custom->{'font'}) {      if (!$is_custom->{'font'}) {
         $datatable .=  '<td>'.&mt('Default in use:').'&nbsp;<span id="css_default_'.$role.'_font" style="color: '.$defaults->{'font'}.';">'.$defaults->{'font'}.'</span></td>';          $datatable .=  '<td>'.&mt('Default in use:').'&nbsp;<span id="css_default_'.$role.'_font" style="color: '.$defaults->{'font'}.';">'.$defaults->{'font'}.'</span></td>';
Line 1348  sub display_color_options { Line 1373  sub display_color_options {
     $datatable .= '<td class="LC_right_item">'.      $datatable .= '<td class="LC_right_item">'.
                   '<table border="0"><tr>';                    '<table border="0"><tr>';
   
   
     foreach my $item (@{$bgs}) {      foreach my $item (@{$bgs}) {
 #        my $link = &color_pick($phase,$role,$item,$choices->{$item},$designs->{'bgs'}{$item});  
         $datatable .= '<td align="center">';          $datatable .= '<td align="center">';
  my $color = $designs->{'bgs'}{$item} ? $designs->{'bgs'}{$item} : $defaults->{'bgs'}{$item};   my $color = $designs->{'bgs'}{$item} ? $designs->{'bgs'}{$item} : $defaults->{'bgs'}{$item};
         if ($designs->{'bgs'}{$item}) {          if ($designs->{'bgs'}{$item}) {
Line 2767  sub spares_row { Line 2790  sub spares_row {
             $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';              $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
             $datatable .= '<tr'.$css_class.'>              $datatable .= '<tr'.$css_class.'>
                            <td rowspan="2">                             <td rowspan="2">
                             <span class="LC_nobreak"><b>'.$server.'</b> when busy, offloads to:</span></td>'."\n";                              <span class="LC_nobreak">'.
                             &mt('[_1] when busy, offloads to:'
                                 ,'<b>'.$server.'</b>').
                             "\n";
             my (%current,%canselect);              my (%current,%canselect);
             my @choices =               my @choices = 
                 &possible_newspares($server,$spareid->{$server},$serverhomes,$altids);                  &possible_newspares($server,$spareid->{$server},$serverhomes,$altids);
Line 3016  sub print_loadbalancing { Line 3042  sub print_loadbalancing {
                                '<table><tr>'.$targettable.'</tr></table><br />';                                 '<table><tr>'.$targettable.'</tr></table><br />';
             }              }
         }          }
         my $cssidx = $balnum%2;   
         $datatable .= '</div></td></tr>'.          $datatable .= '</div></td></tr>'.
                       &loadbalancing_rules($dom,$intdom,$currrules{$lonhost},                        &loadbalancing_rules($dom,$intdom,$currrules{$lonhost},
                                            $othertitle,$usertypes,$types,\%servers,                                             $othertitle,$usertypes,$types,\%servers,
Line 5589  sub write_metadata { Line 5614  sub write_metadata {
         print $logfile "\nWrite metadata file for ".$targetdir.'/'.$file;          print $logfile "\nWrite metadata file for ".$targetdir.'/'.$file;
         my $mfh;          my $mfh;
         if (open($mfh,'>'.$targetdir.'/'.$file.'.meta')) {          if (open($mfh,'>'.$targetdir.'/'.$file.'.meta')) {
             foreach (sort keys %metadatafields) {              foreach (sort(keys(%metadatafields))) {
                 unless ($_=~/\./) {                  unless ($_=~/\./) {
                     my $unikey=$_;                      my $unikey=$_;
                     $unikey=~/^([A-Za-z]+)/;                      $unikey=~/^([A-Za-z]+)/;
Line 5673  sub check_switchserver { Line 5698  sub check_switchserver {
     my @ids=&Apache::lonnet::current_machine_ids();      my @ids=&Apache::lonnet::current_machine_ids();
     foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }      foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
     if (!$allowed) {      if (!$allowed) {
  $switchserver='<a href="/adm/switchserver?otherserver='.$home.'&role=dc./'.$dom.'/">'.&mt('Switch Server').'</a>';   $switchserver='<a href="/adm/switchserver?otherserver='.$home.'&amp;role=dc./'.$dom.'/&amp;destinationurl=/adm/domainprefs">'.&mt('Switch Server').'</a>';
     }      }
     return $switchserver;      return $switchserver;
 }  }
Line 6320  sub modify_autocreate { Line 6345  sub modify_autocreate {
             foreach my $item (@types) {              foreach my $item (@types) {
                 if ($changes{$item}) {                  if ($changes{$item}) {
                     my $newtxt = $offon[$newvals{$item}];                      my $newtxt = $offon[$newvals{$item}];
                     $resulttext .= '<li>'.&mt("$title{$item} set to [_1]$newtxt [_2]",'<b>','</b>').'</li>';                      $resulttext .= '<li>'.
                                      &mt("$title{$item} set to [_1]$newtxt [_2]",
                                          '<b>','</b>').
                                      '</li>';
                 }                  }
             }              }
             if ($changes{'xmldc'}) {              if ($changes{'xmldc'}) {
                 my ($dcname,$dcdom) = split(':',$newvals{'xmldc'});                  my ($dcname,$dcdom) = split(':',$newvals{'xmldc'});
                 my $newtxt = &Apache::loncommon::plainname($dcname,$dcdom);                  my $newtxt = &Apache::loncommon::plainname($dcname,$dcdom);
                 $resulttext .= '<li>'.&mt("$title{'xmldc'} set to [_1]$newtxt [_2]",'<b>','</b>').'</li>';                   $resulttext .= '<li>'.&mt("$title{'xmldc'} set to [_1]",'<b>'.$newtxt.'</b>').'</li>'; 
             }              }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';
         } else {          } else {
Line 6472  sub modify_directorysrch { Line 6500  sub modify_directorysrch {
                         } else {                          } else {
                             $chgtext =~ s/\; $//;                              $chgtext =~ s/\; $//;
                         }                          }
                         $resulttext .= '<li>'.&mt("Users from domain '<span class=\"LC_cusr_emph\">[_1]</span>' permitted to search the institutional directory set to: [_2]",$dom,$chgtext).'</li>';                          $resulttext .= 
                               '<li>'.
                               &mt("Users from domain '[_1]' permitted to search the institutional directory set to: [_2]",
                                   '<span class="LC_cusr_emph">'.$dom.'</span>',$chgtext).
                               '</li>';
                     }                      }
                 }                  }
             }              }
Line 6500  sub modify_directorysrch { Line 6532  sub modify_directorysrch {
                     }                      }
                 }                  }
                 $chgtext =~ s/\; $//;                  $chgtext =~ s/\; $//;
                 $resulttext .= '<li>'.&mt("$title{'searchtypes'} set to: \"[_1]\"",$chgtext).'</li>';                  $resulttext .= '<li>'.&mt($title{'searchtypes'}.' set to: "[_1]"',$chgtext).'</li>';
             }              }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';
         } else {          } else {
Line 7086  sub process_captcha { Line 7118  sub process_captcha {
     if (ref($current->{'recaptchakeys'}) eq 'HASH') {      if (ref($current->{'recaptchakeys'}) eq 'HASH') {
         $currpub = $current->{'recaptchakeys'}{'public'};          $currpub = $current->{'recaptchakeys'}{'public'};
         $currpriv = $current->{'recaptchakeys'}{'private'};          $currpriv = $current->{'recaptchakeys'}{'private'};
         $newsettings->{'recaptchakeys'} = {          unless ($newsettings->{'captcha'} eq 'recaptcha') {
                                              public  => '',              $newsettings->{'recaptchakeys'} = {
                                              private => '',                                                   public  => '',
                                           }                                                   private => '',
                                                 }
           }
     }      }
     if (($newpub ne $currpub) || ($newpriv ne $currpriv)) {      if (($newpub ne $currpub) || ($newpriv ne $currpriv)) {
         if ($container eq 'cancreate') {          if ($container eq 'cancreate') {
Line 8465  sub active_dc_picker { Line 8499  sub active_dc_picker {
                           '<input type="radio" name="autocreate_xmldc"'.                            '<input type="radio" name="autocreate_xmldc"'.
                           ' value="'.$dcs[$i].'"'.$check.'/>'.                            ' value="'.$dcs[$i].'"'.$check.'/>'.
                           &Apache::loncommon::plainname($dcname,$dcdom).                            &Apache::loncommon::plainname($dcname,$dcdom).
                             ' ('.$dcname.':'.$dcdom.')'.
                           '</label></span></td>';                            '</label></span></td>';
         }          }
         $datatable .= '</tr></table>';          $datatable .= '</tr></table>';

Removed from v.1.175  
changed lines
  Added in v.1.186


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