--- loncom/interface/lonsearchcat.pm 2023/12/22 20:11:55 1.358 +++ loncom/interface/lonsearchcat.pm 2025/03/19 15:44:44 1.364 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.358 2023/12/22 20:11:55 raeburn Exp $ +# $Id: lonsearchcat.pm,v 1.364 2025/03/19 15:44:44 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -170,12 +170,26 @@ sub handler { ## &Apache::lonhtmlcommon::clear_breadcrumbs(); - my @allowed_searches = ('portfolio'); + my $crumb_text; + my @allowed_searches; + if ($env{'form.catalogmode'} eq 'import') { + $env{'form.area'} = 'res'; + $crumb_text = 'Content Library Search'; + } else { + push(@allowed_searches,'portfolio'); + } if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'}) eq 'F') { push(@allowed_searches,'res'); - } - my $crumb_text = 'Portfolio Search'; + } else { + unless ($env{'form.catalogmode'} eq 'import') { + $env{'form.area'} = 'portfolio'; + $crumb_text = 'Portfolio Search'; + } + } if (@allowed_searches ==2) { + unless (($env{'form.area'} eq 'portfolio') || ($env{'form.area'} eq 'res')) { + delete($env{'form.area'}); + } $crumb_text = 'Portfolio and Content Library Search'; } my $target = '_top'; @@ -192,7 +206,8 @@ sub handler { &Apache::loncommon::inhibit_menu_check(). '&catalogmode='.$env{'form.catalogmode'}. '&launch='.$env{'form.launch'}. - '&mode='.$env{'form.mode'}, + '&mode='.$env{'form.mode'}. + '&area='.$env{'form.area'}, text=>"$crumb_text", target=>$target, bug=>'Searching',}); @@ -308,7 +323,7 @@ END } # if ($env{'form.searchmode'} eq 'advanced') { - my $srchtype = 'Catalog'; + my $srchtype = 'Content Library'; if ($env{'form.area'} eq 'portfolio') { $srchtype = 'Portfolio'; } @@ -317,10 +332,23 @@ END '&phase=disp_adv'. '&catalogmode='.$env{'form.catalogmode'}. '&launch='.$env{'form.launch'}. - '&mode='.$env{'form.mode'}, + '&mode='.$env{'form.mode'}. + '&area='.$env{'form.area'}, text=>"Advanced $srchtype Search", bug=>'Searching',}); - } + } elsif (($env{'form.phase'} eq 'results') || + ($env{'form.phase'} =~ /^(sort|run_search)$/)) { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). + '&phase=disp_adv'. + '&catalogmode='.$env{'form.catalogmode'}. + '&launch='.$env{'form.launch'}. + '&mode='.$env{'form.mode'}. + '&area='.$env{'form.area'}. + '&searchmode='.$env{'form.searchmode'}, + text=>"Search Results", + bug=>'Searching',}); + } ## ## Switch on the phase ## @@ -399,7 +427,7 @@ END } } return OK; -} +} # # The mechanism used to store values away and retrieve them does not @@ -437,6 +465,42 @@ sub hidden_field { return ''.$/; } +sub start_search_tabs { + my $area; + my %lt = &Apache::lonlocal::texthash ( + res => 'Content Library Search', + portfolio => 'Portfolio Search', + ); + my $output = '
'.
- &Apache::lonhtmlcommon::textbox('basicexp',
- $env{'form.basicexp'},50).
- ' '. - ''.&searchhelp().''.' | '.
- ''.
- ''.(' 'x3).$adv_search_link.''.' '. - ''.(' 'x1).$userelatedwords.''.' '. - ''.(' 'x1).$onlysearchdomain.''.' '. - ''.(' 'x1).$inclext.''.' '. - ' | '.
- '
' + $scrout .= '
' .&viewoptions() .'
' .'' @@ -565,9 +632,9 @@ sub setup_basic_search { .'value="'.&mt('Search').'" />' .' ' .$closebutton - .'
'; + .'' .&mt('Internal Error - Bad view selected.') - .'
'."\n"); + .''."\n" + .''.&Apache::loncommon::end_page()); $r->rflush(); return; } @@ -2683,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') { @@ -2694,7 +2815,7 @@ sub display_results { $r->print(''. &mt('Unable to save import results.'). '
'. - ''. + ''. &Apache::loncommon::end_page()); $r->rflush(); return; @@ -2715,7 +2836,7 @@ sub display_results { $r->print(''. &mt('A MySQL error has occurred.'). '
'. - ''. + ''. &Apache::loncommon::end_page()); &Apache::lonnet::logthis("lonmysql was unable to determine the number". " of rows in table ".$table); @@ -2820,17 +2941,18 @@ sub display_results { $env{'form.sortorder'}='asc'; } } - my $sortform = '' - .&mt('Sort by:').' ' + my $sortform = '' + .&mt('Sort by:').' ' .&Apache::loncommon::select_form($env{'form.sortfield'}, - 'sortfield', - \%sort_fields) + 'sortfield', + \%sort_fields,'','','', + 'LC_sortby') .' ' .&Apache::loncommon::select_form($env{'form.sortorder'}, - 'sortorder', - {asc =>&mt('Ascending'), - desc=>&mt('Descending') - }) + 'sortorder', + {asc =>&mt('Ascending'), + desc=>&mt('Descending') + },'','','','LC_sortby') .''; ## ## Display links for 'prev' and 'next' pages (if necessary) and Display Options @@ -2844,15 +2966,15 @@ sub display_results { ); if ($total_results == 0) { - $r->print(''.&mt('There are currently no results.').'
'. - "". + $r->print('