Diff for /loncom/interface/domainprefs.pm between versions 1.160.6.66 and 1.244

version 1.160.6.66, 2016/08/04 17:53:12 version 1.244, 2014/05/23 08:32:55
Line 213  sub handler { Line 213  sub handler {
                 'quotas','autoenroll','autoupdate','autocreate',                  'quotas','autoenroll','autoupdate','autocreate',
                 'directorysrch','usercreation','usermodification',                  'directorysrch','usercreation','usermodification',
                 'contacts','defaults','scantron','coursecategories',                  'contacts','defaults','scantron','coursecategories',
                 'serverstatuses','requestcourses','coursedefaults',                  'serverstatuses','requestcourses','helpsettings',
                 'usersessions','loadbalancing','requestauthor',                  'coursedefaults','usersessions','loadbalancing',
                 'selfenrollment','inststatus'],$dom);                  'requestauthor','selfenrollment','inststatus'],$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','selfcreation','usermodification','scantron',                         'usercreation','selfcreation','usermodification','scantron',
                        'requestcourses','requestauthor','coursecategories',                         'requestcourses','requestauthor','coursecategories',
                        'serverstatuses','coursedefaults','selfenrollment',                         'serverstatuses','helpsettings',
                        'usersessions');                         'coursedefaults','selfenrollment','usersessions');
     my %existing;      my %existing;
     if (ref($domconfig{'loadbalancing'}) eq 'HASH') {      if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
         %existing = %{$domconfig{'loadbalancing'}};          %existing = %{$domconfig{'loadbalancing'}};
Line 250  sub handler { Line 250  sub handler {
                       header => [{col1 => 'Log-in Page Items',                        header => [{col1 => 'Log-in Page Items',
                                   col2 => '',},                                    col2 => '',},
                                  {col1 => 'Log-in Help',                                   {col1 => 'Log-in Help',
                                   col2 => 'Value'},  
                                  {col1 => 'Custom HTML in document head',  
                                   col2 => 'Value'}],                                    col2 => 'Value'}],
                       print => \&print_login,                        print => \&print_login,
                       modify => \&modify_login,                        modify => \&modify_login,
Line 411  sub handler { Line 409  sub handler {
                   print => \&print_serverstatuses,                    print => \&print_serverstatuses,
                   modify => \&modify_serverstatuses,                    modify => \&modify_serverstatuses,
                  },                   },
           'helpsettings' =>
                    {text   => 'Help page settings',
                     help   => 'Domain_Configuration_Help_Settings',
                     header => [{col1 => 'Help Settings (logged-in users)',
                                 col2 => 'Value'}],
                     print  => \&print_helpsettings,
                     modify => \&modify_helpsettings,
                    },
         'coursedefaults' =>           'coursedefaults' => 
                  {text => 'Course/Community defaults',                   {text => 'Course/Community defaults',
                   help => 'Domain_Configuration_Course_Defaults',                    help => 'Domain_Configuration_Course_Defaults',
Line 433  sub handler { Line 439  sub handler {
                   print => \&print_selfenrollment,                    print => \&print_selfenrollment,
                   modify => \&modify_selfenrollment,                    modify => \&modify_selfenrollment,
                  },                   },
           'privacy' => 
                    {text   => 'User Privacy',
                     help   => 'Domain_Configuration_User_Privacy',
                     header => [{col1 => 'Setting',
                                 col2 => 'Value',}],
                     print => \&print_privacy,
                     modify => \&modify_privacy,
                    },
         'usersessions' =>          'usersessions' =>
                  {text  => 'User session hosting/offloading',                   {text  => 'User session hosting/offloading',
                   help  => 'Domain_Configuration_User_Sessions',                    help  => 'Domain_Configuration_User_Sessions',
Line 465  sub handler { Line 479  sub handler {
                                        {col1 => 'Log-in Page Items',                                         {col1 => 'Log-in Page Items',
                                         col2 => ''},                                          col2 => ''},
                                        {col1 => 'Log-in Help',                                         {col1 => 'Log-in Help',
                                         col2 => 'Value'},  
                                        {col1 => 'Custom HTML in document head',  
                                         col2 => 'Value'}],                                          col2 => 'Value'}],
                             print => \&print_login,                              print => \&print_login,
                             modify => \&modify_login,                              modify => \&modify_login,
Line 619  sub process_changes { Line 631  sub process_changes {
         $output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig);          $output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig);
     } elsif ($action eq 'requestauthor') {      } elsif ($action eq 'requestauthor') {
         $output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig);          $output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig);
       } elsif ($action eq 'helpsettings') {
           $output = &modify_helpsettings($r,$dom,$confname,%domconfig);
     } elsif ($action eq 'coursedefaults') {      } elsif ($action eq 'coursedefaults') {
         $output = &modify_coursedefaults($dom,$lastactref,%domconfig);          $output = &modify_coursedefaults($dom,$lastactref,%domconfig);
     } elsif ($action eq 'selfenrollment') {      } elsif ($action eq 'selfenrollment') {
Line 656  sub print_config_box { Line 670  sub print_config_box {
         my $colspan = '';          my $colspan = '';
         my $rightcolspan = '';          my $rightcolspan = '';
         if (($action eq 'rolecolors') || ($action eq 'defaults') ||          if (($action eq 'rolecolors') || ($action eq 'defaults') ||
             (($action eq 'login') && ($numheaders < 4))) {              (($action eq 'login') && ($numheaders < 3))) {
             $colspan = ' colspan="2"';              $colspan = ' colspan="2"';
         }          }
         if ($action eq 'usersessions') {          if ($action eq 'usersessions') {
Line 678  sub print_config_box { Line 692  sub print_config_box {
         } elsif ($action eq 'coursecategories') {          } elsif ($action eq 'coursecategories') {
             $output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal);              $output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal);
         } elsif ($action eq 'login') {          } elsif ($action eq 'login') {
             if ($numheaders == 4) {              if ($numheaders == 3) {
                 $colspan = ' colspan="2"';                  $colspan = ' colspan="2"';
                 $output .= &print_login('service',$dom,$confname,$phase,$settings,\$rowtotal);                  $output .= &print_login('service',$dom,$confname,$phase,$settings,\$rowtotal);
             } else {              } else {
Line 731  sub print_config_box { Line 745  sub print_config_box {
                   ($action eq 'defaults')) {                    ($action eq 'defaults')) {
             $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);              $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
         } elsif ($action eq 'login') {          } elsif ($action eq 'login') {
             if ($numheaders == 4) {              if ($numheaders == 3) {
                 $output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'                  $output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'
            </table>             </table>
           </td>            </td>
Line 747  sub print_config_box { Line 761  sub print_config_box {
             } else {              } else {
                 $output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal);                  $output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal);
             }              }
             $output .= '  
            </table>  
           </td>  
          </tr>  
          <tr>  
            <td>  
             <table class="LC_nested">  
              <tr class="LC_info_row">';  
             if ($numheaders == 4) {  
                 $output .= '  
               <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</td>  
               <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col2'}).'</td>  
              </tr>';  
             } else {  
                 $output .= '  
               <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>  
               <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col2'}).'</td>  
              </tr>';  
             }  
             $rowtotal ++;  
             $output .= &print_login('headtag',$dom,$confname,$phase,$settings,\$rowtotal);  
         } elsif ($action eq 'requestcourses') {          } elsif ($action eq 'requestcourses') {
             $output .= &print_requestmail($dom,$action,$settings,\$rowtotal);              $output .= &print_requestmail($dom,$action,$settings,\$rowtotal).
             $rowtotal ++;                         &print_studentcode($settings,\$rowtotal).'
             $output .= &print_studentcode($settings,\$rowtotal).'  
            </table>             </table>
           </td>            </td>
          </tr>           </tr>
Line 806  sub print_config_box { Line 798  sub print_config_box {
             &print_validation_rows('requestcourses',$dom,$settings,\$rowtotal);              &print_validation_rows('requestcourses',$dom,$settings,\$rowtotal);
         } elsif ($action eq 'requestauthor') {          } elsif ($action eq 'requestauthor') {
             $output .= &print_requestmail($dom,$action,$settings,\$rowtotal);              $output .= &print_requestmail($dom,$action,$settings,\$rowtotal);
             $rowtotal ++;  
         } elsif ($action eq 'rolecolors') {          } elsif ($action eq 'rolecolors') {
             $output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).'              $output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).'
            </table>             </table>
Line 1188  sub print_login { Line 1179  sub print_login {
             $itemcount ++;              $itemcount ++;
         }          }
         $datatable .= &captcha_choice('login',$settings,$itemcount);          $datatable .= &captcha_choice('login',$settings,$itemcount);
     } elsif ($caller eq 'headtag') {  
         my %domservers = &Apache::lonnet::get_servers($dom);  
         my $choice = $choices{'headtag'};  
         $css_class = ' class="LC_odd_row"';  
         $datatable .= '<tr'.$css_class.'><td colspan="2">'.$choice.'</td>'.  
                       '<td align="left"><table><tr><th>'.$choices{'hostid'}.'</th>'.  
                       '<th>'.$choices{'current'}.'</th>'.  
                       '<th>'.$choices{'action'}.'</th>'.  
                       '<th>'.$choices{'exempt'}.'</th></tr>'."\n";  
         my (%currurls,%currexempt);  
         if (ref($settings) eq 'HASH') {  
             if (ref($settings->{'headtag'}) eq 'HASH') {  
                 foreach my $lonhost (keys(%{$settings->{'headtag'}})) {  
                     if (ref($settings->{'headtag'}{$lonhost}) eq 'HASH') {  
                         $currurls{$lonhost} = $settings->{'headtag'}{$lonhost}{'url'};  
                         $currexempt{$lonhost} = $settings->{'headtag'}{$lonhost}{'exempt'};  
                     }  
                 }  
             }  
         }  
         my %lt = &Apache::lonlocal::texthash(  
                                                del  => 'Delete?',  
                                                rep  => 'Replace:',  
                                                upl  => 'Upload:',  
                                                curr => 'View contents',  
                                                none => 'None',  
         );  
         my $switchserver = &check_switchserver($dom,$confname);  
         foreach my $lonhost (sort(keys(%domservers))) {  
             my $exempt = &check_exempt_addresses($currexempt{$lonhost});  
             $datatable .= '<tr><td>'.$domservers{$lonhost}.'</td>';  
             if ($currurls{$lonhost}) {  
                 $datatable .= '<td class="LC_right_item"><a href="'.  
                               "javascript:void(open('$currurls{$lonhost}?inhibitmenu=yes','Custom_HeadTag',  
                               'menubar=0,toolbar=1,scrollbars=1,width=600,height=500,resizable=yes'))".  
                               '">'.$lt{'curr'}.'</a></td>'.  
                               '<td><span class="LC_nobreak"><label>'.  
                               '<input type="checkbox" name="loginheadtag_del" value="'.$lonhost.'" />'.  
                               $lt{'del'}.'</label>&nbsp;'.$lt{'rep'}.'</span>';  
             } else {  
                 $datatable .= '<td class="LC_right_item">'.$lt{'none'}.'</td><td>'.$lt{'upl'};  
             }  
             $datatable .='<br />';  
             if ($switchserver) {  
                 $datatable .= &mt('Upload to library server: [_1]',$switchserver);  
             } else {  
                 $datatable .= '<input type="file" name="loginheadtag_'.$lonhost.'" />';  
             }  
             $datatable .= '</td><td><input type="textbox" name="loginheadtagexempt_'.$lonhost.'" value="'.$exempt.'" /></td></tr>';  
         }  
         $datatable .= '</table></td></tr>';  
     }      }
     return $datatable;      return $datatable;
 }  }
Line 1272  sub login_choices { Line 1212  sub login_choices {
             link          => "Link",              link          => "Link",
             alink         => "Active link",              alink         => "Active link",
             vlink         => "Visited link",              vlink         => "Visited link",
             headtag       => "Custom markup",  
             action        => "Action",  
             current       => "Current",  
         );          );
     return %choices;      return %choices;
 }  }
Line 2137  sub print_requestmail { Line 2074  sub print_requestmail {
         $datatable .= &mt('There are no active Domain Coordinators');          $datatable .= &mt('There are no active Domain Coordinators');
     }      }
     $datatable .='</td></tr>';      $datatable .='</td></tr>';
       $$rowtotal += $rows;
     return $datatable;      return $datatable;
 }  }
   
Line 2145  sub print_studentcode { Line 2083  sub print_studentcode {
     my $rownum = 0;       my $rownum = 0; 
     my ($output,%current);      my ($output,%current);
     my @crstypes = ('official','unofficial','community','textbook');      my @crstypes = ('official','unofficial','community','textbook');
     if (ref($settings) eq 'HASH') {      if (ref($settings->{'uniquecode'}) eq 'HASH') {
         if (ref($settings->{'uniquecode'}) eq 'HASH') {          foreach my $type (@crstypes) {
             foreach my $type (@crstypes) {              $current{$type} = $settings->{'uniquecode'}{$type};
                 $current{$type} = $settings->{'uniquecode'}{$type};  
             }  
         }          }
     }      }
     $output .= '<tr>'.      $output .= '<tr>'.
Line 2583  sub print_autocreate { Line 2519  sub print_autocreate {
                   $createoff{'req'}.' value="0" />'.&mt('No').'</label></span>';                    $createoff{'req'}.' value="0" />'.&mt('No').'</label></span>';
     my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio',      my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio',
                                                    'autocreate_xmldc',%currhash);                                                     'autocreate_xmldc',%currhash);
     $datatable .= '</td></tr><tr class="LC_odd_row"><td>';  
     if ($numdc > 1) {      if ($numdc > 1) {
         $datatable .= &mt('Course creation processed as: (choose Dom. Coord.)').          $datatable .= '</td></tr><tr class="LC_odd_row"><td>'.
                       '</td><td class="LC_left_item">';                        &mt('Course creation processed as: (choose Dom. Coord.)').
                         '</td><td class="LC_left_item">'.$dctable.'</td></tr>';
     } else {      } else {
         $datatable .= &mt('Course creation processed as:').          $datatable .= $dctable.'</td></tr>';
                       '</td><td class="LC_right_item">';  
     }      }
     $datatable .= $dctable.'</td></tr>';  
     $$rowtotal += $rows;      $$rowtotal += $rows;
     return $datatable;      return $datatable;
 }  }
Line 2826  sub print_helpsettings { Line 2760  sub print_helpsettings {
   
 sub radiobutton_prefs {  sub radiobutton_prefs {
     my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick,      my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick,
         $additional,$align) = @_;          $additional) = @_;
     return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') &&      return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') &&
                    (ref($choices) eq 'HASH'));                     (ref($choices) eq 'HASH'));
   
Line 2860  sub radiobutton_prefs { Line 2794  sub radiobutton_prefs {
         $datatable .=          $datatable .=
             '<tr'.$css_class.'><td valign="top">'.              '<tr'.$css_class.'><td valign="top">'.
             '<span class="LC_nobreak">'.$choices->{$item}.              '<span class="LC_nobreak">'.$choices->{$item}.
             '</span></td>';              '</span></td>'.
         if ($align eq 'left') {              '<td class="LC_right_item"><span class="LC_nobreak">'.
             $datatable .= '<td class="LC_left_item">';  
         } else {  
             $datatable .= '<td class="LC_right_item">';  
         }  
         $datatable .=  
             '<span class="LC_nobreak">'.  
             '<label><input type="radio" name="'.              '<label><input type="radio" name="'.
             $item.'" '.$checkedon{$item}.' value="1"'.$onclick.' />'.&mt('Yes').              $item.'" '.$checkedon{$item}.' value="1"'.$onclick.' />'.&mt('Yes').
             '</label>&nbsp;<label><input type="radio" name="'.$item.'" '.              '</label>&nbsp;<label><input type="radio" name="'.$item.'" '.
Line 2885  sub print_coursedefaults { Line 2813  sub print_coursedefaults {
     my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles);      my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles);
     my $itemcount = 1;      my $itemcount = 1;
     my %choices =  &Apache::lonlocal::texthash (      my %choices =  &Apache::lonlocal::texthash (
           canuse_pdfforms      => 'Course/Community users can create/upload PDF forms',
         uploadquota          => 'Default quota for files uploaded directly to course/community using Course Editor (MB)',          uploadquota          => 'Default quota for files uploaded directly to course/community using Course Editor (MB)',
         anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys',          anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys',
         coursecredits        => 'Credits can be specified for courses',          coursecredits        => 'Credits can be specified for courses',
         uselcmath            => 'Math preview uses LON-CAPA previewer (javascript) in place of DragMath (Java)',  
         usejsme              => 'Molecule editor uses JSME (HTML5) in place of JME (Java)',  
         postsubmit           => 'Disable submit button/keypress following student submission',  
         canclone             => "People who may clone a course (besides course's owner and coordinators)",  
     );      );
     my %staticdefaults = (      my %staticdefaults = (
                            anonsurvey_threshold => 10,                             anonsurvey_threshold => 10,
                            uploadquota          => 500,                             uploadquota          => 500,
                            postsubmit           => 60,  
                          );                           );
     if ($position eq 'top') {      if ($position eq 'top') {
         %defaultchecked = (          %defaultchecked = ('canuse_pdfforms' => 'off');
                             'uselcmath'       => 'on',          @toggles = ('canuse_pdfforms');
                             'usejsme'         => 'on',  
                             'canclone'        => 'none',  
                           );  
         @toggles = ('uselcmath','usejsme');  
         ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,          ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
                                                      \%choices,$itemcount);                                                   \%choices,$itemcount);
         $css_class = $itemcount%2?' class="LC_odd_row"':'';  
         $datatable .=  
             '<tr'.$css_class.'><td valign="top">'.  
             '<span class="LC_nobreak">'.$choices{'canclone'}.  
             '</span></td><td class="LC_left_item">';  
         my $currcanclone = 'none';  
         my $onclick;  
         my @cloneoptions = ('none','domain');  
         my %clonetitles = (  
                              none     => 'No additional course requesters',  
                              domain   => "Any course requester in course's domain",  
                              instcode => 'Course requests for official courses ...',  
                           );  
         my (%codedefaults,@code_order,@posscodes);  
         if (&Apache::lonnet::auto_instcode_defaults($dom,\%codedefaults,  
                                                     \@code_order) eq 'ok') {  
             if (@code_order > 0) {  
                 push(@cloneoptions,'instcode');  
                 $onclick = ' onclick="toggleDisplay(this.form,'."'cloneinstcode'".');"';  
             }  
         }  
         if (ref($settings) eq 'HASH') {  
             if ($settings->{'canclone'}) {  
                 if (ref($settings->{'canclone'}) eq 'HASH') {  
                     if (ref($settings->{'canclone'}{'instcode'}) eq 'ARRAY') {  
                         if (@code_order > 0) {  
                             $currcanclone = 'instcode';  
                             @posscodes = @{$settings->{'canclone'}{'instcode'}};  
                         }  
                     }  
                 } elsif ($settings->{'canclone'} eq 'domain') {  
                     $currcanclone = $settings->{'canclone'};  
                 }  
             }  
         }  
         foreach my $option (@cloneoptions) {  
             my ($checked,$additional);  
             if ($currcanclone eq $option) {  
                 $checked = ' checked="checked"';  
             }  
             if ($option eq 'instcode') {  
                 if (@code_order) {  
                     my $show = 'none';  
                     if ($checked) {  
                         $show = 'block';  
                     }  
                     $additional = '<div id="cloneinstcode" style="display:'.$show.'" />'.  
                                   &mt('Institutional codes for new and cloned course have identical:').  
                                   '<br />';  
                     foreach my $item (@code_order) {  
                         my $codechk;  
                         if ($checked) {  
                             if (grep(/^\Q$item\E$/,@posscodes)) {  
                                 $codechk = ' checked="checked"';  
                             }  
                         }  
                         $additional .= '<label>'.  
                                        '<input type="checkbox" name="clonecode" value="'.$item.'"'.$codechk.' />'.  
                                        $item.'</label>';  
                     }  
                     $additional .= ('&nbsp;'x2).'('.&mt('check as many as needed').')</div>';  
                 }  
             }  
             $datatable .=  
                 '<span class="LC_nobreak"><label><input type="radio" name="canclone"'.$checked.  
                 ' value="'.$option.'"'.$onclick.' />'.$clonetitles{$option}.  
                 '</label>&nbsp;'.$additional.'</span><br />';  
         }  
         $datatable .= '</td>'.  
                       '</tr>';  
         $itemcount ++;  
     } else {      } else {
         $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';          $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
         my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout);          my ($currdefresponder,$def_official_credits,$def_unofficial_credits,$def_textbook_credits,
               %curruploadquota);
         my $currusecredits = 0;          my $currusecredits = 0;
         my $postsubmitclient = 1;  
         my @types = ('official','unofficial','community','textbook');          my @types = ('official','unofficial','community','textbook');
         if (ref($settings) eq 'HASH') {          if (ref($settings) eq 'HASH') {
             $currdefresponder = $settings->{'anonsurvey_threshold'};              $currdefresponder = $settings->{'anonsurvey_threshold'};
Line 2992  sub print_coursedefaults { Line 2841  sub print_coursedefaults {
                 }                  }
             }              }
             if (ref($settings->{'coursecredits'}) eq 'HASH') {              if (ref($settings->{'coursecredits'}) eq 'HASH') {
                 foreach my $type (@types) {                  $def_official_credits = $settings->{'coursecredits'}->{'official'};
                     next if ($type eq 'community');                  $def_unofficial_credits = $settings->{'coursecredits'}->{'unofficial'};
                     $defcredits{$type} = $settings->{'coursecredits'}->{$type};                  $def_textbook_credits = $settings->{'coursecredits'}->{'textbook'};
                     if ($defcredits{$type} ne '') {                  if (($def_official_credits ne '') || ($def_unofficial_credits ne '') ||
                         $currusecredits = 1;                      ($def_textbook_credits ne '')) {
                     }                      $currusecredits = 1;
                 }                  }
             }              }
             if (ref($settings->{'postsubmit'}) eq 'HASH') {  
                 if ($settings->{'postsubmit'}->{'client'} eq 'off') {  
                     $postsubmitclient = 0;  
                     foreach my $type (@types) {  
                         $deftimeout{$type} = $staticdefaults{'postsubmit'};  
                     }  
                 } else {  
                     foreach my $type (@types) {  
                         if (ref($settings->{'postsubmit'}->{'timeout'}) eq 'HASH') {  
                             if ($settings->{'postsubmit'}->{'timeout'}->{$type} =~ /^\d+$/) {  
                                 $deftimeout{$type} = $settings->{'postsubmit'}->{'timeout'}->{$type};  
                             } else {  
                                 $deftimeout{$type} = $staticdefaults{'postsubmit'};  
                             }  
                         } else {  
                             $deftimeout{$type} = $staticdefaults{'postsubmit'};  
                         }  
                     }  
                 }  
             } else {  
                 foreach my $type (@types) {  
                     $deftimeout{$type} = $staticdefaults{'postsubmit'};  
                 }  
             }  
         } else {  
             foreach my $type (@types) {  
                 $deftimeout{$type} = $staticdefaults{'postsubmit'};  
             }  
         }          }
         if (!$currdefresponder) {          if (!$currdefresponder) {
             $currdefresponder = $staticdefaults{'anonsurvey_threshold'};              $currdefresponder = $staticdefaults{'anonsurvey_threshold'};
Line 3067  sub print_coursedefaults { Line 2888  sub print_coursedefaults {
             $display = 'block';              $display = 'block';
         }          }
         my $additional = '<div id="credits" style="display: '.$display.'">'.          my $additional = '<div id="credits" style="display: '.$display.'">'.
                          '<i>'.&mt('Default credits').'</i><br /><table><tr>';                           '<span class="LC_nobreak">'.
         foreach my $type (@types) {                           &mt('Default credits for official courses [_1]',
             next if ($type eq 'community');                           '<input type="text" name="official_credits" value="'.
             $additional .= '<td align="center">'.&mt($type).'<br />'.                           $def_official_credits.'" size="3" />').
                            '<input type="text" name="'.$type.'_credits"'.                           '</span><br />'.
                            ' value="'.$defcredits{$type}.'" size="3" /></td>';                           '<span class="LC_nobreak">'.
         }                           &mt('Default credits for unofficial courses [_1]',
         $additional .= '</tr></table></div>'."\n";                           '<input type="text" name="unofficial_credits" value="'.
                            $def_unofficial_credits.'" size="3" />').
                            '</span><br />'.
                            '<span class="LC_nobreak">'.
                            &mt('Default credits for textbook courses [_1]',
                            '<input type="text" name="textbook_credits" value="'.
                            $def_textbook_credits.'" size="3" />').
                            '</span></div>'."\n";
         %defaultchecked = ('coursecredits' => 'off');          %defaultchecked = ('coursecredits' => 'off');
         @toggles = ('coursecredits');          @toggles = ('coursecredits');
         my $current = {          my $current = {
Line 3082  sub print_coursedefaults { Line 2910  sub print_coursedefaults {
                       };                        };
         (my $table,$itemcount) =          (my $table,$itemcount) =
             &radiobutton_prefs($current,\@toggles,\%defaultchecked,              &radiobutton_prefs($current,\@toggles,\%defaultchecked,
                                \%choices,$itemcount,$onclick,$additional,'left');                                 \%choices,$itemcount,$onclick,$additional);
         $datatable .= $table;  
         $onclick = "toggleDisplay(this.form,'studentsubmission');";  
         my $display = 'none';  
         if ($postsubmitclient) {  
             $display = 'block';  
         }  
         $additional = '<div id="studentsubmission" style="display: '.$display.'">'.  
                       &mt('Number of seconds submit is disabled').'<br />'.  
                       '<i>'.&mt('Enter 0 to remain disabled until page reload.').'</i><br />'.  
                       '<table><tr>';  
         foreach my $type (@types) {  
             $additional .= '<td align="center">'.&mt($type).'<br />'.  
                            '<input type="text" name="'.$type.'_timeout" value="'.  
                            $deftimeout{$type}.'" size="5" /></td>';  
         }  
         $additional .= '</tr></table></div>'."\n";  
         %defaultchecked = ('postsubmit' => 'on');  
         @toggles = ('postsubmit');  
         my $current = {  
                         'postsubmit' => $postsubmitclient,  
                       };  
         ($table,$itemcount) =  
             &radiobutton_prefs($current,\@toggles,\%defaultchecked,  
                                \%choices,$itemcount,$onclick,$additional,'left');  
         $datatable .= $table;          $datatable .= $table;
           $itemcount ++;
     }      }
     $$rowtotal += $itemcount;      $$rowtotal += $itemcount;
     return $datatable;      return $datatable;
Line 3312  sub print_validation_rows { Line 3117  sub print_validation_rows {
     }      }
     if ($caller eq 'requestcourses') {      if ($caller eq 'requestcourses') {
         my %currhash;          my %currhash;
         if (ref($settings) eq 'HASH') {          if (ref($settings->{'validation'}) eq 'HASH') {
             if (ref($settings->{'validation'}) eq 'HASH') {              if ($settings->{'validation'}{'dc'} ne '') {
                 if ($settings->{'validation'}{'dc'} ne '') {                  $currhash{$settings->{'validation'}{'dc'}} = 1;
                     $currhash{$settings->{'validation'}{'dc'}} = 1;  
                 }  
             }              }
         }          }
         my $numinrow = 2;          my $numinrow = 2;
         my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio',          my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio',
                                                        'validationdc',%currhash);                                                         'validationdc',%currhash);
         my $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';  
         $datatable .= '</td></tr><tr'.$css_class.'><td>';  
         if ($numdc > 1) {          if ($numdc > 1) {
             $datatable .= &mt('Course creation processed as: (choose Dom. Coord.)');              $datatable .= '</td></tr><tr class="LC_odd_row"><td>'.
                             &mt('Course creation processed as: (choose Dom. Coord.)').
                             '</td><td class="LC_left_item">'.$dctable.'</td></tr>';
         } else {          } else {
             $datatable .=  &mt('Course creation processed as: ');              $datatable .= $dctable.'</td></tr>';
         }          }
         $datatable .= '</td><td class="LC_left_item">'.$dctable.'</td></tr>';  
         $itemcount ++;          $itemcount ++;
     }      }
     if (ref($rowtotal)) {      if (ref($rowtotal)) {
Line 3352  sub print_usersessions { Line 3154  sub print_usersessions {
     if ($position eq 'top') {      if ($position eq 'top') {
         if (keys(%serverhomes) > 1) {          if (keys(%serverhomes) > 1) {
             my %spareid = &current_offloads_to($dom,$settings,\%servers);              my %spareid = &current_offloads_to($dom,$settings,\%servers);
             my $curroffloadnow;              $datatable .= &spares_row($dom,\%servers,\%spareid,\%serverhomes,\%altids,$rowtotal);
             if (ref($settings) eq 'HASH') {  
                 if (ref($settings->{'offloadnow'}) eq 'HASH') {  
                     $curroffloadnow = $settings->{'offloadnow'};  
                 }  
             }  
             $datatable .= &spares_row($dom,\%servers,\%spareid,\%serverhomes,\%altids,$curroffloadnow,$rowtotal);  
         } else {          } else {
             $datatable .= '<tr'.$css_class.'><td colspan="2">'.              $datatable .= '<tr'.$css_class.'><td colspan="2">'.
                           &mt('Nothing to set here, as the cluster to which this domain belongs only contains one server.');                            &mt('Nothing to set here, as the cluster to which this domain belongs only contains one server.');
Line 3608  sub current_offloads_to { Line 3404  sub current_offloads_to {
 }  }
   
 sub spares_row {  sub spares_row {
     my ($dom,$servers,$spareid,$serverhomes,$altids,$curroffloadnow,$rowtotal) = @_;      my ($dom,$servers,$spareid,$serverhomes,$altids,$rowtotal) = @_;
     my $css_class;      my $css_class;
     my $numinrow = 4;      my $numinrow = 4;
     my $itemcount = 1;      my $itemcount = 1;
Line 3628  sub spares_row { Line 3424  sub spares_row {
                 }                  }
             }              }
             next unless (ref($spareid->{$server}) eq 'HASH');              next unless (ref($spareid->{$server}) eq 'HASH');
             my $checkednow;  
             if (ref($curroffloadnow) eq 'HASH') {  
                 if ($curroffloadnow->{$server}) {  
                     $checkednow = ' checked="checked"';  
                 }  
             }  
             $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">'.                              <span class="LC_nobreak">'.
                           &mt('[_1] when busy, offloads to:'                            &mt('[_1] when busy, offloads to:'
                               ,'<b>'.$server.'</b>').'</span><br />'.                                ,'<b>'.$server.'</b>').
                           '<span class="LC_nobreak">'."\n".  
                           '<label><input type="checkbox" name="offloadnow" value="'.$server.'"'.$checkednow.' />'.  
                           '&nbsp;'.&mt('Switch active users on next access').'</label></span>'.  
                           "\n";                            "\n";
             my (%current,%canselect);              my (%current,%canselect);
             my @choices =               my @choices = 
Line 3866  sub print_loadbalancing { Line 3653  sub print_loadbalancing {
                     $disabled = ' disabled="disabled"';                      $disabled = ' disabled="disabled"';
                 }                  }
                 $targettable .=                  $targettable .=
                     '<td><span class="LC_nobreak"><label>'.                      '<td><label><input type="checkbox" name="loadbalancing_target_'.$balnum.'_'.$sparetype.'"'.
                     '<input type="checkbox" name="loadbalancing_target_'.$balnum.'_'.$sparetype.'"'.  
                     $checked.$disabled.' value="'.$chkboxval.'" id="loadbalancing_target_'.$balnum.'_'.$sparetype.'_'.$i.'" onclick="checkOffloads('."this,'$balnum','$sparetype'".');" /><span id="loadbalancing_targettxt_'.$balnum.'_'.$sparetype.'_'.$i.'">&nbsp;'.$chkboxval.                      $checked.$disabled.' value="'.$chkboxval.'" id="loadbalancing_target_'.$balnum.'_'.$sparetype.'_'.$i.'" onclick="checkOffloads('."this,'$balnum','$sparetype'".');" /><span id="loadbalancing_targettxt_'.$balnum.'_'.$sparetype.'_'.$i.'">&nbsp;'.$chkboxval.
                     '</span></label></span></td>';                      '</span></label></td>';
                 my $rem = $i%($numinrow);                  my $rem = $i%($numinrow);
                 if ($rem == 0) {                  if ($rem == 0) {
                     if (($i > 0) && ($i < $numspares-1)) {                      if (($i > 0) && ($i < $numspares-1)) {
Line 3959  sub loadbalancing_rules { Line 3745  sub loadbalancing_rules {
             if (ref($currrules) eq 'HASH') {              if (ref($currrules) eq 'HASH') {
                 $current = $currrules->{$type};                  $current = $currrules->{$type};
             }              }
             if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) {              if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) {
                 if ($dom ne &Apache::lonnet::host_domain($lonhost)) {                  if ($dom ne &Apache::lonnet::host_domain($lonhost)) {
                     $current = '';                      $current = '';
                 }                  }
Line 4011  sub loadbalance_rule_row { Line 3797  sub loadbalance_rule_row {
     my @rulenames;      my @rulenames;
     my %ruletitles = &offloadtype_text();      my %ruletitles = &offloadtype_text();
     if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) {      if (($type eq '_LC_ipchangesso') || ($type eq '_LC_ipchange')) {
         @rulenames = ('balancer','offloadedto','specific');          @rulenames = ('balancer','offloadedto');
     } else {      } else {
         @rulenames = ('default','homeserver');          @rulenames = ('default','homeserver');
         if ($type eq '_LC_external') {          if ($type eq '_LC_external') {
Line 4022  sub loadbalance_rule_row { Line 3808  sub loadbalance_rule_row {
         push(@rulenames,'none');          push(@rulenames,'none');
     }      }
     my $style = $targets_div_style;      my $style = $targets_div_style;
     if (($type eq '_LC_external') || ($type eq '_LC_internetdom')) {      if (($type eq '_LC_external') || ($type eq '_LC_internetdom') || ($type eq '_LC_ipchange')) {
         $style = $homedom_div_style;          $style = $homedom_div_style;
     }      }
     my $space;      my $space;
Line 4073  sub loadbalance_rule_row { Line 3859  sub loadbalance_rule_row {
                    '<input type="radio" name="loadbalancing_rules_'.$balnum.'_'.$type.                     '<input type="radio" name="loadbalancing_rules_'.$balnum.'_'.$type.
                    '" id="loadbalancing_rules_'.$balnum.'_'.$type.'_'.$i.'" value="'.                     '" id="loadbalancing_rules_'.$balnum.'_'.$type.'_'.$i.'" value="'.
                    $rule.'" onclick="balanceruleChange('."this.form,'$balnum','$type'".                     $rule.'" onclick="balanceruleChange('."this.form,'$balnum','$type'".
                    ')"'.$checked.' />&nbsp;';                     ')"'.$checked.' />&nbsp;'.$ruletitles{$rulenames[$i]}.
         if (($rulenames[$i] eq 'specific') && ($type =~ /^_LC_ipchange/)) {                     '</label>'.$extra.'</span><br />'."\n";
             $output .= $ruletitles{'particular'};  
         } else {  
             $output .= $ruletitles{$rulenames[$i]};  
         }  
         $output .= '</label>'.$extra.'</span><br />'."\n";  
     }      }
     $output .= '</div></td></tr>'."\n";      $output .= '</div></td></tr>'."\n";
     return $output;      return $output;
Line 4094  sub offloadtype_text { Line 3875  sub offloadtype_text {
            'none'             => 'No offload',             'none'             => 'No offload',
            'balancer'         => 'Session hosted on Load Balancer, after re-authentication',             'balancer'         => 'Session hosted on Load Balancer, after re-authentication',
            'offloadedto'      => 'Session hosted on offload server, after re-authentication',             'offloadedto'      => 'Session hosted on offload server, after re-authentication',
            'particular'       => 'Session hosted (after re-auth) on server:',  
     );      );
     return %ruletitles;      return %ruletitles;
 }  }
Line 4377  sub print_selfcreation { Line 4157  sub print_selfcreation {
                 $datatable .= '<tr>';                  $datatable .= '<tr>';
             }              }
             my $currval;              my $currval;
             if (ref($createsettings) eq 'HASH') {              if (ref($createsettings->{'shibenv'}) eq 'HASH') {
                 if (ref($createsettings->{'shibenv'}) eq 'HASH') {                  $currval = $createsettings->{'shibenv'}{$fields[$i]};
                     $currval = $createsettings->{'shibenv'}{$fields[$i]};  
                 }  
             }              }
             $datatable .= '<td class="LC_left_item">'.              $datatable .= '<td class="LC_left_item">'.
                           '<span class="LC_nobreak">'.                            '<span class="LC_nobreak">'.
Line 4769  sub print_defaults { Line 4547  sub print_defaults {
                 my $includeempty = 1;                  my $includeempty = 1;
                 $datatable .= &Apache::loncommon::select_datelocale($item,$defaults{$item},undef,$includeempty);                  $datatable .= &Apache::loncommon::select_datelocale($item,$defaults{$item},undef,$includeempty);
             } elsif ($item eq 'lang_def') {              } elsif ($item eq 'lang_def') {
                 my $includeempty = 1;                  my %langchoices = &get_languages_hash();
                 $datatable .= &Apache::loncommon::select_language($item,$defaults{$item},$includeempty);                  $langchoices{''} = 'No language preference';
                   %langchoices = &Apache::lonlocal::texthash(%langchoices);
                   $datatable .= &Apache::loncommon::select_form($defaults{$item},$item,
                                                                 \%langchoices);
             } else {              } else {
                 my $size;                  my $size;
                 if ($item eq 'portal_def') {                  if ($item eq 'portal_def') {
Line 4839  sub print_defaults { Line 4620  sub print_defaults {
                     $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';                      $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';
                 }                  }
                 $datatable .= '</select>&nbsp;'.&mt('Internal ID:').                  $datatable .= '</select>&nbsp;'.&mt('Internal ID:').
                               '<input type="text" size="10" name="addinststatus" value="" />'.                                '<input type="text" size="10" name="addinststatus" value="" /></span>'.
                               '&nbsp;'.&mt('(new)').                                '&nbsp;'.&mt('(new)').
                               '</span></td><td class="LC_left_item"><span class="LC_nobreak">'.                                '</span></td><td class="LC_left_item"><span class="LC_nobreak">'.
                               &mt('Name displayed:').                                &mt('Name displayed:').
Line 5376  sub serverstatus_pages { Line 5157  sub serverstatus_pages {
     return ('userstatus','lonstatus','loncron','server-status','codeversions',      return ('userstatus','lonstatus','loncron','server-status','codeversions',
             'checksums','clusterstatus','metadata_keywords','metadata_harvest',              'checksums','clusterstatus','metadata_keywords','metadata_harvest',
             'takeoffline','takeonline','showenv','toggledebug','ping','domconf',              'takeoffline','takeonline','showenv','toggledebug','ping','domconf',
             'uniquecodes','diskusage','coursecatalog');              'uniquecodes','diskusage');
 }  }
   
 sub defaults_javascript {  sub defaults_javascript {
     my ($settings) = @_;      my ($settings) = @_;
     return unless (ref($settings) eq 'HASH');      my ($output,$jstext); 
     if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) {      if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) {
         my $maxnum = scalar(@{$settings->{'inststatusorder'}});          my $maxnum = scalar(@{$settings->{'inststatusorder'}});
         if ($maxnum eq '') {          if ($maxnum eq '') {
             $maxnum = 0;              $maxnum = 0;
         }          }
         $maxnum ++;          $maxnum ++;
         my $jstext = '    var inststatuses = Array('."'".join("','",@{$settings->{'inststatusorder'}})."'".');';            $jstext = '    var inststatuses = Array('."'".join("','",@{$settings->{'inststatusorder'}})."'".');';  
         return <<"ENDSCRIPT";          return <<"ENDSCRIPT";
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA[  // <![CDATA[
Line 5466  sub coursecategories_javascript { Line 5247  sub coursecategories_javascript {
     }      }
     my $instcode_reserved = &mt('The name: [_1] is a reserved category.','"instcode"');      my $instcode_reserved = &mt('The name: [_1] is a reserved category.','"instcode"');
     my $communities_reserved = &mt('The name: [_1] is a reserved category.','"communities"');      my $communities_reserved = &mt('The name: [_1] is a reserved category.','"communities"');
     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.'); 
     &js_escape(\$instcode_reserved);  
     &js_escape(\$communities_reserved);  
     &js_escape(\$choose_again);  
     $output = <<"ENDSCRIPT";      $output = <<"ENDSCRIPT";
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA[  // <![CDATA[
Line 5984  sub modify_login { Line 5762  sub modify_login {
     }      }
   
     my %servers = &Apache::lonnet::internet_dom_servers($dom);      my %servers = &Apache::lonnet::internet_dom_servers($dom);
     my %domservers = &Apache::lonnet::get_servers($dom);  
     my @loginvia_attribs = ('serverpath','custompath','exempt');      my @loginvia_attribs = ('serverpath','custompath','exempt');
     if (keys(%servers) > 1) {      if (keys(%servers) > 1) {
         foreach my $lonhost (keys(%servers)) {          foreach my $lonhost (keys(%servers)) {
Line 6027  sub modify_login { Line 5804  sub modify_login {
                             $changes{'loginvia'}{$lonhost} = 1;                              $changes{'loginvia'}{$lonhost} = 1;
                         }                          }
                         if ($item eq 'exempt') {                          if ($item eq 'exempt') {
                             $new = &check_exempt_addresses($new);                              $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;                          $loginhash{login}{loginvia}{$lonhost}{$item} = $new;
                     }                      }
Line 6139  sub modify_login { Line 5931  sub modify_login {
             $errors .= '<li><span class="LC_error">'.$error.'</span></li>';              $errors .= '<li><span class="LC_error">'.$error.'</span></li>';
         }          }
     }      }
   
     my (%currheadtagurls,%currexempt,@newhosts,%newheadtagurls,%possexempt);  
     if (ref($domconfig{'login'}) eq 'HASH') {  
         if (ref($domconfig{'login'}{'headtag'}) eq 'HASH') {  
             foreach my $lonhost (keys(%{$domconfig{'login'}{'headtag'}})) {  
                 if ($domservers{$lonhost}) {  
                     if (ref($domconfig{'login'}{'headtag'}{$lonhost}) eq 'HASH') {  
                         $currheadtagurls{$lonhost} = $domconfig{'login'}{'headtag'}{$lonhost}{'url'};  
                         $currexempt{$lonhost} = $domconfig{'login'}{'headtagexempt'}{$lonhost}{'exempt'}  
                     }  
                 }  
             }  
         }  
     }  
     my @delheadtagurls = &Apache::loncommon::get_env_multiple('form.loginheadtag_del');  
     foreach my $lonhost (sort(keys(%domservers))) {  
         if (grep(/^\Q$lonhost\E$/,@delheadtagurls)) {  
             $changes{'headtag'}{$lonhost} = 1;  
         } else {  
             if ($env{'form.loginheadtagexempt_'.$lonhost}) {  
                 $possexempt{$lonhost} = &check_exempt_addresses($env{'form.loginheadtagexempt_'.$lonhost});  
             }  
             if ($env{'form.loginheadtag_'.$lonhost.'.filename'}) {  
                 push(@newhosts,$lonhost);  
             } elsif ($currheadtagurls{$lonhost}) {  
                 $loginhash{'login'}{'headtag'}{$lonhost}{'url'} = $currheadtagurls{$lonhost};  
                 if ($currexempt{$lonhost}) {  
                     if ((!exists($possexempt{$lonhost})) || ($possexempt{$lonhost} ne $currexempt{$lonhost})) {  
                         $changes{'headtag'}{$lonhost} = 1;  
                     }  
                 } elsif ($possexempt{$lonhost}) {  
                     $changes{'headtag'}{$lonhost} = 1;  
                 }  
                 if ($possexempt{$lonhost}) {  
                     $loginhash{'login'}{'headtag'}{$lonhost}{'exempt'} = $possexempt{$lonhost};  
                 }  
             }  
         }  
     }  
     if (@newhosts) {  
         my $error;  
         my ($configuserok,$author_ok,$switchserver) = &config_check($dom,$confname,$servadm);  
         if ($configuserok eq 'ok') {  
             if ($switchserver) {  
                 $error = &mt("Upload of custom markup is not permitted to this server: [_1]",$switchserver);  
             } elsif ($author_ok eq 'ok') {  
                 foreach my $lonhost (@newhosts) {  
                     my $formelem = 'loginheadtag_'.$lonhost;  
                     (my $result,$newheadtagurls{$lonhost}) = &publishlogo($r,'upload',$formelem,$dom,$confname,  
                                                                           "login/headtag/$lonhost",'','',  
                                                                           $env{'form.loginheadtag_'.$lonhost.'.filename'});  
                     if ($result eq 'ok') {  
                         $loginhash{'login'}{'headtag'}{$lonhost}{'url'} = $newheadtagurls{$lonhost};  
                         $changes{'headtag'}{$lonhost} = 1;  
                         if ($possexempt{$lonhost}) {  
                             $loginhash{'login'}{'headtag'}{$lonhost}{'exempt'} = $possexempt{$lonhost};  
                         }  
                     } else {  
                         my $puberror = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].",  
                                            $newheadtagurls{$lonhost},$result);  
                         $errors .= '<li><span class="LC_error">'.$puberror.'</span></li>';  
                         if ((grep(/^\Q$lonhost\E$/,keys(%currheadtagurls))) &&  
                             (!grep(/^\Q$lonhost\E$/,@delheadtagurls))) {  
                             $loginhash{'login'}{'headtag'}{$lonhost} = $currheadtagurls{$lonhost};  
                         }  
                     }  
                 }  
             } else {  
                 $error = &mt("Upload of custom markup file(s) failed because an author role could not be assigned to a Domain Configuration user ([_1]) in domain: [_2].  Error was: [_3].",$confname,$dom,$author_ok);  
             }  
         } else {  
             $error = &mt("Upload of custom markup file(s) failed because a Domain Configuration user ([_1]) could not be created in domain: [_2].  Error was: [_3].",$confname,$dom,$configuserok);  
         }  
         if ($error) {  
             &Apache::lonnet::logthis($error);  
             $errors .= '<li><span class="LC_error">'.$error.'</span></li>';  
         }  
     }  
   
     &process_captcha('login',\%changes,$loginhash{'login'},$domconfig{'login'});      &process_captcha('login',\%changes,$loginhash{'login'},$domconfig{'login'});
   
     my $defaulthelpfile = '/adm/loginproblems.html';      my $defaulthelpfile = '/adm/loginproblems.html';
Line 6318  sub modify_login { Line 6031  sub modify_login {
                             }                              }
                         }                          }
                     }                      }
                 } elsif ($item eq 'headtag') {  
                     if (ref($changes{$item}) eq 'HASH') {  
                         foreach my $lonhost (sort(keys(%{$changes{$item}}))) {  
                             if (grep(/^\Q$lonhost\E$/,@delheadtagurls)) {  
                                 $resulttext .= '<li>'.&mt('custom markup file removed for [_1]',$domservers{$lonhost}).'</li>';  
                             } elsif (ref($loginhash{'login'}{'headtag'}{$lonhost}) eq 'HASH') {  
                                 $resulttext .= '<li><a href="'.  
                                                "javascript:void(open('$loginhash{'login'}{'headtag'}{$lonhost}{'url'}?inhibitmenu=yes','Custom_HeadTag',  
                                                'menubar=0,toolbar=1,scrollbars=1,width=600,height=500,resizable=yes'))".  
                                                '">'.&mt('custom markup').'</a> '.&mt('(for [_1])',$servers{$lonhost}).' ';  
                                 if ($possexempt{$lonhost}) {  
                                     $resulttext .= &mt('not included for client IP(s): [_1]',$possexempt{$lonhost});  
                                 } else {  
                                     $resulttext .= &mt('included for any client IP');  
                                 }  
                                 $resulttext .= '</li>';  
                             }  
                         }  
                     }  
                 } elsif ($item eq 'captcha') {                  } elsif ($item eq 'captcha') {
                     if (ref($loginhash{'login'}) eq 'HASH') {                      if (ref($loginhash{'login'}) eq 'HASH') {
                         my $chgtxt;                          my $chgtxt;
Line 6368  sub modify_login { Line 6062  sub modify_login {
                         if (!$privkey) {                          if (!$privkey) {
                             $chgtxt .= '<li>'.&mt('Private key deleted').'</li>';                              $chgtxt .= '<li>'.&mt('Private key deleted').'</li>';
                         } else {                          } else {
                             $chgtxt .= '<li>'.&mt('Private key set to [_1]',$privkey).'</li>';                              $chgtxt .= '<li>'.&mt('Private key set to [_1]',$pubkey).'</li>';
                         }                          }
                         $chgtxt .= '</ul>';                          $chgtxt .= '</ul>';
                         $resulttext .= '<li>'.$chgtxt.'</li>';                          $resulttext .= '<li>'.$chgtxt.'</li>';
Line 6392  sub modify_login { Line 6086  sub modify_login {
     return $resulttext;      return $resulttext;
 }  }
   
 sub check_exempt_addresses {  
     my ($iplist) = @_;  
     $iplist =~ s/^\s+//;  
     $iplist =~ s/\s+$//;  
     my @poss_ips = split(/\s*[,:]\s*/,$iplist);  
     my (@okips,$new);  
     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 = '';  
     }  
     return $new;  
 }  
   
 sub color_font_choices {  sub color_font_choices {
     my %choices =      my %choices =
         &Apache::lonlocal::texthash (          &Apache::lonlocal::texthash (
Line 7301  sub modify_quotas { Line 6974  sub modify_quotas {
                                     my $newpos = $env{'form.'.$itemid};                                      my $newpos = $env{'form.'.$itemid};
                                     $newpos =~ s/\D+//g;                                      $newpos =~ s/\D+//g;
                                     foreach my $item ('subject','title','publisher','author') {                                      foreach my $item ('subject','title','publisher','author') {
                                         next if ((($item eq 'author') || ($item eq 'publisher')) &&                                          next if ((($item eq 'author') || ($item eq 'publisher')) && 
                                                  ($type eq 'templates'));                                                   ($type eq 'templates'));
                                         $confhash{$type}{$key}{$item} = $env{'form.'.$type.'_'.$item.'_'.$i};                                          $confhash{$type}{$key}{$item} = $env{'form.'.$type.'_'.$item.'_'.$i};
                                         if ($domconfig{$action}{$type}{$key}{$item} ne $confhash{$type}{$key}{$item}) {                                          if ($domconfig{$action}{$type}{$key}{$item} ne $confhash{$type}{$key}{$item}) {
Line 7398  sub modify_quotas { Line 7071  sub modify_quotas {
                         if (@{$confhash{'validation'}{$item}} > 0) {                          if (@{$confhash{'validation'}{$item}} > 0) {
                             @{$confhash{'validation'}{$item}} = sort(@{$confhash{'validation'}{$item}});                              @{$confhash{'validation'}{$item}} = sort(@{$confhash{'validation'}{$item}});
                         }                          }
                         if (ref($domconfig{'requestcourses'}) eq 'HASH') {                          if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') {
                             if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') {                              if (ref($domconfig{'requestcourses'}{'validation'}{$item}) eq 'ARRAY') {
                                 if (ref($domconfig{'requestcourses'}{'validation'}{$item}) eq 'ARRAY') {                                  @changed = &Apache::loncommon::compare_arrays($confhash{'validation'}{$item},
                                     @changed = &Apache::loncommon::compare_arrays($confhash{'validation'}{$item},                                                                                $domconfig{'requestcourses'}{'validation'}{$item});
                                                                                   $domconfig{'requestcourses'}{'validation'}{$item});  
                                 } else {  
                                     @changed = @{$confhash{'validation'}{$item}};  
                                 }  
                             } else {                              } else {
                                 @changed = @{$confhash{'validation'}{$item}};                                  @changed = @{$confhash{'validation'}{$item}};
                             }                              }
Line 7426  sub modify_quotas { Line 7095  sub modify_quotas {
                                 $env{'form.requestcourses_validation_'.$item} =~ s/[\n\r\f]+/\s/gs;                                  $env{'form.requestcourses_validation_'.$item} =~ s/[\n\r\f]+/\s/gs;
                             }                              }
                         }                          }
                         if (ref($domconfig{'requestcourses'}) eq 'HASH') {                          if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') {
                             if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') {                              if ($domconfig{'requestcourses'}{'validation'}{$item} ne $confhash{'validation'}{$item}) {
                                 if ($domconfig{'requestcourses'}{'validation'}{$item} ne $confhash{'validation'}{$item}) {                                  $changes{'validation'}{$item} = $confhash{'validation'}{$item};
                                     $changes{'validation'}{$item} = $confhash{'validation'}{$item};  
                                 }  
                             } else {  
                                 if ($confhash{'validation'}{$item} ne '') {  
                                     $changes{'validation'}{$item} = $confhash{'validation'}{$item};  
                                 }  
                             }                              }
                         } else {                          } else {
                             if ($confhash{'validation'}{$item} ne '') {                              if ($confhash{'validation'}{$item} ne '') {
Line 7452  sub modify_quotas { Line 7115  sub modify_quotas {
                 }                  }
             }              }
             if (ref($confhash{'validation'}) eq 'HASH') {              if (ref($confhash{'validation'}) eq 'HASH') {
                 if (ref($domconfig{'requestcourses'}) eq 'HASH') {                  if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') {
                     if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') {                      if ($domconfig{'requestcourses'}{'validation'}{'dc'}) {
                         if ($domconfig{'requestcourses'}{'validation'}{'dc'}) {                          unless ($confhash{'validation'}{'dc'} eq $domconfig{'requestcourses'}{'validation'}{'dc'}) {
                             unless ($confhash{'validation'}{'dc'} eq $domconfig{'requestcourses'}{'validation'}{'dc'}) {                              if ($confhash{'validation'}{'dc'} eq '') {
                                 if ($confhash{'validation'}{'dc'} eq '') {                                  $changes{'validation'}{'dc'} = &mt('None');
                                     $changes{'validation'}{'dc'} = &mt('None');                              } else {
                                 } else {                                  $changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'};
                                     $changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'};  
                                 }  
                             }                              }
                         } elsif ($confhash{'validation'}{'dc'} ne '') {  
                             $changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'};  
                         }                          }
                     } elsif ($confhash{'validation'}{'dc'} ne '') {                      } elsif ($confhash{'validation'}{'dc'} ne '') {
                         $changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'};                          $changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'};
Line 7471  sub modify_quotas { Line 7130  sub modify_quotas {
                 } elsif ($confhash{'validation'}{'dc'} ne '') {                  } elsif ($confhash{'validation'}{'dc'} ne '') {
                     $changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'};                      $changes{'validation'}{'dc'} = $confhash{'validation'}{'dc'};
                 }                  }
             } else {              } elsif (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') {
                 if (ref($domconfig{'requestcourses'}) eq 'HASH') {                  if ($domconfig{'requestcourses'}{'validation'}{'dc'}) {
                     if (ref($domconfig{'requestcourses'}{'validation'}) eq 'HASH') {                      $changes{'validation'}{'dc'} = &mt('None');
                         if ($domconfig{'requestcourses'}{'validation'}{'dc'}) {  
                             $changes{'validation'}{'dc'} = &mt('None');  
                         }  
                     }  
                 }                  }
             }              }
         }          }
Line 9293  sub modify_selfcreation { Line 8948  sub modify_selfcreation {
                                 foreach my $type (@{$types}) {                                  foreach my $type (@{$types}) {
                                     if (ref($cancreate{'emailusername'}{$type}) eq 'HASH') {                                      if (ref($cancreate{'emailusername'}{$type}) eq 'HASH') {
                                         if (keys(%{$cancreate{'emailusername'}{$type}}) > 0) {                                          if (keys(%{$cancreate{'emailusername'}{$type}}) > 0) {
                                             $chgtext .= &mt('When self-creating account with e-mail as username, the following information will be provided by [_1]:',"'$usertypes->{$type}'").                                              $chgtext .= &mt('When self-creating account with e-mail as username, the following information will be provided by [_1]:',$usertypes->{$type}).
                                                     '<ul>';                                                      '<ul>';
                                             foreach my $field (@{$infofields}) {                                              foreach my $field (@{$infofields}) {
                                                 if ($cancreate{'emailusername'}{$type}{$field}) {                                                  if ($cancreate{'emailusername'}{$type}{$field}) {
                                                     $chgtext .= '<li>'.$infotitles->{$field}.'</li>';                                                      $chgtext .= '<li>'.$infotitles->{$field}.'</li>';
                                                 }                                                  }
                                             }                                              }
                                             $chgtext .= '</ul>';  
                                         } else {  
                                             $chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',"'$usertypes->{$type}'").'<br />';  
                                         }                                          }
                                           $chgtext .= '</ul>';
                                     } else {                                      } else {
                                         $chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',"'$usertypes->{$type}'").'<br />';                                          $chgtext .= &mt('When self creating account with e-mail as username, no information besides e-mail address will be provided by [_1].',$usertypes->{$type}).'<br />';
                                     }                                      }
                                 }                                  }
                             }                              }
Line 9411  sub process_captcha { Line 9064  sub process_captcha {
     if ($newsettings->{'captcha'} eq 'recaptcha') {      if ($newsettings->{'captcha'} eq 'recaptcha') {
         $newpub = $env{'form.'.$container.'_recaptchapub'};          $newpub = $env{'form.'.$container.'_recaptchapub'};
         $newpriv = $env{'form.'.$container.'_recaptchapriv'};          $newpriv = $env{'form.'.$container.'_recaptchapriv'};
         $newpub =~ s/[^\w\-]//g;          $newpub =~ s/\W//g;
         $newpriv =~ s/[^\w\-]//g;          $newpriv =~ s/\W//g;
         $newsettings->{'recaptchakeys'} = {          $newsettings->{'recaptchakeys'} = {
                                              public  => $newpub,                                               public  => $newpub,
                                              private => $newpriv,                                               private => $newpriv,
Line 10112  sub modify_coursecategories { Line 9765  sub modify_coursecategories {
             }              }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';
             if ($changes{'unauth'} || $changes{'auth'}) {              if ($changes{'unauth'} || $changes{'auth'}) {
                 my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);                  &Apache::loncommon::devalidate_domconfig_cache($dom);
                 if ($changes{'auth'}) {  
                     $domdefaults{'catauth'} = $domconfig{'coursecategories'}{'auth'};  
                 }  
                 if ($changes{'unauth'}) {  
                     $domdefaults{'catunauth'} = $domconfig{'coursecategories'}{'unauth'};  
                 }  
                 my $cachetime = 24*60*60;  
                 &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);  
                 if (ref($lastactref) eq 'HASH') {                  if (ref($lastactref) eq 'HASH') {
                     $lastactref->{'domdefaults'} = 1;                      $lastactref->{'domainconfig'} = 1;
                 }                  }
             }              }
         } else {          } else {
Line 10319  sub modify_helpsettings { Line 9964  sub modify_helpsettings {
 sub modify_coursedefaults {  sub modify_coursedefaults {
     my ($dom,$lastactref,%domconfig) = @_;      my ($dom,$lastactref,%domconfig) = @_;
     my ($resulttext,$errors,%changes,%defaultshash);      my ($resulttext,$errors,%changes,%defaultshash);
     my %defaultchecked = (      my %defaultchecked = ('canuse_pdfforms' => 'off');
                            'uselcmath'       => 'on',      my @toggles = ('canuse_pdfforms');
                            'usejsme'         => 'on'  
                          );  
     my @toggles = ('uselcmath','usejsme');  
     my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial',      my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial',
                    'uploadquota_community','uploadquota_textbook');                     'uploadquota_community','uploadquota_textbook');
     my @types = ('official','unofficial','community','textbook');      my @types = ('official','unofficial','community','textbook');
     my %staticdefaults = (      my %staticdefaults = (
                            anonsurvey_threshold => 10,                             anonsurvey_threshold => 10,
                            uploadquota          => 500,                             uploadquota          => 500,
                            postsubmit           => 60,  
                          );                           );
   
     $defaultshash{'coursedefaults'} = {};      $defaultshash{'coursedefaults'} = {};
Line 10391  sub modify_coursedefaults { Line 10032  sub modify_coursedefaults {
                 }                  }
             }              }
         }          }
         my $currclone = $domconfig{'coursedefaults'}{'canclone'};  
         my @currclonecode;          my $officialcreds = $env{'form.official_credits'};
         if (ref($currclone) eq 'HASH') {          $officialcreds =~ s/[^\d.]+//g;
             if (ref($currclone->{'instcode'}) eq 'ARRAY') {          my $unofficialcreds = $env{'form.unofficial_credits'};
                 @currclonecode = @{$currclone->{'instcode'}};          $unofficialcreds =~ s/[^\d.]+//g;
             }          my $textbookcreds = $env{'form.textbook_credits'};
         }          $textbookcreds =~ s/[^\d.]+//g;
         my $newclone;          if (ref($domconfig{'coursedefaults'}{'coursecredits'} ne 'HASH') &&
         if ($env{'form.canclone'} =~ /^(none|domain|instcode)$/) {                  ($env{'form.coursecredits'} eq '1')) {
             $newclone = $env{'form.canclone'};                  $changes{'coursecredits'} = 1;
         }          } else {
         if ($newclone eq 'instcode') {              if (($domconfig{'coursedefaults'}{'coursecredits'}{'official'} ne $officialcreds)  ||
             my @newcodes = &Apache::loncommon::get_env_multiple('form.clonecode');                  ($domconfig{'coursedefaults'}{'coursecredits'}{'unofficial'} ne $unofficialcreds) ||
             my (%codedefaults,@code_order,@clonecode);                  ($domconfig{'coursedefaults'}{'coursecredits'}{'textbook'} ne $textbookcreds)) {
             &Apache::lonnet::auto_instcode_defaults($dom,\%codedefaults,                  $changes{'coursecredits'} = 1;
                                                     \@code_order);              }
             foreach my $item (@code_order) {          }
                 if (grep(/^\Q$item\E$/,@newcodes)) {          $defaultshash{'coursedefaults'}{'coursecredits'} = {
                     push(@clonecode,$item);              official   => $officialcreds,
                 }              unofficial => $unofficialcreds,
             }              textbook   => $textbookcreds,
             if (@clonecode) {  
                 $defaultshash{'coursedefaults'}{'canclone'} = { $newclone => \@clonecode };  
                 my @diffs = &Apache::loncommon::compare_arrays(\@currclonecode,\@clonecode);  
                 if (@diffs) {  
                     $changes{'canclone'} = 1;  
                 }  
             } else {  
                 $newclone eq '';  
             }  
         } elsif ($newclone ne '') {  
             $defaultshash{'coursedefaults'}{'canclone'} = $newclone;  
         }  
         if ($newclone ne $currclone) {  
             $changes{'canclone'} = 1;  
         }  
         my %credits;  
         foreach my $type (@types) {  
             unless ($type eq 'community') {  
                 $credits{$type} = $env{'form.'.$type.'_credits'};  
                 $credits{$type} =~ s/[^\d.]+//g;  
             }  
         }  
         if ((ref($domconfig{'coursedefaults'}{'coursecredits'}) ne 'HASH') &&  
             ($env{'form.coursecredits'} eq '1')) {  
             $changes{'coursecredits'} = 1;  
             foreach my $type (keys(%credits)) {  
                 $defaultshash{'coursedefaults'}{'coursecredits'}{$type} = $credits{$type};  
             }  
         } else {  
             if ($env{'form.coursecredits'} eq '1') {  
                 foreach my $type (@types) {  
                     unless ($type eq 'community') {  
                         if ($domconfig{'coursedefaults'}{'coursecredits'}{$type} ne $credits{$type}) {  
                             $changes{'coursecredits'} = 1;  
                         }  
                         $defaultshash{'coursedefaults'}{'coursecredits'}{$type} = $credits{$type};  
                     }  
                 }  
             } elsif (ref($domconfig{'coursedefaults'}{'coursecredits'}) eq 'HASH') {  
                 foreach my $type (@types) {  
                     unless ($type eq 'community') {  
                         if ($domconfig{'coursedefaults'}{'coursecredits'}{$type}) {  
                             $changes{'coursecredits'} = 1;  
                             last;  
                         }  
                     }  
                 }  
             }  
         }  
         if ($env{'form.postsubmit'} eq '1') {  
             $defaultshash{'coursedefaults'}{'postsubmit'}{'client'} = 'on';  
             my %currtimeout;  
             if (ref($domconfig{'coursedefaults'}{'postsubmit'}) eq 'HASH') {  
                 if ($domconfig{'coursedefaults'}{'postsubmit'}{'client'} eq 'off') {  
                     $changes{'postsubmit'} = 1;  
                 }  
                 if (ref($domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}) eq 'HASH') {  
                     %currtimeout = %{$domconfig{'coursedefaults'}{'postsubmit'}{'timeout'}};  
                 }  
             } else {  
                 $changes{'postsubmit'} = 1;  
             }  
             foreach my $type (@types) {  
                 my $timeout = $env{'form.'.$type.'_timeout'};  
                 $timeout =~ s/\D//g;  
                 if ($timeout == $staticdefaults{'postsubmit'}) {  
                     $timeout = '';  
                 } elsif (($timeout eq '') || ($timeout =~ /^0+$/)) {  
                     $timeout = '0';  
                 }  
                 unless ($timeout eq '') {  
                     $defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}{$type} = $timeout;  
                 }  
                 if (exists($currtimeout{$type})) {  
                     if ($timeout ne $currtimeout{$type}) {  
                         $changes{'postsubmit'} = 1;  
                     }  
                 } elsif ($timeout ne '') {  
                     $changes{'postsubmit'} = 1;  
                 }  
             }  
         } else {  
             $defaultshash{'coursedefaults'}{'postsubmit'}{'client'} = 'off';  
             if (ref($domconfig{'coursedefaults'}{'postsubmit'}) eq 'HASH') {  
                 if ($domconfig{'coursedefaults'}{'postsubmit'}{'client'} eq 'on') {  
                     $changes{'postsubmit'} = 1;  
                 }  
             } else {  
                 $changes{'postsubmit'} = 1;  
             }  
         }          }
     }      }
     my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,      my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,
Line 10509  sub modify_coursedefaults { Line 10060  sub modify_coursedefaults {
     if ($putresult eq 'ok') {      if ($putresult eq 'ok') {
         if (keys(%changes) > 0) {          if (keys(%changes) > 0) {
             my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);              my %domdefaults = &Apache::lonnet::get_domain_defaults($dom,1);
             if (($changes{'uploadquota'}) || ($changes{'postsubmit'}) ||              if (($changes{'canuse_pdfforms'}) || ($changes{'coursecredits'}) || 
                 ($changes{'coursecredits'}) || ($changes{'uselcmath'}) || ($changes{'usejsme'}) ||                  ($changes{'uploadquota'})) { 
                 ($changes{'canclone'})) {                  if ($changes{'canuse_pdfforms'}) {
                 foreach my $item ('uselcmath','usejsme') {                      $domdefaults{'canuse_pdfforms'}=$defaultshash{'coursedefaults'}{'canuse_pdfforms'};
                     if ($changes{$item}) {  
                         $domdefaults{$item}=$defaultshash{'coursedefaults'}{$item};  
                     }  
                 }                  }
                 if ($changes{'coursecredits'}) {                  if ($changes{'coursecredits'}) {
                     if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') {                      if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') {
                         foreach my $type (keys(%{$defaultshash{'coursedefaults'}{'coursecredits'}})) {                          $domdefaults{'officialcredits'} =
                             $domdefaults{$type.'credits'} =                              $defaultshash{'coursedefaults'}{'coursecredits'}{'official'};
                                 $defaultshash{'coursedefaults'}{'coursecredits'}{$type};                          $domdefaults{'unofficialcredits'} =
                         }                              $defaultshash{'coursedefaults'}{'coursecredits'}{'unofficial'};
                     }                          $domdefaults{'textbookcredits'} =
                 }                              $domdefaults{'coursedefaults'}{'coursecredits'}{'textbook'};
                 if ($changes{'postsubmit'}) {  
                     if (ref($defaultshash{'coursedefaults'}{'postsubmit'}) eq 'HASH') {  
                         $domdefaults{'postsubmit'} = $defaultshash{'coursedefaults'}{'postsubmit'}{'client'};  
                         if (ref($defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}) eq 'HASH') {  
                             foreach my $type (keys(%{$defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}})) {  
                                 $domdefaults{$type.'postsubtimeout'} =  
                                     $defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}{$type};  
                             }  
                         }  
                     }                      }
                 }                  }
                 if ($changes{'uploadquota'}) {                  if ($changes{'uploadquota'}) {
Line 10543  sub modify_coursedefaults { Line 10082  sub modify_coursedefaults {
                         }                          }
                     }                      }
                 }                  }
                 if ($changes{'canclone'}) {  
                     if (ref($defaultshash{'coursedefaults'}{'canclone'}) eq 'HASH') {  
                         if (ref($defaultshash{'coursedefaults'}{'canclone'}{'instcode'}) eq 'ARRAY') {  
                             my @clonecodes = @{$defaultshash{'coursedefaults'}{'canclone'}{'instcode'}};  
                             if (@clonecodes) {  
                                 $domdefaults{'canclone'} = join('+',@clonecodes);  
                             }  
                         }  
                     } else {  
                         $domdefaults{'canclone'}=$defaultshash{'coursedefaults'}{'canclone'};  
                     }  
                 }  
                 my $cachetime = 24*60*60;                  my $cachetime = 24*60*60;
                 &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);                  &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
                 if (ref($lastactref) eq 'HASH') {                  if (ref($lastactref) eq 'HASH') {
Line 10563  sub modify_coursedefaults { Line 10090  sub modify_coursedefaults {
             }              }
             $resulttext = &mt('Changes made:').'<ul>';              $resulttext = &mt('Changes made:').'<ul>';
             foreach my $item (sort(keys(%changes))) {              foreach my $item (sort(keys(%changes))) {
                 if ($item eq 'uselcmath') {                  if ($item eq 'canuse_pdfforms') {
                     if ($env{'form.'.$item} eq '1') {                      if ($env{'form.'.$item} eq '1') {
                         $resulttext .= '<li>'.&mt('Math preview uses LON-CAPA previewer (javascript), if supported by browser.').'</li>';                          $resulttext .= '<li>'.&mt("Course/Community users can create/upload PDF forms set to 'on'").'</li>';
                     } else {                      } else {
                         $resulttext .= '<li>'.&mt('Math preview uses DragMath (Java), if supported by client OS.').'</li>';                          $resulttext .= '<li>'.&mt('Course/Community users can create/upload PDF forms set to "off"').'</li>';
                     }  
                 } elsif ($item eq 'usejsme') {  
                     if ($env{'form.'.$item} eq '1') {  
                         $resulttext .= '<li>'.&mt('Molecule editor uses JSME (HTML5), if supported by browser.').'</li>';  
                     } else {  
                         $resulttext .= '<li>'.&mt('Molecule editor uses JME (Java), if supported by client OS.').'</li>';  
                     }                      }
                 } elsif ($item eq 'anonsurvey_threshold') {                  } elsif ($item eq 'anonsurvey_threshold') {
                     $resulttext .= '<li>'.&mt('Responder count required for display of anonymous survey submissions set to [_1].',$defaultshash{'coursedefaults'}{'anonsurvey_threshold'}).'</li>';                      $resulttext .= '<li>'.&mt('Responder count required for display of anonymous survey submissions set to [_1].',$defaultshash{'coursedefaults'}{'anonsurvey_threshold'}).'</li>';
Line 10590  sub modify_coursedefaults { Line 10111  sub modify_coursedefaults {
                     } else {                      } else {
                         $resulttext .= '<li>'.&mt('Default quota for content uploaded via Course Editor remains default: [_1] MB',$staticdefaults{'uploadquota'}).'</li>';                          $resulttext .= '<li>'.&mt('Default quota for content uploaded via Course Editor remains default: [_1] MB',$staticdefaults{'uploadquota'}).'</li>';
                     }                      }
                 } elsif ($item eq 'postsubmit') {  
                     if ($domdefaults{'postsubmit'} eq 'off') {  
                         $resulttext .= '<li>'.&mt('Submit button(s) remain enabled on page after student makes submission.');  
                     } else {  
                         $resulttext .= '<li>'.&mt('Submit button(s) disabled on page after student makes submission').'; ';  
                         if (ref($defaultshash{'coursedefaults'}{'postsubmit'}) eq 'HASH') {  
                             $resulttext .= &mt('durations:').'<ul>';  
                             foreach my $type (@types) {  
                                 $resulttext .= '<li>';  
                                 my $timeout;  
                                 if (ref($defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}) eq 'HASH') {  
                                     $timeout = $defaultshash{'coursedefaults'}{'postsubmit'}{'timeout'}{$type};  
                                 }  
                                 my $display;  
                                 if ($timeout eq '0') {  
                                     $display = &mt('unlimited');  
                                 } elsif ($timeout eq '') {  
                                     $display = &mt('[quant,_1,second] (default)',$staticdefaults{'postsubmit'});  
                                 } else {  
                                     $display = &mt('[quant,_1,second]',$timeout);  
                                 }  
                                 if ($type eq 'community') {  
                                     $resulttext .= &mt('Communities');  
                                 } elsif ($type eq 'official') {  
                                     $resulttext .= &mt('Official courses');  
                                 } elsif ($type eq 'unofficial') {  
                                     $resulttext .= &mt('Unofficial courses');  
                                 } elsif ($type eq 'textbook') {  
                                     $resulttext .= &mt('Textbook courses');  
                                 }  
                                 $resulttext .= ' -- '.$display.'</li>';  
                             }  
                             $resulttext .= '</ul>';  
                         }  
                         $resulttext .= '</li>';  
                     }  
                 } elsif ($item eq 'coursecredits') {                  } elsif ($item eq 'coursecredits') {
                     if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') {                      if (ref($defaultshash{'coursedefaults'}{'coursecredits'}) eq 'HASH') {
                         if (($domdefaults{'officialcredits'} eq '') &&                          if (($domdefaults{'officialcredits'} eq '') &&
Line 10643  sub modify_coursedefaults { Line 10128  sub modify_coursedefaults {
                     } else {                      } else {
                         $resulttext .= '<li>'.&mt('Student credits not in use for courses in this domain').'</li>';                          $resulttext .= '<li>'.&mt('Student credits not in use for courses in this domain').'</li>';
                     }                      }
                 } elsif ($item eq 'canclone') {  
                     if (ref($defaultshash{'coursedefaults'}{'canclone'}) eq 'HASH') {  
                         if (ref($defaultshash{'coursedefaults'}{'canclone'}{'instcode'}) eq 'ARRAY') {  
                             my $clonecodes = join(' '.&mt('and').' ',@{$defaultshash{'coursedefaults'}{'canclone'}{'instcode'}});  
                             $resulttext .= '<li>'.&mt('By default, official courses can be cloned from existing courses with the same: [_1]','<b>'.$clonecodes.'</b>').'</li>';  
                         }  
                     } elsif ($defaultshash{'coursedefaults'}{'canclone'} eq 'domain') {  
                         $resulttext .= '<li>'.&mt('By default, a course requester can clone any course from his/her domain.').'</li>';  
                     } else {  
                         $resulttext .= '<li>'.&mt('By default, only course owner and coordinators may clone a course.').'</li>';  
                     }  
                 }                  }
             }              }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';
Line 11072  sub modify_usersessions { Line 10546  sub modify_usersessions {
             $changes{'spares'}{$lonhost} = \%spareschg;              $changes{'spares'}{$lonhost} = \%spareschg;
         }          }
     }      }
     $defaultshash{'usersessions'}{'offloadnow'} = {};  
     my @offloadnow = &Apache::loncommon::get_env_multiple('form.offloadnow');  
     my @okoffload;  
     if (@offloadnow) {  
         foreach my $server (@offloadnow) {  
             if (&Apache::lonnet::hostname($server) ne '') {  
                 unless (grep(/^\Q$server\E$/,@okoffload)) {  
                     push(@okoffload,$server);  
                 }  
             }  
         }  
         if (@okoffload) {  
             foreach my $lonhost (@okoffload) {  
                 $defaultshash{'usersessions'}{'offloadnow'}{$lonhost} = 1;  
             }  
         }  
     }  
     if (ref($domconfig{'usersessions'}) eq 'HASH') {      if (ref($domconfig{'usersessions'}) eq 'HASH') {
         if (ref($domconfig{'usersessions'}{'spares'}) eq 'HASH') {          if (ref($domconfig{'usersessions'}{'spares'}) eq 'HASH') {
             if (ref($changes{'spares'}) eq 'HASH') {              if (ref($changes{'spares'}) eq 'HASH') {
Line 11099  sub modify_usersessions { Line 10557  sub modify_usersessions {
         } else {          } else {
             $savespares = 1;              $savespares = 1;
         }          }
         if (ref($domconfig{'usersessions'}{'offloadnow'}) eq 'HASH') {  
             foreach my $lonhost (keys(%{$domconfig{'usersessions'}{'offloadnow'}})) {  
                 unless ($defaultshash{'usersessions'}{'offloadnow'}{$lonhost}) {  
                     $changes{'offloadnow'} = 1;  
                     last;  
                 }  
             }  
             unless ($changes{'offloadnow'}) {  
                 foreach my $lonhost (keys(%{$defaultshash{'usersessions'}{'offloadnow'}})) {  
                     unless ($domconfig{'usersessions'}{'offloadnow'}{$lonhost}) {  
                         $changes{'offloadnow'} = 1;  
                         last;  
                     }  
                 }  
             }  
         } elsif (@okoffload) {  
             $changes{'offloadnow'} = 1;  
         }  
     } elsif (@okoffload) {  
         $changes{'offloadnow'} = 1;  
     }      }
   
     my $nochgmsg = &mt('No changes made to settings for user session hosting/offloading.');      my $nochgmsg = &mt('No changes made to settings for user session hosting/offloading.');
     if ((keys(%changes) > 0) || ($savespares)) {      if ((keys(%changes) > 0) || ($savespares)) {
         my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,          my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,
Line 11132  sub modify_usersessions { Line 10571  sub modify_usersessions {
                 if (ref($defaultshash{'usersessions'}{'hosted'}) eq 'HASH') {                  if (ref($defaultshash{'usersessions'}{'hosted'}) eq 'HASH') {
                     $domdefaults{'hostedsessions'} = $defaultshash{'usersessions'}{'hosted'};                      $domdefaults{'hostedsessions'} = $defaultshash{'usersessions'}{'hosted'};
                 }                  }
                 if (ref($defaultshash{'usersessions'}{'offloadnow'}) eq 'HASH') {  
                     $domdefaults{'offloadnow'} = $defaultshash{'usersessions'}{'offloadnow'};  
                 }  
             }              }
             my $cachetime = 24*60*60;              my $cachetime = 24*60*60;
             &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);              &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
Line 11203  sub modify_usersessions { Line 10639  sub modify_usersessions {
                         $resulttext .= '</ul>';                          $resulttext .= '</ul>';
                     }                      }
                 }                  }
                 if ($changes{'offloadnow'}) {  
                     if (ref($defaultshash{'usersessions'}{'offloadnow'}) eq 'HASH') {  
                         if (keys(%{$defaultshash{'usersessions'}{'offloadnow'}}) > 0) {  
                             $resulttext .= '<li>'.&mt('Switch active users on next access, for server(s):').'<ul>';  
                             foreach my $lonhost (sort(keys(%{$defaultshash{'usersessions'}{'offloadnow'}}))) {  
                                 $resulttext .= '<li>'.$lonhost.'</li>';  
                             }  
                             $resulttext .= '</ul>';  
                         } else {  
                             $resulttext .= '<li>'.&mt('No servers now set to switch active users on next access.');  
                         }  
                     } else {  
                         $resulttext .= '<li>'.&mt('No servers now set to switch active users on next access.').'</li>';  
                     }  
                 }  
                 $resulttext .= '</ul>';                  $resulttext .= '</ul>';
             } else {              } else {
                 $resulttext = $nochgmsg;                  $resulttext = $nochgmsg;
Line 11239  sub modify_loadbalancing { Line 10660  sub modify_loadbalancing {
     my ($othertitle,$usertypes,$types) =      my ($othertitle,$usertypes,$types) =
         &Apache::loncommon::sorted_inst_types($dom);          &Apache::loncommon::sorted_inst_types($dom);
     my %servers = &Apache::lonnet::internet_dom_servers($dom);      my %servers = &Apache::lonnet::internet_dom_servers($dom);
     my %libraryservers = &Apache::lonnet::get_servers($dom,'library');  
     my @sparestypes = ('primary','default');      my @sparestypes = ('primary','default');
     my %typetitles = &sparestype_titles();      my %typetitles = &sparestype_titles();
     my $resulttext;      my $resulttext;
Line 11331  sub modify_loadbalancing { Line 10751  sub modify_loadbalancing {
                     $rule = $env{'form.loadbalancing_rules_'.$i.'_'.$type};                      $rule = $env{'form.loadbalancing_rules_'.$i.'_'.$type};
                 }                  }
                 if ($rule eq 'specific') {                  if ($rule eq 'specific') {
                     my $specifiedhost = $env{'form.loadbalancing_singleserver_'.$i.'_'.$type};                      $rule = $env{'form.loadbalancing_singleserver_'.$i.'_'.$type};
                     if (exists($servers{$specifiedhost})) {  
                         $rule = $specifiedhost;  
                     }  
                 }                  }
                 $defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type} = $rule;                  $defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type} = $rule;
                 if (ref($currrules{$balancer}) eq 'HASH') {                  if (ref($currrules{$balancer}) eq 'HASH') {
Line 11356  sub modify_loadbalancing { Line 10773  sub modify_loadbalancing {
                                                  \%defaultshash,$dom);                                                   \%defaultshash,$dom);
         if ($putresult eq 'ok') {          if ($putresult eq 'ok') {
             if (keys(%changes) > 0) {              if (keys(%changes) > 0) {
                 my %toupdate;  
                 if (ref($changes{'delete'}) eq 'ARRAY') {                  if (ref($changes{'delete'}) eq 'ARRAY') {
                     foreach my $balancer (sort(@{$changes{'delete'}})) {                      foreach my $balancer (sort(@{$changes{'delete'}})) {
                         $resulttext .= '<li>'.&mt('Load Balancing discontinued for: [_1]',$balancer).'</li>';                          $resulttext .= '<li>'.&mt('Load Balancing discontinued for: [_1]',$balancer).'</li>';
                         $toupdate{$balancer} = 1;                          my $cachekey = &escape('loadbalancing').':'.&escape($dom);
                           &Apache::lonnet::remote_devalidate_cache($balancer,[$cachekey]);
                     }                      }
                 }                  }
                 if (ref($changes{'add'}) eq 'ARRAY') {                  if (ref($changes{'add'}) eq 'ARRAY') {
                     foreach my $balancer (sort(@{$changes{'add'}})) {                      foreach my $balancer (sort(@{$changes{'add'}})) {
                         $resulttext .= '<li>'.&mt('Load Balancing enabled for: [_1]',$balancer);                          $resulttext .= '<li>'.&mt('Load Balancing enabled for: [_1]',$balancer);
                         $toupdate{$balancer} = 1;  
                     }                      }
                 }                  }
                 if (ref($changes{'curr'}) eq 'HASH') {                  if (ref($changes{'curr'}) eq 'HASH') {
                     foreach my $balancer (sort(keys(%{$changes{'curr'}}))) {                      foreach my $balancer (sort(keys(%{$changes{'curr'}}))) {
                         $toupdate{$balancer} = 1;  
                         if (ref($changes{'curr'}{$balancer}) eq 'HASH') {                          if (ref($changes{'curr'}{$balancer}) eq 'HASH') {
                             if ($changes{'curr'}{$balancer}{'targets'}) {                              if ($changes{'curr'}{$balancer}{'targets'}) {
                                 my %offloadstr;                                  my %offloadstr;
Line 11408  sub modify_loadbalancing { Line 10823  sub modify_loadbalancing {
                                         if ($rule eq '') {                                          if ($rule eq '') {
                                             $balancetext =  $ruletitles{'default'};                                              $balancetext =  $ruletitles{'default'};
                                         } elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer') ||                                          } elsif (($rule eq 'homeserver') || ($rule eq 'externalbalancer') ||
                                                  ($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) {                                                   ($rule eq 'balancer') || ($rule eq 'offloadedto')) {
                                             if (($type eq '_LC_ipchange') || ($type eq '_LC_ipchangesso')) {                                              $balancetext =  $ruletitles{$rule};
                                                 foreach my $sparetype (@sparestypes) {  
                                                     if (ref($defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}) eq 'ARRAY') {  
                                                         map { $toupdate{$_} = 1; } (@{$defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype}});  
                                                     }  
                                                 }  
                                                 foreach my $item (@{$alltypes}) {  
                                                     next if ($item =~  /^_LC_ipchange/);  
                                                     my $hasrule = $defaultshash{'loadbalancing'}{$balancer}{'rules'}{$item};  
                                                     if ($hasrule eq 'homeserver') {  
                                                         map { $toupdate{$_} = 1; } (keys(%libraryservers));  
                                                     } else {  
                                                         unless (($hasrule eq 'default') || ($hasrule eq 'none') || ($hasrule eq 'externalbalancer')) {  
                                                             if ($servers{$hasrule}) {  
                                                                 $toupdate{$hasrule} = 1;  
                                                             }  
                                                         }  
                                                     }  
                                                 }  
                                                 if (($rule eq 'balancer') || ($rule eq 'offloadedto')) {  
                                                     $balancetext =  $ruletitles{$rule};  
                                                 } else {  
                                                     my $receiver = $defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type};  
                                                     $balancetext = $ruletitles{'particular'}.' '.$receiver;  
                                                     if ($receiver) {  
                                                         $toupdate{$receiver};  
                                                     }  
                                                 }  
                                             } else {  
                                                 $balancetext =  $ruletitles{$rule};  
                                             }  
                                         } else {                                          } else {
                                             $balancetext = &mt('offload to [_1]',$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type});                                              $balancetext = &mt('offload to [_1]',$defaultshash{'loadbalancing'}{$balancer}{'rules'}{$type});
                                         }                                          }
Line 11448  sub modify_loadbalancing { Line 10833  sub modify_loadbalancing {
                                 }                                  }
                             }                              }
                         }                          }
                         if (keys(%toupdate)) {                          my $cachekey = &escape('loadbalancing').':'.&escape($dom);
                             my %thismachine;                          &Apache::lonnet::remote_devalidate_cache($balancer,[$cachekey]);
                             my $updatedhere;  
                             my $cachetime = 60*60*24;  
                             map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();  
                             foreach my $lonhost (keys(%toupdate)) {  
                                 if ($thismachine{$lonhost}) {  
                                     unless ($updatedhere) {  
                                         &Apache::lonnet::do_cache_new('loadbalancing',$dom,  
                                                                       $defaultshash{'loadbalancing'},  
                                                                       $cachetime);  
                                         $updatedhere = 1;  
                                     }  
                                 } else {  
                                     my $cachekey = &escape('loadbalancing').':'.&escape($dom);  
                                     &Apache::lonnet::remote_devalidate_cache($lonhost,[$cachekey]);  
                                 }  
                             }  
                         }  
                     }                      }
                 }                  }
                 if ($resulttext ne '') {                  if ($resulttext ne '') {
Line 11607  sub active_dc_picker { Line 10975  sub active_dc_picker {
         my ($dcname,$dcdom) = split(':',$domcoord[0]);          my ($dcname,$dcdom) = split(':',$domcoord[0]);
         my $user = &Apache::loncommon::plainname($dcname,$dcdom);          my $user = &Apache::loncommon::plainname($dcname,$dcdom);
         if ($inputtype eq 'radio') {          if ($inputtype eq 'radio') {
             $table = '<input type="hidden" name="'.$name.'" value="'.$domcoord[0].'" />'.$user;              $table .= '<input type="hidden" name="'.$name.'" value="'.$domcoord[0].'" />'.$user;
             if ($user ne $dcname.':'.$dcdom) {              if ($user ne $dcname.':'.$dcdom) {
                 $table .=  ' ('.$dcname.':'.$dcdom.')';                  $table .=  ' ('.$dcname.':'.$dcdom.')';
             }              }
Line 11616  sub active_dc_picker { Line 10984  sub active_dc_picker {
             if (exists($currhash{$domcoord[0]})) {              if (exists($currhash{$domcoord[0]})) {
                 $check = ' checked="checked"';                  $check = ' checked="checked"';
             }              }
             $table = '<span class="LC_nobreak"><label>'.              $table .= '<span class="LC_nobreak"><label>'.
                      '<input type="checkbox" name="'.$name.'" '.                        '<input type="checkbox" name="'.$name.'" '.
                      'value="'.$domcoord[0].'"'.$check.' />'.$user;                        'value="'.$domcoord[0].'"'.$check.' />'.$user;
             if ($user ne $dcname.':'.$dcdom) {              if ($user ne $dcname.':'.$dcdom) {
                 $table .=  ' ('.$dcname.':'.$dcdom.')';                  $table .=  ' ('.$dcname.':'.$dcdom.')';
             }              }
Line 12163  function toggleDisplay(domForm,caller) { Line 11531  function toggleDisplay(domForm,caller) {
     if (document.getElementById(caller)) {      if (document.getElementById(caller)) {
         var divitem = document.getElementById(caller);          var divitem = document.getElementById(caller);
         var optionsElement = domForm.coursecredits;          var optionsElement = domForm.coursecredits;
         var checkval = 1;  
         var dispval = 'block';  
         if (caller == 'emailoptions') {          if (caller == 'emailoptions') {
             optionsElement = domForm.cancreate_email;               optionsElement = domForm.cancreate_email; 
         }          }
         if (caller == 'studentsubmission') {  
             optionsElement = domForm.postsubmit;  
         }  
         if (caller == 'cloneinstcode') {  
             optionsElement = domForm.canclone;  
             checkval = 'instcode';  
         }  
         if (optionsElement.length) {          if (optionsElement.length) {
             var currval;              var currval;
             for (var i=0; i<optionsElement.length; i++) {              for (var i=0; i<optionsElement.length; i++) {
Line 12182  function toggleDisplay(domForm,caller) { Line 11541  function toggleDisplay(domForm,caller) {
                    currval = optionsElement[i].value;                     currval = optionsElement[i].value;
                 }                  }
             }              }
             if (currval == checkval) {              if (currval == 1) {
                 divitem.style.display = dispval;                  divitem.style.display = 'block';
             } else {              } else {
                 divitem.style.display = 'none';                  divitem.style.display = 'none';
             }              }
Line 12216  sub devalidate_remote_domconfs { Line 11575  sub devalidate_remote_domconfs {
     my %thismachine;      my %thismachine;
     map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();      map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();
     my @posscached = ('domainconfig','domdefaults');      my @posscached = ('domainconfig','domdefaults');
     if (keys(%servers)) {      if (keys(%servers) > 1) {
         foreach my $server (keys(%servers)) {          foreach my $server (keys(%servers)) {
             next if ($thismachine{$server});              next if ($thismachine{$server});
             my @cached;              my @cached;

Removed from v.1.160.6.66  
changed lines
  Added in v.1.244


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