[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm
raeburn
lon-capa-cvs-allow@mail.lon-capa.org
Sat, 28 Jul 2007 21:23:53 -0000
raeburn Sat Jul 28 17:23:53 2007 EDT
Modified files:
/loncom/interface domainprefs.pm
Log:
Can set institutional directory searches in the domain to be available only to users with a current role in the domain.
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.23 loncom/interface/domainprefs.pm:1.24
--- loncom/interface/domainprefs.pm:1.23 Wed Jul 25 16:12:26 2007
+++ loncom/interface/domainprefs.pm Sat Jul 28 17:23:53 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.23 2007/07/25 20:12:26 raeburn Exp $
+# $Id: domainprefs.pm,v 1.24 2007/07/28 21:23:53 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -271,7 +271,7 @@
<td>
<table class="LC_nested">
<tr class="LC_info_row">');
- if ($action eq 'login') {
+ if (($action eq 'login') || ($action eq 'directorysrch')) {
$r->print('
<td class="LC_left_item" colspan="2">'.$item->{'header'}->[0]->{'col1'}.'</td>');
} else {
@@ -898,11 +898,17 @@
my $exacton = '';
my $containson = ' checked="checked" ';
my $specifyon = '';
+ 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 ($settings->{'searchtypes'} eq 'exact') {
$exacton = $containson;
$containson = ' ';
@@ -917,14 +923,14 @@
my $numinrow = 4;
my $datatable='<tr class="LC_odd_row">'.
- '<td>'.&mt('Directory search available?').'</td>'.
+ '<td colspan="2">'.&mt('Directory search available?').'</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>'.&mt('Search latitude').'</td>'.
+ '<td colspan="2">'.&mt('Search latitude').'</td>'.
'<td class="LC_right_item"><span class="LC_nobreak"><label>'.
'<input type="radio" name="searchtypes"'.
$exacton.' value="exact" />'.&mt('Exact match only').'</label> '.
@@ -934,8 +940,15 @@
$specifyon.' value="specify" />'.&mt('Specifiable type').
'</label></span></td></tr>'.
'<tr class="LC_odd_row">'.
- '<td>'.&mt('Users permitted to search').
- '</td><td class="LC_left_item"><table>';
+ '<td colspan="2">'.&mt('Other domains can search').'</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><tr>'.
+ '<td>'.&mt('Users allowed to search').' ('.$dom.')'.
+ '</td><td class="LC_left_item" colspan="2"><table>';
for (my $i=0; $i<@{$types}; $i++) {
if (defined($usertypes->{$types->[$i]})) {
my $rem = $i%($numinrow);
@@ -978,9 +991,9 @@
$othertitle.'</label></span></td>'.
'</tr></table></td></tr>';
- $datatable .= '<tr>'.
+ $datatable .= '<tr class="LC_odd_row">'.
'<td>'.&mt('Supported search methods').
- '</td><td class="LC_left_item"><table><tr>';
+ '</td><td class="LC_left_item" colspan="2"><table><tr>';
foreach my $title (@{$titleorder}) {
if (defined($searchtitles->{$title})) {
my $check = ' ';
@@ -1929,10 +1942,11 @@
}
my %title = ( available => 'Directory search available',
cansearch => 'Users permitted to search',
+ localonly => 'Other domains can search',
searchby => 'Search types',
searchtypes => 'Search latitude');
-
my @offon = ('off','on');
+ my @otherdoms = ('Yes','No');
my @cansearch = &Apache::loncommon::get_env_multiple('form.cansearch');
my @searchby = &Apache::loncommon::get_env_multiple('form.searchby');
@@ -1970,6 +1984,7 @@
my %dirsrch_hash = (
directorysrch => { available => $env{'form.dirsrch_available'},
cansearch => \@cansearch,
+ localonly => $env{'form.dirsrch_localonly'},
searchby => \@searchby,
searchtypes => $env{'form.searchtypes'},
}
@@ -1986,6 +2001,15 @@
$changes{'available'} = 1;
}
}
+ if (exists($currdirsrch{'localonly'})) {
+ if ($currdirsrch{'localonly'} ne $env{'form.dirsrch_localonly'}) {
+ $changes{'localonly'} = 1;
+ }
+ } else {
+ if ($env{'form.dirsrch_localonly'} eq '1') {
+ $changes{'localonly'} = 1;
+ }
+ }
if (exists($currdirsrch{'searchtypes'})) {
if ($currdirsrch{'searchtypes'} ne $env{'form.searchtypes'}) {
$changes{'searchtypes'} = 1;
@@ -2000,6 +2024,10 @@
if ($changes{'available'}) {
$resulttext .= '<li>'.&mt("$title{'available'} set to: $offon[$env{'form.dirsrch_available'}]").'</li>';
}
+ if ($changes{'localonly'}) {
+ $resulttext .= '<li>'.&mt("$title{'localonly'} set to: $otherdoms[$env{'form.dirsrch_localonly'}]").'</li>';
+ }
+
if (ref($changes{'cansearch'}) eq 'ARRAY') {
my ($othertitle,$usertypes,$types) = &sorted_inst_types($dom);
my $chgtext;
@@ -2013,7 +2041,7 @@
} else {
$chgtext =~ s/\; $//;
}
- $resulttext .= '<li>'.&mt("$title{'cansearch'} set to: [_1]",$chgtext).'</li>';
+ $resulttext .= '<li>'.&mt("$title{'cansearch'} ([_1]) set to: [_2]",$dom,$chgtext).'</li>';
}
if (ref($changes{'searchby'}) eq 'ARRAY') {
my ($searchtitles,$titleorder) = &sorted_searchtitles();