';
+}
+
######################################################################
=pod
@@ -444,19 +517,31 @@ Prints the form for the basic search. S
######################################################################
sub print_basic_search_form {
my ($r,$closebutton,$hidden_fields) = @_;
+ my %lt = &Apache::lonlocal::texthash (
+ res => 'Content Library Search',
+ portfolio => 'Portfolio Search',
+ );
my $result = ($env{'form.catalogmode'} ne 'import');
+ my $area;
my $bread_crumb =
&Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Basic',
$env{'form.catalogmode'} ne 'import');
- my $scrout = &Apache::loncommon::start_page('Content Library').$bread_crumb;
-# Search form for resource space
+ my $scrout = &Apache::loncommon::start_page('Content Library').$bread_crumb.
+ '
'."\n".
+ &start_search_tabs();
if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'}) eq 'F') {
- $scrout .= &setup_basic_search($r,'res',$hidden_fields,$closebutton);
- $scrout .= ' ';
- }
+ if ($env{'form.area'} eq 'portfolio') {
# Search form for accessible portfolio files
- $scrout.= &setup_basic_search($r,'portfolio',$hidden_fields,$closebutton);
- $scrout .= &Apache::loncommon::end_page();
+ $scrout .= &setup_basic_search($r,'portfolio',$hidden_fields,$closebutton);
+ } else {
+# Search form for resource space
+ $scrout .= &setup_basic_search($r,'res',$hidden_fields,$closebutton);
+ }
+ } else {
+# Search form for accessible portfolio files
+ $scrout .= &setup_basic_search($r,'portfolio',$hidden_fields,$closebutton);
+ }
+ $scrout .= &end_search_tabs().&Apache::loncommon::end_page();
$r->print($scrout);
return;
}
@@ -465,7 +550,7 @@ sub setup_basic_search {
my ($r,$area,$hidden_fields,$closebutton) = @_;
# Define interface components
my %lt = &Apache::lonlocal::texthash (
- res => 'LON-CAPA Catalog Search',
+ res => 'Content Library Search',
portfolio => 'Portfolio Search',
);
my ($userelatedwords,$onlysearchdomain,$inclext,$adv_search_link,$scrout);
@@ -479,14 +564,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 = '';
}
#
- $scrout .= '
'.$/;
-# if ($env{'request.course.id'}) {
- $scrout .= '
'.$lt{$area}.'
';
-# } else {
- # No need to tell them they are searching
-# $scrout.= (' 'x2);
-# }
- $scrout.='
'.&Apache::loncommon::end_page());
return;
}
@@ -2219,7 +2383,8 @@ SCRIPT
sub reload_result_frame {
my ($r) = @_;
my $newloc = '/adm/searchcat?phase=results&persistent_db_id='.
- $env{'form.persistent_db_id'};
+ $env{'form.persistent_db_id'}.'&area='.$env{'form.area'}.
+ '&catalogmode='.$env{'form.catalogmode'};
$r->print(<
SCRIPT
# }
@@ -2617,7 +2791,8 @@ sub display_results {
if (!defined($viewfunction)) {
$r->print('
'
.&mt('Internal Error - Bad view selected.')
- .'
'."\n");
+ .''."\n"
+ .'
'.&Apache::loncommon::end_page());
$r->rflush();
return;
}
@@ -2628,7 +2803,8 @@ sub display_results {
##
## Get the catalog controls setup
##
- my $action = "/adm/searchcat?phase=results";
+ my $action = '/adm/searchcat?phase=results&area='.$env{'form.area'}.
+ '&catalogmode='.$env{'form.catalogmode'};
##
## Deal with import by opening the import db file.
if ($env{'form.catalogmode'} eq 'import') {
@@ -2639,7 +2815,7 @@ sub display_results {
$r->print('