Revoke the previous page-level hierarchial keywords work, in favor of forthcoming work on wiki level keywords work
This commit is contained in:
parent
776397bfa9
commit
d085d7d04a
6 changed files with 2 additions and 112 deletions
|
|
@ -1,5 +1,6 @@
|
|||
7.9.4
|
||||
- fixed #11535: i18n - Asset_MapPoint - Tag form_fax - wrong text
|
||||
- Implement hierarchial keywords differently.
|
||||
|
||||
7.9.3
|
||||
- added #11477: No synopsis in asset now means no synopsis in search index
|
||||
|
|
|
|||
BIN
docs/upgrades/packages-7.9.4/default-wiki-page.wgpkg
Normal file
BIN
docs/upgrades/packages-7.9.4/default-wiki-page.wgpkg
Normal file
Binary file not shown.
|
|
@ -309,35 +309,11 @@ sub getTemplateVars {
|
|||
$self->scrubContent,
|
||||
{skipTitles => [$self->get('title')]},
|
||||
),
|
||||
isKeywordPage => $self->isKeywordPage,
|
||||
isSubscribed => $self->isSubscribed,
|
||||
subscribeUrl => $self->getSubscribeUrl,
|
||||
unsubscribeUrl => $self->getUnsubscribeUrl,
|
||||
owner => $owner->get('alias'),
|
||||
};
|
||||
my @keyword_pages = ();
|
||||
if ($var->{isKeywordPage}) {
|
||||
my $paginator = $keyObj->getMatchingAssets({
|
||||
startAsset => $self->getWiki,
|
||||
keyword => $self->get('title'),
|
||||
usePaginator => 1,
|
||||
});
|
||||
PAGE: foreach my $assetId (@{ $paginator->getPageData }) {
|
||||
next PAGE if $assetId->{assetId} eq $self->getId;
|
||||
my $asset = WebGUI::Asset->newByDynamicClass($session, $assetId->{assetId});
|
||||
next PAGE unless $asset;
|
||||
push @keyword_pages, {
|
||||
title => $asset->getTitle,
|
||||
url => $asset->getUrl,
|
||||
};
|
||||
}
|
||||
$paginator->appendTemplateVars($var);
|
||||
@keyword_pages = map { $_->[1] }
|
||||
sort
|
||||
map { [ lc $_->{title}, $_ ] }
|
||||
@keyword_pages;
|
||||
}
|
||||
$var->{keyword_page_loop} = \@keyword_pages;
|
||||
return $var;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,17 +107,6 @@ our $HELP = {
|
|||
name => 'owner',
|
||||
description => 'help owner',
|
||||
},
|
||||
{ 'name' => 'isKeywordPage', },
|
||||
{ 'name' => 'keyword_page_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'title',
|
||||
'description' => 'keyword page title',
|
||||
},
|
||||
{ 'name' => 'url',
|
||||
'description' => 'keyword page url',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
related => [],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -333,30 +333,6 @@ our $I18N =
|
|||
context => 'Label for asset property',
|
||||
},
|
||||
|
||||
'isKeywordPage' => {
|
||||
message => q{A boolean that is true if this page is a keyword page.},
|
||||
lastUpdated => 0,
|
||||
context => 'template variable help',
|
||||
},
|
||||
|
||||
'keyword_page_loop' => {
|
||||
message => q{If this page is a keyword page, then this loop will contain a list of all pages tagged with this page's keyword. The pagination variables will apply to the list of pages in this loop. If this page is not a keyword page, the loop will be blank, and the pagination variables will not be present.},
|
||||
lastUpdated => 0,
|
||||
context => 'template variable help',
|
||||
},
|
||||
|
||||
'keyword page title' => {
|
||||
message => q{The title of a page that has this keyword.},
|
||||
lastUpdated => 0,
|
||||
context => 'template variable help',
|
||||
},
|
||||
|
||||
'keyword page url' => {
|
||||
message => q{The URL to a page that has this keyword. The URL will have the gateway URL prepended to it.},
|
||||
lastUpdated => 0,
|
||||
context => 'template variable help',
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use lib "$FindBin::Bin/../lib";
|
|||
|
||||
use WebGUI::Test;
|
||||
use WebGUI::Session;
|
||||
use Test::More tests => 29; # increment this value for each test you create
|
||||
use Test::More tests => 17; # increment this value for each test you create
|
||||
use Test::Deep;
|
||||
use WebGUI::Asset::Wobject::WikiMaster;
|
||||
use WebGUI::Asset::WikiPage;
|
||||
|
|
@ -91,55 +91,3 @@ $comments = $wikipage->get('comments');
|
|||
is($comments->[0]{comment}, $secondComment, "you can delete a comment");
|
||||
is($wikipage->get('averageCommentRating'), 1, 'average rating is adjusted after deleting a comment');
|
||||
|
||||
|
||||
##################
|
||||
# This section tests hierarchical keywords support
|
||||
##################
|
||||
|
||||
#
|
||||
## setup some more wiki pages
|
||||
my $properties = {
|
||||
className=>'WebGUI::Asset::WikiPage',
|
||||
content => 'Now is the time for all good men to come to the aid of their country',
|
||||
title => 'Keyword',
|
||||
keywords => 'keyword'
|
||||
};
|
||||
my $wikipage2 = $wiki->addChild($properties, @autoCommitCoda);
|
||||
isa_ok($wikipage2, 'WebGUI::Asset::WikiPage');
|
||||
|
||||
$properties = {
|
||||
className=>'WebGUI::Asset::WikiPage',
|
||||
content => 'The quick brown fox jumps over the lazy dog.',
|
||||
title => 'Fox',
|
||||
keywords => 'keyword'
|
||||
};
|
||||
my $wikipage3 = $wiki->addChild($properties, @autoCommitCoda);
|
||||
isa_ok($wikipage3, 'WebGUI::Asset::WikiPage');
|
||||
|
||||
# Test keywords support
|
||||
my $keywords = $wikipage2->get('keywords');
|
||||
is($keywords,$properties->{'keywords'}, 'Keywords match');
|
||||
|
||||
# Test isKeywordPage()
|
||||
ok $wikipage2->isKeywordPage(), "'".$wikipage2->get('title')."' is a keyword page";
|
||||
my $templateVars = $wikipage2->getTemplateVars;
|
||||
ok $templateVars->{isKeywordPage}, 'isKeywordPage template var, true';
|
||||
cmp_deeply
|
||||
$templateVars->{keyword_page_loop},
|
||||
[
|
||||
{ title => 'Fox', url => '/wikitest/fox', },
|
||||
],
|
||||
'populated keyword_page_loop, sorted by title';
|
||||
ok ! $wikipage3->isKeywordPage(), "'".$wikipage3->get('title')."' is not a keyword page";
|
||||
$templateVars = $wikipage3->getTemplateVars;
|
||||
ok ! $templateVars->{isKeywordPage}, 'isKeywordPage template var, false';
|
||||
cmp_deeply $templateVars->{keyword_page_loop}, [], 'empty keyword_page_loop';
|
||||
|
||||
$wikipage3->update({keywords => $wikipage3->get('keywords').',Fox'});
|
||||
ok $wikipage3->isKeywordPage(), "'".$wikipage3->get('title')."' is now a keyword page";
|
||||
$templateVars = $wikipage3->getTemplateVars;
|
||||
ok $templateVars->{isKeywordPage}, 'isKeywordPage template var, false';
|
||||
cmp_deeply
|
||||
$templateVars->{keyword_page_loop},
|
||||
[ ],
|
||||
'empty keyword_page_loop, self is not put into the loop';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue