Jifty::Plugin::Comment::Model::Comment(3pm)		User Contributed Perl Documentation	       Jifty::Plugin::Comment::Model::Comment(3pm)

NAME
Jifty::Plugin::Comment::Model::Comment - comments attached to anything SYNOPSIS
# to customize... package App::Model::Comment; use base qw/ Jifty::Plugin::Comment::Model::Comment /; use Jifty::DBI::Schema; use App::Record schema { # Add a reference to the current user that creates this comment column by_user => references App::Model::User, ; }; # make it so that any logged user can comment, but anyone can view, except # that we don't really want everyone seeing all those personal bits... sub current_user_can { my $self = shift; my ($right, %args) = @_; if ($right eq 'create') { return 1 if $self->current_user->id; } if ($right eq 'read') { return $self->published unless $args{column} =~ /^ (?: email | status | ip_addr | http_refer | http_user_agent ) $/x; } # otherwise only superuser gets in return $self->SUPER::current_user_can(@_); } DESCRIPTION
This model is the repository for all comments in your application, if you use the Jifty::Plugin::Comment plugin. SCHEMA
title This is the title of the comment. body This is the body of the comment. created_on This is the timestamp of when the comment was created. your_name This is the name the author of the comment has claimed. web_site This is the name of the web site the author claims as her own. email This is the email address the author is claiming. published This is a boolean flag indicating whether the comment should be shown or not when viewed. status This is a flag containing one of two values: "spam" or "ham". It indicates whether the comment has been evaluated as spam or not by Net::Akismet. ip_addr This is the IP address of the remote client of the author that made the comment. http_referer This is the HTTP referer that was sent by the browser when the author made the comment. http_user_agent This is the HTTP user agent that was sent by the browser when the author made the comment. METHODS
table Returns the database table name for the comments table. before_create It is assumed that your comments will be made available for create with very little restriction. This trigger is used to perform aggressive cleanup on the data stored and will attempt to check to see if the comment is spam by using Net::Akismet. before_set_status This trigger is called when changing the status of the message. If Net::Akismet is in use, this trigger will notify Akismet that this message is being marked as spam or as ham, depending upon the new value. current_user_can This method is not actually implemented by this class, but you will either want to implementt this method in your application or add a "before_access" trigger that grants access. Otherwise, your comments won't be very interesting to anyone but a superuser. See the "SYNOPSIS" for a recommended implementation. AUTHOR
Andrew Sterling Hanenkamp "<hanenkamp@cpan.org>" COPYRIGHT AND LICENSE
Copyright 2007 Boomer Consulting, Inc. All Rights Reserved. This program is free software and may be modified and distributed under the same terms as Perl itself. perl v5.12.4 2009-03-09 Jifty::Plugin::Comment::Model::Comment(3pm)