Diff for /loncom/interface/domainprefs.pm between versions 1.332 and 1.342

version 1.332, 2018/07/06 13:32:56 version 1.342, 2018/11/24 16:48:01
Line 352  sub handler { Line 352  sub handler {
                                 col2 => 'Value',},                                  col2 => 'Value',},
                                {col1 => 'Recipient(s) for notifications',                                 {col1 => 'Recipient(s) for notifications',
                                 col2 => 'Value',},                                  col2 => 'Value',},
                                  {col1 => 'Nightly status check e-mail',
                                   col2 => 'Settings',},
                                {col1 => 'Ask helpdesk form settings',                                 {col1 => 'Ask helpdesk form settings',
                                 col2 => 'Value',},],                                  col2 => 'Value',},],
                     print => \&print_contacts,                      print => \&print_contacts,
Line 781  sub print_config_box { Line 783  sub print_config_box {
         $output =          $output =
             &Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,\%full,               &Apache::lonuserutils::custom_roledefs_js($context,$crstype,$formname,\%full, 
                                                       \@templateroles);                                                        \@templateroles);
       } elsif ($action eq 'ltitools') {
           $output .= &ltitools_javascript($settings);
       } elsif ($action eq 'lti') {
           $output .= &lti_javascript($settings);
     }      }
     $output .=      $output .=
          '<table class="LC_nested_outer">           '<table class="LC_nested_outer">
Line 900  sub print_config_box { Line 906  sub print_config_box {
              </tr>'."\n";               </tr>'."\n";
                 if ($action eq 'coursecategories') {                  if ($action eq 'coursecategories') {
                     $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);                      $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
                   } elsif ($action eq 'contacts') {
                       $output .= $item->{'print'}->('lower',$dom,$settings,\$rowtotal).'
                </tr>
               </table>
              </td>
             </tr>
             <tr>
              <td>
               <table class="LC_nested">
                <tr class="LC_info_row">
                 <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>'.
                              $item->{'print'}->('bottom',$dom,$settings,\$rowtotal).'
               </table>
             </td>
            </tr>
            <tr>';
                 } else {                  } else {
                     $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);                      $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
                 }                  }
Line 2482  sub print_textbookcourses { Line 2505  sub print_textbookcourses {
         $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';          $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';
     }      }
     $datatable .= '</select>&nbsp;'."\n".      $datatable .= '</select>&nbsp;'."\n".
                   '<input type="checkbox" name="'.$type.'_addbook" value="1" />'.&mt('Add').'</td>'."\n".                    '<input type="checkbox" name="'.$type.'_addbook" value="1" />'.&mt('Add').'</span></td>'."\n".
                   '<td colspan="2">'.                    '<td colspan="2">'.
                   '<span class="LC_nobreak">'.&mt('Subject:').'<input type="text" size="15" name="'.$type.'_addbook_subject" value="" /></span> '."\n".                    '<span class="LC_nobreak">'.&mt('Subject:').'<input type="text" size="15" name="'.$type.'_addbook_subject" value="" /></span> '."\n".
                   ('&nbsp;'x2).                    ('&nbsp;'x2).
Line 2499  sub print_textbookcourses { Line 2522  sub print_textbookcourses {
         } else {          } else {
             $datatable .= '<input type="file" name="'.$type.'_addbook_image" value="" />';              $datatable .= '<input type="file" name="'.$type.'_addbook_image" value="" />';
         }          }
           $datatable .= '</span>'."\n";
     }      }
     $datatable .= '</span>'."\n".      $datatable .= '<span class="LC_nobreak">'.&mt('LON-CAPA course:').'&nbsp;'.
                   '<span class="LC_nobreak">'.&mt('LON-CAPA course:').'&nbsp;'.  
                   &Apache::loncommon::select_dom_form($env{'request.role.domain'},$type.'_addbook_cdom').                    &Apache::loncommon::select_dom_form($env{'request.role.domain'},$type.'_addbook_cdom').
                   '<input type="text" size="25" name="'.$type.'_addbook_cnum" value="" />'.                    '<input type="text" size="25" name="'.$type.'_addbook_cnum" value="" />'.
                   &Apache::loncommon::selectcourse_link                    &Apache::loncommon::selectcourse_link
                       ('display',$type.'_addbook_cnum',$type.'_addbook_cdom',undef,undef,undef,'Course');                        ('display',$type.'_addbook_cnum',$type.'_addbook_cdom',undef,undef,undef,'Course').
                   '</span></td>'."\n".                    '</span></td>'."\n".
                   '</tr>'."\n";                    '</tr>'."\n";
     $itemcount ++;      $itemcount ++;
