![]() |
|
vjCommentPlugin - 1.2.4Comment behavior + comment's administration and moderation |
|
![]() |
35
users
Sign-in
to change your status |
You want to add comments on news page, pool or anything ? Just use this plugin ! It provides a comment behavior. Now, everything is commentable ! |
| Name | Status | |
|---|---|---|
|
|
lead | rf.fiujelliv-elliv <<ta>> navrom.pj |
|
|
developer | lp.ten.kyzif <<ta>> kyzif |
|
|
developer | moc.citsez <<ta>> poleved |
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
| Version | License | API | Released |
|---|---|---|---|
| 1.2.10stable | MIT license | 1.2.0stable | 20/06/2011 |
| 1.2.9stable | MIT license | 1.2.0stable | 06/04/2011 |
| 1.2.8stable | MIT license | 1.2.0stable | 06/04/2011 |
| 1.2.7stable | MIT license | 1.2.0stable | 10/02/2011 |
| 1.2.6stable | MIT license | 1.2.0stable | 10/12/2010 |
| 1.2.5stable | MIT license | 1.2.0stable | 10/12/2010 |
| 1.2.4stable | MIT license | 1.2.0stable | 10/12/2010 |
| 1.2.3stable | MIT license | 1.2.0stable | 09/12/2010 |
| 1.2.2stable | MIT license | 1.2.2stable | 29/11/2010 |
| 1.2.1stable | MIT license | 1.2.0stable | 07/10/2010 |
| 1.2.0stable | MIT license | 1.2.0stable | 04/10/2010 |
| 1.1.4stable | MIT license | 1.1.0stable | 31/05/2010 |
| 1.1.3stable | MIT license | 1.1.0stable | 23/05/2010 |
| 1.1.1stable | MIT license | 1.0.0stable | 22/04/2010 |
| 1.1.0stable | MIT license | 1.0.0stable | 14/04/2010 |
| 1.0.4stable | MIT license | 0.0.1alpha | 29/03/2010 |
| 1.0.3stable | MIT license | 0.0.1alpha | 26/03/2010 |
| 1.0.2stable | MIT license | 0.0.1alpha | 15/03/2010 |
| 1.0.1stable | MIT license | 0.0.1alpha | 15/03/2010 |
| 1.0.0stable | MIT license | 0.0.1alpha | 15/03/2010 |
| 0.9.9beta | MIT license | 0.0.1alpha | 12/03/2010 |
| 0.9.8beta | MIT license | 0.0.1alpha | 12/03/2010 |
| 0.9.7beta | MIT license | 0.0.1alpha | 12/03/2010 |
| Version | License | API | Released |
|---|---|---|---|
| 1.2.10stable | MIT license | 1.2.0stable | 20/06/2011 |
| 1.2.9stable | MIT license | 1.2.0stable | 06/04/2011 |
| 1.2.8stable | MIT license | 1.2.0stable | 06/04/2011 |
| 1.2.7stable | MIT license | 1.2.0stable | 10/02/2011 |
| 1.2.6stable | MIT license | 1.2.0stable | 10/12/2010 |
| 1.2.5stable | MIT license | 1.2.0stable | 10/12/2010 |
| 1.2.4stable | MIT license | 1.2.0stable | 10/12/2010 |
| 1.2.3stable | MIT license | 1.2.0stable | 09/12/2010 |
| 1.2.2stable | MIT license | 1.2.2stable | 29/11/2010 |
| 1.2.1stable | MIT license | 1.2.0stable | 07/10/2010 |
| 1.2.0stable | MIT license | 1.2.0stable | 04/10/2010 |
| 1.1.4stable | MIT license | 1.1.0stable | 31/05/2010 |
| 1.1.3stable | MIT license | 1.1.0stable | 23/05/2010 |
| 1.1.1stable | MIT license | 1.0.0stable | 22/04/2010 |
| 1.1.0stable | MIT license | 1.0.0stable | 14/04/2010 |
| 1.0.4stable | MIT license | 0.0.1alpha | 29/03/2010 |
| 1.0.3stable | MIT license | 0.0.1alpha | 26/03/2010 |
| 1.0.2stable | MIT license | 0.0.1alpha | 15/03/2010 |
| 1.0.1stable | MIT license | 0.0.1alpha | 15/03/2010 |
| 1.0.0stable | MIT license | 0.0.1alpha | 15/03/2010 |
| 0.9.9beta | MIT license | 0.0.1alpha | 12/03/2010 |
| 0.9.8beta | MIT license | 0.0.1alpha | 12/03/2010 |
| 0.9.7beta | MIT license | 0.0.1alpha | 12/03/2010 |
This plugin proviedes possibility to add commentable functionality to your models, which will allow users to place comments.
A presentation of the plugin is available here.
Install the plugin
$ ./symfony plugin:install vjCommentPlugin
$ ./symfony plugin:publish-assets
$ ./symfony cc
If you do migrations, run them now:
$ ./symfony doctrine:generate-migrations-diff
$ ./symfony doctrine:migrate
Add behavior in your schema:
edit config/doctrine/schema.yml
YourModel:
actAs:
Commentable:
# others behaviors
Build your project:
If it's a new project (you don't have build all, so do it !)
$ ./symfony doctrine:build --all
If it's an old project, you're adding Commentable ability to:
$ ./symfony doctrine:build --all-classes
At this point behaviour doesn't change or add anything to the model, so migrations will do nothing.
Activate module in frontend
edit apps/your_frontend_app/config/settings.yml
enabled_modules: [..., comment]
Add the form and/or the list of comments wherever you want
edit your action file
public function executeIndex(sfWebRequest $request)
{
$this->news = Doctrine::getTable('News')->find($request->getParameter('id'));
}
edit your template file
<?php include_component('comment', 'formComment', array('object' => $yourModelsObject)) ?>
<?php include_component('comment', 'list', array('object' => $yourModelsObject, 'i' => 0)) ?>
And ... that's all ! You only need to get your object and to pass it to the template and two components do the rest.
It's possible to set the sort order of displayed comments to either DESC (newest on top) or ASC (oldest on top):
edit apps/your_frontend_app/config/app.yml
all:
vjCommentPlugin:
list_order: ASC #or DESC
edit apps/your_frontend_app/config/app.yml
all:
vjCommentPlugin:
#false by default
pagination_active: true
#10 by default
max_per_page: 5
Before 1.2.0 version, we used ESC_RAW to render comment's content and only used blockquote, div, br and strong HTML tags. In 1.2.0, we let your escaping strategy working but in most of the cases, HTML tags were escaped.
Since 1.2.1, we've introduced HTML Purifier to do the job. The plugin embeds version 4.2.0 of the library (released on 2010-09-15). By default, we allow blockquote, strong, div and br tags but you can override these.
edit apps/your_frontend_app/config/app.yml
all:
purifier:
#set to false use only your allowed tags
merge: true
#by default, [blockquote,strong,div,br] are allowed
#set to [i,u] with merge to true allows [blockquote,strong,div,br,i,u]
#set to [] with merge to false disables allowed tags
allowed_tags: [i,u]
Since 1.1.0 we've added setting, that would allow you to connect sfGuardUser with comments:
edit apps/your_frontend_app/config/app.yml
all:
vjCommentPlugin:
guardbind: false
restricted: false
First setting adds relation between Comment and sfGuardUser model. After changing this setting, make sure create migrations:
$ ./symfony doctrine:generate-migrations-diff
$ ./symfony doctrine:migrate
$ ./symfony doctrine:build --all-classes
Second setting if set to true restricts comments only to logged in user.
You can define options to retrieve email and website address or name in profile object :
edit apps/your_frontend_app/config/app.yml
all:
vjCommentPlugin:
profile:
# alias between user and profiles tables
alias: Profile
# name of the fields used to retrieve name, email and website informations
field_name: Name
field_email: Email
field_website : Website
The version 5.0.0 of sfDoctrineGuardPlugin introduce a big change in schema : id switched from int(4) to int(8).
To integrate this change into this plugin, you need to overwrite user_id's definition in project's schema definition
with sfDoctrineGuardPlugin since 5.0.0
user_id:
type: integer(8)
notnull: false
You need to enable it in each frontend application
edit apps/your_frontend_app/config/app.yml
all:
recaptcha:
enabled: true
# visit http://recaptcha.net/
public_key: your_public_recaptcha_key
private_key: your_private_recaptcha_key
Gravatar is enabled by default, to disable it
edit apps/your_frontend_app/config/app.yml
all:
gravatar:
enabled: false
You can change default size, image or directories of gravatar
edit apps/your_frontend_app/config/app.yml
all:
gravatar:
default_size: 40
default_image: <?php echo sfConfig::get('sf_web_dir') ?>/images/gravatar_default.png
upload_dir: .. # by default, this uses sf_upload_dir configuration
cache_dir_name: g_cache
Activate modules in backend
edit apps/your_backend_app/config/settings.yml
enabled_modules: [..., commentAdmin, commentReportAdmin]
Moderate comments You can edit a comment, reply to or delete one. Deletion is not permanent ; the comment appears in frontend with the mention 'deleted by moderator'. You can restore it. Reply in backend is same as reply in frontend. You can use the user object to override author values in the form.
Moderate reports You can remove, validate or invalidate a report and edit or remove a comment. There's three states : untreated, validated and invalidated. By default, list only shows untreated reports. You can switch in filters.
In the list of the commentAdmin module, comment's body is truncated to 50 characters by default to keep a readable list. You can edit this option :
edit apps/your_frontend_app/config/app.yml
all:
commentAdmin:
max_length: 50
English (default), French, Italian, Spanish and Polish translations are embed in the plugin.
To use french :
edit apps/your_apps/config/settings.yml
default_culture: fr #en
i18n: true
edit apps/your_apps/config/app.yml
all:
culture_locale: fr_FR.utf8
edit apps/your_apps/config/factories.yml
all:
user:
class: myUser
edit apps/your_apps/lib/myUser.class.php
class myUser extends sfBasicSecurityUser
{
public function setCulture($culture)
{
setlocale(LC_TIME, sfConfig::get('app_culture_locale'));
parent::setCulture($culture);
}
}
copy the generator.yml files
$ cp -r plugins/vjCommentPlugin/more/modules/fr/commentAdmin/ apps/your_backend_app/modules/
$ cp -r plugins/vjCommentPlugin/more/modules/fr/commentReportAdmin/ apps/your_backend_app/modules/
$ symfony cc
don't forget to delete your cookies !
Please contact me if you see a problem, an error or if you think that something can be enhanced ! Advice are cool too !
