[LON-CAPA-cvs] cvs: loncom /interface lonsearchcat.pm
raeburn
raeburn at source.lon-capa.org
Tue Nov 8 20:11:04 EST 2016
raeburn Wed Nov 9 01:11:04 2016 EDT
Modified files:
/loncom/interface lonsearchcat.pm
Log:
- If user has domain-level bre priv, but not system-level bre priv,
both basic search and advanced search are restricted to user's domain.
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.349 loncom/interface/lonsearchcat.pm:1.350
--- loncom/interface/lonsearchcat.pm:1.349 Thu Aug 4 20:59:22 2016
+++ loncom/interface/lonsearchcat.pm Wed Nov 9 01:11:04 2016
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.349 2016/08/04 20:59:22 raeburn Exp $
+# $Id: lonsearchcat.pm,v 1.350 2016/11/09 01:11:04 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -479,14 +479,31 @@
.&mt('use related words')
.'</label>';
+ my $anydom = 1;
+ if ($area eq 'res') {
+ unless (&Apache::lonnet::allowed('bre','/res/') eq 'F') {
+ $anydom = 0;
+ }
+ }
+ my $singledom;
+ my ($disabled,$checked);
+ if ($anydom) {
+ $singledom = $r->dir_config('lonDefDomain');
+ if ($env{'form.domains'} eq $singledom) {
+ $checked = 1;
+ }
+ } else {
+ $singledom = $env{'user.domain'};
+ $disabled = ' disabled="disabled"';
+ $checked = 1;
+ }
$onlysearchdomain = '<label>'
.&Apache::lonhtmlcommon::checkbox(
- 'domains',
- $env{'form.domains'},
- $r->dir_config('lonDefDomain'))
+ 'domains',$checked,
+ $singledom,$disabled)
.' '
.&mt('only search domain [_1]'
- ,'<b>'.$r->dir_config('lonDefDomain').'</b>')
+ ,'<b>'.$singledom.'</b>')
.'</label>';
$adv_search_link = '<a href="/adm/searchcat?'.
@@ -661,10 +678,22 @@
$env{'form.category'})
.&Apache::lonhtmlcommon::row_closure();
- $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt('Domains')))
- .&Apache::loncommon::domain_select('domains',
- $env{'form.domains'},1)
- .&Apache::lonhtmlcommon::row_closure();
+ my $anydomain = 1;
+ if ($env{'form.area'} ne 'portfolio') {
+ unless (&Apache::lonnet::allowed('bre','/res/')) {
+ $anydomain = 0;
+ }
+ }
+
+ $scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt('Domains')));
+ if ($anydomain) {
+ $scrout .= &Apache::loncommon::domain_select('domains',
+ $env{'form.domains'},1);
+ } else {
+ $scrout .= &Apache::loncommon::select_dom_form($env{'user.domain'},
+ 'domains','','','',[$env{'user.domain'}],'',1);
+ }
+ $scrout .= &Apache::lonhtmlcommon::row_closure();
# Misc metadata
if ($env{'form.area'} ne 'portfolio') {
More information about the LON-CAPA-cvs
mailing list