[Jifty-commit] r7213 - in plugins/Jifty-Plugin-Comment: . share/po

Jifty commits jifty-commit at lists.jifty.org
Wed Jun 10 03:37:18 EDT 2009


Author: yves
Date: Wed Jun 10 03:37:18 2009
New Revision: 7213

Added:
   plugins/Jifty-Plugin-Comment/Changes
   plugins/Jifty-Plugin-Comment/README
   plugins/Jifty-Plugin-Comment/share/po/fr.po
Modified:
   plugins/Jifty-Plugin-Comment/Makefile.PL
   plugins/Jifty-Plugin-Comment/lib/Jifty/Plugin/Comment.pm

Log:
ready to upload to cpan
 * fix Makefile, test paths, all_from
 * add Changes, README
 * clean little type in pod
 * add fr po file


Added: plugins/Jifty-Plugin-Comment/Changes
==============================================================================
--- (empty file)
+++ plugins/Jifty-Plugin-Comment/Changes	Wed Jun 10 03:37:18 2009
@@ -0,0 +1,4 @@
+Revision history for Perl module Jifty::Plugin::Comment
+
+0.9  Wed, 10 Jun 2009 09:33:32 +0200
+    - original version for CPAN

Modified: plugins/Jifty-Plugin-Comment/Makefile.PL
==============================================================================
--- plugins/Jifty-Plugin-Comment/Makefile.PL	(original)
+++ plugins/Jifty-Plugin-Comment/Makefile.PL	Wed Jun 10 03:37:18 2009
@@ -1,11 +1,11 @@
-use inc::Module::Install 0.46;
+use inc::Module::Install;
 name('Jifty-Plugin-Comment');
-version_from('lib/Jifty/Plugin/Comment.pm');
+all_from('lib/Jifty/Plugin/Comment.pm');
 
 requires('Jifty');
 
 auto_install();
