version 1.276, 2006/09/26 15:24:18
|
version 1.278, 2006/12/06 22:22:37
|
Line 78 use HTML::Entities();
|
Line 78 use HTML::Entities();
|
use Parse::RecDescent; |
use Parse::RecDescent; |
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
use Apache::lonindexer(); |
use Apache::lonindexer(); |
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
use LONCAPA; |
|
|
###################################################################### |
###################################################################### |
Line 171 sub handler {
|
Line 170 sub handler {
|
'_'.$env{'form.persistent_db_id'}.'_persistent_search.db'; |
'_'.$env{'form.persistent_db_id'}.'_persistent_search.db'; |
## |
## |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
|
|
my @allowed_searches = ('portfolio'); |
|
if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'})) { |
|
push(@allowed_searches,'res'); |
|
} |
if (exists($env{'request.course.id'}) && $env{'request.course.id'} ne '') { |
if (exists($env{'request.course.id'}) && $env{'request.course.id'} ne '') { |
&Apache::lonhtmlcommon::add_breadcrumb |
push(@allowed_searches,'course'); |
({href=>'/adm/searchcat?'. |
} |
'catalogmode='.$env{'form.catalogmode'}. |
my $crumb_text = 'Portfolio Search'; |
'&launch='.$env{'form.launch'}. |
if (@allowed_searches == 3) { |
'&mode='.$env{'form.mode'}, |
$crumb_text = 'Course, Portfolio and Catalog Search'; |
text=>"Course and Catalog Search", |
} elsif (@allowed_searches ==2) { |
target=>'_top', |
if (grep(/^res$/,@allowed_searches)) { |
bug=>'Searching',}); |
$crumb_text = 'Portfolio and Catalog Search'; |
} else { |
} elsif (grep(/^course$/,@allowed_searches)) { |
&Apache::lonhtmlcommon::add_breadcrumb |
$crumb_text = 'Portfolio and Course Search'; |
({href=>'/adm/searchcat?'. |
} |
'catalogmode='.$env{'form.catalogmode'}. |
} |
'&launch='.$env{'form.launch'}. |
&Apache::lonhtmlcommon::add_breadcrumb |
'&mode='.$env{'form.mode'}, |
({href=>'/adm/searchcat?'. |
text=>"Catalog Search", |
'catalogmode='.$env{'form.catalogmode'}. |
|
'&launch='.$env{'form.launch'}. |
|
'&mode='.$env{'form.mode'}, |
|
text=>"$crumb_text", |
target=>'_top', |
target=>'_top', |
bug=>'Searching',}); |
bug=>'Searching',}); |
} |
|
# |
# |
if ($env{'form.phase'} !~ m/(basic|adv|course)_search/) { |
if ($env{'form.phase'} !~ m/(basic|adv|course)_search/) { |
if (! &get_persistent_form_data($persistent_db_file)) { |
if (! &get_persistent_form_data($persistent_db_file)) { |
Line 297 END
|
Line 303 END
|
} |
} |
# |
# |
if ($env{'form.searchmode'} eq 'advanced') { |
if ($env{'form.searchmode'} eq 'advanced') { |
|
my $srchtype = 'Catalog'; |
|
if ($env{'form.area'} eq 'portfolio') { |
|
$srchtype = 'Portfolio'; |
|
} |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>'/adm/searchcat?phase=disp_adv&'. |
({href=>'/adm/searchcat?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'}, |
text=>"Advanced Search", |
text=>"Advanced $srchtype Search", |
bug=>'Searching',}); |
bug=>'Searching',}); |
} elsif ($env{'form.searchmode'} eq 'course search') { |
} elsif ($env{'form.searchmode'} eq 'course search') { |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
Line 511 sub course_search {
|
Line 521 sub course_search {
|
my $applies = 0; |
my $applies = 0; |
my $symb = $resource->symb(); |
my $symb = $resource->symb(); |
my $ressymb = $symb; |
my $ressymb = $symb; |
if ($symb =~ m#(___adm/\w+/\w+)/(\d+)/bulletinboard$#) { |
if ($symb =~ m#(___adm/$LONCAPA::domain_re/$LONCAPA::username_re)/(\d+)/bulletinboard$#) { |
$ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard'; |
$ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard'; |
unless ($ressymb =~ m#bulletin___\d+___adm/wrapper#) { |
unless ($ressymb =~ m#bulletin___\d+___adm/wrapper#) { |
$ressymb=~s#(bulletin___\d+___)#$1adm/wrapper/#; |
$ressymb=~s#(bulletin___\d+___)#$1adm/wrapper/#; |
Line 821 sub print_advanced_search_form{
|
Line 831 sub print_advanced_search_form{
|
<input type="reset" name="reset" value='$lt{"reset"}' /> |
<input type="reset" name="reset" value='$lt{"reset"}' /> |
$closebutton |
$closebutton |
END |
END |
my $scrout= &Apache::loncommon::start_page('Advanced Catalog Search'); |
my $srchtype = 'Catalog'; |
|
if ($env{'form.area'} eq 'portfolio') { |
|
$srchtype = 'Portfolio'; |
|
} |
|
my $scrout= &Apache::loncommon::start_page("Advanced $srchtype Search"); |
$scrout .= <<"ENDHEADER"; |
$scrout .= <<"ENDHEADER"; |
$bread_crumb |
$bread_crumb |
<form method="post" action="/adm/searchcat" name="advsearch"> |
<form method="post" action="/adm/searchcat" name="advsearch"> |
Line 832 ENDHEADER
|
Line 846 ENDHEADER
|
'<input type="hidden" name="phase" value="adv_search" />'; |
'<input type="hidden" name="phase" value="adv_search" />'; |
my %fields=&Apache::lonmeta::fieldnames(); |
my %fields=&Apache::lonmeta::fieldnames(); |
# |
# |
$scrout .= '<h3>'.&mt('Standard Metadata').'</h3>'; |
$scrout .= '<h3>'.&mt('Standard [_1] Metadata',$srchtype).'</h3>'; |
$scrout .= "<table>\n"; |
$scrout .= "<table>\n"; |
$scrout .= '<tr><td> </td><td colspan="2"><font size="-1">'. |
$scrout .= '<tr><td> </td><td colspan="2"><font size="-1">'. |
(' 'x2).&searchhelp()."</font></td></tr>\n"; |
(' 'x2).&searchhelp()."</font></td></tr>\n"; |
Line 1583 sub parse_advanced_search {
|
Line 1597 sub parse_advanced_search {
|
} |
} |
# |
# |
if (@queries) { |
if (@queries) { |
$query="SELECT * FROM metadata WHERE (".join(") AND (",@queries).')'; |
if ($env{'form.area'} eq 'portfolio') { |
|
$query ="SELECT pm.*,pa.keynum,pa.scope FROM portfolio_metadata pm, portfolio_access pa WHERE (pm.url = pa.url AND (pa.start < NOW() AND (pa.end IS NULL OR pa.end > NOW())) AND (".join(') AND (',@queries).'))'; |
|
} else { |
|
$query="SELECT * FROM metadata WHERE (".join(") AND (",@queries).')'; |
|
} |
} elsif ($customquery) { |
} elsif ($customquery) { |
$query = ''; |
$query = ''; |
} |
} |