diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index b3d8e194a..16e0043aa 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -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 diff --git a/docs/upgrades/packages-7.9.4/default-wiki-page.wgpkg b/docs/upgrades/packages-7.9.4/default-wiki-page.wgpkg new file mode 100644 index 000000000..23ff7651a Binary files /dev/null and b/docs/upgrades/packages-7.9.4/default-wiki-page.wgpkg differ diff --git a/lib/WebGUI/Asset/WikiPage.pm b/lib/WebGUI/Asset/WikiPage.pm index 6f9a4000e..e125c4bc6 100644 --- a/lib/WebGUI/Asset/WikiPage.pm +++ b/lib/WebGUI/Asset/WikiPage.pm @@ -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; } diff --git a/lib/WebGUI/Help/Asset_WikiPage.pm b/lib/WebGUI/Help/Asset_WikiPage.pm index dc11d5976..15016cdbd 100644 --- a/lib/WebGUI/Help/Asset_WikiPage.pm +++ b/lib/WebGUI/Help/Asset_WikiPage.pm @@ -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 => [], }, diff --git a/lib/WebGUI/i18n/English/Asset_WikiPage.pm b/lib/WebGUI/i18n/English/Asset_WikiPage.pm index 0c1663dbe..cddfe3b7a 100644 --- a/lib/WebGUI/i18n/English/Asset_WikiPage.pm +++ b/lib/WebGUI/i18n/English/Asset_WikiPage.pm @@ -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; diff --git a/t/Asset/WikiPage.t b/t/Asset/WikiPage.t index 3a92d7e00..79815baaa 100644 --- a/t/Asset/WikiPage.t +++ b/t/Asset/WikiPage.t @@ -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';