Line 2813  sub lti_toggle_js { Line 2836  sub lti_toggle_js {
 // <![CDATA[  // <![CDATA[
   
 function toggleLTI(form,setting,item) {  function toggleLTI(form,setting,item) {
     if ((setting == 'user') || (setting == 'crs')) {      if ((setting == 'user') || (setting == 'crs') || (setting == 'passback')) {
         var radioname = '';          var radioname = '';
         var divid = '';          var divid = '';
         if (setting == 'user') {          if (setting == 'user') {
             radioname = 'lti_mapuser_'+item;              radioname = 'lti_mapuser_'+item;
             divid = 'lti_userfield_'+item;              divid = 'lti_userfield_'+item;
         } else {          } else if (settings == 'crs') {
             radioname = 'lti_mapcrs_'+item;              radioname = 'lti_mapcrs_'+item;
             divid = 'lti_crsfield_'+item;              divid = 'lti_crsfield_'+item;
           } else {
               radioname = 'lti_passbackformat_'+item;
               divid =  'lti_passback_'+item;
         }          }
         var num = form.elements[radioname].length;          var num = form.elements[radioname].length;
         if (num) {          if (num) {
             var setvis = '';              var setvis = '';
             for (var i=0; i<num; i++) {              for (var i=0; i<num; i++) {
                if (form.elements[radioname][i].checked) {                 if (form.elements[radioname][i].checked) {
                    if (form.elements[radioname][i].value == 'other') {                     if (setting == 'passback') {
                        if (document.getElementById(divid)) {                         if (form.elements[radioname][i].value == '1') {
                            document.getElementById(divid).style.display = 'inline-block';                             if (document.getElementById(divid)) {
                                  document.getElementById(divid).style.display = 'inline-block';
                              }
                              setvis = 1;
                              break;
                          }
                      } else {
                          if (form.elements[radioname][i].value == 'other') {
                              if (document.getElementById(divid)) {
                                  document.getElementById(divid).style.display = 'inline-block';
                              }
                              setvis = 1;
                              break;
                        }                         }
                        setvis = 1;  
                        break;  
                    }                     }
                }                  } 
             }              }
Line 3024  sub print_autoenroll { Line 3060  sub print_autoenroll {
                   '<td>'.&mt('Failsafe for no drops when institutional data missing').'</td>'.                    '<td>'.&mt('Failsafe for no drops when institutional data missing').'</td>'.
                   '<td class="LC_right_item"><span class="LC_nobreak">'.                    '<td class="LC_right_item"><span class="LC_nobreak">'.
                   '<input type="text" name="autoenroll_failsafe"'.                    '<input type="text" name="autoenroll_failsafe"'.
                   ' value="'.$failsafe.'" size="4" /></td></tr>';                    ' value="'.$failsafe.'" size="4" /></span></td></tr>';
     $$rowtotal += 4;      $$rowtotal += 4;
     return $datatable;      return $datatable;
 }  }
Line 3306  sub print_contacts { Line 3342  sub print_contacts {
     my $datatable;      my $datatable;
     my @contacts = ('adminemail','supportemail');      my @contacts = ('adminemail','supportemail');
     my (%checked,%to,%otheremails,%bccemails,%includestr,%includeloc,%currfield,      my (%checked,%to,%otheremails,%bccemails,%includestr,%includeloc,%currfield,
         $maxsize,$fields,$fieldtitles,$fieldoptions,$possoptions,@mailings);          $maxsize,$fields,$fieldtitles,$fieldoptions,$possoptions,@mailings,%lonstatus);
     if ($position eq 'top') {      if ($position eq 'top') {
         if (ref($settings) eq 'HASH') {          if (ref($settings) eq 'HASH') {
             foreach my $item (@contacts) {              foreach my $item (@contacts) {
Line 3321  sub print_contacts { Line 3357  sub print_contacts {
         foreach my $type (@mailings) {          foreach my $type (@mailings) {
             $otheremails{$type} = '';              $otheremails{$type} = '';
         }          }
       } elsif ($position eq 'lower') {
           if (ref($settings) eq 'HASH') {
               if (ref($settings->{'lonstatus'}) eq 'HASH') {
                   %lonstatus = %{$settings->{'lonstatus'}};
               }
           }
     } else {      } else {
         @mailings = ('helpdeskmail','otherdomsmail');          @mailings = ('helpdeskmail','otherdomsmail');
         foreach my $type (@mailings) {          foreach my $type (@mailings) {
Line 3333  sub print_contacts { Line 3375  sub print_contacts {
         ($fields,$fieldtitles,$fieldoptions,$possoptions) = &helpform_fields();          ($fields,$fieldtitles,$fieldoptions,$possoptions) = &helpform_fields();
     }      }
     if (ref($settings) eq 'HASH') {      if (ref($settings) eq 'HASH') {
         unless ($position eq 'top') {          unless (($position eq 'top') || ($position eq 'lower')) {
             foreach my $type (@mailings) {              foreach my $type (@mailings) {
                 if (exists($settings->{$type})) {                  if (exists($settings->{$type})) {
                     if (ref($settings->{$type}) eq 'HASH') {                      if (ref($settings->{$type}) eq 'HASH') {
Line 3454  sub print_contacts { Line 3496  sub print_contacts {
                     if ($currfield{$field} eq 'no') {                      if ($currfield{$field} eq 'no') {
                         $display = ' style="display:none"';                          $display = ' style="display:none"';
                     }                      }
                     $datatable .= '</td></tr><tr id="help_screenshotsize"'.$display.' />'.                      $datatable .= '</td></tr><tr id="help_screenshotsize"'.$display.'>'.
                                   '<td>'.&mt('Maximum size for upload (MB)').'</td><td>'.                                    '<td>'.&mt('Maximum size for upload (MB)').'</td><td>'.
                                   '<input type="text" size="5" name="helpform_maxsize" value="'.$maxsize.'" />';                                    '<input type="text" size="5" name="helpform_maxsize" value="'.$maxsize.'" />';
                 }                  }
Line 3465  sub print_contacts { Line 3507  sub print_contacts {
         $datatable .= '</td></tr>'."\n";          $datatable .= '</td></tr>'."\n";
         $rownum ++;          $rownum ++;
     }      }
     unless ($position eq 'top') {      unless (($position eq 'top') || ($position eq 'lower')) {
         foreach my $type (@mailings) {          foreach my $type (@mailings) {
             $css_class = $rownum%2?' class="LC_odd_row"':'';              $css_class = $rownum%2?' class="LC_odd_row"':'';
             $datatable .= '<tr'.$css_class.'>'.              $datatable .= '<tr'.$css_class.'>'.
Line 3499  sub print_contacts { Line 3541  sub print_contacts {
                               'value="'.$bccemails{$type}.'"  /></fieldset>'.                                'value="'.$bccemails{$type}.'"  /></fieldset>'.
                               '<fieldset><legend>'.&mt('Optional added text').'</legend>'.                                '<fieldset><legend>'.&mt('Optional added text').'</legend>'.
                               &mt('Text automatically added to e-mail:').' '.                                &mt('Text automatically added to e-mail:').' '.
                               '<input type="text" name="'.$type.'_includestr" value="'.$includestr{$type}.'" /><br >'.                                '<input type="text" name="'.$type.'_includestr" value="'.$includestr{$type}.'" /><br />'.
                               '<span class="LC_nobreak">'.&mt('Location:').'&nbsp;'.                                '<span class="LC_nobreak">'.&mt('Location:').'&nbsp;'.
                               '<label><input type="radio" name="'.$type.'_includeloc" value="s"'.$locchecked{'s'}.' />'.&mt('in subject').'</label>'.                                '<label><input type="radio" name="'.$type.'_includeloc" value="s"'.$locchecked{'s'}.' />'.&mt('in subject').'</label>'.
                               ('&nbsp;'x2).                                ('&nbsp;'x2).
Line 3512  sub print_contacts { Line 3554  sub print_contacts {
     }      }
     if ($position eq 'middle') {      if ($position eq 'middle') {
         my %choices;          my %choices;
         $choices{'reporterrors'} = &mt('E-mail error reports to [_1]',          my $corelink = &core_link_msu();
                                        &Apache::loncommon::modal_link('http://loncapa.org/core.html',          $choices{'reporterrors'} = &mt('E-mail error reports to [_1]',$corelink);
                                        &mt('LON-CAPA core group - MSU'),600,500));  
         $choices{'reportupdates'} = &mt('E-mail record of completed LON-CAPA updates to [_1]',          $choices{'reportupdates'} = &mt('E-mail record of completed LON-CAPA updates to [_1]',
                                         &Apache::loncommon::modal_link('http://loncapa.org/core.html',                                          $corelink);
                                         &mt('LON-CAPA core group - MSU'),600,500));          $choices{'reportstatus'} = &mt('E-mail status if errors above threshold to [_1]',$corelink);
         my @toggles = ('reporterrors','reportupdates');          my @toggles = ('reporterrors','reportupdates','reportstatus');
         my %defaultchecked = ('reporterrors'  => 'on',          my %defaultchecked = ('reporterrors'  => 'on',
                               'reportupdates' => 'on');                                'reportupdates' => 'on',
                                 'reportstatus'  => 'on');
         (my $reports,$rownum) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,          (my $reports,$rownum) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
                                                    \%choices,$rownum);                                                     \%choices,$rownum);
         $datatable .= $reports;          $datatable .= $reports;
       } elsif ($position eq 'lower') {
           $css_class = $rownum%2?' class="LC_odd_row"':'';
           my ($threshold,$sysmail,%excluded,%weights);
           my ($defaults,$names) = &Apache::loncommon::lon_status_items();
           if ($lonstatus{'threshold'} =~ /^\d+$/) {
               $threshold = $lonstatus{'threshold'};
           } else {
               $threshold = $defaults->{'threshold'};
           }
           if ($lonstatus{'sysmail'} =~ /^\d+$/) {
               $sysmail = $lonstatus{'sysmail'};
           } else {
               $sysmail = $defaults->{'sysmail'};
           }
           if (ref($lonstatus{'weights'}) eq 'HASH') {
               foreach my $type ('E','W','N','U') {
                   if ($lonstatus{'weights'}{$type} =~ /^\d+$/) {
                       $weights{$type} = $lonstatus{'weights'}{$type};
                   } else {
                       $weights{$type} = $defaults->{$type};
                   }
               }
           } else {
               foreach my $type ('E','W','N','U') {
                   $weights{$type} = $defaults->{$type};
               }
           }
           if (ref($lonstatus{'excluded'}) eq 'ARRAY') {
               if (@{$lonstatus{'excluded'}} > 0) {
                   map {$excluded{$_} = 1; } @{$lonstatus{'excluded'}};
               }
           }
           $datatable .= '<tr'.$css_class.'>'.
                         '<td class="LC_left_item"><span class="LC_nobreak">'.
                         $titles->{'errorthreshold'}.
                         '</span></td><td class="LC_left_item">'.
                         '<input type="text" name="errorthreshold" value="'.
                         $threshold.'" size="5" /></td></tr>';
           $rownum ++;
           $css_class = $rownum%2?' class="LC_odd_row"':'';
           $datatable .= '<tr'.$css_class.'>'.
                         '<td class="LC_left_item">'.
                         '<span class="LC_nobreak">'.$titles->{'errorweights'}.
                         '</span></td><td class="LC_left_item"><table><tr>';
           foreach my $type ('E','W','N','U') {
               $datatable .= '<td>'.$names->{$type}.'<br />'.
                             '<input type="text" name="errorweights_'.$type.'" value="'.
                             $weights{$type}.'" size="5" /></td>';
           }
           $datatable .= '</tr></table></tr>';
           $rownum ++;
           $css_class = $rownum%2?' class="LC_odd_row"':'';
           $datatable .= '<tr'.$css_class.'><td class="LC_left_item">'.
                         $titles->{'errorexcluded'}.'</td>'.
                         '<td class="LC_left_item"><table>';
           my $numinrow = 4;
           my @ids = sort(values(%Apache::lonnet::serverhomeIDs));
           for (my $i=0; $i<@ids; $i++) {
               my $rem = $i%($numinrow);
               if ($rem == 0) {
                   if ($i > 0) {
                       $datatable .= '</tr>';
                   }
                   $datatable .= '<tr>';
               }
               my $check;
               if ($excluded{$ids[$i]}) {
                   $check = ' checked="checked" ';
               }
               $datatable .= '<td class="LC_left_item">'.
                             '<span class="LC_nobreak"><label>'.
                             '<input type="checkbox" name="errorexcluded" '.
                             'value="'.$ids[$i].'"'.$check.' />'.
                             $ids[$i].'</label></span></td>';
           }
           my $colsleft = $numinrow - @ids%($numinrow);
           if ($colsleft > 1 ) {
               $datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">'.
                             '&nbsp;</td>';
           } elsif ($colsleft == 1) {
               $datatable .= '<td class="LC_left_item">&nbsp;</td>';
           }
           $datatable .= '</tr></table></td></tr>';
           $rownum ++;
           $css_class = $rownum%2?' class="LC_odd_row"':'';
           $datatable .= '<tr'.$css_class.'>'.
                         '<td class="LC_left_item"><span class="LC_nobreak">'.
                         $titles->{'errorsysmail'}.
                         '</span></td><td class="LC_left_item">'.
                         '<input type="text" name="errorsysmail" value="'.
                         $sysmail.'" size="5" /></td></tr>';
           $rownum ++;
     } elsif ($position eq 'bottom') {      } elsif ($position eq 'bottom') {
         my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);          my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
         my (@posstypes,%usertypeshash);          my (@posstypes,%usertypeshash);
Line 3597  sub print_contacts { Line 3731  sub print_contacts {
     return $datatable;      return $datatable;
 }  }
   
   sub core_link_msu {
       return &Apache::loncommon::modal_link('http://loncapa.org/core.html',
                                             &mt('LON-CAPA core group - MSU'),600,500);
   }
   
 sub overridden_helpdesk {  sub overridden_helpdesk {
     my ($checked,$otheremails,$bccemails,$includeloc,$includestr,$type,$rowid,      my ($checked,$otheremails,$bccemails,$includeloc,$includestr,$type,$rowid,
         $typetitle,$css_class,$rowstyle,$contacts,$short_titles) = @_;          $typetitle,$css_class,$rowstyle,$contacts,$short_titles) = @_;
Line 3647  sub overridden_helpdesk { Line 3786  sub overridden_helpdesk {
                'value="'.$bccemails.'"  /></fieldset>'.                 'value="'.$bccemails.'"  /></fieldset>'.
                '<fieldset><legend>'.&mt('Optional added text').'</legend>'.                 '<fieldset><legend>'.&mt('Optional added text').'</legend>'.
                &mt('Text automatically added to e-mail:').' '.                 &mt('Text automatically added to e-mail:').' '.
                '<input type="text" name="override_'.$type.'_includestr" value="'.$includestr.'" /><br >'.                 '<input type="text" name="override_'.$type.'_includestr" value="'.$includestr.'" /><br />'.
                '<span class="LC_nobreak">'.&mt('Location:').'&nbsp;'.                 '<span class="LC_nobreak">'.&mt('Location:').'&nbsp;'.
                '<label><input type="radio" name="override_'.$type.'_includeloc" value="s"'.$locchecked{'s'}.' />'.&mt('in subject').'</label>'.                 '<label><input type="radio" name="override_'.$type.'_includeloc" value="s"'.$locchecked{'s'}.' />'.&mt('in subject').'</label>'.
                ('&nbsp;'x2).                 ('&nbsp;'x2).
Line 3776  sub print_helpsettings { Line 3915  sub print_helpsettings {
             push(@jsarray,('notinc','notexc'));              push(@jsarray,('notinc','notexc'));
         }          }
         my $hiddenstr = join("','",@jsarray);          my $hiddenstr = join("','",@jsarray);
         $datatable .= &helpsettings_javascript(\@roles_by_num,$maxnum,$hiddenstr,$formname);  
         my $context = 'domprefs';          my $context = 'domprefs';
         my $crstype = 'Course';          my $crstype = 'Course';
         my $prefix = 'helproles_';          my $prefix = 'helproles_';
Line 3879  sub print_helpsettings { Line 4017  sub print_helpsettings {
                                                                 \@templateroles,$newcust).                                                                  \@templateroles,$newcust).
                       &Apache::lonuserutils::custom_role_table('Course',\%full,\%levels,                        &Apache::lonuserutils::custom_role_table('Course',\%full,\%levels,
                                                                \%levelscurrent,$newcust).                                                                 \%levelscurrent,$newcust).
                       '</fieldset></td></tr>';                        '</fieldset>'.
                         &helpsettings_javascript(\@roles_by_num,$maxnum,$hiddenstr,$formname).
                         '</td></tr>';
         $count ++;          $count ++;
         $$rowtotal += $count;          $$rowtotal += $count;
     }      }
Line 4168  sub print_ltitools { Line 4308  sub print_ltitools {
     my $confname = $dom.'-domainconfig';      my $confname = $dom.'-domainconfig';
     my $switchserver = &check_switchserver($dom,$confname);      my $switchserver = &check_switchserver($dom,$confname);
     my $maxnum = scalar(keys(%ordered));      my $maxnum = scalar(keys(%ordered));
     my $datatable = &ltitools_javascript($settings);      my $datatable;
     my %lt = &ltitools_names();      my %lt = &ltitools_names();
     my @courseroles = ('cc','in','ta','ep','st');      my @courseroles = ('cc','in','ta','ep','st');
     my @ltiroles = qw(Instructor ContentDeveloper TeachingAssistant Learner);      my @ltiroles = qw(Instructor ContentDeveloper TeachingAssistant Learner);
Line 4269  sub print_ltitools { Line 4409  sub print_ltitools {
                               '<input type="text" name="ltitools_'.$dimen.'_'.$i.'" size="5" value="'.$currdisp{$dimen}.'" /></label>'.                                '<input type="text" name="ltitools_'.$dimen.'_'.$i.'" size="5" value="'.$currdisp{$dimen}.'" /></label>'.
                               ('&nbsp;'x2);                                ('&nbsp;'x2);
             }              }
             $datatable .= '<br />'.              $datatable .= '</span><br />'.
                           '<div class="LC_left_float">'.$lt{'linktext'}.'<br />'.                            '<div class="LC_left_float">'.$lt{'linktext'}.'<br />'.
                           '<input type="text" name="ltitools_linktext_'.$i.'" size="25" value="'.$currdisp{'linktext'}.'" /></label></div>'.                            '<input type="text" name="ltitools_linktext_'.$i.'" size="25" value="'.$currdisp{'linktext'}.'" /></div>'.
                           '<div class="LC_left_float">'.$lt{'explanation'}.'<br />'.                            '<div class="LC_left_float">'.$lt{'explanation'}.'<br />'.
                           '<textarea name="ltitools_explanation_'.$i.'" rows="5" cols="40">'.$currdisp{'explanation'}.                            '<textarea name="ltitools_explanation_'.$i.'" rows="5" cols="40">'.$currdisp{'explanation'}.
                           '</textarea></div><div style=""></div><br />';                            '</textarea></div><div style=""></div><br />';
Line 4442  sub print_ltitools { Line 4582  sub print_ltitools {
         $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';          $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';
     }      }
     $datatable .= '</select>&nbsp;'."\n".      $datatable .= '</select>&nbsp;'."\n".
                   '<input type="checkbox" name="ltitools_add" value="1" />'.&mt('Add').'</td>'."\n".                    '<input type="checkbox" name="ltitools_add" value="1" />'.&mt('Add').'</span></td>'."\n".
                   '<td colspan="2">'.                    '<td colspan="2">'.
                   '<fieldset><legend>'.&mt('Required settings').'</legend>'.                    '<fieldset><legend>'.&mt('Required settings').'</legend>'.
                   '<span class="LC_nobreak">'.$lt{'title'}.':<input type="text" size="20" name="ltitools_add_title" value="" /></span> '."\n".                    '<span class="LC_nobreak">'.$lt{'title'}.':<input type="text" size="20" name="ltitools_add_title" value="" /></span> '."\n".
Line 4479  sub print_ltitools { Line 4619  sub print_ltitools {
                       '<input type="text" name="ltitools_add_'.$dimen.'" size="5" /></label>'.                        '<input type="text" name="ltitools_add_'.$dimen.'" size="5" /></label>'.
                       ('&nbsp;'x2);                        ('&nbsp;'x2);
     }      }
     $datatable .= '<br />'.      $datatable .= '</span><br />'.
                   '<div class="LC_left_float">'.$lt{'linktext'}.'<br />'.                    '<div class="LC_left_float">'.$lt{'linktext'}.'<br />'.
                   '<input type="text" name="ltitools_add_linktext" size="5" /></label></div>'.                    '<input type="text" name="ltitools_add_linktext" size="5" /></div>'.
                   '<div class="LC_left_float">'.$lt{'explanation'}.'<br />'.                    '<div class="LC_left_float">'.$lt{'explanation'}.'<br />'.
                   '<textarea name=ltitools_add_explanation" rows="5" cols="40"></textarea>'.                    '<textarea name="ltitools_add_explanation" rows="5" cols="40"></textarea>'.
                   '</div><div style=""></div><br />';                    '</div><div style=""></div><br />';
     my %units = (      my %units = (
                   'passback' => 'days',                    'passback' => 'days',
Line 4562  sub print_ltitools { Line 4702  sub print_ltitools {
                   '<label><input type="checkbox" name="ltitools_add_custom" value="1" />'.                    '<label><input type="checkbox" name="ltitools_add_custom" value="1" />'.
                   &mt('Add').'</label></span></td><td><input type="text" name="ltitools_add_custom_name" />'.                    &mt('Add').'</label></span></td><td><input type="text" name="ltitools_add_custom_name" />'.
                   '</td><td><input type="text" name="ltitools_add_custom_value" /></td></tr>'.                    '</td><td><input type="text" name="ltitools_add_custom_value" /></td></tr>'.
                   '</table></fieldset></td></tr>'."\n".                    '</table></fieldset>'."\n".
                   '</td>'."\n".                    '</td>'."\n".
                   '</tr>'."\n";                    '</tr>'."\n";
     $itemcount ++;      $itemcount ++;
Line 4620  sub print_lti { Line 4760  sub print_lti {
         }          }
     }      }
     my $maxnum = scalar(keys(%ordered));      my $maxnum = scalar(keys(%ordered));
     my $datatable = &lti_javascript($settings);      my $datatable;
     my %lt = &lti_names();      my %lt = &lti_names();
     if (keys(%ordered)) {      if (keys(%ordered)) {
         my @items = sort { $a <=> $b } keys(%ordered);          my @items = sort { $a <=> $b } keys(%ordered);
Line 4685  sub print_lti { Line 4825  sub print_lti {
         $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';          $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';
     }      }
     $datatable .= '</select>&nbsp;'."\n".      $datatable .= '</select>&nbsp;'."\n".
                   '<input type="checkbox" name="lti_add" value="1" />'.&mt('Add').'</td>'."\n".                    '<input type="checkbox" name="lti_add" value="1" />'.&mt('Add').'</span></td>'."\n".
                   '<td colspan="2">'.                    '<td colspan="2">'.
                   '<fieldset><legend>'.&mt('Required settings').'</legend>'.                    '<fieldset><legend>'.&mt('Required settings').'</legend>'.
                   '<span class="LC_nobreak">'.$lt{'consumer'}.                    '<span class="LC_nobreak">'.$lt{'consumer'}.
Line 4746  sub lti_options { Line 4886  sub lti_options {
     my $crsfieldsty = 'none';      my $crsfieldsty = 'none';
     my $crssecfieldsty = 'none';      my $crssecfieldsty = 'none';
     my $secsrcfieldsty = 'none';      my $secsrcfieldsty = 'none';
       my $passbacksty = 'none';
     my $lcauthparm;      my $lcauthparm;
     my $lcauthparmstyle = 'display:none';      my $lcauthparmstyle = 'display:none';
     my $lcauthparmtext;      my $lcauthparmtext;
Line 4948  sub lti_options { Line 5089  sub lti_options {
                    $checked{'mapcrs'}{$option}.$onclickcrs.' />'.$option.'</label>'.                     $checked{'mapcrs'}{$option}.$onclickcrs.' />'.$option.'</label>'.
                    ($option eq 'other' ? '' : ('&nbsp;'x2) );                     ($option eq 'other' ? '' : ('&nbsp;'x2) );
     }      }
     $output .= '</div><div class="LC_floatleft" style="display:'.$crsfieldsty.';" id="lti_crsfield_'.$num.'".>'.      $output .= '</span></div><div class="LC_floatleft" style="display:'.$crsfieldsty.';" id="lti_crsfield_'.$num.'">'.
                '<input type="text" name="lti_mapcrsfield_'.$num.'" value="'.$cidfield.'" />'.                 '<input type="text" name="lti_mapcrsfield_'.$num.'" value="'.$cidfield.'" />'.
                '</div><div style="padding:0;clear:both;margin:0;border:0"></div>'.                 '</div><div style="padding:0;clear:both;margin:0;border:0"></div>'.
                '<span class="LC_nobreak">'.&mt('LON-CAPA course type(s)').':&nbsp;';                 '<span class="LC_nobreak">'.&mt('LON-CAPA course type(s)').':&nbsp;';
Line 4976  sub lti_options { Line 5117  sub lti_options {
                '<label><input type="radio" name="lti_crssec_'.$num.'" value="0"'.                 '<label><input type="radio" name="lti_crssec_'.$num.'" value="0"'.
                $checked{'crssec'}{'N'}.$onclicksec.' />'.&mt('No').'</label>'.('&nbsp;'x2).                 $checked{'crssec'}{'N'}.$onclicksec.' />'.&mt('No').'</label>'.('&nbsp;'x2).
                '<label><input type="radio" name="lti_crssec_'.$num.'" value="1"'.                 '<label><input type="radio" name="lti_crssec_'.$num.'" value="1"'.
                $checked{'crssec'}{'Y'}.$onclicksec.' />'.&mt('Yes').'</label><span></div>'.                 $checked{'crssec'}{'Y'}.$onclicksec.' />'.&mt('Yes').'</label></span></div>'.
                '<div class="LC_floatleft" style="display:'.$crssecfieldsty.';" id="lti_crssecfield_'.$num.'">'.                 '<div class="LC_floatleft" style="display:'.$crssecfieldsty.';" id="lti_crssecfield_'.$num.'">'.
                '<span class="LC_nobreak">'.&mt('From').':<label>'.                 '<span class="LC_nobreak">'.&mt('From').':<label>'.
                '<input type="radio" name="lti_crssecsrc_'.$num.'" value="course_section_sourcedid"'.                 '<input type="radio" name="lti_crssecsrc_'.$num.'" value="course_section_sourcedid"'.
Line 4984  sub lti_options { Line 5125  sub lti_options {
                &mt('Standard field').'</label>'.('&nbsp;'x2).                 &mt('Standard field').'</label>'.('&nbsp;'x2).
                '<label><input type="radio" name="lti_crssecsrc_'.$num.'" value="other"'.                 '<label><input type="radio" name="lti_crssecsrc_'.$num.'" value="other"'.
                $checked{'crssecsrc'}{'other'}.$onclicksecsrc.' />'.&mt('Other').                 $checked{'crssecsrc'}{'other'}.$onclicksecsrc.' />'.&mt('Other').
                '</label></div><div class="LC_floatleft" style="display:'.$secsrcfieldsty.';" id="lti_secsrcfield_'.$num.'">'.                 '</label></span></div><div class="LC_floatleft" style="display:'.$secsrcfieldsty.';" id="lti_secsrcfield_'.$num.'">'.
                '<input type="text" name="lti_customsection_'.$num.'" value="'.$crssecsrc.'" />'.                 '<input type="text" name="lti_customsection_'.$num.'" value="'.$crssecsrc.'" />'.
                '</div><div style="padding:0;clear:both;margin:0;border:0"></div>';                  '</div><div style="padding:0;clear:both;margin:0;border:0"></div>';
     foreach my $extra ('passback','roster') {      my ($pb1p1chk,$pb1p0chk,$onclickpb);
       foreach my $extra ('roster','passback') {
         my $checkedon = '';          my $checkedon = '';
         my $checkedoff = ' checked="checked"';          my $checkedoff = ' checked="checked"';
           if ($extra eq 'passback') {
               $pb1p1chk = ' checked="checked"';
               $pb1p0chk = '';
               $onclickpb = ' onclick="toggleLTI(this.form,'."'passback','$num'".');"'; 
           } else {
               $onclickpb = ''; 
           }
         if (ref($current) eq 'HASH') {          if (ref($current) eq 'HASH') {
             if (($current->{$extra})) {              if (($current->{$extra})) {
                 $checkedon = $checkedoff;                  $checkedon = $checkedoff;
                 $checkedoff = '';                  $checkedoff = '';
                   if ($extra eq 'passback') {
                       $passbacksty = 'inline-block';
                   }
                   if ($current->{'passbackformat'} eq '1.0') {
                       $pb1p0chk =  ' checked="checked"';
                       $pb1p1chk = '';
                   }
             }              }
         }          }
         $output .= $lt{$extra}.'&nbsp;'.          $output .= $lt{$extra}.'&nbsp;'.
                    '<label><input type="radio" name="lti_'.$extra.'_'.$num.'" value="0"'.$checkedoff.' />'.                     '<label><input type="radio" name="lti_'.$extra.'_'.$num.'" value="0"'.$checkedoff.$onclickpb.' />'.
                    &mt('No').'</label>'.('&nbsp;'x2).                     &mt('No').'</label>'.('&nbsp;'x2).
                    '<label><input type="radio" name="lti_'.$extra.'_'.$num.'" value="1"'.$checkedon.' />'.                     '<label><input type="radio" name="lti_'.$extra.'_'.$num.'" value="1"'.$checkedon.$onclickpb.' />'.
                    &mt('Yes').'</label><br />';                     &mt('Yes').'</label><br />';
     }      }
     $output .= '</span></fieldset>'.      $output .= '<div class="LC_floatleft" style="display:'.$passbacksty.';" id="lti_passback_'.$num.'">'.
                  '<span class="LC_nobreak">'.&mt('Grade format').
                  '<label><input type="radio" name="lti_passbackformat_'.$num.'" value="1.1"'.$pb1p1chk.' />'.
                  &mt('Outcomes Service (1.1)').'</label>'.('&nbsp;'x2).
                  '<label><input type="radio" name="lti_passbackformat_'.$num.'" value="1.0"'.$pb1p0chk.'/>'.
                  &mt('Outcomes Extension (1.0)').'</label></span></div></fieldset>'.
                '<fieldset><legend>'.&mt('Course defaults (Course Coordinator can override)').'</legend>'.                 '<fieldset><legend>'.&mt('Course defaults (Course Coordinator can override)').'</legend>'.
                '<div class="LC_floatleft"><span class="LC_nobreak">'.$lt{'topmenu'}.':&nbsp;'.                 '<div class="LC_floatleft"><span class="LC_nobreak">'.$lt{'topmenu'}.':&nbsp;'.
                '<label><input type="radio" name="lti_topmenu_'.$num.'" value="0"'.                 '<label><input type="radio" name="lti_topmenu_'.$num.'" value="0"'.
                $checked{'topmenu'}{'N'}.$onclickmenu.' />'.&mt('No').'</label>'.('&nbsp;'x2).                 $checked{'topmenu'}{'N'}.$onclickmenu.' />'.&mt('No').'</label>'.('&nbsp;'x2).
                '<label><input type="radio" name="lti_topmenu_'.$num.'" value="1"'.                 '<label><input type="radio" name="lti_topmenu_'.$num.'" value="1"'.
                $checked{'topmenu'}{'Y'}.$onclickmenu.' />'.&mt('Yes').'</label><span></div>'.                 $checked{'topmenu'}{'Y'}.$onclickmenu.' />'.&mt('Yes').'</label></span></div>'.
                '<div style="padding:0;clear:both;margin:0;border:0"></div>'.                 '<div style="padding:0;clear:both;margin:0;border:0"></div>'.
                '<div class="LC_floatleft"><span class="LC_nobreak">'.$lt{'inlinemenu'}.':&nbsp;'.                 '<div class="LC_floatleft"><span class="LC_nobreak">'.$lt{'inlinemenu'}.':&nbsp;'.
                '<label><input type="radio" name="lti_inlinemenu_'.$num.'" value="0"'.                 '<label><input type="radio" name="lti_inlinemenu_'.$num.'" value="0"'.
                $checked{'inlinemenu'}{'N'}.$onclickmenu.' />'.&mt('No').'</label>'.('&nbsp;'x2).                 $checked{'inlinemenu'}{'N'}.$onclickmenu.' />'.&mt('No').'</label>'.('&nbsp;'x2).
                '<label><input type="radio" name="lti_inlinemenu_'.$num.'" value="1"'.                 '<label><input type="radio" name="lti_inlinemenu_'.$num.'" value="1"'.
                $checked{'inlinemenu'}{'Y'}.$onclickmenu.' />'.&mt('Yes').'</label><span></div>';                 $checked{'inlinemenu'}{'Y'}.$onclickmenu.' />'.&mt('Yes').'</label></span></div>';
      $output .='<div style="padding:0;clear:both;margin:0;border:0"></div>'.        $output .='<div style="padding:0;clear:both;margin:0;border:0"></div>'. 
                '<div class="LC_floatleft" style="display:'.$menusty.';" id="lti_menufield_'.$num.'">'.                 '<div class="LC_floatleft" style="display:'.$menusty.';" id="lti_menufield_'.$num.'">'.
                '<span class="LC_nobreak">'.&mt('Menu items').':&nbsp;';                 '<span class="LC_nobreak">'.&mt('Menu items').':&nbsp;';
Line 5023  sub lti_options { Line 5184  sub lti_options {
                    $checked{'menuitem'}{$type}.' />'.$menutitles{$type}.'</label>'.                     $checked{'menuitem'}{$type}.' />'.$menutitles{$type}.'</label>'.
                    ('&nbsp;'x2);                     ('&nbsp;'x2);
     }      }
     $output .= '</span></fieldset>';      $output .= '</span></div></fieldset>';
 #        '<fieldset><legend>'.&mt('Assigning author roles').'</legend>';  #        '<fieldset><legend>'.&mt('Assigning author roles').'</legend>';
 #  #
 #    $output .= '</fieldset>'.  #    $output .= '</fieldset>'.
Line 5519  sub print_validation_rows { Line 5680  sub print_validation_rows {
                               '</label></span> ';                                '</label></span> ';
             }              }
         } elsif ($item eq 'markup') {          } elsif ($item eq 'markup') {
             $datatable .= '<textarea name="'.$caller.'_validation_markup" cols="50" rows="5" wrap="soft">'.              $datatable .= '<textarea name="'.$caller.'_validation_markup" cols="50" rows="5">'.
                            $currvalidation{$item}.                             $currvalidation{$item}.
                               '</textarea>';                                '</textarea>';
         }          }
Line 5541  sub print_validation_rows { Line 5702  sub print_validation_rows {
         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"' : '';          my $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
         $datatable .= '</td></tr><tr'.$css_class.'><td>';          $datatable .= '<tr'.$css_class.'><td>';
         if ($numdc > 1) {          if ($numdc > 1) {
             $datatable .= &mt('Course creation processed as: (choose Dom. Coord.)');              $datatable .= &mt('Course creation processed as: (choose Dom. Coord.)');
         } else {          } else {
Line 6178  sub print_loadbalancing { Line 6339  sub print_loadbalancing {
     my $numinrow = 1;      my $numinrow = 1;
     my $datatable;      my $datatable;
     my %servers = &Apache::lonnet::internet_dom_servers($dom);      my %servers = &Apache::lonnet::internet_dom_servers($dom);
     my (%currbalancer,%currtargets,%currrules,%existing);      my (%currbalancer,%currtargets,%currrules,%existing,%currcookies);
     if (ref($settings) eq 'HASH') {      if (ref($settings) eq 'HASH') {
         %existing = %{$settings};          %existing = %{$settings};
     }      }
     if ((keys(%servers) > 1) || (keys(%existing) > 0)) {      if ((keys(%servers) > 1) || (keys(%existing) > 0)) {
         &get_loadbalancers_config(\%servers,\%existing,\%currbalancer,          &get_loadbalancers_config(\%servers,\%existing,\%currbalancer,
                                   \%currtargets,\%currrules);                                    \%currtargets,\%currrules,\%currcookies);
     } else {      } else {
         return;          return;
     }      }
Line 6261  sub print_loadbalancing { Line 6422  sub print_loadbalancing {
         my %hostherechecked = (          my %hostherechecked = (
                                   no => ' checked="checked"',                                    no => ' checked="checked"',
                               );                                );
           my %balcookiechecked = (
                                     no => ' checked="checked"', 
                                  );
         foreach my $sparetype (@sparestypes) {          foreach my $sparetype (@sparestypes) {
             my $targettable;              my $targettable;
             for (my $i=0; $i<$numspares; $i++) {              for (my $i=0; $i<$numspares; $i++) {
Line 6316  sub print_loadbalancing { Line 6480  sub print_loadbalancing {
                 }                  }
             }              }
         }          }
           if ($currcookies{$lonhost}) {
               %balcookiechecked = (
                                       yes => ' checked="checked"',
                                   );
           }
         $datatable .= &mt('Hosting on balancer itself').'<br />'.          $datatable .= &mt('Hosting on balancer itself').'<br />'.
                       '<label><input type="radio" name="loadbalancing_target_'.$balnum.'_hosthere" value="no"'.                        '<label><input type="radio" name="loadbalancing_target_'.$balnum.'_hosthere" value="no"'.
                       $hostherechecked{'no'}.' />'.&mt('No').'</label><br />';                        $hostherechecked{'no'}.' />'.&mt('No').'</label><br />';
Line 6324  sub print_loadbalancing { Line 6493  sub print_loadbalancing {
                           'value="'.$sparetype.'"'.$hostherechecked{$sparetype}.' /><i>'.$typetitles{$sparetype}.                            'value="'.$sparetype.'"'.$hostherechecked{$sparetype}.' /><i>'.$typetitles{$sparetype}.
                           '</i></label><br />';                            '</i></label><br />';
         }          }
         $datatable .= '</div></td></tr>'.          $datatable .= &mt('Use balancer cookie').'<br />'.
                         '<label><input type="radio" name="loadbalancing_cookie_'.$balnum.'" value="1"'.
                         $balcookiechecked{'yes'}.' />'.&mt('Yes').'</label><br />'.
                         '<label><input type="radio" name="loadbalancing_cookie_'.$balnum.'" value="0"'.
                         $balcookiechecked{'no'}.' />'.&mt('No').'</label><br />'.
                         '</div></td></tr>'.
                       &loadbalancing_rules($dom,$intdom,$currrules{$lonhost},                        &loadbalancing_rules($dom,$intdom,$currrules{$lonhost},
                                            $othertitle,$usertypes,$types,\%servers,                                             $othertitle,$usertypes,$types,\%servers,
                                            \%currbalancer,$lonhost,                                             \%currbalancer,$lonhost,
Line 6338  sub print_loadbalancing { Line 6512  sub print_loadbalancing {
 }  }
   
 sub get_loadbalancers_config {  sub get_loadbalancers_config {
     my ($servers,$existing,$currbalancer,$currtargets,$currrules) = @_;      my ($servers,$existing,$currbalancer,$currtargets,$currrules,$currcookies) = @_;
     return unless ((ref($servers) eq 'HASH') &&      return unless ((ref($servers) eq 'HASH') &&
                    (ref($existing) eq 'HASH') && (ref($currbalancer) eq 'HASH') &&                     (ref($existing) eq 'HASH') && (ref($currbalancer) eq 'HASH') &&
                    (ref($currtargets) eq 'HASH') && (ref($currrules) eq 'HASH'));                     (ref($currtargets) eq 'HASH') && (ref($currrules) eq 'HASH') &&
                      (ref($currcookies) eq 'HASH'));
     if (keys(%{$existing}) > 0) {      if (keys(%{$existing}) > 0) {
         my $oldlonhost;          my $oldlonhost;
         foreach my $key (sort(keys(%{$existing}))) {          foreach my $key (sort(keys(%{$existing}))) {
Line 6360  sub get_loadbalancers_config { Line 6535  sub get_loadbalancers_config {
                 $currbalancer->{$key} = 1;                  $currbalancer->{$key} = 1;
                 $currtargets->{$key} = $existing->{$key}{'targets'};                  $currtargets->{$key} = $existing->{$key}{'targets'};
                 $currrules->{$key} = $existing->{$key}{'rules'};                  $currrules->{$key} = $existing->{$key}{'rules'};
                   if ($existing->{$key}{'cookie'}) {
                       $currcookies->{$key} = 1;
                   }
             }              }
         }          }
     } else {      } else {
Line 6555  sub contact_titles { Line 6733  sub contact_titles {
                    'requestsmail'    => 'E-mail from course requests requiring approval',                     'requestsmail'    => 'E-mail from course requests requiring approval',
                    'updatesmail'     => 'E-mail from nightly check of LON-CAPA module integrity/updates',                     'updatesmail'     => 'E-mail from nightly check of LON-CAPA module integrity/updates',
                    'idconflictsmail' => 'E-mail from bi-nightly check for multiple users sharing same student/employee ID',                     'idconflictsmail' => 'E-mail from bi-nightly check for multiple users sharing same student/employee ID',
                      'errorthreshold'  => 'Error/warning threshold for status e-mail',
                      'errorsysmail'    => 'Error threshold for e-mail to core group',
                      'errorweights'    => 'Weights used to compute error count',
                      'errorexcluded'   => 'Servers with unsent updates excluded from count',
                  );                   );
     my %short_titles = &Apache::lonlocal::texthash (      my %short_titles = &Apache::lonlocal::texthash (
                            adminemail   => 'Admin E-mail address',                             adminemail   => 'Admin E-mail address',
Line 6844  sub print_selfcreation { Line 7026  sub print_selfcreation {
         $datatable .= '<tr'.$css_class.'>'.          $datatable .= '<tr'.$css_class.'>'.
                      '<td class="LC_left_item">'.&mt('Mapping of Shibboleth environment variable names to user data fields (SSO auth)').'</td>'.                       '<td class="LC_left_item">'.&mt('Mapping of Shibboleth environment variable names to user data fields (SSO auth)').'</td>'.
                      '<td class="LC_left_item">'."\n".                       '<td class="LC_left_item">'."\n".
                      '<table><tr><td>'."\n";                       '<table>'."\n";
         for (my $i=0; $i<@fields; $i++) {          for (my $i=0; $i<@fields; $i++) {
             $rem = $i%($numperrow);              $rem = $i%($numperrow);
             if ($rem == 0) {              if ($rem == 0) {
Line 8251  sub print_serverstatuses { Line 8433  sub print_serverstatuses {
                       '<span class="LC_nobreak">'.                        '<span class="LC_nobreak">'.
                       '<input type="text" name="'.$type.'_machines" '.                        '<input type="text" name="'.$type.'_machines" '.
                       'value="'.$machineaccess{$type}.'" size="10" />'.                        'value="'.$machineaccess{$type}.'" size="10" />'.
                       '</td></tr>'."\n";                        '</span></td></tr>'."\n";
     }      }
     $$rowtotal += $rownum;      $$rowtotal += $rownum;
     return $datatable;      return $datatable;
Line 8844  sub insttypes_row { Line 9026  sub insttypes_row {
         }          }
         $output .= '&nbsp;';            $output .= '&nbsp;';  
     } else {      } else {
         if (($rem == 0) && (@{$types} > 0)) {          if ($rem == 0) {
             $output .= '<tr>';              $output .= '<tr>';
         }          }
         if ($colsleft > 1) {          if ($colsleft > 1) {
Line 11123  sub modify_ltitools { Line 11305  sub modify_ltitools {
                         if ($env{'form.ltitools_'.$extra.'_'.$i}) {                          if ($env{'form.ltitools_'.$extra.'_'.$i}) {
                             $confhash{$itemid}{$extra} = 1;                              $confhash{$itemid}{$extra} = 1;
                             if ($env{'form.ltitools_'.$extra.'valid_'.$i} ne '') {                              if ($env{'form.ltitools_'.$extra.'valid_'.$i} ne '') {
                                 my $lifetime = $env{'form.ltitools_'.$extra.'valid_add'};                                  my $lifetime = $env{'form.ltitools_'.$extra.'valid_'.$i};
                                 $lifetime =~ s/^\s+|\s+$//g;                                  $lifetime =~ s/^\s+|\s+$//g;
                                 if ($lifetime =~ /^\d+\.?\d*$/) {                                  if ($lifetime =~ /^\d+\.?\d*$/) {
                                     $confhash{$itemid}{$extra.'valid'} = $lifetime;                                      $confhash{$itemid}{$extra.'valid'} = $lifetime;
Line 11709  sub modify_lti { Line 11891  sub modify_lti {
                 $confhash{$itemid}{$field} = 1;                  $confhash{$itemid}{$field} = 1;
             }              }
         }          }
           if ($env{'form.lti_passback_'.$idx}) {
               if ($env{'form.lti_passbackformat_'.$idx} eq '1.0') {
                   $confhash{$itemid}{'passbackformat'} = '1.0';
               } else {
                   $confhash{$itemid}{'passbackformat'} = '1.1';
               }
           }
         if ($env{'form.lti_topmenu_'.$idx} || $env{'form.lti_inlinemenu_'.$idx}) {          if ($env{'form.lti_topmenu_'.$idx} || $env{'form.lti_inlinemenu_'.$idx}) {
             $confhash{$itemid}{lcmenu} = [];              $confhash{$itemid}{lcmenu} = [];
             my @possmenu = &Apache::loncommon::get_env_multiple('form.lti_menuitem_'.$idx);              my @possmenu = &Apache::loncommon::get_env_multiple('form.lti_menuitem_'.$idx);
Line 11728  sub modify_lti { Line 11916  sub modify_lti {
                     $changes{$itemid} = 1;                      $changes{$itemid} = 1;
                 }                  }
             }              }
               unless ($changes{$itemid}) {
                   if ($domconfig{$action}{$itemid}{'passback'} eq $confhash{$itemid}{'passback'}) {
                       if ($domconfig{$action}{$itemid}{'passbackformat'} ne $confhash{$itemid}{'passbackformat'}) {
                           $changes{$itemid} = 1;
                       }
                   }
               }
             foreach my $field ('makeuser','mapcrstype','selfenroll','instdata','lcmenu') {              foreach my $field ('makeuser','mapcrstype','selfenroll','instdata','lcmenu') {
                 unless ($changes{$itemid}) {                  unless ($changes{$itemid}) {
                     if (ref($domconfig{$action}{$itemid}{$field}) eq 'ARRAY') {                      if (ref($domconfig{$action}{$itemid}{$field}) eq 'ARRAY') {
Line 11944  sub modify_lti { Line 12139  sub modify_lti {
                         $resulttext .= '<li>'.$lt{$item}.':&nbsp;';                          $resulttext .= '<li>'.$lt{$item}.':&nbsp;';
                         if ($confhash{$itemid}{$item}) {                          if ($confhash{$itemid}{$item}) {
                             $resulttext .= &mt('Yes');                              $resulttext .= &mt('Yes');
                               if ($item eq 'passback') {
                                   if ($confhash{$itemid}{'passbackformat'} eq '1.0') {
                                       $resulttext .= '&nbsp;('.&mt('Outcomes Extension (1.0)').')';
                                   } elsif ($confhash{$itemid}{'passbackformat'} eq '1.1') {
                                       $resulttext .= '&nbsp;('.&mt('Outcomes Service (1.1)').')';
                                   }
                               }
                         } else {                          } else {
                             $resulttext .= &mt('No');                              $resulttext .= &mt('No');
                         }                          }
Line 12603  sub modify_contacts { Line 12805  sub modify_contacts {
     my @contacts = ('supportemail','adminemail');      my @contacts = ('supportemail','adminemail');
     my @mailings = ('errormail','packagesmail','helpdeskmail','otherdomsmail',      my @mailings = ('errormail','packagesmail','helpdeskmail','otherdomsmail',
                     'lonstatusmail','requestsmail','updatesmail','idconflictsmail');                      'lonstatusmail','requestsmail','updatesmail','idconflictsmail');
     my @toggles = ('reporterrors','reportupdates');      my @toggles = ('reporterrors','reportupdates','reportstatus');
       my @lonstatus = ('threshold','sysmail','weights','excluded');
     my ($fields,$fieldtitles,$fieldoptions,$possoptions) = &helpform_fields();      my ($fields,$fieldtitles,$fieldoptions,$possoptions) = &helpform_fields();
     foreach my $type (@mailings) {      foreach my $type (@mailings) {
         @{$newsetting{$type}} =           @{$newsetting{$type}} = 
Line 12636  sub modify_contacts { Line 12839  sub modify_contacts {
             $contacts_hash{'contacts'}{$item} = $env{'form.'.$item};              $contacts_hash{'contacts'}{$item} = $env{'form.'.$item};
         }          }
     }      }
       my ($lonstatus_defs,$lonstatus_names) = &Apache::loncommon::lon_status_items();
       foreach my $item (@lonstatus) {
           if ($item eq 'excluded') {
               my (%serverhomes,@excluded);
               map { $serverhomes{$_} = 1; } values(%Apache::lonnet::serverhomeIDs);
               my @possexcluded = &Apache::loncommon::get_env_multiple('form.errorexcluded');
               if (@possexcluded) {
                   foreach my $id (sort(@possexcluded)) {
                       if ($serverhomes{$id}) {
                           push(@excluded,$id);
                       }
                   }
               }
               if (@excluded) {
                   $contacts_hash{'contacts'}{'lonstatus'}{$item} = \@excluded;
               }
           } elsif ($item eq 'weights') {
               foreach my $type ('E','W','N') {
                   $env{'form.error'.$item.'_'.$type} =~ s/^\s+|\s+$//g;
                   if ($env{'form.error'.$item.'_'.$type} =~ /^\d+$/) {
                       unless ($env{'form.error'.$item.'_'.$type} == $lonstatus_defs->{$type}) {
                           $contacts_hash{'contacts'}{'lonstatus'}{$item}{$type} =
                               $env{'form.error'.$item.'_'.$type};
                       }
                   }
               }
           } elsif (($item eq 'threshold') || ($item eq 'sysmail')) {
               $env{'form.error'.$item} =~ s/^\s+|\s+$//g;
               if ($env{'form.error'.$item} =~ /^\d+$/) {
                   unless ($env{'form.error'.$item} == $lonstatus_defs->{$item}) {
                       $contacts_hash{'contacts'}{'lonstatus'}{$item} = $env{'form.error'.$item};
                   }
               }
           }
       }
     if ((ref($fields) eq 'ARRAY') && (ref($possoptions) eq 'HASH')) {      if ((ref($fields) eq 'ARRAY') && (ref($possoptions) eq 'HASH')) {
         foreach my $field (@{$fields}) {          foreach my $field (@{$fields}) {
             if (ref($possoptions->{$field}) eq 'ARRAY') {              if (ref($possoptions->{$field}) eq 'ARRAY') {
Line 12774  sub modify_contacts { Line 13012  sub modify_contacts {
                 }                  }
             }              }
         }          }
           if (ref($currsetting{'lonstatus'}) eq 'HASH') {
               foreach my $key ('excluded','weights','threshold','sysmail') {
                   if ($key eq 'excluded') {
                       if ((ref($contacts_hash{contacts}{lonstatus}) eq 'HASH') &&
                           (ref($contacts_hash{contacts}{lonstatus}{excluded}) eq 'ARRAY')) {
                           if ((ref($currsetting{'lonstatus'}{$key}) eq 'ARRAY') &&
                               (@{$currsetting{'lonstatus'}{$key}})) {
                               my @diffs =
                                   &Apache::loncommon::compare_arrays($contacts_hash{contacts}{lonstatus}{excluded},
                                                                      $currsetting{'lonstatus'}{$key});
                               if (@diffs) {
                                   push(@{$changes{'lonstatus'}},$key);
                               }
                           } elsif (@{$contacts_hash{contacts}{lonstatus}{excluded}}) {
                               push(@{$changes{'lonstatus'}},$key);
                           }
                       } elsif ((ref($currsetting{'lonstatus'}{$key}) eq 'ARRAY') &&
                                (@{$currsetting{'lonstatus'}{$key}})) {
                           push(@{$changes{'lonstatus'}},$key);
                       }
                   } elsif ($key eq 'weights') {
                       if ((ref($contacts_hash{contacts}{lonstatus}) eq 'HASH') &&
                           (ref($contacts_hash{contacts}{lonstatus}{$key}) eq 'HASH')) {
                           if (ref($currsetting{'lonstatus'}{$key}) eq 'HASH') {
                               foreach my $type ('E','W','N','U') {
                                   unless ($contacts_hash{contacts}{lonstatus}{$key}{$type} eq
                                           $currsetting{'lonstatus'}{$key}{$type}) {
                                       push(@{$changes{'lonstatus'}},$key);
                                       last;
                                   }
                               }
                           } else {
                               foreach my $type ('E','W','N','U') {
                                   if ($contacts_hash{contacts}{lonstatus}{$key}{$type} ne '') {
                                       push(@{$changes{'lonstatus'}},$key);
                                       last;
                                   }
                               }
                           }
                       } elsif (ref($currsetting{'lonstatus'}{$key}) eq 'HASH') {
                           foreach my $type ('E','W','N','U') {
                               if ($currsetting{'lonstatus'}{$key}{$type} ne '') {
                                   push(@{$changes{'lonstatus'}},$key);
                                   last;
                               }
                           }
                       }
                   } elsif (($key eq 'threshold') || ($key eq 'sysmail')) {
                       if (ref($contacts_hash{contacts}{lonstatus}) eq 'HASH') {
                           if ($currsetting{'lonstatus'}{$key} =~ /^\d+$/) {
                               if ($currsetting{'lonstatus'}{$key} != $contacts_hash{contacts}{lonstatus}{$key}) {
                                   push(@{$changes{'lonstatus'}},$key);
                               }
                           } elsif ($contacts_hash{contacts}{lonstatus}{$key} =~ /^\d+$/) {
                               push(@{$changes{'lonstatus'}},$key);
                           }
                       } elsif ($currsetting{'lonstatus'}{$key} =~ /^\d+$/) {
                           push(@{$changes{'lonstatus'}},$key);
                       }
                   }
               }
           } else {
               if (ref($contacts_hash{contacts}{lonstatus}) eq 'HASH') {
                   foreach my $key ('excluded','weights','threshold','sysmail') {
                       if (exists($contacts_hash{contacts}{lonstatus}{$key})) {
                           push(@{$changes{'lonstatus'}},$key);
                       }
                   }
               }
           }
     } else {      } else {
         my %default;          my %default;
         $default{'supportemail'} = $Apache::lonnet::perlvar{'lonSupportEMail'};          $default{'supportemail'} = $Apache::lonnet::perlvar{'lonSupportEMail'};
Line 12818  sub modify_contacts { Line 13126  sub modify_contacts {
                 }                  }
             }              }
         }          }
           if (ref($contacts_hash{contacts}{lonstatus}) eq 'HASH') {
               foreach my $key ('excluded','weights','threshold','sysmail') {
                   if (exists($contacts_hash{contacts}{lonstatus}{$key})) {
                       push(@{$changes{'lonstatus'}},$key);
                   }
               }
           }
     }      }
     foreach my $item (@toggles) {      foreach my $item (@toggles) {
         if (($env{'form.'.$item} == 1) && ($currsetting{$item} == 0)) {          if (($env{'form.'.$item} == 1) && ($currsetting{$item} == 0)) {
Line 12943  sub modify_contacts { Line 13258  sub modify_contacts {
                 }                  }
             }              }
             my @offon = ('off','on');              my @offon = ('off','on');
               my $corelink = &core_link_msu();
             if ($changes{'reporterrors'}) {              if ($changes{'reporterrors'}) {
                 $resulttext .= '<li>'.                  $resulttext .= '<li>'.
                                &mt('E-mail error reports to [_1] set to "'.                                 &mt('E-mail error reports to [_1] set to "'.
                                    $offon[$env{'form.reporterrors'}].'".',                                     $offon[$env{'form.reporterrors'}].'".',
                                    &Apache::loncommon::modal_link('http://loncapa.org/core.html',                                     $corelink).
                                        &mt('LON-CAPA core group - MSU'),600,500)).  
                                '</li>';                                 '</li>';
             }              }
             if ($changes{'reportupdates'}) {              if ($changes{'reportupdates'}) {
                 $resulttext .= '<li>'.                  $resulttext .= '<li>'.
                                 &mt('E-mail record of completed LON-CAPA updates to [_1] set to "'.                                  &mt('E-mail record of completed LON-CAPA updates to [_1] set to "'.
                                     $offon[$env{'form.reportupdates'}].'".',                                      $offon[$env{'form.reportupdates'}].'".',
                                     &Apache::loncommon::modal_link('http://loncapa.org/core.html',                                      $corelink).
                                         &mt('LON-CAPA core group - MSU'),600,500)).                                  '</li>';
               }
               if ($changes{'reportstatus'}) {
                   $resulttext .= '<li>'.
                                   &mt('E-mail status if errors above threshold to [_1] set to "'.
                                       $offon[$env{'form.reportstatus'}].'".',
                                       $corelink).
                                 '</li>';                                  '</li>';
             }              }
               if (ref($changes{'lonstatus'}) eq 'ARRAY') {
                   $resulttext .= '<li>'.
                                  &mt('Nightly status check e-mail settings').':<ul>';
                   my (%defval,%use_def,%shown);
                   $defval{'threshold'} = $lonstatus_defs->{'threshold'};
                   $defval{'sysmail'} = $lonstatus_defs->{'sysmail'};
                   $defval{'weights'} =
                       join(', ',map { $lonstatus_names->{$_}.'='.$lonstatus_defs->{$_}; } ('E','W','N','U'));
                   $defval{'excluded'} = &mt('None');
                   if (ref($contacts_hash{'contacts'}{'lonstatus'}) eq 'HASH') {
                       foreach my $item ('threshold','sysmail','weights','excluded') {
                           if (exists($contacts_hash{'contacts'}{'lonstatus'}{$item})) {
                               if (($item eq 'threshold') || ($item eq 'sysmail')) {
                                   $shown{$item} = $contacts_hash{'contacts'}{'lonstatus'}{$item};
                               } elsif ($item eq 'weights') {
                                   if (ref($contacts_hash{'contacts'}{'lonstatus'}{$item}) eq 'HASH') {
                                       foreach my $type ('E','W','N','U') {
                                           $shown{$item} .= $lonstatus_names->{$type}.'=';
                                           if (exists($contacts_hash{'contacts'}{'lonstatus'}{$item}{$type})) {
                                               $shown{$item} .= $contacts_hash{'contacts'}{'lonstatus'}{$item}{$type};
                                           } else {
                                               $shown{$item} .= $lonstatus_defs->{$type};
                                           }
                                           $shown{$item} .= ', ';
                                       }
                                       $shown{$item} =~ s/, $//;
                                   } else {
                                       $shown{$item} = $defval{$item};
                                   }
                               } elsif ($item eq 'excluded') {
                                   if (ref($contacts_hash{'contacts'}{'lonstatus'}{$item}) eq 'ARRAY') {
                                       $shown{$item} = join(', ',@{$contacts_hash{'contacts'}{'lonstatus'}{$item}});
                                   } else {
                                       $shown{$item} = $defval{$item};
                                   }
                               }
                           } else {
                               $shown{$item} = $defval{$item};
                           }
                       }
                   } else {
                       foreach my $item ('threshold','weights','excluded','sysmail') {
                           $shown{$item} = $defval{$item};
                       }
                   }
                   foreach my $item ('threshold','weights','excluded','sysmail') {
                       $resulttext .= '<li>'.&mt($titles->{'error'.$item}.' -- [_1]',
                                             $shown{$item}).'</li>';
                   }
                   $resulttext .= '</ul></li>';
               }
             if ((ref($changes{'helpform'}) eq 'ARRAY') && (ref($fields) eq 'ARRAY')) {              if ((ref($changes{'helpform'}) eq 'ARRAY') && (ref($fields) eq 'ARRAY')) {
                 my (@optional,@required,@unused,$maxsizechg);                  my (@optional,@required,@unused,$maxsizechg);
                 foreach my $field (@{$changes{'helpform'}}) {                  foreach my $field (@{$changes{'helpform'}}) {
Line 16358  sub modify_ssl { Line 16730  sub modify_ssl {
                 if ($env{'form.'.$prefix.'_'.$type} =~ /^(no|req)$/) {                  if ($env{'form.'.$prefix.'_'.$type} =~ /^(no|req)$/) {
                     $value = $env{'form.'.$prefix.'_'.$type};                      $value = $env{'form.'.$prefix.'_'.$type};
                 }                  }
                 if (ref($domconfig{$action}{$prefix}) eq 'HASH') {                  if (ref($domconfig{$action}) eq 'HASH') {
                     if ($domconfig{$action}{$prefix}{$type} ne '') {                      if (ref($domconfig{$action}{$prefix}) eq 'HASH') {
                         if ($value ne $domconfig{$action}{$prefix}{$type}) {                          if ($domconfig{$action}{$prefix}{$type} ne '') {
                               if ($value ne $domconfig{$action}{$prefix}{$type}) {
                                   $changes{$prefix}{$type} = 1;
                               }
                               $defaultshash{$action}{$prefix}{$type} = $value;
                           } else {
                               $defaultshash{$action}{$prefix}{$type} = $value;
                             $changes{$prefix}{$type} = 1;                              $changes{$prefix}{$type} = 1;
                         }                          }
                         $defaultshash{$action}{$prefix}{$type} = $value;  
                     } else {                      } else {
                         $defaultshash{$action}{$prefix}{$type} = $value;                          $defaultshash{$action}{$prefix}{$type} = $value;
                         $changes{$prefix}{$type} = 1;                          $changes{$prefix}{$type} = 1;
Line 16433  sub modify_ssl { Line 16810  sub modify_ssl {
             }              }
         }          }
     }      }
       if (keys(%changes)) {
           foreach my $prefix (keys(%changes)) {
               if (ref($changes{$prefix}) eq 'HASH') {
                   if (scalar(keys(%{$changes{$prefix}})) == 0) {
                       delete($changes{$prefix});
                   }
               } else {
                   delete($changes{$prefix});
               }
           }
       }
     my $nochgmsg = &mt('No changes made to LON-CAPA SSL settings');      my $nochgmsg = &mt('No changes made to LON-CAPA SSL settings');
     if (keys(%changes) > 0) {      if (keys(%changes) > 0) {
         my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,          my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash,
Line 16443  sub modify_ssl { Line 16831  sub modify_ssl {
                     $domdefaults{'replication'} = $defaultshash{$action}{'replication'};                      $domdefaults{'replication'} = $defaultshash{$action}{'replication'};
                 }                  }
                 if (ref($defaultshash{$action}{'connto'}) eq 'HASH') {                  if (ref($defaultshash{$action}{'connto'}) eq 'HASH') {
                     $domdefaults{'connto'} = $domconfig{$action}{'connto'};                      $domdefaults{'connto'} = $defaultshash{$action}{'connto'};
                 }                  }
                 if (ref($defaultshash{$action}{'connfrom'}) eq 'HASH') {                  if (ref($defaultshash{$action}{'connfrom'}) eq 'HASH') {
                     $domdefaults{'connfrom'} = $domconfig{$action}{'connfrom'};                      $domdefaults{'connfrom'} = $defaultshash{$action}{'connfrom'};
                 }                  }
             }              }
             my $cachetime = 24*60*60;              my $cachetime = 24*60*60;
Line 16632  sub modify_loadbalancing { Line 17020  sub modify_loadbalancing {
     my @sparestypes = ('primary','default');      my @sparestypes = ('primary','default');
     my %typetitles = &sparestype_titles();      my %typetitles = &sparestype_titles();
     my $resulttext;      my $resulttext;
     my (%currbalancer,%currtargets,%currrules,%existing);      my (%currbalancer,%currtargets,%currrules,%existing,%currcookies);
     if (ref($domconfig{'loadbalancing'}) eq 'HASH') {      if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
         %existing = %{$domconfig{'loadbalancing'}};          %existing = %{$domconfig{'loadbalancing'}};
     }      }
     &get_loadbalancers_config(\%servers,\%existing,\%currbalancer,      &get_loadbalancers_config(\%servers,\%existing,\%currbalancer,
                               \%currtargets,\%currrules);                                \%currtargets,\%currrules,\%currcookies);
     my ($saveloadbalancing,%defaultshash,%changes);      my ($saveloadbalancing,%defaultshash,%changes);
     my ($alltypes,$othertypes,$titles) =      my ($alltypes,$othertypes,$titles) =
         &loadbalancing_titles($dom,$intdom,$usertypes,$types);          &loadbalancing_titles($dom,$intdom,$usertypes,$types);
Line 16689  sub modify_loadbalancing { Line 17077  sub modify_loadbalancing {
             }              }
             $defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype} = \@offloadto;              $defaultshash{'loadbalancing'}{$balancer}{'targets'}{$sparetype} = \@offloadto;
         }          }
           if ($env{'form.loadbalancing_cookie_'.$i}) {
               $defaultshash{'loadbalancing'}{$balancer}{'cookie'} = 1;
               if (exists($currbalancer{$balancer})) { 
                   unless ($currcookies{$balancer}) {
                       $changes{'curr'}{$balancer}{'cookie'} = 1;
                   }
               }
           } elsif (exists($currbalancer{$balancer})) {
               if ($currcookies{$balancer}) {
                   $changes{'curr'}{$balancer}{'cookie'} = 1;
               }
           }
         if (ref($currtargets{$balancer}) eq 'HASH') {          if (ref($currtargets{$balancer}) eq 'HASH') {
             foreach my $sparetype (@sparestypes) {              foreach my $sparetype (@sparestypes) {
                 if (ref($currtargets{$balancer}{$sparetype}) eq 'ARRAY') {                  if (ref($currtargets{$balancer}{$sparetype}) eq 'ARRAY') {
Line 16842  sub modify_loadbalancing { Line 17242  sub modify_loadbalancing {
                                 }                                  }
                             }                              }
                         }                          }
                           if ($changes{'curr'}{$balancer}{'cookie'}) {
                               $resulttext .= '<li>'.&mt('Load Balancer: [_1] -- cookie use enabled',
                                                         $balancer).'</li>'; 
                           }
                         if (keys(%toupdate)) {                          if (keys(%toupdate)) {
                             my %thismachine;                              my %thismachine;
                             my $updatedhere;                              my $updatedhere;
Line 17071  sub lonbalance_targets_js { Line 17475  sub lonbalance_targets_js {
     }      }
     push(@alltypes,'default','_LC_adv','_LC_author','_LC_internetdom','_LC_external');      push(@alltypes,'default','_LC_adv','_LC_author','_LC_internetdom','_LC_external');
     $allinsttypes = join("','",@alltypes);      $allinsttypes = join("','",@alltypes);
     my (%currbalancer,%currtargets,%currrules,%existing);      my (%currbalancer,%currtargets,%currrules,%existing,%currcookies);
     if (ref($settings) eq 'HASH') {      if (ref($settings) eq 'HASH') {
         %existing = %{$settings};          %existing = %{$settings};
     }      }
     &get_loadbalancers_config($servers,\%existing,\%currbalancer,      &get_loadbalancers_config($servers,\%existing,\%currbalancer,
                               \%currtargets,\%currrules);                                \%currtargets,\%currrules,\%currcookies);
     my $balancers = join("','",sort(keys(%currbalancer)));      my $balancers = join("','",sort(keys(%currbalancer)));
     return <<"END";      return <<"END";
   

Removed from v.1.332  
changed lines
  Added in v.1.342


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