rfe: Search Asset returns URLs

This commit is contained in:
JT Smith 2007-10-26 16:29:25 +00:00
parent 99337c3473
commit 1b51697dbd
4 changed files with 60 additions and 33 deletions

View file

@ -1,5 +1,6 @@
7.5.0
- rfe: Default log level to ERROR
- rfe: Search Asset returns URLs
- Added link to return to inbox from message in inbox message template (Diona Kidd, Knowmad Technologies)
- fix: Cannot delete private message (Diona Kidd, Knowmad Technologies)
- fix: Workflow activities don't pick up new default values

View file

@ -20,19 +20,19 @@ my $quiet; # this line required
my $session = start(); # this line required
# upgrade functions go here
addFriendsNetwork($session);
addSearchWithContainers($session);
finish($session); # this line required
##-------------------------------------------------
#sub exampleFunction {
# my $session = shift;
# print "\tWe're doing some stuff here that you should know about..." unless $quiet;
# # and here's our code
# print "DONE!\n" unless $quiet;
#}
#-------------------------------------------------
sub addSearchWithContainers {
my $session = shift;
print "\tMaking search capable of displaying containers in search results instead of individaul assets." unless $quiet;
$session->db->write("alter table Search add column useContainers int not null default 0");
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub addFriendsNetwork {

View file

@ -72,30 +72,37 @@ sub definition {
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')
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')
fieldType => "asset",
defaultValue => $session->setting->get("defaultPage"),
tab => "properties",
hoverHelp => $i18n->get("search root description"),
label => $i18n->get('search root')
},
classLimiter => {
fieldType => "checkList",
defaultValue => undef,
vertical=>1,
tab=>"properties",
hoverHelp=>$i18n->get("class limiter description"),
label=>$i18n->get("class limiter"),
options=>$session->db->buildHashRef("select distinct(className) from asset")
}
fieldType => "checkList",
defaultValue => undef,
vertical => 1,
tab => "properties",
hoverHelp => $i18n->get("class limiter description"),
label => $i18n->get("class limiter"),
options => $session->db->buildHashRef("select distinct(className) from asset")
},
useContainers => {
tab => "properties",
hoverHelp => "useContainers help",
label => "useContainers",
fieldType => "yesNo",
defaultValue => 0,
},
);
push(@{$definition}, {
assetName=>$i18n->get('assetName'),
@ -156,11 +163,18 @@ sub view {
my $rs = $search->getResultSet;
while (my $data = $rs->hashRef) {
if ($self->session->user->userId eq $data->{ownerUserId} || $self->session->user->isInGroup($data->{groupIdView}) || $self->session->user->isInGroup($data->{groupIdEdit})) {
push(@results, {
url=>$data->{url},
title=>$data->{title},
synopsis=>$data->{synopsis},
assetId=>$data->{assetId},
my $url = $data->{url};
if ($self->get("useContainers")) {
my $asset = WebGUI::Asset->new($self->session, $data->{assetId}, $data->{className});
if (defined $asset) {
$url = $asset->getContainer->get("url");
}
}
push(@results, {
url => $url,
title => $data->{title},
synopsis => $data->{synopsis},
assetId => $data->{assetId},
});
$var{results_found} = 1;
}

View file

@ -2,6 +2,18 @@ package WebGUI::i18n::English::Asset_Search; ##Be sure to change the package na
our $I18N = { ##hashref of hashes
'useContainers' => {
message => q|Use container URLs in results?|,
lastUpdated => 0,
context => q|an asset property|
},
'useContainers help' => {
message => q|Set this to "Yes" if you'd like the search results to return full pages instead of individual assets.|,
lastUpdated => 0,
context => q|an asset property help|
},
'search' => {
message => q|search|,
lastUpdated => 0,