simplified the rules engine
This commit is contained in:
parent
5037b16dbe
commit
394da51da7
5 changed files with 184 additions and 42 deletions
110
lib/WebGUI/Asset/Wobject/Search.pm
Normal file
110
lib/WebGUI/Asset/Wobject/Search.pm
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
package WebGUI::Asset::Wobject::Search;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# 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 strict;
|
||||
use base "WebGUI::Asset::Wobject";
|
||||
use Tie::IxHash;
|
||||
use WebGUI::International;
|
||||
use WebGUI::Paginator;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Asset::Wobject::Search
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Asset used to search WebGUI content.
|
||||
|
||||
=head2 definition ( $class, $definition )
|
||||
|
||||
This method defines all properties of a Search and is used to autogenerate most methods.
|
||||
|
||||
=head3 $class
|
||||
|
||||
$class is used to make sure that inheritance works on Assets and Wobjects.
|
||||
|
||||
=head3 $definition
|
||||
|
||||
Definition hashref from subclasses.
|
||||
|
||||
=head3 Search specific properties
|
||||
|
||||
=over 4
|
||||
|
||||
=item templateId
|
||||
|
||||
ID of a tempate from the Search namespace to display the search results.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift;
|
||||
my $i18n = WebGUI::International->new($session,'Asset_Search');
|
||||
my %properties;
|
||||
tie %properties, 'Tie::IxHash';
|
||||
%properties = (
|
||||
templateId =>{
|
||||
fieldType=>"template",
|
||||
defaultValue=>'PBtmpl0000000000000200',
|
||||
tab=>"display",
|
||||
namespace=>"Search",
|
||||
hoverHelp=>$i18n->get('search template description'),
|
||||
label=>$i18n->get('search template')
|
||||
},
|
||||
searchRoot => {
|
||||
fieldType=>"asset",
|
||||
defaultValue=>$session->setting->get("defaultPage"),
|
||||
tab=>"properties",
|
||||
hoverHelp=>$i18n->get("search root description"),
|
||||
label=>$i18n->get('search root')
|
||||
}
|
||||
classLimiter => {
|
||||
fieldType => "checkList",
|
||||
defaultValue => [],
|
||||
tab=>"properties",
|
||||
hoverHelp=>$i18n->get("class limiter description"),
|
||||
label=>$i18n->get("class limiter"),
|
||||
options=>$session->db->buildHashRef("select distinct()")
|
||||
);
|
||||
push(@{$definition}, {
|
||||
assetName=>$i18n->get('assetName'),
|
||||
icon=>'search.gif',
|
||||
autoGenerateForms=>1,
|
||||
tableName=>'search',
|
||||
className=>'WebGUI::Asset::Wobject::Search',
|
||||
properties=>\%properties
|
||||
});
|
||||
return $class->SUPER::definition($session, $definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 view ( )
|
||||
|
||||
view defines all template variables, processes the template and
|
||||
returns the output.
|
||||
|
||||
=cut
|
||||
|
||||
sub view {
|
||||
my $self = shift;
|
||||
my %var;
|
||||
return $self->processTemplate(\%var, $templateId);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
|
@ -3,7 +3,7 @@ package WebGUI::Asset::Wobject::NewWobject;
|
|||
$VERSION = "1.0.0";
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# WebGUI is Copyright 2001-2005 Plain Black Corporation.
|
||||
# WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
#-------------------------------------------------------------------
|
||||
# Please read the legal notices (docs/legal.txt) and the license
|
||||
# (docs/license.txt) that came with this distribution before using
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue