Diff for /loncom/interface/domainprefs.pm between versions 1.362 and 1.369

version 1.362, 2019/06/04 03:16:19 version 1.369, 2020/02/05 23:46:01
Line 831  sub print_config_box { Line 831  sub print_config_box {
     if ($numheaders > 1) {      if ($numheaders > 1) {
         my $colspan = '';          my $colspan = '';
         my $rightcolspan = '';          my $rightcolspan = '';
           my $leftnobr = '';
         if (($action eq 'rolecolors') || ($action eq 'defaults') ||          if (($action eq 'rolecolors') || ($action eq 'defaults') ||
             ($action eq 'directorysrch') ||              ($action eq 'directorysrch') ||
             (($action eq 'login') && ($numheaders < 4))) {              (($action eq 'login') && ($numheaders < 4))) {
Line 839  sub print_config_box { Line 840  sub print_config_box {
         if ($action eq 'usersessions') {          if ($action eq 'usersessions') {
             $rightcolspan = ' colspan="3"';               $rightcolspan = ' colspan="3"'; 
         }          }
           if ($action eq 'passwords') {
               $leftnobr = ' LC_nobreak';
           }
         $output .= '          $output .= '
           <tr>            <tr>
            <td>             <td>
             <table class="LC_nested">              <table class="LC_nested">
              <tr class="LC_info_row">               <tr class="LC_info_row">
               <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[0]->{'col1'}).'</td>                <td class="LC_left_item'.$leftnobr.'"'.$colspan.'>'.&mt($item->{'header'}->[0]->{'col1'}).'</td>
               <td class="LC_right_item"'.$rightcolspan.'>'.&mt($item->{'header'}->[0]->{'col2'}).'</td>                <td class="LC_right_item"'.$rightcolspan.'>'.&mt($item->{'header'}->[0]->{'col2'}).'</td>
              </tr>';               </tr>';
         $rowtotal ++;          $rowtotal ++;
Line 889  sub print_config_box { Line 893  sub print_config_box {
             ($action eq 'usersessions') || ($action eq 'coursecategories') ||               ($action eq 'usersessions') || ($action eq 'coursecategories') || 
             ($action eq 'trust') || ($action eq 'contacts') ||              ($action eq 'trust') || ($action eq 'contacts') ||
             ($action eq 'privacy') || ($action eq 'passwords')) {              ($action eq 'privacy') || ($action eq 'passwords')) {
               my $leftnobr = ' LC_nobreak';
             if ($action eq 'coursecategories') {              if ($action eq 'coursecategories') {
                 $output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal);                  $output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal);
                 $colspan = ' colspan="2"';                  $colspan = ' colspan="2"';
Line 956  sub print_config_box { Line 961  sub print_config_box {
            <td>             <td>
             <table class="LC_nested">              <table class="LC_nested">
              <tr class="LC_info_row">               <tr class="LC_info_row">
               <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</td>                <td class="LC_left_item'.$leftnobr.'"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</td>
               <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col2'}).'</td></tr>'."\n";                <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col2'}).'</td></tr>'."\n";
                     if ($action eq 'passwords') {                      if ($action eq 'passwords') {
                         $output .= $item->{'print'}->('bottom',$dom,$confname,$settings,\$rowtotal);                          $output .= $item->{'print'}->('bottom',$dom,$confname,$settings,\$rowtotal);
Line 2905  function toggleLTI(form,setting,item) { Line 2910  function toggleLTI(form,setting,item) {
                 }                  }
             }              }
         }          }
     } else if ((setting == 'user') || (setting == 'crs') || (setting == 'passback')) {      } else if ((setting == 'user') || (setting == 'crs') || (setting == 'passback') || (setting == 'callback')) {
         var radioname = '';          var radioname = '';
         var divid = '';          var divid = '';
         if (setting == 'user') {          if (setting == 'user') {
Line 2914  function toggleLTI(form,setting,item) { Line 2919  function toggleLTI(form,setting,item) {
         } else if (setting == 'crs') {          } else if (setting == 'crs') {
             radioname = 'lti_mapcrs_'+item;              radioname = 'lti_mapcrs_'+item;
             divid = 'lti_crsfield_'+item;              divid = 'lti_crsfield_'+item;
           } else if (setting == 'callback') {
               radioname = 'lti_callback_'+item;
               divid = 'lti_callbackfield_'+item;
         } else {          } else {
             radioname = 'lti_passback_'+item;              radioname = 'lti_passback_'+item;
             divid =  'lti_passback_'+item;              divid =  'lti_passback_'+item;
Line 2923  function toggleLTI(form,setting,item) { Line 2931  function toggleLTI(form,setting,item) {
             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 (setting == 'passback') {                     if ((setting == 'passback') || (setting == 'callback')) {
                        if (form.elements[radioname][i].value == '1') {                         if (form.elements[radioname][i].value == '1') {
                            if (document.getElementById(divid)) {                             if (document.getElementById(divid)) {
                                document.getElementById(divid).style.display = 'inline-block';                                 document.getElementById(divid).style.display = 'inline-block';
Line 4957  sub lti_names { Line 4965  sub lti_names {
   
 sub lti_options {  sub lti_options {
     my ($num,$current,$itemcount,%lt) = @_;      my ($num,$current,$itemcount,%lt) = @_;
     my (%checked,%rolemaps,$crssecsrc,$userfield,$cidfield);      my (%checked,%rolemaps,$crssecsrc,$userfield,$cidfield,$callback);
     $checked{'mapuser'}{'sourcedid'} = ' checked="checked"';      $checked{'mapuser'}{'sourcedid'} = ' checked="checked"';
     $checked{'mapcrs'}{'course_offering_sourcedid'} = ' checked="checked"';      $checked{'mapcrs'}{'course_offering_sourcedid'} = ' checked="checked"';
     $checked{'makecrs'}{'N'} = '  checked="checked"';      $checked{'makecrs'}{'N'} = '  checked="checked"';
Line 4975  sub lti_options { Line 4983  sub lti_options {
     my $crsfieldsty = 'none';      my $crsfieldsty = 'none';
     my $crssecfieldsty = 'none';      my $crssecfieldsty = 'none';
     my $secsrcfieldsty = 'none';      my $secsrcfieldsty = 'none';
       my $callbacksty = 'none';
     my $passbacksty = 'none';      my $passbacksty = 'none';
     my $optionsty = 'block';      my $optionsty = 'block';
     my $lcauthparm;      my $lcauthparm;
Line 5054  sub lti_options { Line 5063  sub lti_options {
         } else {          } else {
             $checked{'crssec'}{'N'} = ' checked="checked"';              $checked{'crssec'}{'N'} = ' checked="checked"';
         }          }
           if ($current->{'callback'} ne '') {
               $callback = $current->{'callback'};
               $checked{'callback'}{'Y'} = ' checked="checked"';
               $callbacksty = 'inline-block';
           } else {
               $checked{'callback'}{'N'} = ' checked="checked"';
           }
         if ($current->{'topmenu'}) {          if ($current->{'topmenu'}) {
             $checked{'topmenu'}{'Y'} = ' checked="checked"';              $checked{'topmenu'}{'Y'} = ' checked="checked"';
         } else {          } else {
Line 5079  sub lti_options { Line 5095  sub lti_options {
     } else {      } else {
         $checked{'makecrs'}{'N'} = ' checked="checked"';          $checked{'makecrs'}{'N'} = ' checked="checked"';
         $checked{'crssec'}{'N'} = ' checked="checked"';          $checked{'crssec'}{'N'} = ' checked="checked"';
           $checked{'callback'}{'N'} = ' checked="checked"';
         $checked{'topmenu'}{'N'} = ' checked="checked"';          $checked{'topmenu'}{'N'} = ' checked="checked"';
         $checked{'inlinemenu'}{'Y'} = ' checked="checked"';           $checked{'inlinemenu'}{'Y'} = ' checked="checked"'; 
         $checked{'menuitem'}{'grades'} = ' checked="checked"';          $checked{'menuitem'}{'grades'} = ' checked="checked"';
Line 5107  sub lti_options { Line 5124  sub lti_options {
     my $onclickuser = ' onclick="toggleLTI(this.form,'."'user','$num'".');"';      my $onclickuser = ' onclick="toggleLTI(this.form,'."'user','$num'".');"';
     my $onclickcrs = ' onclick="toggleLTI(this.form,'."'crs','$num'".');"';      my $onclickcrs = ' onclick="toggleLTI(this.form,'."'crs','$num'".');"';
     my $onclicksec = ' onclick="toggleLTI(this.form,'."'sec','$num'".');"';      my $onclicksec = ' onclick="toggleLTI(this.form,'."'sec','$num'".');"';
       my $onclickcallback = ' onclick="toggleLTI(this.form,'."'callback','$num'".');"';
     my $onclicksecsrc = ' onclick="toggleLTI(this.form,'."'secsrc','$num'".')"';      my $onclicksecsrc = ' onclick="toggleLTI(this.form,'."'secsrc','$num'".')"';
     my $onclicklcauth = ' onclick="toggleLTI(this.form,'."'lcauth','$num'".')"';      my $onclicklcauth = ' onclick="toggleLTI(this.form,'."'lcauth','$num'".')"';
     my $onclickmenu = ' onclick="toggleLTI(this.form,'."'lcmenu','$num'".');"';      my $onclickmenu = ' onclick="toggleLTI(this.form,'."'lcmenu','$num'".');"';
Line 5256  sub lti_options { Line 5274  sub lti_options {
                '<label><input type="radio" name="lti_passbackformat_'.$num.'" value="1.1"'.$pb1p1chk.' />'.                 '<label><input type="radio" name="lti_passbackformat_'.$num.'" value="1.1"'.$pb1p1chk.' />'.
                &mt('Outcomes Service (1.1)').'</label>'.('&nbsp;'x2).                 &mt('Outcomes Service (1.1)').'</label>'.('&nbsp;'x2).
                '<label><input type="radio" name="lti_passbackformat_'.$num.'" value="1.0"'.$pb1p0chk.'/>'.                 '<label><input type="radio" name="lti_passbackformat_'.$num.'" value="1.0"'.$pb1p0chk.'/>'.
                &mt('Outcomes Extension (1.0)').'</label></span></div></fieldset>'.                 &mt('Outcomes Extension (1.0)').'</label></span></div>'.
                  '<div style="padding:0;clear:both;margin:0;border:0"></div>'.
                  '<div class="LC_floatleft"><span class="LC_nobreak">'.&mt('Callback on logout').':&nbsp;'.
                  '<label><input type="radio" name="lti_callback_'.$num.'" value="0"'.
                  $checked{'callback'}{'N'}.$onclickcallback.' />'.&mt('No').'</label>'.('&nbsp;'x2).
                  '<label><input type="radio" name="lti_callback_'.$num.'" value="1"'.
                  $checked{'callback'}{'Y'}.$onclickcallback.' />'.&mt('Yes').'</label></span></div>'.
                  '<div class="LC_floatleft" style="display:'.$callbacksty.';" id="lti_callbackfield_'.$num.'">'.
                  '<span class="LC_nobreak">'.&mt('Parameter').': '.
                  '<input type="text" name="lti_callbackparam_'.$num.'" value="'.$callback.'" /></span>'.
                  '</div><div style="padding:0;clear:both;margin:0;border:0"></div></fieldset>'.
                '<fieldset class="ltioption_'.$num.'" style="display:'.$optionsty.'"><legend>'.&mt('Course defaults (Course Coordinator can override)').'</legend>'.                 '<fieldset class="ltioption_'.$num.'" style="display:'.$optionsty.'"><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"'.
Line 6033  sub print_passwords { Line 6061  sub print_passwords {
                 $datatable .= '<span class="LC_nobreak"><label>'.                  $datatable .= '<span class="LC_nobreak"><label>'.
                               '<input type="checkbox" name="passwords_case_sensitive" value="'.                                '<input type="checkbox" name="passwords_case_sensitive" value="'.
                               $item.'"'.$checkedcase.' />'.$usertypes->{$item}.'</label>'.                                $item.'"'.$checkedcase.' />'.$usertypes->{$item}.'</label>'.
                               '<span>&nbsp;&nbsp; ';                                '</span>&nbsp;&nbsp; ';
             }              }
         }          }
         my $checkedcase;          my $checkedcase;
Line 6137  sub print_passwords { Line 6165  sub print_passwords {
                       &mt('(If you use the same account ...  reset a password from this page.)').'</span><br /><br />'.                        &mt('(If you use the same account ...  reset a password from this page.)').'</span><br /><br />'.
                       &mt('Include custom text:');                        &mt('Include custom text:');
         if ($customurl) {          if ($customurl) {
             my $link =  &Apache::loncommon::modal_link($customurl,&mt('Custom text file'),600,500,              my $link =  &Apache::loncommon::modal_link($customurl,&mt('custom text'),600,500,
                                                        undef,undef,undef,undef,'background-color:#ffffff');                                                         undef,undef,undef,undef,'background-color:#ffffff');
             $datatable .= '<span class="LC_nobreak">&nbsp;'.$link.              $datatable .= '<span class="LC_nobreak">&nbsp;'.$link.
                           '<label><input type="checkbox" name="passwords_custom_del"'.                            '<label><input type="checkbox" name="passwords_custom_del"'.
Line 6233  sub print_passwords { Line 6261  sub print_passwords {
         }          }
     } elsif ($position eq 'lower') {      } elsif ($position eq 'lower') {
         my ($min,$max,%chars,$expire,$numsaved);          my ($min,$max,%chars,$expire,$numsaved);
           $min = $Apache::lonnet::passwdmin;
         if (ref($settings) eq 'HASH') {          if (ref($settings) eq 'HASH') {
             if ($settings->{min}) {              if ($settings->{min}) {
                 $min = $settings->{min};                  $min = $settings->{min};
Line 6249  sub print_passwords { Line 6278  sub print_passwords {
             if ($settings->{numsaved}) {              if ($settings->{numsaved}) {
                 $numsaved = $settings->{numsaved};                  $numsaved = $settings->{numsaved};
             }              }
         } else {  
             $min = '7';  
         }          }
         my %rulenames = &Apache::lonlocal::texthash(          my %rulenames = &Apache::lonlocal::texthash(
                                                      uc => 'At least one upper case letter',                                                       uc => 'At least one upper case letter',
Line 6261  sub print_passwords { Line 6288  sub print_passwords {
         $css_class = $itemcount%2?' class="LC_odd_row"':'';          $css_class = $itemcount%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'><td>'.$titles{'min'}.'</td>'.          $datatable .= '<tr'.$css_class.'><td>'.$titles{'min'}.'</td>'.
                       '<td class="LC_left_item"><span class="LC_nobreak">'.                        '<td class="LC_left_item"><span class="LC_nobreak">'.
                       '<input type="text" name="passwords_min" value="'.$min.'" size="3" />'.                        '<input type="text" name="passwords_min" value="'.$min.'" size="3" '.
                       '<span class="LC_fontsize_small"> '.&mt('(Leave blank for no minimum)').'</span>'.                        'onblur="javascript:warnIntPass(this);" />'.
                         '<span class="LC_fontsize_small"> '.&mt('(Enter an integer: 7 or larger)').'</span>'.
                       '</span></td></tr>';                        '</span></td></tr>';
         $itemcount ++;          $itemcount ++;
         $css_class = $itemcount%2?' class="LC_odd_row"':'';          $css_class = $itemcount%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'><td>'.$titles{'max'}.'</td>'.          $datatable .= '<tr'.$css_class.'><td>'.$titles{'max'}.'</td>'.
                       '<td class="LC_left_item"><span class="LC_nobreak">'.                        '<td class="LC_left_item"><span class="LC_nobreak">'.
                       '<input type="text" name="passwords_max" value="'.$max.'" size="3" />'.                        '<input type="text" name="passwords_max" value="'.$max.'" size="3" '.
                         'onblur="javascript:warnIntPass(this);" />'.
                       '<span class="LC_fontsize_small"> '.&mt('(Leave blank for no maximum)').'</span>'.                        '<span class="LC_fontsize_small"> '.&mt('(Leave blank for no maximum)').'</span>'.
                       '</span></td></tr>';                        '</span></td></tr>';
         $itemcount ++;          $itemcount ++;
Line 6308  sub print_passwords { Line 6337  sub print_passwords {
         $css_class = $itemcount%2?' class="LC_odd_row"':'';          $css_class = $itemcount%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'><td>'.$titles{'expire'}.'</td>'.          $datatable .= '<tr'.$css_class.'><td>'.$titles{'expire'}.'</td>'.
                       '<td class="LC_left_item"><span class="LC_nobreak">'.                        '<td class="LC_left_item"><span class="LC_nobreak">'.
                       '<input type="text" name="passwords_expire" value="'.$expire.'" size="4" />'.                        '<input type="text" name="passwords_expire" value="'.$expire.'" size="4" '.
                         'onblur="javascript:warnIntPass(this);" />'.
                       '<span class="LC_fontsize_small"> '.&mt('(Leave blank for no expiration)').'</span>'.                        '<span class="LC_fontsize_small"> '.&mt('(Leave blank for no expiration)').'</span>'.
                       '</span></td></tr>';                        '</span></td></tr>';
         $itemcount ++;          $itemcount ++;
         $css_class = $itemcount%2?' class="LC_odd_row"':'';          $css_class = $itemcount%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'><td>'.$titles{'numsaved'}.'</td>'.          $datatable .= '<tr'.$css_class.'><td>'.$titles{'numsaved'}.'</td>'.
                       '<td class="LC_left_item"><span class="LC_nobreak">'.                        '<td class="LC_left_item"><span class="LC_nobreak">'.
                       '<input type="text" name="passwords_numsaved" value="'.$numsaved.'" size="3" />'.                        '<input type="text" name="passwords_numsaved" value="'.$numsaved.'" size="3" '.
                         'onblur="javascript:warnIntPass(this);" />'. 
                       '<span class="LC_fontsize_small"> '.&mt('(Leave blank to not save previous passwords)').'</span>'.                        '<span class="LC_fontsize_small"> '.&mt('(Leave blank to not save previous passwords)').'</span>'.
                       '</span></td></tr>';                        '</span></td></tr>';
     } else {      } else {
Line 6361  sub print_passwords { Line 6392  sub print_passwords {
                     $datatable .= '<span class="LC_nobreak"><label>'.                      $datatable .= '<span class="LC_nobreak"><label>'.
                                   '<input type="checkbox" name="passwords_crsowner_'.$item.'" value="'.                                    '<input type="checkbox" name="passwords_crsowner_'.$item.'" value="'.
                                   $type.'"'.$checked.' />'.$usertypes->{$type}.'</label>'.                                    $type.'"'.$checked.' />'.$usertypes->{$type}.'</label>'.
                                   '<span>&nbsp;&nbsp; ';                                    '</span>&nbsp;&nbsp; ';
                 }                  }
             }              }
             my $checked;              my $checked;
Line 9272  ENDSCRIPT Line 9303  ENDSCRIPT
 }  }
   
 sub passwords_javascript {  sub passwords_javascript {
     my $intauthcheck = &mt('Warning: disallowing login for an authenticated user if the stored cost is less than the default will require a password reset by/for the user.');      my %intalert = &Apache::lonlocal::texthash (
     my $intauthcost = &mt('Warning: bcrypt encryption cost for internal authentication must be an integer.');          authcheck => 'Warning: disallowing login for an authenticated user if the stored cost is less than the default will require a password reset by/for the user.',
     &js_escape(\$intauthcheck);          authcost => 'Warning: bcrypt encryption cost for internal authentication must be an integer.',
     &js_escape(\$intauthcost);          passmin => 'Warning: minimum password length must be a positive integer greater than 6.',
           passmax => 'Warning: maximum password length must be a positive integer (or blank).',
           passexp => 'Warning: days before password expiration must be a positive integer (or blank).',
           passnum => 'Warning: number of previous passwords to save must be a positive integer (or blank).',
       );
       &js_escape(\%intalert);
       my $defmin = $Apache::lonnet::passwdmin;
     my $intauthjs = <<"ENDSCRIPT";      my $intauthjs = <<"ENDSCRIPT";
   
 function warnIntAuth(field) {  function warnIntAuth(field) {
     if (field.name == 'intauth_check') {      if (field.name == 'intauth_check') {
         if (field.value == '2') {          if (field.value == '2') {
             alert('$intauthcheck');              alert('$intalert{authcheck}');
         }          }
     }      }
     if (field.name == 'intauth_cost') {      if (field.name == 'intauth_cost') {
Line 9289  function warnIntAuth(field) { Line 9326  function warnIntAuth(field) {
         if (field.value != '') {          if (field.value != '') {
             var regexdigit=/^\\d+\$/;              var regexdigit=/^\\d+\$/;
             if (!regexdigit.test(field.value)) {              if (!regexdigit.test(field.value)) {
                 alert('$intauthcost');                  alert('$intalert{authcost}');
               }
           }
       }
       return;
   }
   
   function warnIntPass(field) {
       field.value.replace(/^\s+/,'');
       field.value.replace(/\s+\$/,'');
       var regexdigit=/^\\d+\$/;
       if (field.name == 'passwords_min') {
           if (field.value == '') {
               alert('$intalert{passmin}');
               field.value = '$defmin';
           } else {
               if (!regexdigit.test(field.value)) {
                   alert('$intalert{passmin}');
                   field.value = '$defmin';
               }
               var minval = parseInt(field.value,10);
               if (minval < $defmin) {
                   alert('$intalert{passmin}');
                   field.value = '$defmin';
               }
           }
       } else {
           if (field.value == '0') {
               field.value = '';
           }
           if (field.value != '') {
               if (field.name == 'passwords_expire') {
                   var regexpposnum=/^\\d+(|\\.\\d*)\$/; 
                   if (!regexpposnum.test(field.value)) {
                       alert('$intalert{passexp}');
                       field.value = '';
                   } else {
                       var expval = parseFloat(field.value);
                       if (expval == 0) {
                           alert('$intalert{passexp}');
                           field.value = '';
                       }
                   }
               } else {
                   if (!regexdigit.test(field.value)) {
                       if (field.name == 'passwords_max') {
                           alert('$intalert{passmax}');
                       } else {
                           if (field.name == 'passwords_numsaved') {
                               alert('$intalert{passnum}');
                           }
                       }
                   }
                   field.value = '';
             }              }
         }          }
     }      }
Line 12675  sub modify_lti { Line 12765  sub modify_lti {
                     }                      }
                 }                  }
             }              }
               if ($env{'form.lti_callback_'.$idx}) {
                   if ($env{'form.lti_callbackparam_'.$idx}) {
                       my $callback = $env{'form.lti_callbackparam_'.$idx};
                       $callback =~ s/^\s+|\s+$//g;
                       $confhash{$itemid}{'callback'} = $callback;
                   }
               }
             foreach my $field ('passback','roster','topmenu','inlinemenu') {              foreach my $field ('passback','roster','topmenu','inlinemenu') {
                 if ($env{'form.lti_'.$field.'_'.$idx}) {                  if ($env{'form.lti_'.$field.'_'.$idx}) {
                     $confhash{$itemid}{$field} = 1;                      $confhash{$itemid}{$field} = 1;
Line 12700  sub modify_lti { Line 12797  sub modify_lti {
                 }                  }
             }              }
             unless (($idx eq 'add') || ($changes{$itemid})) {              unless (($idx eq 'add') || ($changes{$itemid})) {
                 foreach my $field ('mapuser','mapcrs','makecrs','section','passback','roster','lcauth','lcauthparm','topmenu','inlinemenu') {                  foreach my $field ('mapuser','mapcrs','makecrs','section','passback','roster','lcauth','lcauthparm','topmenu','inlinemenu','callback') {
                     if ($domconfig{$action}{$itemid}{$field} ne $confhash{$itemid}{$field}) {                      if ($domconfig{$action}{$itemid}{$field} ne $confhash{$itemid}{$field}) {
                         $changes{$itemid} = 1;                          $changes{$itemid} = 1;
                     }                      }
Line 12926  sub modify_lti { Line 13023  sub modify_lti {
                         } else {                          } else {
                             $resulttext .= '<li>'.&mt('No section assignment').'</li>';                              $resulttext .= '<li>'.&mt('No section assignment').'</li>';
                         }                          }
                           if ($confhash{$itemid}{'callback'}) {
                               $resulttext .= '<li>'.&mt('Callback setting').': '.$confhash{$itemid}{'callback'}.'</li>';
                           } else {
                               $resulttext .= '<li>'.&mt('No callback to logout LON-CAPA session when user logs out of Comsumer');
                           }
                         foreach my $item ('passback','roster','topmenu','inlinemenu') {                          foreach my $item ('passback','roster','topmenu','inlinemenu') {
                             $resulttext .= '<li>'.$lt{$item}.':&nbsp;';                              $resulttext .= '<li>'.$lt{$item}.':&nbsp;';
                             if ($confhash{$itemid}{$item}) {                              if ($confhash{$itemid}{$item}) {
Line 14455  sub modify_passwords { Line 14557  sub modify_passwords {
         'intauth_cost'   => 10,          'intauth_cost'   => 10,
         'intauth_check'  => 0,          'intauth_check'  => 0,
         'intauth_switch' => 0,          'intauth_switch' => 0,
         'min'            => 7,  
     );      );
       $staticdefaults{'min'} = $Apache::lonnet::passwdmin;
     foreach my $type (@oktypes) {      foreach my $type (@oktypes) {
         $staticdefaults{'resetpostlink'}{$type} = ['email','username'];          $staticdefaults{'resetpostlink'}{$type} = ['email','username'];
     }      }
Line 14468  sub modify_passwords { Line 14570  sub modify_passwords {
             if ($current{'resetlink'} ne $linklife) {              if ($current{'resetlink'} ne $linklife) {
                 $changes{'reset'} = 1;                  $changes{'reset'} = 1;
             }              }
         } elsif (!exists($domconfig{passwords})) {          } elsif (!ref($domconfig{passwords}) eq 'HASH') {
             if ($staticdefaults{'resetlink'} ne $linklife) {              if ($staticdefaults{'resetlink'} ne $linklife) {
                 $changes{'reset'} = 1;                  $changes{'reset'} = 1;
             }              }
Line 14489  sub modify_passwords { Line 14591  sub modify_passwords {
         if (@diffs > 0) {          if (@diffs > 0) {
             $changes{'reset'} = 1;              $changes{'reset'} = 1;
         }          }
     } elsif (!exists($domconfig{passwords})) {      } elsif (!ref($domconfig{passwords}) eq 'HASH') {
         my @diffs = &Apache::loncommon::compare_arrays($staticdefaults{'resetcase'},\@casesens);          my @diffs = &Apache::loncommon::compare_arrays($staticdefaults{'resetcase'},\@casesens);
         if (@diffs > 0) {          if (@diffs > 0) {
             $changes{'reset'} = 1;              $changes{'reset'} = 1;
Line 14501  sub modify_passwords { Line 14603  sub modify_passwords {
             if ($current{'resetprelink'} ne $newvalues{'resetprelink'}) {              if ($current{'resetprelink'} ne $newvalues{'resetprelink'}) {
                 $changes{'reset'} = 1;                  $changes{'reset'} = 1;
             }              }
         } elsif (!exists($domconfig{passwords})) {          } elsif (!ref($domconfig{passwords}) eq 'HASH') {
             if ($staticdefaults{'resetprelink'} ne $newvalues{'resetprelink'}) {              if ($staticdefaults{'resetprelink'} ne $newvalues{'resetprelink'}) {
                 $changes{'reset'} = 1;                  $changes{'reset'} = 1;
             }              }
Line 14528  sub modify_passwords { Line 14630  sub modify_passwords {
                 } else {                  } else {
                     $changes{'reset'} = 1;                      $changes{'reset'} = 1;
                 }                  }
             } elsif (!exists($domconfig{passwords})) {              } elsif (!ref($domconfig{passwords}) eq 'HASH') {
                 my @diffs = &Apache::loncommon::compare_arrays($staticdefaults{'resetpostlink'}{$type},\@postlink);                  my @diffs = &Apache::loncommon::compare_arrays($staticdefaults{'resetpostlink'}{$type},\@postlink);
                 if (@diffs > 0) {                  if (@diffs > 0) {
                     $changes{'reset'} = 1;                      $changes{'reset'} = 1;
Line 14550  sub modify_passwords { Line 14652  sub modify_passwords {
             if (@diffs > 0) {              if (@diffs > 0) {
                 $changes{'reset'} = 1;                  $changes{'reset'} = 1;
             }              }
         } elsif (!exists($domconfig{passwords})) {          } elsif (!ref($domconfig{passwords}) eq 'HASH') {
             my @diffs = &Apache::loncommon::compare_arrays($staticdefaults{'resetemail'},\@resetemail);              my @diffs = &Apache::loncommon::compare_arrays($staticdefaults{'resetemail'},\@resetemail);
             if (@diffs > 0) {              if (@diffs > 0) {
                 $changes{'reset'} = 1;                  $changes{'reset'} = 1;
Line 14637  sub modify_passwords { Line 14739  sub modify_passwords {
         $env{'form.passwords_'.$rule} =~ s/^\s+|\s+$//g;          $env{'form.passwords_'.$rule} =~ s/^\s+|\s+$//g;
         my $ruleok;          my $ruleok;
         if ($rule eq 'expire') {          if ($rule eq 'expire') {
             if ($env{'form.passwords_'.$rule} =~ /^\d+(|\.\d*)$/) {              if (($env{'form.passwords_'.$rule} =~ /^\d+(|\.\d*)$/) &&
                   ($env{'form.passwords_'.$rule} ne '0')) {
                 $ruleok = 1;                  $ruleok = 1;
             }              }
         } elsif ($env{'form.passwords_'.$rule} =~ /^\d+$/) {          } elsif ($rule eq 'min') {
               if ($env{'form.passwords_'.$rule} =~ /^\d+$/) {
                   if ($env{'form.passwords_'.$rule} >= $Apache::lonnet::passwdmin) {
                       $ruleok = 1;
                   }
               }
           } elsif (($env{'form.passwords_'.$rule} =~ /^\d+$/) &&
                    ($env{'form.passwords_'.$rule} ne '0')) {
             $ruleok = 1;              $ruleok = 1;
         }          }
         if ($ruleok) {          if ($ruleok) {
Line 14701  sub modify_passwords { Line 14811  sub modify_passwords {
                 }                  }
             }              }
         }          }
     } elsif (!exists($domconfig{passwords})) {      } elsif (!(ref($domconfig{passwords}) eq 'HASH')) {
         foreach my $item ('by','for') {          foreach my $item ('by','for') {
             if (@{$crsownerchg{$item}} > 0) {              if (@{$crsownerchg{$item}} > 0) {
                 $changes{'crsownerchg'} = 1;                  $changes{'crsownerchg'} = 1;
Line 14731  sub modify_passwords { Line 14841  sub modify_passwords {
                             $resulttext .= '<li>'.&mt('CAPTCHA validation set to use: original CAPTCHA').'</li>';                              $resulttext .= '<li>'.&mt('CAPTCHA validation set to use: original CAPTCHA').'</li>';
                         } elsif ($confighash{'passwords'}{'captcha'} eq 'recaptcha') {                          } elsif ($confighash{'passwords'}{'captcha'} eq 'recaptcha') {
                             $resulttext .= '<li>'.&mt('CAPTCHA validation set to use: reCAPTCHA').' '.                              $resulttext .= '<li>'.&mt('CAPTCHA validation set to use: reCAPTCHA').' '.
                                            &mt('version: [_1]',$confighash{'passwords'}{'recaptchaversion'}).'<br />'.                                             &mt('version: [_1]',$confighash{'passwords'}{'recaptchaversion'}).'<br />';
                                            &mt('Public key: [_1]',$confighash{'passwords'}{'recaptchapub'}).'</br>'.                              if (ref($confighash{'passwords'}{'recaptchakeys'}) eq 'HASH') {
                                            &mt('Private key: [_1]',$confighash{'passwords'}{'recaptchapriv'}).'</li>';                                  $resulttext .= &mt('Public key: [_1]',$confighash{'passwords'}{'recaptchakeys'}{'public'}).'</br>'.
                                                  &mt('Private key: [_1]',$confighash{'passwords'}{'recaptchakeys'}{'private'}).'</li>';
                               }
                         } else {                          } else {
                             $resulttext .= '<li>'.&mt('No CAPTCHA validation').'</li>';                              $resulttext .= '<li>'.&mt('No CAPTCHA validation').'</li>';
                         }                          }
Line 14812  sub modify_passwords { Line 14924  sub modify_passwords {
                         }                          }
                         if ($confighash{'passwords'}{'resetcustom'}) {                          if ($confighash{'passwords'}{'resetcustom'}) {
                             my $customlink = &Apache::loncommon::modal_link($confighash{'passwords'}{'resetcustom'},                              my $customlink = &Apache::loncommon::modal_link($confighash{'passwords'}{'resetcustom'},
                                                                             $titles{custom},600,500);                                                                              &mt('custom text'),600,500,undef,undef,
                             $resulttext .= '<li>'.&mt('Preamble to "Forgot Password" form includes [_1]',$customlink).'</li>';                                                                              undef,undef,'background-color:#ffffff');
                               $resulttext .= '<li>'.&mt('Preamble to "Forgot Password" form includes: [_1]',$customlink).'</li>';
                         } else {                          } else {
                             $resulttext .= '<li>'.&mt('No custom text included in preamble to "Forgot Password" form').'</li>';                              $resulttext .= '<li>'.&mt('No custom text included in preamble to "Forgot Password" form').'</li>';
                         }                          }
Line 14850  sub modify_passwords { Line 14963  sub modify_passwords {
                             if ($confighash{'passwords'}{$rule} eq '') {                              if ($confighash{'passwords'}{$rule} eq '') {
                                 if ($rule eq 'min') {                                  if ($rule eq 'min') {
                                     $resulttext .= '<li>'.&mt('[_1] not set.',$titles{$rule});                                      $resulttext .= '<li>'.&mt('[_1] not set.',$titles{$rule});
                                                    ' '.&mt('Default of 7 will be used').'</li>';                                                     ' '.&mt('Default of [_1] will be used',
                                                              $Apache::lonnet::passwdmin).'</li>';
                                 } else {                                  } else {
                                     $resulttext .= '<li>'.&mt('[_1] set to none',$titles{$rule}).'</li>';                                      $resulttext .= '<li>'.&mt('[_1] set to none',$titles{$rule}).'</li>';
                                 }                                  }
Line 15997  sub modify_selfcreation { Line 16111  sub modify_selfcreation {
 }  }
   
 sub process_captcha {  sub process_captcha {
     my ($container,$changes,$newsettings,$current) = @_;      my ($container,$changes,$newsettings,$currsettings) = @_;
     return unless ((ref($changes) eq 'HASH') && (ref($newsettings) eq 'HASH') || (ref($current) eq 'HASH'));      return unless ((ref($changes) eq 'HASH') && (ref($newsettings) eq 'HASH'));
     $newsettings->{'captcha'} = $env{'form.'.$container.'_captcha'};      $newsettings->{'captcha'} = $env{'form.'.$container.'_captcha'};
     unless ($newsettings->{'captcha'} eq 'recaptcha' || $newsettings->{'captcha'} eq 'notused') {      unless ($newsettings->{'captcha'} eq 'recaptcha' || $newsettings->{'captcha'} eq 'notused') {
         $newsettings->{'captcha'} = 'original';          $newsettings->{'captcha'} = 'original';
     }      }
     if ($current->{'captcha'} ne $newsettings->{'captcha'}) {      my %current;
       if (ref($currsettings) eq 'HASH') {
           %current = %{$currsettings};
       }
       if ($current{'captcha'} ne $newsettings->{'captcha'}) {
         if ($container eq 'cancreate') {          if ($container eq 'cancreate') {
             if (ref($changes->{'cancreate'}) eq 'ARRAY') {              if (ref($changes->{'cancreate'}) eq 'ARRAY') {
                 push(@{$changes->{'cancreate'}},'captcha');                  push(@{$changes->{'cancreate'}},'captcha');
             } elsif (!defined($changes->{'cancreate'})) {              } elsif (!defined($changes->{'cancreate'})) {
                 $changes->{'cancreate'} = ['captcha'];                  $changes->{'cancreate'} = ['captcha'];
             }              }
           } elsif ($container eq 'passwords') {
               $changes->{'reset'} = 1;
         } else {          } else {
             $changes->{'captcha'} = 1;              $changes->{'captcha'} = 1;
         }          }
Line 16031  sub process_captcha { Line 16151  sub process_captcha {
         }          }
         $newsettings->{'recaptchaversion'} = $newversion;          $newsettings->{'recaptchaversion'} = $newversion;
     }      }
     if (ref($current->{'recaptchakeys'}) eq 'HASH') {      if (ref($current{'recaptchakeys'}) eq 'HASH') {
         $currpub = $current->{'recaptchakeys'}{'public'};          $currpub = $current{'recaptchakeys'}{'public'};
         $currpriv = $current->{'recaptchakeys'}{'private'};          $currpriv = $current{'recaptchakeys'}{'private'};
         unless ($newsettings->{'captcha'} eq 'recaptcha') {          unless ($newsettings->{'captcha'} eq 'recaptcha') {
             $newsettings->{'recaptchakeys'} = {              $newsettings->{'recaptchakeys'} = {
                                                  public  => '',                                                   public  => '',
Line 16041  sub process_captcha { Line 16161  sub process_captcha {
                                               }                                                }
         }          }
     }      }
     if ($current->{'captcha'} eq 'recaptcha') {      if ($current{'captcha'} eq 'recaptcha') {
         $currversion = $current->{'recaptchaversion'};          $currversion = $current{'recaptchaversion'};
         if ($currversion ne '2') {          if ($currversion ne '2') {
             $currversion = 1;              $currversion = 1;
         }          }
Line 16054  sub process_captcha { Line 16174  sub process_captcha {
             } elsif (!defined($changes->{'cancreate'})) {              } elsif (!defined($changes->{'cancreate'})) {
                 $changes->{'cancreate'} = ['recaptchaversion'];                  $changes->{'cancreate'} = ['recaptchaversion'];
             }              }
           } elsif ($container eq 'passwords') {
               $changes->{'reset'} = 1;
         } else {          } else {
             $changes->{'recaptchaversion'} = 1;              $changes->{'recaptchaversion'} = 1;
         }          }
Line 16065  sub process_captcha { Line 16187  sub process_captcha {
             } elsif (!defined($changes->{'cancreate'})) {              } elsif (!defined($changes->{'cancreate'})) {
                 $changes->{'cancreate'} = ['recaptchakeys'];                  $changes->{'cancreate'} = ['recaptchakeys'];
             }              }
           } elsif ($container eq 'passwords') {
               $changes->{'reset'} = 1;
         } else {          } else {
             $changes->{'recaptchakeys'} = 1;              $changes->{'recaptchakeys'} = 1;
         }          }
Line 16860  sub modify_coursecategories { Line 16984  sub modify_coursecategories {
                     }                      }
                     $resulttext .= '</ul></li>';                      $resulttext .= '</ul></li>';
                 }                  }
                   &Apache::lonnet::do_cache_new('cats',$dom,$cathash,3600);
                   if (ref($lastactref) eq 'HASH') {
                       $lastactref->{'cats'} = 1;
                   }
             }              }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';
             if ($changes{'unauth'} || $changes{'auth'}) {              if ($changes{'unauth'} || $changes{'auth'}) {
Line 19640  sub devalidate_remote_domconfs { Line 19768  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','ltitools','usersessions',      my @posscached = ('domainconfig','domdefaults','ltitools','usersessions',
                       'directorysrch','passwdconf');                        'directorysrch','passwdconf','cats');
     if (keys(%servers)) {      if (keys(%servers)) {
         foreach my $server (keys(%servers)) {          foreach my $server (keys(%servers)) {
             next if ($thismachine{$server});              next if ($thismachine{$server});

Removed from v.1.362  
changed lines
  Added in v.1.369


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