56 lines
2.2 KiB
Perl
56 lines
2.2 KiB
Perl
package WebGUI::Operation::Search;
|
|
|
|
#-------------------------------------------------------------------
|
|
# WebGUI is Copyright 2001-2002 Plain Black Software.
|
|
#-------------------------------------------------------------------
|
|
# Please read the legal notices (docs/legal.txt) and the license
|
|
# (docs/license.txt) that came with this distribution before using
|
|
# this software.
|
|
#-------------------------------------------------------------------
|
|
# http://www.plainblack.com info@plainblack.com
|
|
#-------------------------------------------------------------------
|
|
|
|
use Exporter;
|
|
use strict;
|
|
use WebGUI::HTMLForm;
|
|
use WebGUI::International;
|
|
use WebGUI::Paginator;
|
|
use WebGUI::Search;
|
|
use WebGUI::Session;
|
|
use WebGUI::SQL;
|
|
use WebGUI::URL;
|
|
|
|
our @ISA = qw(Exporter);
|
|
our @EXPORT = qw(&www_search);
|
|
|
|
#-------------------------------------------------------------------
|
|
sub www_search {
|
|
my ($constraints, $p, $output, %page, $sth, @row, $i);
|
|
$output = WebGUI::Search::form({op=>'search'});
|
|
$constraints = WebGUI::Search::buildConstraints([qw(page.synopsis page.title page.menuTitle page.metaTags
|
|
page.urlizedTitle wobject.description wobject.title wobject.namespace)]);
|
|
if ($constraints ne "") {
|
|
tie %page, 'Tie::CPHash';
|
|
$sth = WebGUI::SQL->read("select page.urlizedTitle,page.title,wobject.wobjectId from page,wobject where $constraints
|
|
and page.pageId=wobject.pageId and (page.pageId > 25 or page.pageId=1) and page.pageId<>$session{page}{pageId} order by lastEdited");
|
|
while (%page = $sth->hash) {
|
|
$row[$i] = '<li><a href="'.WebGUI::URL::gateway($page{urlizedTitle}).'#'.$page{wobjectId}.'">'.$page{title}.'</a>';
|
|
$i++;
|
|
}
|
|
$sth->finish;
|
|
}
|
|
if ($row[0] ne "") {
|
|
$p = WebGUI::Paginator->new(WebGUI::URL::page('op=search'),\@row,$session{form}{numResults});
|
|
$output .= '<p/>'.WebGUI::International::get(365).'<p><ol>';
|
|
$output .= $p->getPage($session{form}{pn});
|
|
$output .= '</ol>'.$p->getBarTraditional($session{form}{pn});
|
|
} elsif ($session{form}{exactPhrase} ne "" || $session{form}{all} ne "" || $session{form}{without} ne "" || $session{form}{atLeastOne} ne "") {
|
|
$output .= '<p/>'.WebGUI::International::get(366).'<p/>';
|
|
}
|
|
return $output;
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|