version 1.362, 2025/03/19 15:18:59
|
version 1.364, 2025/03/19 15:44:44
|
Line 170 sub handler {
|
Line 170 sub handler {
|
## |
## |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&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') { |
if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'}) eq 'F') { |
push(@allowed_searches,'res'); |
push(@allowed_searches,'res'); |
} |
} else { |
my $crumb_text = 'Portfolio Search'; |
unless ($env{'form.catalogmode'} eq 'import') { |
|
$env{'form.area'} = 'portfolio'; |
|
$crumb_text = 'Portfolio Search'; |
|
} |
|
} |
if (@allowed_searches ==2) { |
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'; |
$crumb_text = 'Portfolio and Content Library Search'; |
} |
} |
my $target = '_top'; |
my $target = '_top'; |
Line 192 sub handler {
|
Line 206 sub handler {
|
&Apache::loncommon::inhibit_menu_check(). |
&Apache::loncommon::inhibit_menu_check(). |
'&catalogmode='.$env{'form.catalogmode'}. |
'&catalogmode='.$env{'form.catalogmode'}. |
'&launch='.$env{'form.launch'}. |
'&launch='.$env{'form.launch'}. |
'&mode='.$env{'form.mode'}, |
'&mode='.$env{'form.mode'}. |
|
'&area='.$env{'form.area'}, |
text=>"$crumb_text", |
text=>"$crumb_text", |
target=>$target, |
target=>$target, |
bug=>'Searching',}); |
bug=>'Searching',}); |
Line 317 END
|
Line 332 END
|
'&phase=disp_adv'. |
'&phase=disp_adv'. |
'&catalogmode='.$env{'form.catalogmode'}. |
'&catalogmode='.$env{'form.catalogmode'}. |
'&launch='.$env{'form.launch'}. |
'&launch='.$env{'form.launch'}. |
'&mode='.$env{'form.mode'}, |
'&mode='.$env{'form.mode'}. |
|
'&area='.$env{'form.area'}, |
text=>"Advanced $srchtype Search", |
text=>"Advanced $srchtype Search", |
bug=>'Searching',}); |
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 |
## Switch on the phase |
## |
## |
Line 437 sub hidden_field {
|
Line 465 sub hidden_field {
|
return '<input type="hidden" name="'.$name.'" value="'.$value.'" />'.$/; |
return '<input type="hidden" name="'.$name.'" value="'.$value.'" />'.$/; |
} |
} |
|
|
|
sub start_search_tabs { |
|
my $area; |
|
my %lt = &Apache::lonlocal::texthash ( |
|
res => 'Content Library Search', |
|
portfolio => 'Portfolio Search', |
|
); |
|
my $output = '<ul class="LC_TabContentBigger" id="main">'; |
|
if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'}) eq 'F') { |
|
unless ($env{'form.area'} eq 'portfolio') { |
|
$area = 'res'; |
|
} |
|
$output .= "\n".'<li'.($area eq 'res'?' class="active"':''). |
|
'><a href="/adm/searchcat?area=res&catalogmode='.$env{'form.catalogmode'}.'">'. |
|
'<b> '.$lt{'res'}. |
|
' </b></a></li>'; |
|
unless ($env{'form.catalogmode'}) { |
|
$output .= '<li'.($area ne 'res'?' class="active"':''). |
|
'><a href="/adm/searchcat?area=portfolio"><b> '.$lt{'portfolio'}. |
|
' </b></a></li></ul>'; |
|
} |
|
} else { |
|
$area = 'portfolio'; |
|
$output .= "\n".'<li class="active">'. |
|
'<a href="/adm/searchcat?area=portfolio"><b> '.$lt{'portfolio'}. |
|
' </b></a></li></ul>'; |
|
} |
|
$output .= '<div class="LC_Box" style="clear:both;margin:0;">'. |
|
'<div id="maincoursedoc" style="margin:0 0;padding:0 0;">'. |
|
'<div class="LC_ContentBox" id="mainCourseDocuments" style="display: block;">'; |
|
return $output; |
|
} |
|
|
|
sub end_search_tabs { |
|
return '</div></div></div>'; |
|
} |
|
|
###################################################################### |
###################################################################### |
|
|
=pod |
=pod |
Line 453 Prints the form for the basic search. S
|
Line 517 Prints the form for the basic search. S
|
###################################################################### |
###################################################################### |
sub print_basic_search_form { |
sub print_basic_search_form { |
my ($r,$closebutton,$hidden_fields) = @_; |
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 $result = ($env{'form.catalogmode'} ne 'import'); |
|
my $area; |
my $bread_crumb = |
my $bread_crumb = |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Basic', |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Basic', |
$env{'form.catalogmode'} ne 'import'); |
$env{'form.catalogmode'} ne 'import'); |
my $scrout = &Apache::loncommon::start_page('Content Library').$bread_crumb; |
my $scrout = &Apache::loncommon::start_page('Content Library').$bread_crumb. |
# Search form for resource space |
'<div class="LC_landmark" role="main">'."\n". |
|
&start_search_tabs(); |
if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'}) eq 'F') { |
if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'}) eq 'F') { |
$scrout .= &setup_basic_search($r,'res',$hidden_fields,$closebutton); |
if ($env{'form.area'} eq 'portfolio') { |
$scrout .= '<hr /><br />'; |
|
} |
|
# Search form for accessible portfolio files |
# Search form for accessible portfolio files |
$scrout.= &setup_basic_search($r,'portfolio',$hidden_fields,$closebutton); |
$scrout .= &setup_basic_search($r,'portfolio',$hidden_fields,$closebutton); |
$scrout .= &Apache::loncommon::end_page(); |
} 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); |
$r->print($scrout); |
return; |
return; |
} |
} |
Line 535 sub setup_basic_search {
|
Line 611 sub setup_basic_search {
|
$scrout .= '<input type="hidden" name="area" value="'.$area.'" />'; |
$scrout .= '<input type="hidden" name="area" value="'.$area.'" />'; |
} |
} |
# |
# |
$scrout .= '<div align="center">'.$/; |
$scrout .= '<div class="LC_floatleft">'. |
# if ($env{'request.course.id'}) { |
'<label>'. |
$scrout .= '<h1>'.$lt{$area}.'</h1>'; |
&Apache::lonhtmlcommon::textbox('basicexp', |
# } else { |
$env{'form.basicexp'},50). |
# No need to tell them they are searching |
'<br />'. |
# $scrout.= ('<br />'x2); |
'<span class="LC_fontsize_medium">'.&searchhelp().'</span></label></div>'. |
# } |
'<div class="LC_floatleft" style="text-align: left;">'. |
$scrout.='<table>'. |
'<span class="LC_nobreak">'.(' 'x3).$adv_search_link.'</span>'.'<br />'. |
'<tr><td align="center" valign="top">'. |
'<span class="LC_nobreak">'.(' 'x1).$userelatedwords.'</span>'.'<br />'. |
&Apache::lonhtmlcommon::textbox('basicexp', |
'<span class="LC_nobreak">'.(' 'x1).$onlysearchdomain.'</span>'.'<br />'. |
$env{'form.basicexp'},50). |
'<span class="LC_nobreak">'.(' 'x1).$inclext.'</span>'.'<br />'. |
'<br />'. |
'</div><br clear="both" />'.$/; |
'<span class="LC_fontsize_medium">'.&searchhelp().'</span>'.'</td>'. |
|
'<td>'. |
|
'<span class="LC_nobreak">'.(' 'x3).$adv_search_link.'</span>'.'<br />'. |
|
'<span class="LC_nobreak">'.(' 'x1).$userelatedwords.'</span>'.'<br />'. |
|
'<span class="LC_nobreak">'.(' 'x1).$onlysearchdomain.'</span>'.'<br />'. |
|
'<span class="LC_nobreak">'.(' 'x1).$inclext.'</span>'.'<br />'. |
|
'</td>'. |
|
'</tr>'. |
|
'</table>'.$/; |
|
# |
# |
$scrout .= '<p>' |
$scrout .= '<div><p>' |
.&viewoptions() |
.&viewoptions() |
.'</p>' |
.'</p>' |
.'<p>' |
.'<p>' |
Line 565 sub setup_basic_search {
|
Line 632 sub setup_basic_search {
|
.'value="'.&mt('Search').'" />' |
.'value="'.&mt('Search').'" />' |
.' ' |
.' ' |
.$closebutton |
.$closebutton |
.'</p>'; |
.'</p></div>'; |
# |
# |
$scrout .= '</div>'.'</form>'; |
$scrout .= '</form>'; |
return $scrout; |
return $scrout; |
} |
} |
|
|
Line 617 function additional_metadata() {
|
Line 684 function additional_metadata() {
|
} |
} |
my $scrout= &Apache::loncommon::start_page("Advanced $srchtype Search", |
my $scrout= &Apache::loncommon::start_page("Advanced $srchtype Search", |
$jscript); |
$jscript); |
$scrout .= $bread_crumb.'<div class="LC_landmark" role="main">'."\n"; |
$scrout .= $bread_crumb.'<div class="LC_landmark" role="main">'."\n". |
|
&start_search_tabs(); |
|
|
$scrout .= '<form method="post" action="/adm/searchcat" name="advsearch">' |
$scrout .= '<form method="post" action="/adm/searchcat" name="advsearch">' |
.$hidden_fields |
.$hidden_fields |
Line 919 function additional_metadata() {
|
Line 987 function additional_metadata() {
|
$scrout .= $advanced_buttons |
$scrout .= $advanced_buttons |
.'</form>'; |
.'</form>'; |
|
|
$scrout .= '</div>'.&Apache::loncommon::end_page(); |
$scrout .= &end_search_tabs().'</div>'.&Apache::loncommon::end_page(); |
$r->print($scrout); |
$r->print($scrout); |
return; |
return; |
} |
} |
Line 1301 sub parse_advanced_search {
|
Line 1369 sub parse_advanced_search {
|
} |
} |
if (! $fillflag) { |
if (! $fillflag) { |
&output_blank_field_error($r,$closebutton, |
&output_blank_field_error($r,$closebutton, |
'phase=disp_adv',$hidden_fields); |
'phase=disp_adv&area='.$env{'form.area'}. |
|
'&catalogmode='.$env{'form.catalogmode'}, |
|
$hidden_fields); |
return; |
return; |
} |
} |
# Turn the form input into a SQL-based query |
# Turn the form input into a SQL-based query |
Line 1315 sub parse_advanced_search {
|
Line 1385 sub parse_advanced_search {
|
&process_phrase_input($env{'form.'.$field}, |
&process_phrase_input($env{'form.'.$field}, |
$env{'form.'.$field.'_related'},$field); |
$env{'form.'.$field.'_related'},$field); |
if (defined($error)) { |
if (defined($error)) { |
&output_unparsed_phrase_error($r,$closebutton,'phase=disp_adv', |
&output_unparsed_phrase_error($r,$closebutton, |
|
'phase=disp_adv&area='.$env{'form.area'}. |
|
'&catalogmode='.$env{'form.catalogmode'}. |
$hidden_fields,$field); |
$hidden_fields,$field); |
return; |
return; |
} else { |
} else { |
Line 1599 sub parse_basic_search {
|
Line 1671 sub parse_basic_search {
|
# Check to see if enough of a query is filled in |
# Check to see if enough of a query is filled in |
my $search_string = $env{'form.basicexp'}; |
my $search_string = $env{'form.basicexp'}; |
if (! &filled($search_string)) { |
if (! &filled($search_string)) { |
&output_blank_field_error($r,$closebutton,'phase=disp_basic'); |
&output_blank_field_error($r,$closebutton,'phase=disp_basic'. |
|
'&area='.$env{'form.area'}. |
|
'&catalogmode='.$env{'form.catalogmode'}); |
return OK; |
return OK; |
} |
} |
my $pretty_search_string=$search_string; |
my $pretty_search_string=$search_string; |
Line 1615 sub parse_basic_search {
|
Line 1689 sub parse_basic_search {
|
$env{'form.related'}, |
$env{'form.related'}, |
$searchfield); |
$searchfield); |
if ($error) { |
if ($error) { |
&output_unparsed_phrase_error($r,$closebutton,'phase=disp_basic', |
&output_unparsed_phrase_error($r,$closebutton,'phase=disp_basic'. |
|
'&area='.$env{'form.area'}. |
|
'&catalogmode='.$env{'form.catalogmode'}, |
'','basicexp'); |
'','basicexp'); |
return; |
return; |
} |
} |
Line 2307 SCRIPT
|
Line 2383 SCRIPT
|
sub reload_result_frame { |
sub reload_result_frame { |
my ($r) = @_; |
my ($r) = @_; |
my $newloc = '/adm/searchcat?phase=results&persistent_db_id='. |
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); |
$r->print(<<SCRIPT); |
<script type="text/javascript"> |
<script type="text/javascript"> |
parent.update_results("$newloc"); |
parent.update_results("$newloc"); |
Line 2377 sub revise_button {
|
Line 2454 sub revise_button {
|
my $newloc = '/adm/searchcat'. |
my $newloc = '/adm/searchcat'. |
'?persistent_db_id='.$env{'form.persistent_db_id'}. |
'?persistent_db_id='.$env{'form.persistent_db_id'}. |
'&cleargroupsort=1'. |
'&cleargroupsort=1'. |
'&phase='.$revise_phase; |
'&phase='.$revise_phase. |
|
'&area='.$env{'form.area'}. |
|
'&catalogmode='.$env{'form.catalogmode'}; |
my $result = qq{<input type="button" value="$revisetext" name="revise"} . |
my $result = qq{<input type="button" value="$revisetext" name="revise"} . |
qq{ onclick="parent.location='$newloc';" /> }; |
qq{ onclick="parent.location='$newloc';" /> }; |
return $result; |
return $result; |
Line 2652 END
|
Line 2731 END
|
# if ($env{'form.catalogmode'} ne 'import') { |
# if ($env{'form.catalogmode'} ne 'import') { |
$r->print(<<SCRIPT); |
$r->print(<<SCRIPT); |
<script> |
<script> |
window.location='/adm/searchcat?phase=sort&persistent_db_id=$env{'form.persistent_db_id'}'; |
window.location='/adm/searchcat?phase=sort&area=$env{"form.area"}&catalogmode=$env{"form.catalogmode"}&persistent_db_id=$env{"form.persistent_db_id"}'; |
</script> |
</script> |
SCRIPT |
SCRIPT |
# } |
# } |
Line 2724 sub display_results {
|
Line 2803 sub display_results {
|
## |
## |
## Get the catalog controls setup |
## 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. |
## Deal with import by opening the import db file. |
if ($env{'form.catalogmode'} eq 'import') { |
if ($env{'form.catalogmode'} eq 'import') { |
Line 3289 END
|
Line 3369 END
|
|
|
sub results_link { |
sub results_link { |
my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. |
my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. |
|
"&area=".$env{'form.area'}. |
|
"&catalogmode=".$env{'form.catalogmode'}. |
"&persistent_db_id=".$env{'form.persistent_db_id'}; |
"&persistent_db_id=".$env{'form.persistent_db_id'}; |
my $results_link = $basic_link."&phase=results". |
my $results_link = $basic_link."&phase=results". |
"&pause=1"."&start=1"; |
"&pause=1"."&start=1"; |
Line 3299 sub results_link {
|
Line 3381 sub results_link {
|
###################################################################### |
###################################################################### |
sub print_frames_interface { |
sub print_frames_interface { |
my $r = shift; |
my $r = shift; |
my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. |
my $basic_link = "/adm/searchcat?table=".$env{'form.table'}. |
|
"&area=".$env{'form.area'}. |
|
"&catalogmode=".$env{'form.catalogmode'}. |
"&persistent_db_id=".$env{'form.persistent_db_id'}; |
"&persistent_db_id=".$env{'form.persistent_db_id'}; |
my $run_search_link = $basic_link."&phase=run_search"; |
my $run_search_link = $basic_link."&phase=run_search"; |
my $results_link = &results_link(); |
my $results_link = &results_link(); |