-tests(qw( t/*/t/*.t ));
+tests('t/*.t t/*/t/*.t');
 
 install_share;
 

Added: plugins/Jifty-Plugin-Comment/README
==============================================================================
--- (empty file)
+++ plugins/Jifty-Plugin-Comment/README	Wed Jun 10 03:37:18 2009
@@ -0,0 +1,141 @@
+NAME
+    Jifty::Plugin::Comment - Add comments to any record
+
+SYNOPSIS
+    Setup the config.yml
+
+      Plugins:
+        - Comment:
+
+          # Set this if you want spam checking by Net::Akismet
+          Akismet:
+            Key: 1234567890a
+            Url: http://example.com
+
+          # Set this if you want to customize the HTML scrubbing of comments
+          Scrubber:
+            message: "Comments may only contain <strong>, <em>, and <a> tags."
+            allow:
+              - strong
+              - em
+              - a
+            default:
+              - 0
+              - 
+                '*': 0
+                href: !!perl/regexp:
+                  REGEXP: '^(?!(?:java)?script)'
+                  MODIFIERS: i
+
+    Setup a model that has comments:
+
+      package App::Model::Fooble;
+
+      use Jifty::DBI::Schema;
+      use App::Record schema {
+          column scribble => type is 'text';
+          column wobble => type is 'int';
+      };
+
+      use Jifty::Plugin::Comment::Mixin::Model::Commented;
+
+      sub allow_owner_update_delete {
+          my $self = shift;
+          my ($right, %args) = @_;
+
+          if ($right eq 'create') {
+              return 'allow' ;#if $self->current_user->id;
+          }
+
+          if ($right eq 'update' || $right eq 'delete') {
+              return 'allow' if $self->current_user->id;
+          }
+
+          if ($right eq 'read') {
+              return 'allow';
+          }
+
+          return 'deny';
+      };
+
+      App::Model::FoobleComment->add_trigger( name => 'before_access', callback => \&allow_owner_update_delete);
+      App::Model::Comment->add_trigger( name => 'before_access', callback => \&allow_owner_update_delete);
+
+    Setup a view for creating, viewing, and managing the comments:
+
+      # assuming $fooble here isa App::Action::UpdateFooble object
+      template 'fooble/view' => page {
+          my $fooble = get 'fooble';
+
+          render_action $fooble, undef, { render_mode => 'read' };
+
+          render_region
+              name     => 'fooble-comments',
+              path     => '__comment/list_and_add',
+              defaults => { 
+                  comment_upon  => $fooble->record->for_commenting,
+                  initial_title => 'Re: '.substr($fooble->scribble, 0, 20).'...',
+              },
+              ;
+      };
+
+DESCRIPTION
+    This plugin allows you to attach comments to any model. You do this
+    using the three steps listed in the synopsis. For variations on these
+    steps, see the other classes that handle the individual parts.
+
+COMMENTED RECORDS
+    To set up a commented model, you will need to do the following:
+
+    1 Add ths plugin to your project by modifying your config.yml.
+    1 Add the Jifty::Plugin::Comment::Mixin::Model::Commented mixin to the
+    model or models that you want to have comments attached to. See that
+    class for details on how it works. You may also want to examine
+    Jifty::Plugin::Comment::Model::Comment on how to customize that class
+    for your application.
+    1 Create a view that appends a comment editor to your edit form (or on a
+    separate page or wherever you feel like comments work best in your
+    application). You should be able to use these views from either
+    Template::Declare or HTML::Mason templates. See
+    Jifty::Plugin::Comment::View for additional details on what views are
+    available.
+
+METHODS
+  init
+    Called during initialization. This will setup the Net::Akismet object if
+    it is configured and available.
+
+  akismet
+    This returns an instance of Net::Akismet that is used to check to see if
+    a new comment posted contains spam. No such checking is performed if
+    this returns "undef", which indicates that "Net::Akismet" is
+    unavailable, wasn't configured, or there was an error configuring it
+    (e.g., the Akismet server was unavailable during Jifty startup).
+
+  scrubber
+    This returns an instance of HTML::Scrubber that is used to clean up HTML
+    submitted in comments.
+
+TO DO
+    Right now the module depends directly upon HTML::Scrubber to do the work
+    of cleaning up the text. You might want to use something else to do
+    this. It also provides no mechanism for customizing any other aspect of
+    the formatting. For example, your application might want to use
+    Markdown, or BBCode, or just turn line breaks in the BR-tags, or
+    anything else to format the comment text.
+
+    In the future, I'd like to consider something like Text::Pipe or a
+    similar API to allow these formats to be customized more easily.
+
+SEE ALSO
+    Net::Akismet, HTML::Scrubber
+
+AUTHOR
+    Andrew Sterling Hanenkamp, "<hanenkamp at 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.
+

Modified: plugins/Jifty-Plugin-Comment/lib/Jifty/Plugin/Comment.pm
==============================================================================
--- plugins/Jifty-Plugin-Comment/lib/Jifty/Plugin/Comment.pm	(original)
+++ plugins/Jifty-Plugin-Comment/lib/Jifty/Plugin/Comment.pm	Wed Jun 10 03:37:18 2009
@@ -20,7 +20,7 @@
 
   Plugins:
     - Comment:
-      
+
       # Set this if you want spam checking by Net::Akismet
       Akismet:
         Key: 1234567890a
@@ -44,7 +44,7 @@
 Setup a model that has comments:
 
   package App::Model::Fooble;
-  
+
   use Jifty::DBI::Schema;
   use App::Record schema {
       column scribble => type is 'text';

Added: plugins/Jifty-Plugin-Comment/share/po/fr.po
==============================================================================
--- (empty file)
+++ plugins/Jifty-Plugin-Comment/share/po/fr.po	Wed Jun 10 03:37:18 2009
@@ -0,0 +1,124 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# Yves Agostini <agostini at univ-metz.fr>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2009-06-10 08:39:17+0200\n"
+"PO-Revision-Date: 2009-06-10 08:39:17+0200\n"
+"Last-Translator: Yves Agostini <agostini at univ-metz.fr>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: plugins/Comment/lib/Jifty/Plugin/Comment/Notification/CommentNeedsModeration.pm:73
+#. ($url,         $self->parent->title,        $comment->title,         $from,         $comment->created_on->strftime('%A, %B %d, %Y @ %H:%M%P')
+msgid ""
+"\n"
+"The following comment has not been published. If you would like to publish it, please visit the link below and click on the \"publish\" link. If it has been marked as spam and should not have been you should also click on the \"mark as ham\" link.\n"
+"\n"
+"View Comment: %1\n"
+"\n"
+"On Post: %2\n"
+"Subject: %3\n"
+"From: %4\n"
+"Date: %5\n"
+"\n"
+"%6\n"
+msgstr ""
+"\n"
+"Le commentaire suivant n'a pas encore été publié. Si vous voulez le publier, consultez le lien ci-dessous et cliquez sur le lien \"publier\". S'il a été marqué par erreur comme spam, cliquez sur le lien \"marquer comme han\".\n"
+"\n"
+"Commentaire: %1\n"
+"\n"
+"Sur le billet: %2\n"
+"Sujet: %3\n"
+"De: %4\n"
+"Date: %5\n"
+"\n"
+"%6\n"
+
+#: plugins/Comment/lib/Jifty/Plugin/Comment/Notification/CommentPublished.pm:71
+#. ($url,        $self->parent->title,        $comment->title,         $from,         $comment->created_on->strftime('%A, %B %d, %Y @ %H:%M%P')
+msgid ""
+"\n"
+"View Comment: %1\n"
+"\n"
+"On Post: %2\n"
+"Subject: %3\n"
+"From: %4\n"
+"Date: %5\n"
+"\n"
+"%6\n"
+msgstr ""
+"\n"
+"Commentaire: %1\n"
+"\n"
+"Sur le billet: %2\n"
+"Sujet: %3\n"
+"De: %4\n"
+"Date: %5\n"
+"\n"
+"%6\n"
+
+#: plugins/Comment/lib/Jifty/Plugin/Comment/View.pm:165
+msgid "Add a comment"
+msgstr "Ajouter un commentaire"
+
+#: plugins/Comment/t/TestApp-Plugin-Comments/lib/TestApp/Plugin/Comments/View.pm:22
+#. ($blog->author)
+msgid "By %1"
+msgstr "Par %1"
+
+#: plugins/Comment/lib/Jifty/Plugin/Comment/View.pm:138 plugins/Comment/lib/Jifty/Plugin/Comment/View.pm:197
+#. ($poster,                     $created_on->strftime('%A, %B %d, %Y @ %H:%M%P')
+#. ($poster,                             $created_on->strftime('%A, %B %d, %Y @ %H:%M%P')
+msgid "By %1 %2"
+msgstr "Par %1 %2"
+
+#: plugins/Comment/lib/Jifty/Plugin/Comment/View.pm:304
+msgid "No one has made a comment yet."
+msgstr "Aucun commentaire pour l'instant"
+
+#: plugins/Comment/t/TestApp-Plugin-Comments/lib/TestApp/Plugin/Comments/View.pm:13
+msgid "Post"
+msgstr "Poster"
+
+#: plugins/Comment/lib/Jifty/Plugin/Comment/View.pm:221
+msgid "Preview"
+msgstr "Aperçu"
+
+#: plugins/Comment/lib/Jifty/Plugin/Comment/View.pm:236
+msgid "Submit"
+msgstr "Soumettre"
+
+#: plugins/Comment/lib/Jifty/Plugin/Comment/Action/CreateComment.pm:268
+msgid "Your comment has been added. If it does not immediately appear, it may have been flagged for moderation and should appear shortly."
+msgstr "Votre commentaire a été ajouté. S'il n'apparaît pas immédiatement, c'est qu'il est en attente de modération et sera bientôt publié."
+
+#: plugins/Comment/lib/Jifty/Plugin/Comment/Notification/CommentNeedsModeration.pm:67
+#. ($appname, $comment->title)
+msgid "[%1] Moderate comment: %2"
+msgstr "[%1] Commentaire modéré : %2"
+
+#: plugins/Comment/lib/Jifty/Plugin/Comment/Notification/CommentPublished.pm:65
+#. ($appname, $comment->title)
+msgid "[%1] New comment: %2"
+msgstr "[%1] Nouveau commentaire : %2"
+
+#: plugins/Comment/lib/Jifty/Plugin/Comment/View.pm:87
+#. ($status)
+msgid "mark as %1"
+msgstr "marquer comme %1"
+
+#: plugins/Comment/lib/Jifty/Plugin/Comment/View.pm:100
+msgid "publish"
+msgstr "publier"
+
+#: plugins/Comment/lib/Jifty/Plugin/Comment/View.pm:100
+msgid "unpublish"
+msgstr "ne pas publier"


More information about the Jifty-commit mailing list