fixed some keywords bugs
took beta label away from event manager added option to shelf to include items below it and items included via keywords
This commit is contained in:
parent
b0ec9edf53
commit
ab55978f55
5 changed files with 16 additions and 17 deletions
|
|
@ -14,6 +14,7 @@ save you many hours of grief.
|
|||
Exception::Class
|
||||
Path::Class
|
||||
Image::ExifTool
|
||||
List::MoreUtils
|
||||
|
||||
* WebGUI versions since 7.3.0 (when the new Calendar was added)
|
||||
have allowed users to post Events to Calendars, but the owner of
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ package WebGUI::Asset::Wobject::Shelf;
|
|||
#-------------------------------------------------------------------
|
||||
|
||||
use strict;
|
||||
use List::MoreUtils;
|
||||
use Tie::IxHash;
|
||||
use WebGUI::International;
|
||||
use base 'WebGUI::Asset::Wobject';
|
||||
|
|
@ -90,20 +91,19 @@ sub view {
|
|||
}
|
||||
|
||||
# get other child skus
|
||||
my @childSkus = ();
|
||||
foreach my $child (@{$self->getLineage(['children'],{includeOnlyClasses=>['WebGUI::Asset::Wobject::Shelf']})}) {
|
||||
my $properties = $child->get;
|
||||
$child->{url} = $self->getUrl;
|
||||
push @childSkus, $child;
|
||||
}
|
||||
my @childSkus = @{$self->getLineage(['children'],{includeOnlyClasses=>['WebGUI::Asset::Wobject::Shelf']})};
|
||||
|
||||
# find products based upon keywords
|
||||
my @keywords = $self->get('keywords');
|
||||
my $keywordBasedAsssetIds = WebGUI::Keyword->new($session)->getMatchingAssets({
|
||||
my $keywordBasedAssetIds = WebGUI::Keyword->new($session)->getMatchingAssets({
|
||||
matchAssetKeywords => $self,
|
||||
isa => 'WebGUI::Asset::Sku',
|
||||
});
|
||||
$p->setBaseUrl($self->getUrl('func=view'));
|
||||
|
||||
# create paginator
|
||||
my @products = List::MoreUtils::uniq(@childSkus, @{$keywordBasedAssetIds});
|
||||
my $p = WebGUI::Paginator->new($session, $self->getUrl('func=view'));
|
||||
$p->setDataByArrayRef(\@products);
|
||||
|
||||
# generate template variables
|
||||
my @skus = ();
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ sub getKeywordsForAsset {
|
|||
return \@keywords;
|
||||
}
|
||||
else {
|
||||
return join(" ", map({ m/\s/ ? '"' . $_ . '"' : $_ } @keywords));
|
||||
return join(" ", map({ (m/\s/) ? '"' . $_ . '"' : $_ } @keywords));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ Instead of returning an array reference of assetId's, return a paginator object.
|
|||
|
||||
sub getMatchingAssets {
|
||||
my ($self, $options) = @_;
|
||||
|
||||
|
||||
# base query
|
||||
my @clauses = ();
|
||||
my @params = ();
|
||||
|
|
@ -228,13 +228,12 @@ sub getMatchingAssets {
|
|||
}
|
||||
|
||||
# looking for a list of keywords
|
||||
if (exists $options->{keywords}) {
|
||||
if (exists $options->{keywords} && scalar(@{$options->{keywords}})) {
|
||||
my @placeholders = ();
|
||||
foreach my $word (@{$options->{keywords}}){
|
||||
push @placeholders, '?';
|
||||
push @params, $word;
|
||||
}
|
||||
next unless scalar @placeholders;
|
||||
push @clauses, 'keyword in ('.join(',', @placeholders).')';
|
||||
}
|
||||
|
||||
|
|
@ -248,9 +247,7 @@ sub getMatchingAssets {
|
|||
$p->setDataByQuery($query, undef, undef, \@params);
|
||||
return $p;
|
||||
}
|
||||
else {
|
||||
return $self->session->db->buildArrayRef($query, \@params);
|
||||
}
|
||||
return $self->session->db->buildArrayRef($query, \@params);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -423,8 +423,8 @@ our $I18N = {
|
|||
},
|
||||
|
||||
'assetName' => {
|
||||
message => q|Event Manager (beta)|,
|
||||
lastUpdated => 1131394072,
|
||||
message => q|Event Manager|,
|
||||
lastUpdated => 1211045812,
|
||||
context => q|name of asset|,
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ checkModule("Image::ExifTool","7.00");
|
|||
checkModule("Archive::Any","0.093");
|
||||
checkModule("Path::Class", '0.16');
|
||||
checkModule("Exception::Class","1.23");
|
||||
checkModule("List::MoreUtils","0.22");
|
||||
|
||||
|
||||
###################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue