[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lonsearchcat.pm
raeburn
raeburn at source.lon-capa.org
Thu Aug 10 20:32:07 EDT 2017
raeburn Fri Aug 11 00:32:07 2017 EDT
Modified files:
/loncom/interface loncommon.pm lonsearchcat.pm
Log:
- Trust settings
loncommon::domain_select() can take optional args -- refs to arrays of
included domains, or excluded domains; used to populate drop-down list
for domains in Advanced search interface.
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1288 loncom/interface/loncommon.pm:1.1289
--- loncom/interface/loncommon.pm:1.1288 Fri Aug 11 00:24:52 2017
+++ loncom/interface/loncommon.pm Fri Aug 11 00:32:07 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.1288 2017/08/11 00:24:52 raeburn Exp $
+# $Id: loncommon.pm,v 1.1289 2017/08/11 00:32:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2477,10 +2477,24 @@
# ------------------------------------------
sub domain_select {
- my ($name,$value,$multiple)=@_;
+ my ($name,$value,$multiple,$incdoms,$excdoms)=@_;
+ my @possdoms;
+ if (ref($incdoms) eq 'ARRAY') {
+ @possdoms = @{$incdoms};
+ } else {
+ @possdoms = &Apache::lonnet::all_domains();
+ }
+
my %domains=map {
$_ => $_.' '. &Apache::lonnet::domain($_,'description')
- } &Apache::lonnet::all_domains();
+ } @possdoms;
+
+ if ((ref($excdoms) eq 'ARRAY') && (@{$excdoms} > 0)) {
+ foreach my $dom (@{$excdoms}) {
+ delete($domains{$dom});
+ }
+ }
+
if ($multiple) {
$domains{''}=&mt('Any domain');
$domains{'select_form_order'} = [sort {lc($a) cmp lc($b) } (keys(%domains))];
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.352 loncom/interface/lonsearchcat.pm:1.353
--- loncom/interface/lonsearchcat.pm:1.352 Thu Aug 10 22:49:01 2017
+++ loncom/interface/lonsearchcat.pm Fri Aug 11 00:32:07 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.352 2017/08/10 22:49:01 raeburn Exp $
+# $Id: lonsearchcat.pm,v 1.353 2017/08/11 00:32:07 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -687,8 +687,10 @@
$scrout .= &Apache::lonhtmlcommon::row_title(&titlefield(&mt('Domains')));
if ($anydomain) {
+ my $defdom = &Apache::lonnet::default_login_domain();
+ my ($trusted,$untrusted) = &Apache::lonnet::trusted_domains('shared',$defdom);
$scrout .= &Apache::loncommon::domain_select('domains',
- $env{'form.domains'},1);
+ $env{'form.domains'},1,$trusted,$untrusted);
} else {
$scrout .= &Apache::loncommon::select_dom_form($env{'user.domain'},
'domains','','','',[$env{'user.domain'}],'',1);
More information about the LON-CAPA-cvs
mailing list