[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface domainprefs.pm
raeburn
raeburn at source.lon-capa.org
Sun Sep 18 15:24:15 EDT 2016
raeburn Sun Sep 18 19:24:15 2016 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface domainprefs.pm
Log:
- For 2.11
- Backport 1.277, 1.278
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.160.6.71 loncom/interface/domainprefs.pm:1.160.6.72
--- loncom/interface/domainprefs.pm:1.160.6.71 Sun Sep 18 19:22:48 2016
+++ loncom/interface/domainprefs.pm Sun Sep 18 19:24:14 2016
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.71 2016/09/18 19:22:48 raeburn Exp $
+# $Id: domainprefs.pm,v 1.160.6.72 2016/09/18 19:24:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -304,9 +304,11 @@
modify => \&modify_autocreate,
},
'directorysrch' =>
- { text => 'Institutional directory searches',
+ { text => 'Directory searches',
help => 'Domain_Configuration_InstDirectory_Search',
- header => [{col1 => 'Setting',
+ header => [{col1 => 'Institutional Directory Setting',
+ col2 => 'Value',},
+ {col1 => 'LON-CAPA Directory Setting',
col2 => 'Value',}],
print => \&print_directorysrch,
modify => \&modify_directorysrch,
@@ -656,6 +658,7 @@
my $colspan = '';
my $rightcolspan = '';
if (($action eq 'rolecolors') || ($action eq 'defaults') ||
+ ($action eq 'directorysrch') ||
(($action eq 'login') && ($numheaders < 4))) {
$colspan = ' colspan="2"';
}
@@ -673,7 +676,7 @@
$rowtotal ++;
if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') ||
($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);
} elsif ($action eq 'coursecategories') {
$output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal);
@@ -728,7 +731,7 @@
}
$rowtotal ++;
} elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||
- ($action eq 'defaults')) {
+ ($action eq 'defaults') || ($action eq 'directorysrch')) {
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
} elsif ($action eq 'login') {
if ($numheaders == 4) {
@@ -841,7 +844,7 @@
<td>
<table class="LC_nested">
<tr class="LC_info_row">';
- if (($action eq 'login') || ($action eq 'directorysrch')) {
+ if ($action eq 'login') {
$output .= '
<td class="LC_left_item" colspan="2">'.&mt($item->{'header'}->[0]->{'col1'}).'</td>';
} elsif ($action eq 'serverstatuses') {
@@ -885,8 +888,9 @@
$rowtotal ++;
if ($action eq 'quotas') {
$output .= &print_quotas($dom,$settings,\$rowtotal,$action);
- } elsif (($action eq 'autoenroll') || ($action eq 'autocreate') || ($action eq 'directorysrch') ||
- ($action eq 'contacts') || ($action eq 'serverstatuses') || ($action eq 'loadbalancing')) {
+ } elsif (($action eq 'autoenroll') || ($action eq 'autocreate') ||
+ ($action eq 'contacts') || ($action eq 'serverstatuses') ||
+ ($action eq 'loadbalancing')) {
$output .= $item->{'print'}->($dom,$settings,\$rowtotal);
} elsif ($action eq 'scantron') {
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);
@@ -2604,115 +2608,149 @@
}
sub print_directorysrch {
- my ($dom,$settings,$rowtotal) = @_;
- my $srchon = ' ';
- my $srchoff = ' checked="checked" ';
- my ($exacton,$containson,$beginson);
- my $localon = ' ';
- my $localoff = ' checked="checked" ';
- if (ref($settings) eq 'HASH') {
- if ($settings->{'available'} eq '1') {
- $srchon = $srchoff;
- $srchoff = ' ';
- }
- if ($settings->{'localonly'} eq '1') {
- $localon = $localoff;
- $localoff = ' ';
- }
- if (ref($settings->{'searchtypes'}) eq 'ARRAY') {
- foreach my $type (@{$settings->{'searchtypes'}}) {
- if ($type eq 'exact') {
+ my ($position,$dom,$settings,$rowtotal) = @_;
+ my $datatable;
+ if ($position eq 'top') {
+ my $instsrchon = ' ';
+ my $instsrchoff = ' checked="checked" ';
+ my ($exacton,$containson,$beginson);
+ my $instlocalon = ' ';
+ my $instlocaloff = ' checked="checked" ';
+ if (ref($settings) eq 'HASH') {
+ if ($settings->{'available'} eq '1') {
+ $instsrchon = $instsrchoff;
+ $instsrchoff = ' ';
+ }
+ if ($settings->{'localonly'} eq '1') {
+ $instlocalon = $instlocaloff;
+ $instlocaloff = ' ';
+ }
+ 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" ';
- } 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" ';
- $containson = ' checked="checked" ';
- }
}
- }
- my ($searchtitles,$titleorder) = &sorted_searchtitles();
- my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
+ my ($searchtitles,$titleorder) = &sorted_searchtitles();
+ my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
- my $numinrow = 4;
- my $cansrchrow = 0;
- my $datatable='<tr class="LC_odd_row">'.
- '<td colspan="2"><span class ="LC_nobreak">'.&mt('Directory search available?').'</span></td>'.
- '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
- '<input type="radio" name="dirsrch_available"'.
- $srchon.' value="1" />'.&mt('Yes').'</label> '.
- '<label><input type="radio" name="dirsrch_available"'.
- $srchoff.' value="0" />'.&mt('No').'</label></span></td>'.
- '</tr><tr>'.
- '<td colspan="2"><span class ="LC_nobreak">'.&mt('Other domains can search?').'</span></td>'.
- '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
- '<input type="radio" name="dirsrch_localonly"'.
- $localoff.' value="0" />'.&mt('Yes').'</label> '.
- '<label><input type="radio" name="dirsrch_localonly"'.
- $localon.' value="1" />'.&mt('No').'</label></span></td>'.
- '</tr>';
- $$rowtotal += 2;
- if (ref($usertypes) eq 'HASH') {
- if (keys(%{$usertypes}) > 0) {
- $datatable .= &insttypes_row($settings,$types,$usertypes,$dom,
- $numinrow,$othertitle,'cansearch');
- $cansrchrow = 1;
+ my $numinrow = 4;
+ my $cansrchrow = 0;
+ $datatable='<tr class="LC_odd_row">'.
+ '<td colspan="2"><span class ="LC_nobreak">'.&mt('Institutional directory search available?').'</span></td>'.
+ '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
+ '<input type="radio" name="dirsrch_available"'.
+ $instsrchon.' value="1" />'.&mt('Yes').'</label> '.
+ '<label><input type="radio" name="dirsrch_available"'.
+ $instsrchoff.' value="0" />'.&mt('No').'</label></span></td>'.
+ '</tr><tr>'.
+ '<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>'.
+ '<input type="radio" name="dirsrch_instlocalonly"'.
+ $instlocaloff.' value="0" />'.&mt('Yes').'</label> '.
+ '<label><input type="radio" name="dirsrch_instlocalonly"'.
+ $instlocalon.' value="1" />'.&mt('No').'</label></span></td>'.
+ '</tr>';
+ $$rowtotal += 2;
+ if (ref($usertypes) eq 'HASH') {
+ if (keys(%{$usertypes}) > 0) {
+ $datatable .= &insttypes_row($settings,$types,$usertypes,$dom,
+ $numinrow,$othertitle,'cansearch');
+ $cansrchrow = 1;
+ }
}
- }
- if ($cansrchrow) {
- $$rowtotal ++;
- $datatable .= '<tr>';
- } else {
- $datatable .= '<tr class="LC_odd_row">';
- }
- $datatable .= '<td><span class ="LC_nobreak">'.&mt('Supported search methods').
- '</span></td><td class="LC_left_item" colspan="2"><table><tr>';
- foreach my $title (@{$titleorder}) {
- if (defined($searchtitles->{$title})) {
- my $check = ' ';
- if (ref($settings) eq 'HASH') {
- if (ref($settings->{'searchby'}) eq 'ARRAY') {
- if (grep(/^\Q$title\E$/,@{$settings->{'searchby'}})) {
- $check = ' checked="checked" ';
+ if ($cansrchrow) {
+ $$rowtotal ++;
+ $datatable .= '<tr>';
+ } else {
+ $datatable .= '<tr class="LC_odd_row">';
+ }
+ $datatable .= '<td><span class ="LC_nobreak">'.&mt('Supported search methods').
+ '</span></td><td class="LC_left_item" colspan="2"><table><tr>';
+ foreach my $title (@{$titleorder}) {
+ if (defined($searchtitles->{$title})) {
+ my $check = ' ';
+ if (ref($settings) eq 'HASH') {
+ if (ref($settings->{'searchby'}) eq 'ARRAY') {
+ if (grep(/^\Q$title\E$/,@{$settings->{'searchby'}})) {
+ $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>';
- $$rowtotal ++;
- if ($cansrchrow) {
- $datatable .= '<tr class="LC_odd_row">';
+ $datatable .= '</tr></table></td></tr>';
+ $$rowtotal ++;
+ if ($cansrchrow) {
+ $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> '.
+ '<label><input type="checkbox" name="searchtypes" '.
+ $beginson.' value="begins" />'.&mt('Begins with').
+ '</label> '.
+ '<label><input type="checkbox" name="searchtypes" '.
+ $containson.' value="contains" />'.&mt('Contains').
+ '</label></span></td></tr>';
+ $$rowtotal ++;
} 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> '.
+ '<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> '.
+ '<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> '.
- '<label><input type="checkbox" name="searchtypes" '.
- $beginson.' value="begins" />'.&mt('Begins with').
- '</label> '.
- '<label><input type="checkbox" name="searchtypes" '.
- $containson.' value="contains" />'.&mt('Contains').
- '</label></span></td></tr>';
- $$rowtotal ++;
return $datatable;
}
@@ -8296,8 +8334,10 @@
$currdirsrch{$key} = $domconfig{'directorysrch'}{$key};
}
}
- my %title = ( available => 'Directory search available',
- localonly => 'Other domains can search',
+ my %title = ( available => 'Institutional directory search available',
+ localonly => 'Other domains can search institution',
+ lcavailable => 'LON-CAPA directory search available',
+ lclocalonly => 'Other domains can search LON-CAPA domain',
searchby => 'Search types',
searchtypes => 'Search latitude');
my @offon = ('off','on');
@@ -8371,7 +8411,9 @@
my %dirsrch_hash = (
directorysrch => { available => $env{'form.dirsrch_available'},
cansearch => \@cansearch,
- localonly => $env{'form.dirsrch_localonly'},
+ localonly => $env{'form.dirsrch_instlocalonly'},
+ lclocalonly => $env{'form.dirsrch_domlocalonly'},
+ lcavailable => $env{'form.dirsrch_domavailable'},
searchby => \@searchby,
searchtypes => \@searchtypes,
}
@@ -8388,24 +8430,47 @@
$changes{'available'} = 1;
}
}
- if (exists($currdirsrch{'localonly'})) {
- if ($currdirsrch{'localonly'} ne $env{'form.dirsrch_localonly'}) {
- $changes{'localonly'} = 1;
+ if (exists($currdirsrch{'lcavailable'})) {
+ if ($currdirsrch{'lcavailable'} ne $env{'form.dirsrch_domavailable'}) {
+ $changes{'lcavailable'} = 1;
}
} 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;
}
+ } 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) {
$resulttext = &mt('Changes made:').'<ul>';
if ($changes{'available'}) {
$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'}) {
- $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') {
my $chgtext;
if (ref($usertypes) eq 'HASH') {
@@ -8456,7 +8521,7 @@
}
$resulttext .= '</ul>';
} else {
- $resulttext = &mt('No changes made to institution directory search settings');
+ $resulttext = &mt('No changes made to directory search settings');
}
} else {
$resulttext = '<span class="LC_error">'.
More information about the LON-CAPA-cvs
mailing list