diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index a8262b048..cc0db9ba2 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,4 +1,5 @@ 7.8.0 + - fixed #10998: wiki page locked? - fixed #10982: Survey menu options appearing twice - fixed #10890: Story Manager: pagination broken for keywords - fixed #10856: no paginate in wiki keyword search diff --git a/docs/upgrades/packages-7.8.0/default-wiki-page.wgpkg b/docs/upgrades/packages-7.8.0/default-wiki-page.wgpkg index 7cfe6a49b..2d372aee3 100644 Binary files a/docs/upgrades/packages-7.8.0/default-wiki-page.wgpkg and b/docs/upgrades/packages-7.8.0/default-wiki-page.wgpkg differ diff --git a/lib/WebGUI/Asset/WikiPage.pm b/lib/WebGUI/Asset/WikiPage.pm index b46d335e7..d2e8ef30b 100644 --- a/lib/WebGUI/Asset/WikiPage.pm +++ b/lib/WebGUI/Asset/WikiPage.pm @@ -299,6 +299,7 @@ sub getTemplateVars { allowsAttachments => $wiki->get("allowAttachments"), comments => $self->getFormattedComments(), canEdit => $self->canEdit, + isProtected => $self->isProtected, content => $wiki->autolinkHtml( $self->scrubContent, {skipTitles => [$self->get('title')]}, diff --git a/lib/WebGUI/Help/Asset_WikiPage.pm b/lib/WebGUI/Help/Asset_WikiPage.pm index 36354c338..a9596f8c9 100644 --- a/lib/WebGUI/Help/Asset_WikiPage.pm +++ b/lib/WebGUI/Help/Asset_WikiPage.pm @@ -59,6 +59,7 @@ our $HELP = { { name => 'canEdit', description => 'canEdit variable', }, + { name => 'isProtected', }, { name => 'historyLabel', description => 'historyLabel variable', }, diff --git a/lib/WebGUI/i18n/English/Asset_WikiPage.pm b/lib/WebGUI/i18n/English/Asset_WikiPage.pm index 18e320002..e49d21113 100644 --- a/lib/WebGUI/i18n/English/Asset_WikiPage.pm +++ b/lib/WebGUI/i18n/English/Asset_WikiPage.pm @@ -91,6 +91,11 @@ our $I18N = lastUpdated => 1165790228, }, + 'locked' => { + message => q|Locked|, + lastUpdated => 1253139992, + }, + 'add/edit title' => { message => q|Wiki Page, Add/Edit Template|, lastUpdated => 1165790228, diff --git a/t/Asset/WikiPage.t b/t/Asset/WikiPage.t index 4c54ecd27..f08781a5f 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 => 14; # increment this value for each test you create +use Test::More tests => 18; # increment this value for each test you create use WebGUI::Asset::Wobject::WikiMaster; use WebGUI::Asset::WikiPage; @@ -25,6 +25,7 @@ my $session = WebGUI::Test->session; my $node = WebGUI::Asset->getImportNode($session); my $versionTag = WebGUI::VersionTag->getWorking($session); $versionTag->set({name=>"Wiki Test"}); +WebGUI::Test->tagsToRollback($versionTag); my $wiki = $node->addChild({className=>'WebGUI::Asset::Wobject::WikiMaster'}); $versionTag->commit; @@ -32,6 +33,7 @@ my $wikipage = $wiki->addChild({className=>'WebGUI::Asset::WikiPage'}); # Wikis create and autocommit a version tag when a child is added. Lets get the name so we can roll it back. my $secondVersionTag = WebGUI::VersionTag->new($session,$wikipage->get("tagId")); +WebGUI::Test->tagsToRollback($secondVersionTag ); # Test for sane object types isa_ok($wiki, 'WebGUI::Asset::Wobject::WikiMaster'); @@ -45,7 +47,19 @@ is($article, undef, "Can't add an Article wobject as a child to a Wiki Page."); my $wikiPageCopy = $wikipage->duplicate(); isa_ok($wikiPageCopy, 'WebGUI::Asset::WikiPage'); my $thirdVersionTag = WebGUI::VersionTag->new($session,$wikiPageCopy->get("tagId")); +WebGUI::Test->tagsToRollback($thirdVersionTag); +## isProtected + +$wikiPageCopy->update({isProtected => 1}); +ok($wikiPageCopy->isProtected, 'isProtected: copied page returns true'); +ok(! $wikipage->isProtected, '... original page is not'); + +## wiki page template variables + +ok( ! $wikipage->getTemplateVars->{isProtected}, 'view template variables: isProtected is false on wiki page 1'); + +ok( $wikiPageCopy->getTemplateVars->{isProtected}, '... isProtected is true on wiki page 2'); ################## # This section tests the Comments aspect