--- loncom/interface/lonsearchcat.pm 2015/06/16 20:24:39 1.346
+++ loncom/interface/lonsearchcat.pm 2020/08/26 00:42:39 1.354
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.346 2015/06/16 20:24:39 damieng Exp $
+# $Id: lonsearchcat.pm,v 1.354 2020/08/26 00:42:39 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -479,14 +479,31 @@ sub setup_basic_search {
.&mt('use related words')
.'';
+ 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 = '';
$adv_search_link = '{'url'});
# Check for priv
- if (($Metadata->{'copyright'} eq 'priv') &&
- (($env{'user.name'} ne $resname) &&
- ($env{'user.domain'} ne $resdom))) {
- return 0;
+ if ($Metadata->{'copyright'} eq 'priv') {
+ unless (($env{'user.name'} eq $resname) &&
+ ($env{'user.domain'} eq $resdom)) {
+ return 0;
+ }
}
# Check for domain
if (($Metadata->{'copyright'} eq 'domain') &&
@@ -2370,8 +2406,6 @@ END
%all_library_servers = (%library_servers,%older_library_servers);
@Servers_to_contact = sort(keys(%all_library_servers));
foreach my $server (@Servers_to_contact) {
- my %possdoms;
- map { $possdoms{$_}=1; } &Apache::lonnet::machine_domains($all_library_servers{$server});
$domains_by_server{$server} =
join(',',sort(&Apache::lonnet::machine_domains($all_library_servers{$server})));
}
@@ -2411,6 +2445,7 @@ END
## Prepare for the big loop.
my $hitcountsum;
my $oldhitcountsum;
+ my $displaycount;
my %matches;
my $server;
my $status;
@@ -2535,8 +2570,10 @@ END
last if ($connection->aborted());
if ($oldhitcountsum < $hitcountsum) {
&update_count_status($r,$hitcountsum);
- if ($hitcountsum <= $env{'form.show'}) {
+ if (($hitcountsum <= $env{'form.show'}) ||
+ (!$displaycount && $hitcountsum)) {
reload_result_frame($r);
+ $displaycount = $hitcountsum;
}
$oldhitcountsum = $hitcountsum;
}
@@ -3332,7 +3369,7 @@ sub detailed_citation_view {
''.$prefix.
''.' '.
''.$values{'title'}."\n".
+ 'target="preview" onclick="openMyModal(this.href, 500, 500, \'yes\');return false;">'.$values{'title'}."\n".
&display_tools($values{'title'}, $jumpurl).
"
\n".
''.$values{'author'}.','.
@@ -3465,7 +3502,7 @@ sub summary_view {
my $link = '
'.&display_url($jumpurl,1).'
';
$result .=
''.$values{'title'}.''.
+ ' target="preview" onclick="openMyModal(this.href, 500, 500, \'yes\');return false;">'.$values{'title'}.''.
&display_tools($values{'title'}, $jumpurl).<
@@ -3511,7 +3548,7 @@ sub compact_view {
}
$jumpurl = &HTML::Entities::encode($jumpurl,'<>&"');
$result.=' '.
- ''.
+ ''.
&HTML::Entities::encode($values{'title'},'<>&"').' '.
&display_tools($values{'title'}, $jumpurl).
$link.' '.$values{'author'}.' ('.$values{'domain'}.')';
@@ -3527,12 +3564,17 @@ sub display_url {
} elsif ($url=~m{^(http://|/uploaded/)}) {
$link=''.$url.'';
} else {
+ # replace the links to open in a new window
+ # (because the search opens in a new window, it gets
+ # confusing when the links open a tab in the
+ # parent window; ideally we should not force windows)
+ my $onclick = " onclick=\"window.open(this.href, '_blank', 'toolbar=1,location=1,menubar=0');return false;\"";
$link=&Apache::lonhtmlcommon::crumbs(
$url,
'preview',
'',
- (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),
- $skiplast).' ';
+ '',
+ $skiplast,$onclick).' ';
}
return $link;
}