added Subscribable AssetAspect to Wiki

This commit is contained in:
Doug Bell 2009-09-09 17:24:00 -05:00
parent b838102df5
commit 0697673846
15 changed files with 936 additions and 56 deletions

View file

@ -11,7 +11,11 @@ package WebGUI::Asset::Wobject::WikiMaster;
#-------------------------------------------------------------------
use Class::C3;
use base qw(WebGUI::AssetAspect::RssFeed WebGUI::Asset::Wobject);
use base qw(
WebGUI::AssetAspect::Subscribable
WebGUI::AssetAspect::RssFeed
WebGUI::Asset::Wobject
);
use strict;
use Tie::IxHash;
use WebGUI::International;
@ -444,6 +448,36 @@ sub getRssFeedItems {
return $var;
}
#----------------------------------------------------------------------------
=head2 getTemplateVars ( )
Get the common template variables for all views of the wiki.
=cut
sub getTemplateVars {
my ( $self ) = @_;
my $i18n = WebGUI::International->new($self->session, "Asset_WikiMaster");
my $var = { %{$self->get},
url => $self->getUrl,
searchLabel => $i18n->get("searchLabel"),
mostPopularUrl => $self->getUrl("func=mostPopular"),
mostPopularLabel => $i18n->get("mostPopularLabel"),
addPageLabel => $i18n->get("addPageLabel"),
addPageUrl => $self->getUrl("func=add;class=WebGUI::Asset::WikiPage"),
recentChangesUrl => $self->getUrl("func=recentChanges"),
recentChangesLabel => $i18n->get("recentChangesLabel"),
restoreLabel => $i18n->get("restoreLabel"),
canAdminister => $self->canAdminister,
isSubscribed => $self->isSubscribed,
subscribeUrl => $self->getSubscribeUrl,
unsubscribeUrl => $self->getUnsubscribeUrl,
};
return $var;
}
#-------------------------------------------------------------------
=head2 prepareView
@ -492,6 +526,19 @@ sub processPropertiesFromFormPost {
#-------------------------------------------------------------------
=head2 shouldSkipNotification ( )
WikiMasters do not send notification
=cut
sub shouldSkipNotification {
my ( $self ) = @_;
return 1;
}
#-------------------------------------------------------------------
=head2 view
Render the front page of the wiki.
@ -500,23 +547,13 @@ Render the front page of the wiki.
sub view {
my $self = shift;
my $i18n = WebGUI::International->new($self->session, "Asset_WikiMaster");
my $var = {
description => $self->autolinkHtml($self->get('description')),
searchLabel=>$i18n->get("searchLabel"),
mostPopularUrl=>$self->getUrl("func=mostPopular"),
mostPopularLabel=>$i18n->get("mostPopularLabel"),
addPageLabel=>$i18n->get("addPageLabel"),
addPageUrl=>$self->getUrl("func=add;class=WebGUI::Asset::WikiPage"),
recentChangesUrl=>$self->getUrl("func=recentChanges"),
recentChangesLabel=>$i18n->get("recentChangesLabel"),
restoreLabel => $i18n->get("restoreLabel"),
canAdminister => $self->canAdminister,
keywordCloud => WebGUI::Keyword->new($self->session)->generateCloud({
startAsset=>$self,
displayFunc=>"byKeyword",
}),
};
my $var = $self->getTemplateVars;
$var->{ description } = $self->autolinkHtml( $var->{ description } );
$var->{ keywordCloud }
= WebGUI::Keyword->new($self->session)->generateCloud({
startAsset=>$self,
displayFunc=>"byKeyword",
});
my $template = $self->{_frontPageTemplate};
$self->appendSearchBoxVars($var);
$self->appendRecentChanges($var, $self->get('recentChangesCountFront'));