Diff for /loncom/interface/domainprefs.pm between versions 1.160.6.71 and 1.160.6.72

version 1.160.6.71, 2016/09/18 19:22:48 version 1.160.6.72, 2016/09/18 19:24:14
Line 304  sub handler { Line 304  sub handler {
                      modify => \&modify_autocreate,                       modify => \&modify_autocreate,
                   },                    },
         'directorysrch' =>           'directorysrch' => 
                   { text => 'Institutional directory searches',                    { text => 'Directory searches',
                     help => 'Domain_Configuration_InstDirectory_Search',                      help => 'Domain_Configuration_InstDirectory_Search',
                     header => [{col1 => 'Setting',                      header => [{col1 => 'Institutional Directory Setting',
                                   col2 => 'Value',},
                                  {col1 => 'LON-CAPA Directory Setting',
                                 col2 => 'Value',}],                                  col2 => 'Value',}],
                     print => \&print_directorysrch,                      print => \&print_directorysrch,
                     modify => \&modify_directorysrch,                      modify => \&modify_directorysrch,
Line 656  sub print_config_box { Line 658  sub print_config_box {
         my $colspan = '';          my $colspan = '';
         my $rightcolspan = '';          my $rightcolspan = '';
         if (($action eq 'rolecolors') || ($action eq 'defaults') ||          if (($action eq 'rolecolors') || ($action eq 'defaults') ||
               ($action eq 'directorysrch') ||
             (($action eq 'login') && ($numheaders < 4))) {              (($action eq 'login') && ($numheaders < 4))) {
             $colspan = ' colspan="2"';              $colspan = ' colspan="2"';
         }          }
Line 673  sub print_config_box { Line 676  sub print_config_box {
         $rowtotal ++;          $rowtotal ++;
         if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') ||          if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') ||
             ($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') ||              ($action eq 'usermodification') || ($action eq 'defaults') || ($action eq 'coursedefaults') ||
             ($action eq 'selfenrollment') || ($action eq 'usersessions')) {              ($action eq 'selfenrollment') || ($action eq 'usersessions') || ($action eq 'directorysrch')) {
             $output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal);              $output .= $item->{'print'}->('top',$dom,$settings,\$rowtotal);
         } elsif ($action eq 'coursecategories') {          } elsif ($action eq 'coursecategories') {
             $output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal);              $output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal);
Line 728  sub print_config_box { Line 731  sub print_config_box {
             }              }
             $rowtotal ++;              $rowtotal ++;
         } elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||          } elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||
                   ($action eq 'defaults')) {                    ($action eq 'defaults') || ($action eq 'directorysrch')) {
             $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);              $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
         } elsif ($action eq 'login') {          } elsif ($action eq 'login') {
             if ($numheaders == 4) {              if ($numheaders == 4) {
Line 841  sub print_config_box { Line 844  sub print_config_box {
            <td>             <td>
             <table class="LC_nested">              <table class="LC_nested">
              <tr class="LC_info_row">';               <tr class="LC_info_row">';
         if (($action eq 'login') || ($action eq 'directorysrch')) {          if ($action eq 'login') {
             $output .= '                $output .= '  
               <td class="LC_left_item" colspan="2">'.&mt($item->{'header'}->[0]->{'col1'}).'</td>';                <td class="LC_left_item" colspan="2">'.&mt($item->{'header'}->[0]->{'col1'}).'</td>';
         } elsif ($action eq 'serverstatuses') {          } elsif ($action eq 'serverstatuses') {
Line 885  sub print_config_box { Line 888  sub print_config_box {
         $rowtotal ++;          $rowtotal ++;
         if ($action eq 'quotas') {          if ($action eq 'quotas') {
             $output .= &print_quotas($dom,$settings,\$rowtotal,$action);              $output .= &print_quotas($dom,$settings,\$rowtotal,$action);
         } elsif (($action eq 'autoenroll') || ($action eq 'autocreate') || ($action eq 'directorysrch') ||          } elsif (($action eq 'autoenroll') || ($action eq 'autocreate') || 
                  ($action eq 'contacts') || ($action eq 'serverstatuses') || ($action eq 'loadbalancing')) {                   ($action eq 'contacts') || ($action eq 'serverstatuses') ||
                    ($action eq 'loadbalancing')) {
             $output .= $item->{'print'}->($dom,$settings,\$rowtotal);              $output .= $item->{'print'}->($dom,$settings,\$rowtotal);
         } elsif ($action eq 'scantron') {          } elsif ($action eq 'scantron') {
             $output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);              $output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);
Line 2604  sub print_autocreate { Line 2608  sub print_autocreate {
 }  }
   
 sub print_directorysrch {  sub print_directorysrch {
     my ($dom,$settings,$rowtotal) = @_;      my ($position,$dom,$settings,$rowtotal) = @_;
     my $srchon = ' ';      my $datatable;
     my $srchoff = ' checked="checked" ';      if ($position eq 'top') {
     my ($exacton,$containson,$beginson);          my $instsrchon = ' ';
     my $localon = ' ';          my $instsrchoff = ' checked="checked" ';
     my $localoff = ' checked="checked" ';          my ($exacton,$containson,$beginson);
     if (ref($settings) eq 'HASH') {          my $instlocalon = ' ';
         if ($settings->{'available'} eq '1') {          my $instlocaloff = ' checked="checked" ';
             $srchon = $srchoff;          if (ref($settings) eq 'HASH') {
             $srchoff = ' ';              if ($settings->{'available'} eq '1') {
         }                  $instsrchon = $instsrchoff;
         if ($settings->{'localonly'} eq '1') {                  $instsrchoff = ' ';
             $localon = $localoff;              }
             $localoff = ' ';              if ($settings->{'localonly'} eq '1') {
         }                  $instlocalon = $instlocaloff;
         if (ref($settings->{'searchtypes'}) eq 'ARRAY') {                  $instlocaloff = ' ';
             foreach my $type (@{$settings->{'searchtypes'}}) {              }
                 if ($type eq 'exact') {              if (ref($settings->{'searchtypes'}) eq 'ARRAY') {
                   foreach my $type (@{$settings->{'searchtypes'}}) {
                       if ($type eq 'exact') {
                           $exacton = ' checked="checked" ';
                       } elsif ($type eq 'contains') {
                           $containson = ' checked="checked" ';
                       } elsif ($type eq 'begins') {
                           $beginson = ' checked="checked" ';
                       }
                   }
               } else {
                   if ($settings->{'searchtypes'} eq 'exact') {
                       $exacton = ' checked="checked" ';
                   } elsif ($settings->{'searchtypes'} eq 'contains') {
                       $containson = ' checked="checked" ';
                   } elsif ($settings->{'searchtypes'} eq 'specify') {
                     $exacton = ' checked="checked" ';                      $exacton = ' checked="checked" ';
                 } elsif ($type eq 'contains') {  
                     $containson = ' checked="checked" ';                      $containson = ' checked="checked" ';
                 } elsif ($type eq 'begins') {  
                     $beginson = ' checked="checked" ';  
                 }                  }
             }              }
         } else {  
             if ($settings->{'searchtypes'} eq 'exact') {  
                 $exacton = ' checked="checked" ';  
             } elsif ($settings->{'searchtypes'} eq 'contains') {  
                 $containson = ' checked="checked" ';  
             } elsif ($settings->{'searchtypes'} eq 'specify') {  
                 $exacton = ' checked="checked" ';  
                 $containson = ' checked="checked" ';  
             }  
         }          }
     }          my ($searchtitles,$titleorder) = &sorted_searchtitles();
     my ($searchtitles,$titleorder) = &sorted_searchtitles();          my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
     my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);  
   
     my $numinrow = 4;          my $numinrow = 4;
     my $cansrchrow = 0;          my $cansrchrow = 0;
     my $datatable='<tr class="LC_odd_row">'.          $datatable='<tr class="LC_odd_row">'.
                   '<td colspan="2"><span class ="LC_nobreak">'.&mt('Directory search available?').'</span></td>'.                     '<td colspan="2"><span class ="LC_nobreak">'.&mt('Institutional directory search available?').'</span></td>'.
                   '<td class="LC_right_item"><span class="LC_nobreak"><label>'.                     '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
                   '<input type="radio" name="dirsrch_available"'.                     '<input type="radio" name="dirsrch_available"'.
                   $srchon.' value="1" />'.&mt('Yes').'</label>&nbsp;'.                     $instsrchon.' value="1" />'.&mt('Yes').'</label>&nbsp;'.
                   '<label><input type="radio" name="dirsrch_available"'.                     '<label><input type="radio" name="dirsrch_available"'.
                   $srchoff.' value="0" />'.&mt('No').'</label></span></td>'.                     $instsrchoff.' value="0" />'.&mt('No').'</label></span></td>'.
                   '</tr><tr>'.                     '</tr><tr>'.
                   '<td colspan="2"><span class ="LC_nobreak">'.&mt('Other domains can search?').'</span></td>'.                     '<td colspan="2"><span class ="LC_nobreak">'.&mt('Other domains can search institution?').'</span></td>'.
                   '<td class="LC_right_item"><span class="LC_nobreak"><label>'.                     '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
                   '<input type="radio" name="dirsrch_localonly"'.                     '<input type="radio" name="dirsrch_instlocalonly"'.
                   $localoff.' value="0" />'.&mt('Yes').'</label>&nbsp;'.                     $instlocaloff.' value="0" />'.&mt('Yes').'</label>&nbsp;'.
                   '<label><input type="radio" name="dirsrch_localonly"'.                     '<label><input type="radio" name="dirsrch_instlocalonly"'.
                   $localon.' value="1" />'.&mt('No').'</label></span></td>'.                     $instlocalon.' value="1" />'.&mt('No').'</label></span></td>'.
                   '</tr>';                     '</tr>';
     $$rowtotal += 2;          $$rowtotal += 2;
     if (ref($usertypes) eq 'HASH') {          if (ref($usertypes) eq 'HASH') {
         if (keys(%{$usertypes}) > 0) {              if (keys(%{$usertypes}) > 0) {
             $datatable .= &insttypes_row($settings,$types,$usertypes,$dom,                  $datatable .= &insttypes_row($settings,$types,$usertypes,$dom,
                                          $numinrow,$othertitle,'cansearch');                                               $numinrow,$othertitle,'cansearch');
             $cansrchrow = 1;                  $cansrchrow = 1;
               }
         }          }
     }          if ($cansrchrow) {
     if ($cansrchrow) {              $$rowtotal ++;
         $$rowtotal ++;              $datatable .= '<tr>';
         $datatable .= '<tr>';          } else {
     } else {              $datatable .= '<tr class="LC_odd_row">';
         $datatable .= '<tr class="LC_odd_row">';          }
     }          $datatable .= '<td><span class ="LC_nobreak">'.&mt('Supported search methods').
     $datatable .= '<td><span class ="LC_nobreak">'.&mt('Supported search methods').                        '</span></td><td class="LC_left_item" colspan="2"><table><tr>';
                   '</span></td><td class="LC_left_item" colspan="2"><table><tr>';          foreach my $title (@{$titleorder}) {
     foreach my $title (@{$titleorder}) {              if (defined($searchtitles->{$title})) {
         if (defined($searchtitles->{$title})) {                  my $check = ' ';
             my $check = ' ';                  if (ref($settings) eq 'HASH') {
             if (ref($settings) eq 'HASH') {                      if (ref($settings->{'searchby'}) eq 'ARRAY') {
                 if (ref($settings->{'searchby'}) eq 'ARRAY') {                          if (grep(/^\Q$title\E$/,@{$settings->{'searchby'}})) {
                     if (grep(/^\Q$title\E$/,@{$settings->{'searchby'}})) {                              $check = ' checked="checked" ';
                         $check = ' checked="checked" ';                          }
                     }                      }
                 }                  }
                   $datatable .= '<td class="LC_left_item">'.
                                 '<span class="LC_nobreak"><label>'.
                                 '<input type="checkbox" name="searchby" '.
                                 'value="'.$title.'"'.$check.'/>'.
                                 $searchtitles->{$title}.'</label></span></td>';
             }              }
             $datatable .= '<td class="LC_left_item">'.  
                           '<span class="LC_nobreak"><label>'.  
                           '<input type="checkbox" name="searchby" '.  
                           'value="'.$title.'"'.$check.'/>'.  
                           $searchtitles->{$title}.'</label></span></td>';  
         }          }
     }          $datatable .= '</tr></table></td></tr>';
     $datatable .= '</tr></table></td></tr>';          $$rowtotal ++;
     $$rowtotal ++;          if ($cansrchrow) {
     if ($cansrchrow) {              $datatable .= '<tr class="LC_odd_row">';
         $datatable .= '<tr class="LC_odd_row">';          } else {
               $datatable .= '<tr>';
           }
           $datatable .= '<td><span class ="LC_nobreak">'.&mt('Search latitude').'</span></td>'.   
                         '<td class="LC_left_item" colspan="2">'.
                         '<span class="LC_nobreak"><label>'.
                         '<input type="checkbox" name="searchtypes" '.
                         $exacton.' value="exact" />'.&mt('Exact match').
                         '</label>&nbsp;'.
                         '<label><input type="checkbox" name="searchtypes" '.
                         $beginson.' value="begins" />'.&mt('Begins with').
                         '</label>&nbsp;'.
                         '<label><input type="checkbox" name="searchtypes" '.
                         $containson.' value="contains" />'.&mt('Contains').
                         '</label></span></td></tr>';
           $$rowtotal ++;
     } else {      } else {
         $datatable .= '<tr>';          my $domsrchon = ' checked="checked" ';
           my $domsrchoff = ' ';
           my $domlocalon = ' ';
           my $domlocaloff = ' checked="checked" ';
           if (ref($settings) eq 'HASH') {
               if ($settings->{'lclocalonly'} eq '1') {
                   $domlocalon = $domlocaloff;
                   $domlocaloff = ' ';
               }
               if ($settings->{'lcavailable'} eq '0') {
                   $domsrchoff = $domsrchon;
                   $domsrchon = ' ';
               }
           }
           $datatable='<tr class="LC_odd_row">'.
                         '<td colspan="2"><span class ="LC_nobreak">'.&mt('LON-CAPA directory search available?').'</span></td>'.
                         '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
                         '<input type="radio" name="dirsrch_domavailable"'.
                         $domsrchon.' value="1" />'.&mt('Yes').'</label>&nbsp;'.
                         '<label><input type="radio" name="dirsrch_domavailable"'.
                         $domsrchoff.' value="0" />'.&mt('No').'</label></span></td>'.
                         '</tr><tr>'.
                         '<td colspan="2"><span class ="LC_nobreak">'.&mt('Other domains can search LON-CAPA domain?').'</span></td>'.
                         '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
                         '<input type="radio" name="dirsrch_domlocalonly"'.
                         $domlocaloff.' value="0" />'.&mt('Yes').'</label>&nbsp;'.
                         '<label><input type="radio" name="dirsrch_domlocalonly"'.
                         $domlocalon.' value="1" />'.&mt('No').'</label></span></td>'.
                         '</tr>';
           $$rowtotal += 2;
     }      }
     $datatable .= '<td><span class ="LC_nobreak">'.&mt('Search latitude').'</span></td>'.     
                   '<td class="LC_left_item" colspan="2">'.  
                   '<span class="LC_nobreak"><label>'.  
                   '<input type="checkbox" name="searchtypes" '.  
                   $exacton.' value="exact" />'.&mt('Exact match').  
                   '</label>&nbsp;'.  
                   '<label><input type="checkbox" name="searchtypes" '.  
                   $beginson.' value="begins" />'.&mt('Begins with').  
                   '</label>&nbsp;'.  
                   '<label><input type="checkbox" name="searchtypes" '.  
                   $containson.' value="contains" />'.&mt('Contains').  
                   '</label></span></td></tr>';  
     $$rowtotal ++;  
     return $datatable;      return $datatable;
 }  }
   
Line 8296  sub modify_directorysrch { Line 8334  sub modify_directorysrch {
             $currdirsrch{$key} = $domconfig{'directorysrch'}{$key};              $currdirsrch{$key} = $domconfig{'directorysrch'}{$key};
         }          }
     }      }
     my %title = ( available => 'Directory search available',      my %title = ( available => 'Institutional directory search available',
                   localonly => 'Other domains can search',                    localonly => 'Other domains can search institution',
                     lcavailable => 'LON-CAPA directory search available',
                     lclocalonly => 'Other domains can search LON-CAPA domain',
                   searchby => 'Search types',                    searchby => 'Search types',
                   searchtypes => 'Search latitude');                    searchtypes => 'Search latitude');
     my @offon = ('off','on');      my @offon = ('off','on');
Line 8371  sub modify_directorysrch { Line 8411  sub modify_directorysrch {
     my %dirsrch_hash =  (      my %dirsrch_hash =  (
             directorysrch => { available => $env{'form.dirsrch_available'},              directorysrch => { available => $env{'form.dirsrch_available'},
                                cansearch => \@cansearch,                                 cansearch => \@cansearch,
                                localonly => $env{'form.dirsrch_localonly'},                                 localonly => $env{'form.dirsrch_instlocalonly'},
                                  lclocalonly => $env{'form.dirsrch_domlocalonly'},
                                  lcavailable => $env{'form.dirsrch_domavailable'},
                                searchby => \@searchby,                                 searchby => \@searchby,
                                searchtypes => \@searchtypes,                                 searchtypes => \@searchtypes,
                              }                               }
Line 8388  sub modify_directorysrch { Line 8430  sub modify_directorysrch {
                 $changes{'available'} = 1;                  $changes{'available'} = 1;
             }              }
         }          }
         if (exists($currdirsrch{'localonly'})) {          if (exists($currdirsrch{'lcavailable'})) {
              if ($currdirsrch{'localonly'} ne $env{'form.dirsrch_localonly'}) {               if ($currdirsrch{'lcavailable'} ne $env{'form.dirsrch_domavailable'}) {
                  $changes{'localonly'} = 1;                   $changes{'lcavailable'} = 1;
              }               }
         } else {          } else {
             if ($env{'form.dirsrch_localonly'} eq '1') {              if ($env{'form.dirsrch_lcavailable'} eq '1') {
                   $changes{'lcavailable'} = 1;
               }
           }
           if (exists($currdirsrch{'localonly'})) {
               if ($currdirsrch{'localonly'} ne $env{'form.dirsrch_instlocalonly'}) {
                 $changes{'localonly'} = 1;                  $changes{'localonly'} = 1;
             }              }
           } else {
               if ($env{'form.dirsrch_instlocalonly'} eq '1') {
                   $changes{'localonly'} = 1;
               }
           }
           if (exists($currdirsrch{'lclocalonly'})) {
               if ($currdirsrch{'lclocalonly'} ne $env{'form.dirsrch_domlocalonly'}) {
                   $changes{'lclocalonly'} = 1;
               }
           } else {
               if ($env{'form.dirsrch_domlocalonly'} eq '1') {
                   $changes{'lclocalonly'} = 1;
               }
         }          }
         if (keys(%changes) > 0) {          if (keys(%changes) > 0) {
             $resulttext = &mt('Changes made:').'<ul>';              $resulttext = &mt('Changes made:').'<ul>';
             if ($changes{'available'}) {              if ($changes{'available'}) {
                 $resulttext .= '<li>'.&mt("$title{'available'} set to: $offon[$env{'form.dirsrch_available'}]").'</li>';                  $resulttext .= '<li>'.&mt("$title{'available'} set to: $offon[$env{'form.dirsrch_available'}]").'</li>';
             }              }
               if ($changes{'lcavailable'}) {
                   $resulttext .= '<li>'.&mt("$title{'lcavailable'} set to: $offon[$env{'form.dirsrch_domavailable'}]").'</li>';
               }
             if ($changes{'localonly'}) {              if ($changes{'localonly'}) {
                 $resulttext .= '<li>'.&mt("$title{'localonly'} set to: $otherdoms[$env{'form.dirsrch_localonly'}]").'</li>';                  $resulttext .= '<li>'.&mt("$title{'localonly'} set to: $otherdoms[$env{'form.dirsrch_instlocalonly'}]").'</li>';
               }
               if ($changes{'lclocalonly'}) {
                   $resulttext .= '<li>'.&mt("$title{'lclocalonly'} set to: $otherdoms[$env{'form.dirsrch_domlocalonly'}]").'</li>';
             }              }
   
             if (ref($changes{'cansearch'}) eq 'ARRAY') {              if (ref($changes{'cansearch'}) eq 'ARRAY') {
                 my $chgtext;                  my $chgtext;
                 if (ref($usertypes) eq 'HASH') {                  if (ref($usertypes) eq 'HASH') {
Line 8456  sub modify_directorysrch { Line 8521  sub modify_directorysrch {
             }              }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';
         } else {          } else {
             $resulttext = &mt('No changes made to institution directory search settings');              $resulttext = &mt('No changes made to directory search settings');
         }          }
     } else {      } else {
         $resulttext = '<span class="LC_error">'.          $resulttext = '<span class="LC_error">'.

Removed from v.1.160.6.71  
changed lines
  Added in v.1.160.6.72


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