- Added Comments asset aspect, which allows comments to be added to any asset

easily.
 - Added comments aspect to wiki.
This commit is contained in:
JT Smith 2008-10-11 20:33:38 +00:00
parent 57e3255a97
commit e7c6fe6cae
13 changed files with 590 additions and 26 deletions

View file

@ -10,8 +10,9 @@ package WebGUI::Asset::WikiPage;
# http://www.plainblack.com info@plainblack.com
# -------------------------------------------------------------------
use base 'WebGUI::Asset';
use strict;
use Class::C3;
use base qw(WebGUI::AssetAspect::Comments WebGUI::Asset);
use Tie::IxHash;
use WebGUI::International;
use WebGUI::Utility;
@ -40,7 +41,7 @@ Override the default method in order to deal with attachments.
sub addRevision {
my $self = shift;
my $newSelf = $self->SUPER::addRevision(@_);
my $newSelf = $self->next::method(@_);
my $now = time();
$newSelf->update({
isHidden => 1,
@ -52,7 +53,7 @@ sub addRevision {
sub canAdd {
my $class = shift;
my $session = shift;
$class->SUPER::canAdd($session, undef, '7');
$class->next::method($session, undef, '7');
}
#-------------------------------------------------------------------
@ -109,16 +110,7 @@ sub definition {
properties => \%properties,
};
return $class->SUPER::definition($session, $definition);
}
#-------------------------------------------------------------------
# BUGGO: how to handle this?
sub duplicate {
my $self = shift;
my $newAsset = $self->SUPER::duplicate(@_);
return $newAsset;
return $class->next::method($session, $definition);
}
@ -192,7 +184,7 @@ sub getWiki {
#-------------------------------------------------------------------
sub indexContent {
my $self = shift;
my $indexer = $self->SUPER::indexContent;
my $indexer = $self->next::method;
$indexer->addKeywords($self->get('content'));
return $indexer;
}
@ -216,7 +208,7 @@ sub preparePageTemplate {
#-------------------------------------------------------------------
sub prepareView {
my $self = shift;
$self->SUPER::prepareView;
$self->next::method;
$self->preparePageTemplate;
}
@ -224,24 +216,27 @@ sub prepareView {
#-------------------------------------------------------------------
sub processPropertiesFromFormPost {
my $self = shift;
$self->SUPER::processPropertiesFromFormPost(@_);
$self->next::method(@_);
my $actionTaken = ($self->session->form->process("assetId") eq "new") ? "Created" : "Edited";
my $wiki = $self->getWiki;
$self->update({ groupIdView => $wiki->get('groupIdView'),
groupIdEdit => $wiki->get('groupToAdminister'),
actionTakenBy => $self->session->user->userId,
actionTaken => $actionTaken,
});
my $properties = {
groupIdView => $wiki->get('groupIdView'),
groupIdEdit => $wiki->get('groupToAdminister'),
actionTakenBy => $self->session->user->userId,
actionTaken => $actionTaken,
};
if ($wiki->canAdminister) {
$self->update({isProtected => $self->session->form("isProtected")});
$properties->{isProtected} = $self->session->form->get("isProtected");
}
$self->update($properties);
# deal with attachments from the attachments form control
my $options = {
maxImageSize => $wiki->get('maxImageSize'),
thumbnailSize => $wiki->get('thumbnailSize'),
};
# deal with attachments from the attachments form control
my @attachments = $self->session->form->param("attachments");
my @tags = ();
foreach my $assetId (@attachments) {
@ -311,7 +306,8 @@ Wrap update to force isHidden to be on, all the time.
sub update {
my $self = shift;
my $properties = shift;
return $self->SUPER::update({%$properties, isHidden => 1});
$properties->{isHidden} = 1;
return $self->next::method($properties);
}
#-------------------------------------------------------------------
@ -346,6 +342,7 @@ sub view {
historyUrl => $self->getUrl("func=getHistory"),
editContent => $self->getEditForm,
allowsAttachments => $self->getWiki->get("allowAttachments"),
comments => $self->getFormattedComments(),
content => $self->getWiki->autolinkHtml(
$self->scrubContent,
{skipTitles => [$self->get('title')]},