Diff for /loncom/interface/domainprefs.pm between versions 1.102.2.15 and 1.127

version 1.102.2.15, 2010/08/20 04:03:56 version 1.127, 2010/02/22 18:28:13
Line 202  sub handler { Line 202  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'],$dom);                  'serverstatuses','requestcourses','helpsettings',
                   'coursedefaults'],$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','coursecategories','serverstatuses');                         'requestcourses','coursecategories','serverstatuses','helpsettings',
                          'coursedefaults');
     my %prefs = (      my %prefs = (
         'rolecolors' =>          'rolecolors' =>
                    { text => 'Default color schemes',                     { text => 'Default color schemes',
Line 220  sub handler { Line 222  sub handler {
                                 {col1 => 'Administrator Settings',                                  {col1 => 'Administrator Settings',
                                  col2 => '',}],                                   col2 => '',}],
                     },                      },
         'login' =>            'login' =>
                     { text => 'Log-in page options',                      { text => 'Log-in page options',
                       help => 'Domain_Configuration_Login_Page',                        help => 'Domain_Configuration_Login_Page',
                       header => [{col1 => 'Item',                        header => [{col1 => 'Item',
                                   col2 => '',}],                                    col2 => '',}],
                     },                      },
   
         'defaults' =>           'defaults' => 
                     { text => 'Default authentication/language/timezone',                      { text => 'Default authentication/language/timezone',
                       help => 'Domain_Configuration_LangTZAuth',                        help => 'Domain_Configuration_LangTZAuth',
Line 233  sub handler { Line 236  sub handler {
                                   col2 => 'Value'}],                                    col2 => 'Value'}],
                     },                      },
         'quotas' =>           'quotas' => 
                     { text => 'User blogs, personal information pages, portfolios',                      { text => 'User blogs, personal information pages and portfolios',
                       help => 'Domain_Configuration_Quotas',                        help => 'Domain_Configuration_Quotas',
                       header => [{col1 => 'User affiliation',                        header => [{col1 => 'User affiliation',
                                   col2 => 'Available tools',                                    col2 => 'Available tools',
Line 250  sub handler { Line 253  sub handler {
                      help => 'Domain_Configuration_Auto_Updates',                       help => 'Domain_Configuration_Auto_Updates',
                      header => [{col1 => 'Setting',                       header => [{col1 => 'Setting',
                                  col2 => 'Value',},                                   col2 => 'Value',},
                                 {col1 => 'Setting',  
                                  col2 => 'Affiliation'},  
                                 {col1 => 'User population',                                  {col1 => 'User population',
                                  col2 => 'Updateable user data'}],                                   col2 => 'Updataeable user data'}],
                   },                    },
         'autocreate' =>           'autocreate' => 
                   {  text => 'Auto-course creation settings',                    { text => 'Auto-course creation settings',
                      help => 'Domain_Configuration_Auto_Creation',                       help => 'Domain_Configuration_Auto_Creation',
                      header => [{col1 => 'Configuration Setting',                       header => [{col1 => 'Configuration Setting',
                                  col2 => 'Value',}],                                   col2 => 'Value',}],
Line 326  sub handler { Line 327  sub handler {
                               col3 => 'Specific IPs',                                col3 => 'Specific IPs',
                             }],                              }],
                  },                   },
         'coursedefaults' =>          'helpsettings' =>
                    {text   => 'Help page settings',
                     help   => 'Domain_Configuration_Help_Settings',
                     header => [{col1 => 'Authenticated Help Settings',
                                 col2 => ''},
                                {col1 => 'Unauthenticated Help Settings',
                                 col2 => ''}],
                    },
           'coursedefaults' => 
                  {text => 'Course/Community defaults',                   {text => 'Course/Community defaults',
                   help => 'Domain_Configuration_Course_Defaults',                    help => 'Domain_Configuration_Course_Defaults',
                   header => [{col1 => 'Setting',                    header => [{col1 => 'Setting',
                               col2 => 'Value',}],                                col2 => 'Value',}],
                  },                   },
           'privacy' => 
                    {text   => 'User Privacy',
                     help   => 'Domain_Configuration_User_Privacy',
                     header => [{col1 => 'Setting',
                                 col2 => 'Value',}],
                    },
     );      );
     my %servers = &dom_servers($dom);      my %servers = &dom_servers($dom);
     if (keys(%servers) > 1) {      if (keys(%servers) > 1) {
Line 347  sub handler { Line 362  sub handler {
     my @actions = &Apache::loncommon::get_env_multiple('form.actions');      my @actions = &Apache::loncommon::get_env_multiple('form.actions');
     &Apache::lonhtmlcommon::add_breadcrumb      &Apache::lonhtmlcommon::add_breadcrumb
     ({href=>"javascript:changePage(document.$phase,'pickactions')",      ({href=>"javascript:changePage(document.$phase,'pickactions')",
       text=>"Settings to display/modify"});        text=>"Pick functionality"});
     my $confname = $dom.'-domainconfig';      my $confname = $dom.'-domainconfig';
     if ($phase eq 'process') {      if ($phase eq 'process') {
         &Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,\@roles);          &Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,\%prefs,\%domconfig,$confname,\@roles);
Line 430  sub process_changes { Line 445  sub process_changes {
         $output = &modify_serverstatuses($dom,%domconfig);          $output = &modify_serverstatuses($dom,%domconfig);
     } elsif ($action eq 'requestcourses') {      } elsif ($action eq 'requestcourses') {
         $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') {
           $output = &modify_coursedefaults($dom,%domconfig);
     }      }
     return $output;      return $output;
 }  }
Line 455  sub print_config_box { Line 474  sub print_config_box {
     }      }
     if ($numheaders > 1) {      if ($numheaders > 1) {
         my $colspan = '';          my $colspan = '';
         if (($action eq 'rolecolors') || ($action eq 'coursecategories')) {          if (($action eq 'rolecolors') || ($action eq 'coursecategories') || ($action eq 'helpsettings')) {
             $colspan = ' colspan="2"';              $colspan = ' colspan="2"';
         }          }
         $output .= '          $output .= '
Line 480  sub print_config_box { Line 499  sub print_config_box {
             $colspan = ' colspan="2"';              $colspan = ' colspan="2"';
         } elsif ($action eq 'requestcourses') {          } elsif ($action eq 'requestcourses') {
             $output .= &print_quotas($dom,$settings,\$rowtotal,$action);              $output .= &print_quotas($dom,$settings,\$rowtotal,$action);
         } else {          } elsif ($action eq 'helpsettings') {
               $output .= &print_helpsettings('top',$dom,$confname,$settings,\$rowtotal);
           } elsif ($action eq 'rolecolors') {
             $output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal);              $output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal);
         }          }
         $output .= '          $output .= '
Line 497  sub print_config_box { Line 518  sub print_config_box {
              </tr>';               </tr>';
             $rowtotal ++;              $rowtotal ++;
         if ($action eq 'autoupdate') {          if ($action eq 'autoupdate') {
             $output .= &print_autoupdate('middle',$dom,$settings,\$rowtotal).'              $output .= &print_autoupdate('bottom',$dom,$settings,\$rowtotal);
            </table>  
           </td>  
          </tr>  
          <tr>  
            <td>  
             <table class="LC_nested">  
              <tr class="LC_info_row">  
               <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>  
               <td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td>      </tr>'.  
             &print_autoupdate('bottom',$dom,$settings,\$rowtotal);  
             $rowtotal ++;  
         } elsif ($action eq 'usercreation') {          } elsif ($action eq 'usercreation') {
             $output .= &print_usercreation('middle',$dom,$settings,\$rowtotal).'              $output .= &print_usercreation('middle',$dom,$settings,\$rowtotal).'
            </table>             </table>
Line 532  sub print_config_box { Line 542  sub print_config_box {
             <table class="LC_nested">              <table class="LC_nested">
              <tr class="LC_info_row">               <tr class="LC_info_row">
               <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>                <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>
               <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_usermodification('bottom',$dom,$settings,\$rowtotal);                         &print_usermodification('bottom',$dom,$settings,\$rowtotal);
             $rowtotal ++;              $rowtotal ++;
         } elsif ($action eq 'coursecategories') {          } elsif ($action eq 'coursecategories') {
Line 541  sub print_config_box { Line 552  sub print_config_box {
             $output .= &print_login('bottom',$dom,$confname,$phase,$settings,\$rowtotal);              $output .= &print_login('bottom',$dom,$confname,$phase,$settings,\$rowtotal);
         } elsif ($action eq 'requestcourses') {          } elsif ($action eq 'requestcourses') {
             $output .= &print_courserequestmail($dom,$settings,\$rowtotal);              $output .= &print_courserequestmail($dom,$settings,\$rowtotal);
         } else {          } elsif ($action eq 'helpsettings') {
               $output .= &print_helpsettings('bottom',$dom,$confname,$settings,\$rowtotal);
           } elsif ($action eq 'rolecolors') {
             $output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).'              $output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).'
            </table>             </table>
           </td>            </td>
Line 627  sub print_config_box { Line 640  sub print_config_box {
             $output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);              $output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);
         } elsif ($action eq 'serverstatuses') {          } elsif ($action eq 'serverstatuses') {
             $output .= &print_serverstatuses($dom,$settings,\$rowtotal);              $output .= &print_serverstatuses($dom,$settings,\$rowtotal);
           } elsif ($action eq 'helpsettings') {
               $output .= &print_helpsettings('top',$dom,$confname,$settings,\$rowtotal);
       } elsif ($action eq 'coursedefaults') {
               $output .= &print_coursedefaults($dom,$settings,\$rowtotal);
         }          }
     }      }
     $output .= '      $output .= '
Line 641  sub print_login { Line 658  sub print_login {
     my ($position,$dom,$confname,$phase,$settings,$rowtotal) = @_;      my ($position,$dom,$confname,$phase,$settings,$rowtotal) = @_;
     my ($css_class,$datatable);      my ($css_class,$datatable);
     my %choices = &login_choices();      my %choices = &login_choices();
       my $itemcount = 1;
   
     if ($position eq 'top') {      if ($position eq 'top') {
         my %servers = &dom_servers($dom);          my %servers = &dom_servers($dom);
         my $choice = $choices{'disallowlogin'};          my $choice = $choices{'disallowlogin'};
         $css_class = ' class="LC_odd_row"';          $css_class = ' class="LC_odd_row"';
         $datatable .= '<tr'.$css_class.'><td>'.$choice.'</td>'.          $datatable .= '<tr'.$css_class.'><td>'.$choices{'disallowlogin'}.'</td>'.
                       '<td align="right"><table><tr><th>'.$choices{'hostid'}.'</th>'.                        '<td align="right"><table><tr><th>'.$choices{'hostid'}.'</th>'.
                       '<th>'.$choices{'server'}.'</th>'.                        '<th>'.$choices{'serverurl'}.'</th></tr>'."\n";
                       '<th>'.$choices{'serverpath'}.'</th>'.  
                       '<th>'.$choices{'custompath'}.'</th>'.  
                       '<th><span class="LC_nobreak">'.$choices{'exempt'}.'</span></th></tr>'."\n";  
         my %disallowed;          my %disallowed;
         if (ref($settings) eq 'HASH') {          if (ref($settings) eq 'HASH') {
             if (ref($settings->{'loginvia'}) eq 'HASH') {              if (ref($settings->{'loginvia'}) eq 'HASH') {
Line 660  sub print_login { Line 675  sub print_login {
         }          }
         foreach my $lonhost (sort(keys(%servers))) {          foreach my $lonhost (sort(keys(%servers))) {
             my $direct = 'selected="selected"';              my $direct = 'selected="selected"';
             if (ref($disallowed{$lonhost}) eq 'HASH') {              if ($disallowed{$lonhost} eq '') {
                 if ($disallowed{$lonhost}{'server'} ne '') {                  $direct = '';
                     $direct = '';  
                 }  
             }              }
             $datatable .= '<tr><td>'.$servers{$lonhost}.'</td>'.              $datatable .= '<tr><td>'.$servers{$lonhost}.'</td>'.
                           '<td><select name="'.$lonhost.'_server">'.                            '<td><select name="'.$lonhost.'_serverurl">'.
                           '<option value=""'.$direct.'>'.$choices{'directlogin'}.                            '<option value=""'.$direct.'>'.$choices{'directlogin'}.
                           '</option>';                            '</option>';
             foreach my $hostid (keys(%servers)) {              foreach my $hostid (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 ($hostid eq $disallowed{$lonhost}) {
                     if ($hostid eq $disallowed{$lonhost}{'server'}) {                      $selected = 'selected="selected"';
                         $selected = 'selected="selected"';  
                     }  
                 }                  }
                 $datatable .= '<option value="'.$hostid.'"'.$selected.'>'.                  $datatable .= '<option value="'.$hostid.'"'.$selected.'>'.
                               $servers{$hostid}.'</option>';                                $servers{$hostid}.'</option>';
             }              }
             $datatable .= '</select></td>'.              $datatable .= '</select></td></tr>';
                           '<td><select name="'.$lonhost.'_serverpath">';  
             foreach my $path ('','/','/adm/login','/adm/roles','custom') {  
                 my $pathname = $path;  
                 if ($path eq 'custom') {  
                     $pathname = &mt('Custom Path').' ->';  
                 }  
                 my $selected = '';  
                 if (ref($disallowed{$lonhost}) eq 'HASH') {  
                     if ($path eq $disallowed{$lonhost}{'serverpath'}) {  
                         $selected = 'selected="selected"';  
                     }  
                 } elsif ($path eq '') {  
                     $selected = 'selected="selected"';  
                 }  
                 $datatable .= '<option value="'.$path.'"'.$selected.'>'.$pathname.'</option>';  
             }  
             $datatable .= '</select></td>';  
             my ($custom,$exempt);  
             if (ref($disallowed{$lonhost}) eq 'HASH') {  
                 $custom = $disallowed{$lonhost}{'custompath'};  
                 $exempt = $disallowed{$lonhost}{'exempt'};  
             }  
             $datatable .= '<td><input type="text" name="'.$lonhost.'_custompath" size="6" value="'.$custom.'" /></td>'.  
                           '<td><input type="text" name="'.$lonhost.'_exempt" size="8" value="'.$exempt.'" /></td>'.  
                           '</tr>';  
         }          }
         $datatable .= '</table></td></tr>';          $datatable .= '</table></td></tr>';
         return $datatable;          return $datatable;
Line 846  sub login_choices { Line 832  sub login_choices {
     my %choices =      my %choices =
         &Apache::lonlocal::texthash (          &Apache::lonlocal::texthash (
             coursecatalog => 'Display Course/Community Catalog link?',              coursecatalog => 'Display Course/Community Catalog link?',
             adminmail => "Display Administrator's E-mail Address?",              adminmail     => "Display Administrator's E-mail Address?",
             disallowlogin => "Login page requests redirected",              disallowlogin => "Login page requests redirected",
             hostid        => "Server",              hostid        => "Server",
             server        => "Redirect to:",              serverurl     => "Redirect to log-in via:",
             serverpath    => "Path",  
             custompath    => "Custom",  
             exempt        => "Exempt IP(s)",  
             directlogin   => "No redirect",              directlogin   => "No redirect",
             newuser   => "Link to create a user account",              newuser       => "Link to create a user account",
             img => "Header",              img           => "Header",
             logo => "Main Logo",              logo          => "Main Logo",
             domlogo => "Domain Logo",              domlogo       => "Domain Logo",
             login => "Log-in Header",               login         => "Log-in Header", 
             textcol => "Text color",              textcol       => "Text color",
             bgcol   => "Box color",              bgcol         => "Box color",
             bgs => "Background colors",              bgs           => "Background colors",
             links => "Link colors",              links         => "Link colors",
             font => "Font color",              font          => "Font color",
             pgbg => "Header",              pgbg          => "Header",
             mainbg => "Page",              mainbg        => "Page",
             sidebg => "Login box",              sidebg        => "Login box",
             link => "Link",              link          => "Link",
             alink => "Active link",              alink         => "Active link",
             vlink => "Visited link",              vlink         => "Visited link",
         );          );
     return %choices;      return %choices;
 }  }
Line 887  sub print_rolecolors { Line 870  sub print_rolecolors {
     my %defaults = (      my %defaults = (
                    img => $defaultdesign{$role.'.img'},                     img => $defaultdesign{$role.'.img'},
                    font => $defaultdesign{$role.'.font'},                     font => $defaultdesign{$role.'.font'},
      fontmenu => $defaultdesign{$role.'.fontmenu'},
                    );                     );
     foreach my $item (@bgs) {      foreach my $item (@bgs) {
         $defaults{'bgs'}{$item} = $defaultdesign{$role.'.'.$item};          $defaults{'bgs'}{$item} = $defaultdesign{$role.'.'.$item};
Line 904  sub print_rolecolors { Line 888  sub print_rolecolors {
                 $designs{'font'} = $settings->{$role}->{'font'};                  $designs{'font'} = $settings->{$role}->{'font'};
                 $is_custom{'font'} = 1;                  $is_custom{'font'} = 1;
             }              }
               if ($settings->{$role}->{'fontmenu'} ne '') {
                   $designs{'fontmenu'} = $settings->{$role}->{'fontmenu'};
                   $is_custom{'fontmenu'} = 1;
               }
             foreach my $item (@bgs) {              foreach my $item (@bgs) {
                 if ($settings->{$role}->{$item} ne '') {                  if ($settings->{$role}->{$item} ne '') {
                     $designs{'bgs'}{$item} = $settings->{$role}->{$item};                      $designs{'bgs'}{$item} = $settings->{$role}->{$item};
Line 922  sub print_rolecolors { Line 910  sub print_rolecolors {
             $designs{img} = $designhash{$dom.'.'.$role.'.img'};              $designs{img} = $designhash{$dom.'.'.$role.'.img'};
             $is_custom{'img'} = 1;              $is_custom{'img'} = 1;
         }          }
           if ($designhash{$dom.'.'.$role.'.fontmenu'} ne '') {
               $designs{fontmenu} = $designhash{$dom.'.'.$role.'.fontmenu'};
               $is_custom{'fontmenu'} = 1; 
           }
         if ($designhash{$dom.'.'.$role.'.font'} ne '') {          if ($designhash{$dom.'.'.$role.'.font'} ne '') {
             $designs{font} = $designhash{$dom.'.'.$role.'.font'};              $designs{font} = $designhash{$dom.'.'.$role.'.font'};
             $is_custom{'font'} = 1;              $is_custom{'font'} = 1;
Line 950  sub display_color_options { Line 942  sub display_color_options {
     my ($dom,$confname,$phase,$role,$itemcount,$choices,$is_custom,$defaults,$designs,      my ($dom,$confname,$phase,$role,$itemcount,$choices,$is_custom,$defaults,$designs,
         $images,$bgs,$links,$alt_text,$rowtotal,$logintext,$loginheader) = @_;          $images,$bgs,$links,$alt_text,$rowtotal,$logintext,$loginheader) = @_;
     my $css_class = $itemcount%2?' class="LC_odd_row"':'';      my $css_class = $itemcount%2?' class="LC_odd_row"':'';
     my $datatable = '<tr'.$css_class.'>'.      my $datatable = '<tr>'.
         '<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 964  sub display_color_options { Line 956  sub display_color_options {
                   '&nbsp;<span id="css_'.$role.'_font" style="background-color: '.                    '&nbsp;<span id="css_'.$role.'_font" style="background-color: '.
                   $designs->{'font'}.';">&nbsp;&nbsp;&nbsp;</span>'.                    $designs->{'font'}.';">&nbsp;&nbsp;&nbsp;</span>'.
                   '</span></td></tr>';                    '</span></td></tr>';
       unless ($role eq 'login') { 
           $datatable .= '<tr'.$css_class.'>'.
                         '<td>'.$choices->{'fontmenu'}.'</td>';
           if (!$is_custom->{'fontmenu'}) {
               $datatable .=  '<td>'.&mt('Default in use:').'&nbsp;<span id="css_default_'.$role.'_font" style="color: '.$defaults->{'fontmenu'}.';">'.$defaults->{'fontmenu'}.'</span></td>';
           } else {
               $datatable .= '<td>&nbsp;</td>';
           }
           $fontlink = &color_pick($phase,$role,'fontmenu',$choices->{'fontmenu'},$designs->{'fontmenu'});
           $datatable .= '<td><span class="LC_nobreak">'.
                         '<input type="text" size="10" name="'.$role.'_fontmenu"'.
                         ' value="'.$designs->{'fontmenu'}.'" />&nbsp;'.$fontlink.
                         '&nbsp;<span id="css_'.$role.'_fontmenu" style="background-color: '.
                         $designs->{'fontmenu'}.';">&nbsp;&nbsp;&nbsp;</span>'.
                         '</span></td></tr>';
       }
     my $switchserver = &check_switchserver($dom,$confname);      my $switchserver = &check_switchserver($dom,$confname);
     foreach my $img (@{$images}) {      foreach my $img (@{$images}) {
  $itemcount ++;   $itemcount ++;
Line 1350  sub print_quotas { Line 1358  sub print_quotas {
                 if ($context eq 'requestcourses') {                  if ($context eq 'requestcourses') {
                     $datatable .= '</tr><tr>';                      $datatable .= '</tr><tr>';
                     foreach my $item (@usertools) {                      foreach my $item (@usertools) {
                         $datatable .= '<td style="vertical-align: top;">'.$cell{$item}.'</td>';                            $datatable .= '<td style="vertical-align: top">'.$cell{$item}.'</td>';  
                     }                      }
                     $datatable .= '</tr></table>';                      $datatable .= '</tr></table>';
                 }                  }
Line 1456  sub print_quotas { Line 1464  sub print_quotas {
     if ($context eq 'requestcourses') {      if ($context eq 'requestcourses') {
         $datatable .= '</tr><tr>';          $datatable .= '</tr><tr>';
         foreach my $item (@usertools) {          foreach my $item (@usertools) {
             $datatable .= '<td style="vertical-align: top;">'.$defcell{$item}.'</td>';              $datatable .= '<td style="vertical-align: top">'.$defcell{$item}.'</td>';
         }          }
         $datatable .= '</tr></table>';          $datatable .= '</tr></table>';
     }      }
Line 1559  sub print_quotas { Line 1567  sub print_quotas {
     if ($context eq 'requestcourses') {      if ($context eq 'requestcourses') {
         $datatable .= '</tr><tr>';          $datatable .= '</tr><tr>';
         foreach my $item (@usertools) {          foreach my $item (@usertools) {
             $datatable .= '<td style="vertical-align: top;">'.$advcell{$item}.'</td>';              $datatable .= '<td style="vertical-align: top">'.$advcell{$item}.'</td>';
         }          }
         $datatable .= '</tr></table>';          $datatable .= '</tr></table>';
     }      }
Line 1649  sub print_courserequestmail { Line 1657  sub print_courserequestmail {
 sub print_autoenroll {  sub print_autoenroll {
     my ($dom,$settings,$rowtotal) = @_;      my ($dom,$settings,$rowtotal) = @_;
     my $autorun = &Apache::lonnet::auto_run(undef,$dom),      my $autorun = &Apache::lonnet::auto_run(undef,$dom),
     my ($defdom,$runon,$runoff,$coownerson,$coownersoff);      my ($defdom,$runon,$runoff);
     if (ref($settings) eq 'HASH') {      if (ref($settings) eq 'HASH') {
         if (exists($settings->{'run'})) {          if (exists($settings->{'run'})) {
             if ($settings->{'run'} eq '0') {              if ($settings->{'run'} eq '0') {
Line 1668  sub print_autoenroll { Line 1676  sub print_autoenroll {
                 $runon = ' ';                  $runon = ' ';
             }              }
         }          }
         if (exists($settings->{'co-owners'})) {  
             if ($settings->{'co-owners'} eq '0') {  
                 $coownersoff = ' checked="checked" ';  
                 $coownerson = ' ';  
             } else {  
                 $coownerson = ' checked="checked" ';  
                 $coownersoff = ' ';  
             }  
         } else {  
             $coownersoff = ' checked="checked" ';  
             $coownerson = ' ';  
         }  
         if (exists($settings->{'sender_domain'})) {          if (exists($settings->{'sender_domain'})) {
             $defdom = $settings->{'sender_domain'};              $defdom = $settings->{'sender_domain'};
         }          }
Line 1710  sub print_autoenroll { Line 1706  sub print_autoenroll {
                   &mt('username').':&nbsp;'.                    &mt('username').':&nbsp;'.
                   '<input type="text" name="sender_uname" value="'.                    '<input type="text" name="sender_uname" value="'.
                   $notif_sender.'" size="10" />&nbsp;&nbsp;'.&mt('domain').                    $notif_sender.'" size="10" />&nbsp;&nbsp;'.&mt('domain').
                   ':&nbsp;'.$domform.'</span></td></tr>'.                    ':&nbsp;'.$domform.'</span></td></tr>';
                   '<tr class="LC_odd_row">'.      $$rowtotal += 2;
                   '<td>'.&mt('Automatically assign co-ownership').'</td>'.  
                   '<td class="LC_right_item"><span class="LC_nobreak"><label>'.  
                   '<input type="radio" name="autoassign_coowners"'.  
                   $coownerson.' value="1" />'.&mt('Yes').'</label>&nbsp;'.  
                   '<label><input type="radio" name="autoassign_coowners"'.  
                   $coownersoff.' value="0" />'.&mt('No').'</label></span></td>'.  
                   '</tr>';  
     $$rowtotal += 3;  
     return $datatable;      return $datatable;
 }  }
   
Line 1761  sub print_autoupdate { Line 1749  sub print_autoupdate {
                   $classlistsoff.'value="0" />'.&mt('No').'</label></span></td>'.                    $classlistsoff.'value="0" />'.&mt('No').'</label></span></td>'.
                   '</tr>';                    '</tr>';
         $$rowtotal += 2;          $$rowtotal += 2;
     } elsif ($position eq 'middle') {  
         my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);  
         my $numinrow = 3;  
         my $locknamesettings;  
         $datatable .= &insttypes_row($settings,$types,$usertypes,  
                                      $dom,$numinrow,$othertitle,  
                                     'lockablenames');  
         $$rowtotal ++;  
     } else {      } else {
         my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);          my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
         my @fields = ('lastname','firstname','middlename','generation',          my @fields = ('lastname','firstname','middlename','gen',
                       'permanentemail','id');                        'permanentemail','id');
         my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles();          my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles();
         my $numrows = 0;          my $numrows = 0;
Line 1826  sub print_autocreate { Line 1806  sub print_autocreate {
     my ($numdc,$dctable) = &active_dc_picker($dom,$curr_dc);      my ($numdc,$dctable) = &active_dc_picker($dom,$curr_dc);
     if ($numdc > 1) {      if ($numdc > 1) {
         $datatable .= '</td><tr><td>'.          $datatable .= '</td><tr><td>'.
                       &mt('XML files processed as: (choose Dom. Coord.)').                        &mt('XML files processed as: (choose Dom. Coord.)'). 
                       '</td><td class="LC_left_item">'.$dctable.'</td></tr>'.                        '</td><td class="LC_left_item">'.$dctable.'</td></tr>'.
                       '<tr class="LC_odd_row">';                        '<tr class="LC_odd_row">';
         $$rowtotal ++ ;          $$rowtotal ++ ;
Line 1960  sub print_contacts { Line 1940  sub print_contacts {
     my ($dom,$settings,$rowtotal) = @_;      my ($dom,$settings,$rowtotal) = @_;
     my $datatable;      my $datatable;
     my @contacts = ('adminemail','supportemail');      my @contacts = ('adminemail','supportemail');
     my (%checked,%to,%otheremails,%bccemails);      my (%checked,%to,%otheremails);
     my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail',      my @mailings = ('errormail','packagesmail','lonstatusmail','helpdeskmail',
                     'requestsmail');                      'requestsmail');
     foreach my $type (@mailings) {      foreach my $type (@mailings) {
         $otheremails{$type} = '';          $otheremails{$type} = '';
     }      }
     $bccemails{'helpdeskmail'} = '';  
     if (ref($settings) eq 'HASH') {      if (ref($settings) eq 'HASH') {
         foreach my $item (@contacts) {          foreach my $item (@contacts) {
             if (exists($settings->{$item})) {              if (exists($settings->{$item})) {
Line 1982  sub print_contacts { Line 1961  sub print_contacts {
                         }                          }
                     }                      }
                     $otheremails{$type} = $settings->{$type}{'others'};                      $otheremails{$type} = $settings->{$type}{'others'};
                     if ($type eq 'helpdeskmail') {  
                         $bccemails{$type} = $settings->{$type}{'bcc'};  
                     }  
                 }                  }
             } elsif ($type eq 'lonstatusmail') {              } elsif ($type eq 'lonstatusmail') {
                 $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" ';                  $checked{'lonstatusmail'}{'adminemail'} = ' checked="checked" ';
Line 2028  sub print_contacts { Line 2004  sub print_contacts {
         }          }
         $datatable .= '</span><br />'.&mt('Others').':&nbsp;&nbsp;'.          $datatable .= '</span><br />'.&mt('Others').':&nbsp;&nbsp;'.
                       '<input type="text" name="'.$type.'_others" '.                        '<input type="text" name="'.$type.'_others" '.
                       'value="'.$otheremails{$type}.'"  />';                        'value="'.$otheremails{$type}.'"  />'.
         if ($type eq 'helpdeskmail') {                        '</td></tr>'."\n";
             $datatable .= '<br />'.&mt('Bcc:').('&nbsp;'x6).  
                           '<input type="text" name="'.$type.'_bcc" '.  
                           'value="'.$bccemails{$type}.'"  />';  
         }  
         $datatable .= '</td></tr>'."\n";  
     }      }
     $$rowtotal += $rownum;      $$rowtotal += $rownum;
     return $datatable;      return $datatable;
 }  }
   
   sub print_helpsettings {
   
    my ($position,$dom,$confname,$settings,$rowtotal) = @_;
    my ($css_class,$datatable);
   
    my $switchserver = &check_switchserver($dom,$confname);
   
    my $itemcount = 1;
   
    if ($position eq 'top') {
   
    my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles);
   
    %choices =
    &Apache::lonlocal::texthash (
    submitbugs => 'Display &quot;Submit a bug&quot; link?',
    );
   
    %defaultchecked = ('submitbugs' => 'on');
   
    @toggles = ('submitbugs',);
   
    foreach my $item (@toggles) {
    if ($defaultchecked{$item} eq 'on') { 
    $checkedon{$item} = ' checked="checked" ';
    $checkedoff{$item} = ' ';
    } elsif ($defaultchecked{$item} eq 'off') {
    $checkedoff{$item} = ' checked="checked" ';
    $checkedon{$item} = ' ';
    }
    }
   
    if (ref($settings) eq 'HASH') {
    foreach my $item (@toggles) {
    if ($settings->{$item} eq '1') {
    $checkedon{$item} =  ' checked="checked" ';
    $checkedoff{$item} = ' ';
    } elsif ($settings->{$item} eq '0') {
    $checkedoff{$item} =  ' checked="checked" ';
    $checkedon{$item} = ' ';
    }
    }
    }
   
    foreach my $item (@toggles) {
    $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
    $datatable .=  
    '<tr'.$css_class.'>
    <td><span class="LC_nobreak">'.$choices{$item}.'</span></td>
    <td><span class="LC_nobreak">&nbsp;</span></td>
    <td class="LC_right_item"><span class="LC_nobreak">
    <label><input type="radio" name="'.$item.'" '.$checkedon{$item}.' value="1" />'.&mt('Yes').'</label>&nbsp;
    <label><input type="radio" name="'.$item.'" '.$checkedoff{$item}.' value="0" />'.&mt('No').'</label>'.
    '</span></td>'.
    '</tr>';
    $itemcount ++;
    }
        
        } else {
        
         $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
        
         $datatable .= '<tr'.$css_class.'>';
        
         if (ref($settings) eq 'HASH') {
    if ($settings->{'loginhelpurl'} ne '') {
    my($directory, $filename) = $settings->{'loginhelpurl'} =~ m/(.*\/)(.*)$/;
    $datatable .= '<td width="33%"><span class="LC_left_item"><label><a href="'.$settings->{'loginhelpurl'}.'" target="_blank">'.&mt('Custom Login Page Help File In Use').'</a></label></span></td>';
    $datatable .= '<td width="33%"><span class="LC_right_item"><label><input type="checkbox" name="loginhelpurl_del" value="1" />'.&mt('Delete?').'</label></span></td>'
    } else {
    $datatable .= '<td width="33%"><span class="LC_left_item"><label>'.&mt('Default Login Page Help File In Use').'</label></span></td>';
    $datatable .= '<td width="33%"><span class="LC_right_item">&nbsp;</span></td>';
    }
    } else {
    $datatable .= '<td><span class="LC_left_item">&nbsp;</span></td>';
    $datatable .= '<td><span class="LC_right_item">&nbsp;</span></td>';
    }
      
         $datatable .= '<td width="33%"><span class="LC_right_item">';
         if ($switchserver) {
               $datatable .= &mt('Upload to library server: [_1]',$switchserver);
           } else {
           $datatable .= &mt('Upload Custom Login Page Help File:');
               $datatable .='<input type="file" name="loginhelpurl" />';
           }
           $datatable .= '</span></td></tr>';
           
        }
        
        return $datatable;
   
   }
   
   
 sub radiobutton_prefs {  sub radiobutton_prefs {
     my ($settings,$toggles,$defaultchecked,$choices,$itemcount) = @_;      my ($settings,$toggles,$defaultchecked,$choices,$itemcount) = @_;
     return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') &&      return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') &&
Line 2146  sub courserequest_titles { Line 2211  sub courserequest_titles {
   
 sub courserequest_conditions {  sub courserequest_conditions {
     my %conditions = &Apache::lonlocal::texthash (      my %conditions = &Apache::lonlocal::texthash (
        approval   => '(Processing of request subject to approval by Domain Coordinator).',         approval    => '(Processing of request subject to approval by Domain Coordinator).',
        validate   => '(Processing of request subject to instittutional validation).',         validate   => '(Processing of request subject to instittutional validation).',
                  );                   );
     return %conditions;      return %conditions;
Line 2642  sub print_scantronformat { Line 2707  sub print_scantronformat {
                       '<span class="LC_nobreak">';                        '<span class="LC_nobreak">';
         if ($scantronurl) {          if ($scantronurl) {
             $datatable .= '<a href="'.$scantronurl.'" target="_blank">'.              $datatable .= '<a href="'.$scantronurl.'" target="_blank">'.
                           &mt('Default bubblesheet format file').'</a>';                            &mt('Default scantron format file').'</a>';
         } else {          } else {
             $datatable = &mt('File unavailable for display');              $datatable = &mt('File unavailable for display');
         }          }
Line 2669  sub print_scantronformat { Line 2734  sub print_scantronformat {
         } elsif ($scantronurl) {          } elsif ($scantronurl) {
             $datatable .= '<td><span class="LC_nobreak">'.              $datatable .= '<td><span class="LC_nobreak">'.
                           '<a href="'.$scantronurl.'" target="_blank">'.                            '<a href="'.$scantronurl.'" target="_blank">'.
                           &mt('Custom bubblesheet format file').'</a><label>'.                            &mt('Custom scantron format file').'</a><label>'.
                           '<input type="checkbox" name="scantronformat_del"'.                            '<input type="checkbox" name="scantronformat_del"'.
                           '" value="1" />'.&mt('Delete?').'</label></span></td>'.                            '" value="1" />'.&mt('Delete?').'</label></span></td>'.
                           '<td><span class="LC_nobreak">&nbsp;'.                            '<td><span class="LC_nobreak">&nbsp;'.
Line 2698  sub legacy_scantronformat { Line 2763  sub legacy_scantronformat {
             &publishlogo($r,'copy',$legacyfile,$dom,$confname,'scantron',              &publishlogo($r,'copy',$legacyfile,$dom,$confname,'scantron',
                          '','',$newfile);                           '','',$newfile);
         if ($result ne 'ok') {          if ($result ne 'ok') {
             $error = &mt("An error occurred publishing the [_1] bubblesheet format file in RES space. Error was: [_2].",$newfile,$result);              $error = &mt("An error occurred publishing the [_1] scantron format file in RES space. Error was: [_2].",$newfile,$result);
         }          }
     }      }
     return ($url,$error);      return ($url,$error);
Line 2742  sub print_coursecategories { Line 2807  sub print_coursecategories {
                      categorizecomm => 'Assign a category to a community',                       categorizecomm => 'Assign a category to a community',
                     );                      );
         my %level = &Apache::lonlocal::texthash (          my %level = &Apache::lonlocal::texthash (
                      dom => 'Set in Domain',                       dom  => 'Set in Domain',
                      crs => 'Set in Course',                          crs  => 'Set in Course',
                      comm => 'Set in Community',                       comm => 'Set in Community',
                     );                      );
         $datatable = '<tr class="LC_odd_row">'.          $datatable = '<tr class="LC_odd_row">'.
Line 2802  sub print_coursecategories { Line 2867  sub print_coursecategories {
                           communities => &mt('Communities'),                            communities => &mt('Communities'),
                     );                      );
   
                     if ((!grep(/^instcode$/,@{$cats[0]})) ||                      if ((!grep(/^instcode$/,@{$cats[0]})) || 
                         ($cathash->{'instcode::0'} eq '') ||                          ($cathash->{'instcode::0'} eq '') ||
                         (!grep(/^communities$/,@{$cats[0]})) ||                          (!grep(/^communities$/,@{$cats[0]})) || 
                         ($cathash->{'communities::0'} eq '')) {                          ($cathash->{'communities::0'} eq '')) {
                         $maxnum ++;                          $maxnum ++;
                     }                      }
Line 2898  sub print_coursecategories { Line 2963  sub print_coursecategories {
                                           '<td><span class="LC_nobreak">'.                                            '<td><span class="LC_nobreak">'.
                                           $default_names{$default}.'</span>';                                            $default_names{$default}.'</span>';
                             if ($default eq 'instcode') {                              if ($default eq 'instcode') {
                                 $datatable .= '<br /><span class="LC_nobreak">('                                  $datatable .= '<br /><span class="LC_nobreak">(' 
                                               .&mt('with institutional codes').')</span>';                                                .&mt('with institutional codes').')</span>';
                             }                              }
                             $datatable .= '</td>'                              $datatable .= '</td>'
Line 2997  sub coursecategories_javascript { Line 3062  sub coursecategories_javascript {
     }      }
     my $instcode_reserved = &mt('The name: "instcode" is a reserved category');      my $instcode_reserved = &mt('The name: "instcode" is a reserved category');
     my $communities_reserved = &mt('The name: "communities" is a reserved category');      my $communities_reserved = &mt('The name: "communities" is a reserved category');
     my $choose_again = '\\n'.&mt('Please use a different name for the new top level category');      my $choose_again = '\\n'.&mt('Please use a different name for the new top level category'); 
     $output = <<"ENDSCRIPT";      $output = <<"ENDSCRIPT";
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA[  // <![CDATA[
Line 3278  sub insttypes_row { Line 3343  sub insttypes_row {
     my %lt = &Apache::lonlocal::texthash (      my %lt = &Apache::lonlocal::texthash (
                       cansearch => 'Users allowed to search',                        cansearch => 'Users allowed to search',
                       statustocreate => 'Institutional affiliation(s) able to create own account (login/SSO)',                        statustocreate => 'Institutional affiliation(s) able to create own account (login/SSO)',
                       lockablenames => 'User preference to lock name',  
              );               );
     my $showdom;      my $showdom;
     if ($context eq 'cansearch') {      if ($context eq 'cansearch') {
Line 3315  sub insttypes_row { Line 3379  sub insttypes_row {
                            $usertypes->{$types->[$i]}.'</label></span></td>';                             $usertypes->{$types->[$i]}.'</label></span></td>';
             }              }
         }          }
          
         $rem = @{$types}%($numinrow);          $rem = @{$types}%($numinrow);
     }      }
     my $colsleft = $numinrow - $rem;      my $colsleft = $numinrow - $rem;
     if (($rem == 0) && (@{$types} > 0)) {  
         $output .= '<tr>';  
     }  
     if ($colsleft > 1) {      if ($colsleft > 1) {
         $output .= '<td colspan="'.$colsleft.'" class="LC_left_item">';          $output .= '<td colspan="'.$colsleft.'" class="LC_left_item">';
     } else {      } else {
Line 3444  sub modify_login { Line 3506  sub modify_login {
     }      }
   
     my %servers = &dom_servers($dom);      my %servers = &dom_servers($dom);
     my @loginvia_attribs = ('serverpath','custompath','exempt');  
     if (keys(%servers) > 1) {      if (keys(%servers) > 1) {
         foreach my $lonhost (keys(%servers)) {          foreach my $lonhost (keys(%servers)) {
             next if ($env{'form.'.$lonhost.'_server'} eq $lonhost);              next if ($env{'form.'.$lonhost.'_serverurl'} eq $lonhost);
             if (ref($curr_loginvia{$lonhost}) eq 'HASH') {              if ($env{'form.'.$lonhost.'_serverurl'} eq $curr_loginvia{$lonhost}) {
                 if ($env{'form.'.$lonhost.'_server'} eq $curr_loginvia{$lonhost}{'server'}) {                  $loginhash{login}{loginvia}{$lonhost} = $curr_loginvia{$lonhost};                next;
                     $loginhash{login}{loginvia}{$lonhost}{'server'} = $curr_loginvia{$lonhost}{'server'};              }
                 } elsif ($curr_loginvia{$lonhost}{'server'} ne '') {              if ($curr_loginvia{$lonhost} ne '') {
                     if (defined($servers{$env{'form.'.$lonhost.'_server'}})) {                  $loginhash{login}{loginvia}{$lonhost} = $env{'form.'.$lonhost.'_serverurl'};
                         $loginhash{login}{loginvia}{$lonhost}{'server'} = $env{'form.'.$lonhost.'_server'};                  $changes{'loginvia'}{$lonhost} = 1;
                         $changes{'loginvia'}{$lonhost} = 1;  
                     } else {  
                         $loginhash{login}{loginvia}{$lonhost}{'server'} = '';  
                         $changes{'loginvia'}{$lonhost} = 1;  
                     }  
                 } else {  
                     if (defined($servers{$env{'form.'.$lonhost.'_server'}})) {  
                         $loginhash{login}{loginvia}{$lonhost}{'server'} = $env{'form.'.$lonhost.'_server'};  
                         $changes{'loginvia'}{$lonhost} = 1;  
                     }  
                 }  
                 if ($loginhash{login}{loginvia}{$lonhost}{'server'} eq '') {  
                     foreach my $item (@loginvia_attribs) {  
                         $loginhash{login}{loginvia}{$lonhost}{$item} = '';  
                     }  
                 } else {  
                     foreach my $item (@loginvia_attribs) {  
                         my $new = $env{'form.'.$lonhost.'_'.$item};  
                         if (($item eq 'serverpath') && ($new eq 'custom')) {  
                             $env{'form.'.$lonhost.'_custompath'} =~ s/\s+//g;  
                             if ($env{'form.'.$lonhost.'_custompath'} eq '') {  
                                 $new = '/';  
                             }  
                         }  
                         if (($item eq 'custompath') &&  
                             ($env{'form.'.$lonhost.'_serverpath'} ne 'custom')) {  
                             $new = '';  
                         }  
                         if ($new ne $curr_loginvia{$lonhost}{$item}) {  
                             $changes{'loginvia'}{$lonhost} = 1;  
                         }  
                         if ($item eq 'exempt') {  
                             $new =~ s/^\s+//;  
                             $new =~ s/\s+$//;  
                             my @poss_ips = split(/\s*[,:]\s*/,$new);  
                             my @okips;  
                             foreach my $ip (@poss_ips) {  
                                 if ($ip =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {  
                                     if (($1 <= 255) && ($2 <= 255) && ($3 <= 255) && ($4 <= 255)) {  
                                         push(@okips,$ip);  
                                     }  
                                 }  
                             }  
                             if (@okips > 0) {  
                                 $new = join(',',@okips);  
                             } else {  
                                 $new = '';  
                             }  
                         }  
   
                         $loginhash{login}{loginvia}{$lonhost}{$item} = $new;  
                     }  
                 }  
             } else {              } else {
                 if (defined($servers{$env{'form.'.$lonhost.'_server'}})) {                  if (defined($servers{$env{'form.'.$lonhost.'_serverurl'}})) {
                     $loginhash{login}{loginvia}{$lonhost}{'server'} = $env{'form.'.$lonhost.'_server'};                      $loginhash{login}{loginvia}{$lonhost} = $env{'form.'.$lonhost.'_serverurl'};
                     $changes{'loginvia'}{$lonhost} = 1;                      $changes{'loginvia'}{$lonhost} = 1;
                     foreach my $item (@loginvia_attribs) {  
                         my $new = $env{'form.'.$lonhost.'_'.$item};  
                         if (($item eq 'serverpath') && ($new eq 'custom')) {  
                             if ($env{'form.'.$lonhost.'_custompath'} eq '') {  
                                 $new = '/';  
                             }  
                         }  
                         if (($item eq 'custompath') &&  
                             ($env{'form.'.$lonhost.'_serverpath'} ne 'custom')) {  
                             $new = '';  
                         }  
                         $loginhash{login}{loginvia}{$lonhost}{$item} = $new;  
                     }  
                 }                  }
             }              }
         }          }
Line 3579  sub modify_login { Line 3574  sub modify_login {
                     if (ref($changes{$item}) eq 'HASH') {                      if (ref($changes{$item}) eq 'HASH') {
                         $resulttext .= '<li>'.&mt('Log-in page availability:').'<ul>';                          $resulttext .= '<li>'.&mt('Log-in page availability:').'<ul>';
                         foreach my $lonhost (sort(keys(%{$changes{$item}}))) {                          foreach my $lonhost (sort(keys(%{$changes{$item}}))) {
                             if (defined($servers{$loginhash{login}{loginvia}{$lonhost}{'server'}})) {                              if ($servers{$env{'form.'.$lonhost.'_serverurl'}} ne '') {
                                 if (ref($loginhash{login}{loginvia}{$lonhost}) eq 'HASH') {                                  $resulttext .= '<li>'.&mt('Server: [_1] log-in page now redirects to [_2]',$lonhost,$servers{$env{'form.'.$lonhost.'_serverurl'}}).'</li>';
                                     my $protocol = $Apache::lonnet::protocol{$env{'form.'.$lonhost.'_server'}};  
                                     $protocol = 'http' if ($protocol ne 'https');  
                                     my $target = $protocol.'://'.$servers{$env{'form.'.$lonhost.'_server'}};  
   
                                     if ($loginhash{login}{loginvia}{$lonhost}{'serverpath'} eq 'custom') {  
                                         $target .= $loginhash{login}{loginvia}{$lonhost}{'custompath'};  
                                     } else {  
                                         $target .= $loginhash{login}{loginvia}{$lonhost}{'serverpath'};  
                                     }  
                                     $resulttext .= '<li>'.&mt('Server: [_1] log-in page redirects to [_2].',$servers{$lonhost},'<a href="'.$target.'">'.$target.'</a>');  
                                     if ($loginhash{login}{loginvia}{$lonhost}{'exempt'} ne '') {  
                                         $resulttext .= '&nbsp;'.&mt('No redirection for clients from following IPs:').'&nbsp;'.$loginhash{login}{loginvia}{$lonhost}{'exempt'};  
                                     }  
                                     $resulttext .= '</li>';  
                                 } else {  
                                     $resulttext .= '<li>'.&mt('Server: [_1] has standard log-in page.',$lonhost).'</li>';  
                                 }  
                             } else {                              } else {
                                 $resulttext .= '<li>'.&mt('Server: [_1] has standard log-in page.',$servers{$lonhost}).'</li>';                                  $resulttext .= '<li>'.&mt('Server: [_1] now has standard log-in page.',$lonhost).'</li>';
                             }                              }
                         }                          }
                         $resulttext .= '</ul></li>';                          $resulttext .= '</ul></li>'; 
                     }                      }
                 } else {                  } else {
                     $resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>';                      $resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>';
Line 3631  sub color_font_choices { Line 3609  sub color_font_choices {
             links => "Link colors",              links => "Link colors",
             images => "Images",              images => "Images",
             font => "Font color",              font => "Font color",
               fontmenu => "Font Menu",
             pgbg => "Page",              pgbg => "Page",
             tabbg => "Header",              tabbg => "Header",
             sidebg => "Border",              sidebg => "Border",
Line 3688  sub modify_colors { Line 3667  sub modify_colors {
             @logintext = ('textcol','bgcol');              @logintext = ('textcol','bgcol');
         } else {          } else {
             %choices = &color_font_choices();              %choices = &color_font_choices();
               $confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'};
         }          }
         if ($role eq 'login') {          if ($role eq 'login') {
             @images = ('img','logo','domlogo','login');              @images = ('img','logo','domlogo','login');
Line 3810  sub modify_colors { Line 3790  sub modify_colors {
                         $changes{$role}{'font'} = 1;                          $changes{$role}{'font'} = 1;
                     }                      }
                 }                  }
                   if ($role ne 'login') {
                       if ($domconfig->{$role}{'fontmenu'} ne '') {
                           if ($confhash->{$role}{'fontmenu'} ne $domconfig->{$role}{'fontmenu'}) {
                               $changes{$role}{'fontmenu'} = 1;
                           }
                       } else {
                           if ($confhash->{$role}{'fontmenu'}) {
                               $changes{$role}{'fontmenu'} = 1;
                           }
                       }
                   }
                 foreach my $item (@bgs) {                  foreach my $item (@bgs) {
                     if ($domconfig->{$role}{$item} ne '') {                      if ($domconfig->{$role}{$item} ne '') {
                         if ($confhash->{$role}{$item} ne $domconfig->{$role}{$item}) {                          if ($confhash->{$role}{$item} ne $domconfig->{$role}{$item}) {
Line 4305  sub modify_quotas { Line 4296  sub modify_quotas {
     }      }
     foreach my $item (@usertools) {      foreach my $item (@usertools) {
         foreach my $type (@{$types},'default','_LC_adv') {          foreach my $type (@{$types},'default','_LC_adv') {
             my $unset;              my $unset; 
             if ($context eq 'requestcourses') {              if ($context eq 'requestcourses') {
                 $unset = '0';                  $unset = '0';
                 if ($type eq '_LC_adv') {                  if ($type eq '_LC_adv') {
Line 4525  sub modify_autoenroll { Line 4516  sub modify_autoenroll {
     }      }
     my $autorun = &Apache::lonnet::auto_run(undef,$dom),      my $autorun = &Apache::lonnet::auto_run(undef,$dom),
     my %title = ( run => 'Auto-enrollment active',      my %title = ( run => 'Auto-enrollment active',
                   sender => 'Sender for notification messages',                    sender => 'Sender for notification messages');
                   coowners => 'Automatic assignment of co-ownership to instructors of record (institutional data)');  
     my @offon = ('off','on');      my @offon = ('off','on');
     my $sender_uname = $env{'form.sender_uname'};      my $sender_uname = $env{'form.sender_uname'};
     my $sender_domain = $env{'form.sender_domain'};      my $sender_domain = $env{'form.sender_domain'};
Line 4535  sub modify_autoenroll { Line 4525  sub modify_autoenroll {
     } elsif ($sender_uname eq '') {      } elsif ($sender_uname eq '') {
         $sender_domain = '';          $sender_domain = '';
     }      }
     my $coowners = $env{'form.autoassign_coowners'};  
     my %autoenrollhash =  (      my %autoenrollhash =  (
                        autoenroll => { run => $env{'form.autoenroll_run'},                         autoenroll => { run => $env{'form.autoenroll_run'},
                                        sender_uname => $sender_uname,                                         sender_uname => $sender_uname,
                                        sender_domain => $sender_domain,                                         sender_domain => $sender_domain,
                                        'co-owners' => $coowners,  
                                 }                                  }
                      );                       );
     my $putresult = &Apache::lonnet::put_dom('configuration',\%autoenrollhash,      my $putresult = &Apache::lonnet::put_dom('configuration',\%autoenrollhash,
Line 4561  sub modify_autoenroll { Line 4550  sub modify_autoenroll {
         if ($currautoenroll{'sender_domain'} ne $sender_domain) {          if ($currautoenroll{'sender_domain'} ne $sender_domain) {
             $changes{'sender'} = 1;              $changes{'sender'} = 1;
         }          }
         if ($currautoenroll{'co-owners'} ne '') {  
             if ($currautoenroll{'co-owners'} ne $coowners) {  
                 $changes{'coowners'} = 1;  
             }  
         } elsif ($coowners) {  
             $changes{'coowners'} = 1;  
         }  
         if (keys(%changes) > 0) {          if (keys(%changes) > 0) {
             $resulttext = &mt('Changes made:').'<ul>';              $resulttext = &mt('Changes made:').'<ul>';
             if ($changes{'run'}) {              if ($changes{'run'}) {
Line 4580  sub modify_autoenroll { Line 4562  sub modify_autoenroll {
                     $resulttext .= '<li>'.&mt("$title{'sender'} set to [_1]",$sender_uname.':'.$sender_domain).'</li>';                      $resulttext .= '<li>'.&mt("$title{'sender'} set to [_1]",$sender_uname.':'.$sender_domain).'</li>';
                 }                  }
             }              }
             if ($changes{'coowners'}) {  
                 $resulttext .= '<li>'.&mt("$title{'coowners'} set to $offon[$env{'form.autoassign_coowners'}]").'</li>';  
                 &Apache::loncommon::devalidate_domconfig_cache($dom);  
             }  
             $resulttext .= '</ul>';              $resulttext .= '</ul>';
         } else {          } else {
             $resulttext = &mt('No changes made to auto-enrollment settings');              $resulttext = &mt('No changes made to auto-enrollment settings');
Line 4615  sub modify_autoupdate { Line 4593  sub modify_autoupdate {
                         lastname => 'Last Name',                          lastname => 'Last Name',
                         firstname => 'First Name',                          firstname => 'First Name',
                         middlename => 'Middle Name',                          middlename => 'Middle Name',
                         generation => 'Generation',                          gen => 'Generation',
                       );                        );
     my $othertitle = &mt('All users');      my $othertitle = &mt('All users');
     if (keys(%{$usertypes}) >  0) {      if (keys(%{$usertypes}) >  0) {
Line 4623  sub modify_autoupdate { Line 4601  sub modify_autoupdate {
     }      }
     foreach my $key (keys(%env)) {      foreach my $key (keys(%env)) {
         if ($key =~ /^form\.updateable_(.+)_([^_]+)$/) {          if ($key =~ /^form\.updateable_(.+)_([^_]+)$/) {
             my ($usertype,$item) = ($1,$2);              push(@{$fields{$1}},$2);
             if (grep(/^\Q$item\E$/,keys(%fieldtitles))) {  
                 if ($usertype eq 'default') {  
                     push(@{$fields{$1}},$2);  
                 } elsif (ref($types) eq 'ARRAY') {  
                     if (grep(/^\Q$usertype\E$/,@{$types})) {  
                         push(@{$fields{$1}},$2);  
                     }  
                 }  
             }  
         }  
     }  
     my @lockablenames = &Apache::loncommon::get_env_multiple('form.lockablenames');  
     @lockablenames = sort(@lockablenames);  
     if (ref($currautoupdate{'lockablenames'}) eq 'ARRAY') {  
         my @changed = &Apache::loncommon::compare_arrays($currautoupdate{'lockablenames'},\@lockablenames);  
         if (@changed) {  
             $changes{'lockablenames'} = 1;  
         }  
     } else {  
         if (@lockablenames) {  
             $changes{'lockablenames'} = 1;  
         }          }
     }      }
     my %updatehash = (      my %updatehash = (
                       autoupdate => { run => $env{'form.autoupdate_run'},                        autoupdate => { run => $env{'form.autoupdate_run'},
                                       classlists => $env{'form.classlists'},                                        classlists => $env{'form.classlists'},
                                       fields => {%fields},                                        fields => {%fields},
                                       lockablenames => \@lockablenames,  
                                     }                                      }
                      );                       );
     foreach my $key (keys(%currautoupdate)) {      foreach my $key (keys(%currautoupdate)) {
Line 4669  sub modify_autoupdate { Line 4625  sub modify_autoupdate {
                         foreach my $type (@{$currautoupdate{$key}{$item}}) {                          foreach my $type (@{$currautoupdate{$key}{$item}}) {
                             if (!exists($fields{$item})) {                              if (!exists($fields{$item})) {
                                 $change = 1;                                  $change = 1;
                                 last;  
                             } elsif (ref($fields{$item}) eq 'ARRAY') {                              } elsif (ref($fields{$item}) eq 'ARRAY') {
                                 if (!grep(/^\Q$type\E$/,@{$fields{$item}})) {                                  if (!grep(/^\Q$type\E$/,@{$fields{$item}})) {
                                     $change = 1;                                      $change = 1;
                                     last;  
                                 }                                  }
                             }                              }
                         }                          }
Line 4683  sub modify_autoupdate { Line 4637  sub modify_autoupdate {
                     }                       } 
                 }                  }
             }              }
         } elsif ($key eq 'lockablenames') {  
             if (ref($currautoupdate{$key}) eq 'ARRAY') {  
                 my @changed = &Apache::loncommon::compare_arrays($currautoupdate{'lockablenames'},\@lockablenames);  
                 if (@changed) {  
                     $changes{'lockablenames'} = 1;  
                 }  
             } else {  
                 if (@lockablenames) {  
                     $changes{'lockablenames'} = 1;  
                 }  
             }  
         }  
     }  
     unless (grep(/^\Qlockablenames\E$/,keys(%currautoupdate))) {  
         if (@lockablenames) {  
             $changes{'lockablenames'} = 1;  
         }          }
     }      }
     foreach my $item (@{$types},'default') {      foreach my $item (@{$types},'default') {
         if (defined($fields{$item})) {          if (defined($fields{$item})) {
             if (ref($currautoupdate{'fields'}) eq 'HASH') {              if (ref($currautoupdate{'fields'}) eq 'HASH') {
                 if (ref($currautoupdate{'fields'}{$item}) eq 'ARRAY') {                  if (!exists($currautoupdate{'fields'}{$item})) {
                     my $change = 0;  
                     if (ref($fields{$item}) eq 'ARRAY') {  
                         foreach my $type (@{$fields{$item}}) {  
                             if (!grep(/^\Q$type\E$/,@{$currautoupdate{'fields'}{$item}})) {  
                                 $change = 1;  
                                 last;  
                             }  
                         }  
                     }  
                     if ($change) {  
                         push(@{$changes{'fields'}},$item);  
                     }  
                 } else {  
                     push(@{$changes{'fields'}},$item);                      push(@{$changes{'fields'}},$item);
                 }                  }
             } else {              } else {
Line 4731  sub modify_autoupdate { Line 4656  sub modify_autoupdate {
         if (keys(%changes) > 0) {          if (keys(%changes) > 0) {
             $resulttext = &mt('Changes made:').'<ul>';              $resulttext = &mt('Changes made:').'<ul>';
             foreach my $key (sort(keys(%changes))) {              foreach my $key (sort(keys(%changes))) {
                 if ($key eq 'lockablenames') {                  if (ref($changes{$key}) eq 'ARRAY') {
                     $resulttext .= '<li>';  
                     if (@lockablenames) {  
                         $usertypes->{'default'} = $othertitle;  
                         $resulttext .= &mt("User preference to disable replacement of user's name with institutional data (by auto-update), available for the following affiliations:").' '.  
                                    join(', ', map { $usertypes->{$_}; } @lockablenames).'</li>';  
                     } else {  
                         $resulttext .= &mt("User preference to disable replacement of user's name with institutional data (by auto-update) is unavailable.");  
                     }  
                     $resulttext .= '</li>';  
                 } elsif (ref($changes{$key}) eq 'ARRAY') {  
                     foreach my $item (@{$changes{$key}}) {                      foreach my $item (@{$changes{$key}}) {
                         my @newvalues;                          my @newvalues;
                         foreach my $type (@{$fields{$item}}) {                          foreach my $type (@{$fields{$item}}) {
Line 4802  sub modify_autocreate { Line 4717  sub modify_autocreate {
     my %domcoords = &get_active_dcs($dom);      my %domcoords = &get_active_dcs($dom);
     unless (exists($domcoords{$newvals{'xmldc'}})) {      unless (exists($domcoords{$newvals{'xmldc'}})) {
         $newvals{'xmldc'} = '';          $newvals{'xmldc'} = '';
     }      } 
     %autocreatehash =  (      %autocreatehash =  (
                         autocreate => { xml => $newvals{'xml'},                          autocreate => { xml => $newvals{'xml'},
                                         req => $newvals{'req'},                                          req => $newvals{'req'},
Line 4828  sub modify_autocreate { Line 4743  sub modify_autocreate {
             }              }
         }          }
         if (keys(%changes) > 0) {          if (keys(%changes) > 0) {
             my @offon = ('off','on');              my @offon = ('off','on'); 
             $resulttext = &mt('Changes made:').'<ul>';              $resulttext = &mt('Changes made:').'<ul>';
             foreach my $item (@types) {              foreach my $item (@types) {
                 if ($changes{$item}) {                  if ($changes{$item}) {
Line 4839  sub modify_autocreate { Line 4754  sub modify_autocreate {
             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]$newtxt [_2]",'<b>','</b>').'</li>'; 
             }              }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';
         } else {          } else {
Line 5034  sub modify_contacts { Line 4949  sub modify_contacts {
             $currsetting{$key} = $domconfig{'contacts'}{$key};              $currsetting{$key} = $domconfig{'contacts'}{$key};
         }          }
     }      }
     my (%others,%to,%bcc);      my (%others,%to);
     my @contacts = ('supportemail','adminemail');      my @contacts = ('supportemail','adminemail');
     my @mailings = ('errormail','packagesmail','helpdeskmail','lonstatusmail',      my @mailings = ('errormail','packagesmail','helpdeskmail','lonstatusmail',
                     'requestsmail');                      'requestsmail');
Line 5050  sub modify_contacts { Line 4965  sub modify_contacts {
         }            }  
         $others{$type} = $env{'form.'.$type.'_others'};          $others{$type} = $env{'form.'.$type.'_others'};
         $contacts_hash{contacts}{$type}{'others'} = $others{$type};          $contacts_hash{contacts}{$type}{'others'} = $others{$type};
         if ($type eq 'helpdeskmail') {  
             $bcc{$type} = $env{'form.'.$type.'_bcc'};  
             $contacts_hash{contacts}{$type}{'bcc'} = $bcc{$type};  
         }  
     }      }
     foreach my $item (@contacts) {      foreach my $item (@contacts) {
         $to{$item} = $env{'form.'.$item};          $to{$item} = $env{'form.'.$item};
Line 5078  sub modify_contacts { Line 4989  sub modify_contacts {
             if ($others{$type} ne $currsetting{$type}{'others'}) {              if ($others{$type} ne $currsetting{$type}{'others'}) {
                 push(@{$changes{$type}},'others');                  push(@{$changes{$type}},'others');
             }              }
             if ($type eq 'helpdeskmail') {  
                 if ($bcc{$type} ne $currsetting{$type}{'bcc'}) {  
                     push(@{$changes{$type}},'bcc');  
                 }  
             }  
         }          }
     } else {      } else {
         my %default;          my %default;
Line 5105  sub modify_contacts { Line 5011  sub modify_contacts {
             }              }
             if ($others{$type} ne '') {              if ($others{$type} ne '') {
                 push(@{$changes{$type}},'others');                  push(@{$changes{$type}},'others');
             }              } 
             if ($type eq 'helpdeskmail') {  
                 if ($bcc{$type} ne '') {  
                     push(@{$changes{$type}},'bcc');  
                 }  
             }  
         }          }
     }      }
     my $putresult = &Apache::lonnet::put_dom('configuration',\%contacts_hash,      my $putresult = &Apache::lonnet::put_dom('configuration',\%contacts_hash,
Line 5138  sub modify_contacts { Line 5039  sub modify_contacts {
                         push(@text,$others{$type});                          push(@text,$others{$type});
                     }                      }
                     $resulttext .= '<span class="LC_cusr_emph">'.                      $resulttext .= '<span class="LC_cusr_emph">'.
                                    join(', ',@text).'</span>';                                     join(', ',@text).'</span></li>';
                     if ($type eq 'helpdeskmail') {  
                         if ($bcc{$type} ne '') {  
                             $resulttext .= '&nbsp;'.&mt('with Bcc to').': <span class="LC_cusr_emph">'.$bcc{$type}.'</span>';  
                         }  
                     }  
                     $resulttext .= '</li>';  
                 }                  }
             }              }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';
Line 5770  sub modify_scantron { Line 5665  sub modify_scantron {
         my $error;          my $error;
         if ($configuserok eq 'ok') {          if ($configuserok eq 'ok') {
             if ($switchserver) {              if ($switchserver) {
                 $error = &mt("Upload of bubblesheet format file is not permitted to this server: [_1]",$switchserver);                  $error = &mt("Upload of scantron format file is not permitted to this server: [_1]",$switchserver);
             } else {              } else {
                 if ($author_ok eq 'ok') {                  if ($author_ok eq 'ok') {
                     my ($result,$scantronurl) =                      my ($result,$scantronurl) =
Line 5810  sub modify_scantron { Line 5705  sub modify_scantron {
                 if (ref($confhash{'scantron'}) eq 'HASH') {                  if (ref($confhash{'scantron'}) eq 'HASH') {
                     $resulttext = &mt('Changes made:').'<ul>';                      $resulttext = &mt('Changes made:').'<ul>';
                     if ($confhash{'scantron'}{'scantronformat'} eq '') {                      if ($confhash{'scantron'}{'scantronformat'} eq '') {
                         $resulttext .= '<li>'.&mt('[_1] bubblesheet format file removed; [_2] file will be used for courses in this domain.',$custom,$default).'</li>';                          $resulttext .= '<li>'.&mt('[_1] scantron format file removed; [_2] file will be used for courses in this domain.',$custom,$default).'</li>';
                     } else {                      } else {
                         $resulttext .= '<li>'.&mt('Custom bubblesheet format file ([_1]) uploaded for use with courses in this domain.',$custom).'</li>';                          $resulttext .= '<li>'.&mt('Custom scantron format file ([_1]) uploaded for use with courses in this domain.',$custom).'</li>';
                     }                      }
                     $resulttext .= '</ul>';                      $resulttext .= '</ul>';
                 } else {                  } else {
                     $resulttext = &mt('Changes made to bubblesheet format file.');                      $resulttext = &mt('Changes made to scantron format file.');
                 }                  }
                 $resulttext .= '</ul>';                  $resulttext .= '</ul>';
                 &Apache::loncommon::devalidate_domconfig_cache($dom);                  &Apache::loncommon::devalidate_domconfig_cache($dom);
             } else {              } else {
                 $resulttext = &mt('No changes made to bubblesheet format file');                  $resulttext = &mt('No changes made to scantron format file');
             }              }
         } else {          } else {
             $resulttext = '<span class="LC_error">'.              $resulttext = '<span class="LC_error">'.
                 &mt('An error occurred: [_1]',$putresult).'</span>';                  &mt('An error occurred: [_1]',$putresult).'</span>';
         }          }
     } else {      } else {
         $resulttext = &mt('No changes made to bubblesheet format file');           $resulttext = &mt('No changes made to scantron format file'); 
     }      }
     if ($errors) {      if ($errors) {
         $resulttext .= &mt('The following errors occurred: ').'<ul>'.          $resulttext .= &mt('The following errors occurred: ').'<ul>'.
Line 6186  sub modify_serverstatuses { Line 6081  sub modify_serverstatuses {
     return $resulttext;      return $resulttext;
 }  }
   
   sub modify_helpsettings {
       my ($r,$dom,$confname,%domconfig) = @_;
     my ($resulttext,$errors,%changes,%helphash);
    
     my $customhelpfile  = $env{'form.loginhelpurl.filename'};
       my $defaulthelpfile = 'defaulthelp.html';
     my $servadm = $r->dir_config('lonAdmEMail');
       my ($configuserok,$author_ok,$switchserver) = 
           &config_check($dom,$confname,$servadm);
    
     my %defaultchecked = ('submitbugs' => 'on');
     my @offon = ('off','on');
       my %title = ( submitbugs     => 'Display link for users to submit a bug', 
        loginhelpurl  => 'Unauthenticated login help page set to custom file');
        
       my @toggles = ('submitbugs');
   
       $helphash{'helpsettings'} = {};
       
       if (ref($domconfig{'helpsettings'}) ne 'HASH') {
           if ($domconfig{'helpsettings'} eq '') {
               $domconfig{'helpsettings'} = {};
           }
       }
       
       if (ref($domconfig{'helpsettings'}) eq 'HASH') {
      
           foreach my $item (@toggles) {
          
    if ($defaultchecked{$item} eq 'on') { 
    if (($domconfig{'helpsettings'}{$item} eq '') &&
    ($env{'form.'.$item} eq '0')) {
    $changes{$item} = 1;
    } elsif ($domconfig{'helpsettings'}{$item} ne $env{'form.'.$item}) {
    $changes{$item} = 1;
    }
    } elsif ($defaultchecked{$item} eq 'off') {
    if (($domconfig{'helpsettings'}{$item} eq '') &&
    ($env{'form.'.$item} eq '1')) {
    $changes{$item} = 1;
    } elsif ($domconfig{'helpsettings'}{$item} ne $env{'form.'.$item}) {
    $changes{$item} = 1;
    }
    }
    $helphash{'helpsettings'}{$item} = $env{'form.'.$item};
    }
   
    if ($customhelpfile ne '') {
    my $error;
    if ($configuserok eq 'ok') {
    if ($switchserver) {
    $error = &mt("Upload of custom help file is not permitted to this server: [_1]",$switchserver);
    } else {
    if ($author_ok eq 'ok') {
    my ($result,$loginhelpurl) =
    &publishlogo($r,'upload','loginhelpurl',$dom,
    $confname,'help','','',$customhelpfile);
    if ($result eq 'ok') {
    $helphash{'helpsettings'}{'loginhelpurl'} = $loginhelpurl;
    $changes{'loginhelpurl'} = 1;
    } else {
    $error = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].",$customhelpfile,$result);
    }
    } else {
    $error = &mt("Upload of [_1] failed because an author role could not be assigned to a Domain Configuration user ([_2]) in domain: [_3].  Error was: [_4].",$customhelpfile,$confname,$dom,$author_ok);
    }
    }
    } else {
    $error = &mt("Upload of [_1] failed because a Domain Configuration user ([_2]) could not be created in domain: [_3].  Error was: [_4].",$customhelpfile,$confname,$dom,$configuserok);
    }
    if ($error) {
    &Apache::lonnet::logthis($error);
    $errors .= '<li><span class="LC_error">'.$error.'</span></li>';
    }
    }
   
           if ($domconfig{'helpsettings'}{'loginhelpurl'} ne '') {
               if ($env{'form.loginhelpurl_del'}) {
                   $helphash{'helpsettings'}{'loginhelpurl'} = '';
                   $changes{'loginhelpurl'} = 1;
               }
           }
       }
       
       
       my $putresult;
       
       if (keys(%changes) > 0) {
       $putresult = &Apache::lonnet::put_dom('configuration',\%helphash,$dom);
       } else {
       $putresult = 'ok';
       }
                                                
       if ($putresult eq 'ok') {
           if (keys(%changes) > 0) {
    $resulttext = &mt('Changes made:').'<ul>';
    foreach my $item (sort(keys(%changes))) {
    if ($item eq 'submitbugs') {
    $resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>';
    }
    if ($item eq 'loginhelpurl') {
    if ($helphash{'helpsettings'}{'loginhelpurl'} eq '') {
                           $resulttext .= '<li>'.&mt('[_1] help file removed; [_2] file will be used for the unathorized help page in this domain.',$customhelpfile,$defaulthelpfile).'</li>';
                       } else {
                           $resulttext .= '<li>'.&mt("$title{$item} [_1]",$customhelpfile).'</li>';
                       }
    }
    }
    $resulttext .= '</ul>';
    } else {
    $resulttext = &mt('No changes made to help settings');
    }
       } else {
           $resulttext = '<span class="LC_error">'.
       &mt('An error occurred: [_1]',$putresult).'</span>';
       }
       if ($errors) {
           $resulttext .= &mt('The following errors occurred: ').'<ul>'.
                          $errors.'</ul>';
       }
       return $resulttext;
   }
   
 sub modify_coursedefaults {  sub modify_coursedefaults {
     my ($dom,%domconfig) = @_;      my ($dom,%domconfig) = @_;
     my ($resulttext,$errors,%changes,%defaultshash);      my ($resulttext,$errors,%changes,%defaultshash);
Line 6347  sub get_active_dcs { Line 6365  sub get_active_dcs {
   
 sub active_dc_picker {  sub active_dc_picker {
     my ($dom,$curr_dc) = @_;      my ($dom,$curr_dc) = @_;
     my %domcoords = &get_active_dcs($dom);      my %domcoords = &get_active_dcs($dom); 
     my @dcs = sort(keys(%domcoords));      my @dcs = sort(keys(%domcoords));
     my $numdcs = scalar(@dcs);      my $numdcs = scalar(@dcs); 
     my $datatable;      my $datatable;
     my $numinrow = 2;      my $numinrow = 2;
     if ($numdcs > 1) {      if ($numdcs > 1) {
Line 6364  sub active_dc_picker { Line 6382  sub active_dc_picker {
             }              }
             my $check = ' ';              my $check = ' ';
             if ($curr_dc eq '') {              if ($curr_dc eq '') {
                 if (!$i) {                  if (!$i) { 
                     $check = ' checked="checked" ';                      $check = ' checked="checked" ';
                 }                  }
             } elsif ($dcs[$i] eq $curr_dc) {              } elsif ($dcs[$i] eq $curr_dc) {

Removed from v.1.102.2.15  
changed lines
  Added in v.1.127


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