Permalink
Browse files

added post & topic generator

just a basic addition to be able to manage posts & topics from the backend
+ add a link to my personal website for a "live demo"
  • Loading branch information...
j0k3r committed Jan 17, 2012
1 parent e8225fb commit 784a105b76e5deea20365e8981922d58910bac4f
View
@@ -4,7 +4,7 @@ This is a port of sfSimpleForumPlugin for Doctrine & Symfony 1.4
It relies on an already working registration process (using sfDoctrineGuardPlugin)
-Screenshots are available [in the wiki](https://github.com/j0k3r/sfDoctrineSimpleForumPlugin/wiki/Screenshots).
+Screenshots are available [in the wiki](https://github.com/j0k3r/sfDoctrineSimpleForumPlugin/wiki/Screenshots) and if you want to test it, the plugin is live on [my personal website](http://www.j0k3r.net/forum).
Requirements
@@ -90,13 +90,15 @@ If you want to enable the plugin administration interface, you have to enable tw
# in myproject/apps/backend/config/settings.yml
all:
.settings:
- enabled_modules: [sfSimpleForumCategoryAdmin, sfSimpleForumForumAdmin, sfSimpleForumRankAdmin, default]
+ enabled_modules: [sfSimpleForumCategoryAdmin, sfSimpleForumForumAdmin, sfSimpleForumTopicAdmin, sfSimpleForumPostAdmin, sfSimpleForumRankAdmin, default]
```
Configure the plugin categories and forums by browsing to the administration modules default pages (assuming your backend application is called _backend_):
http://myproject/backend_dev.php/sfSimpleForumCategoryAdmin
http://myproject/backend_dev.php/sfSimpleForumForumAdmin
+ http://myproject/backend_dev.php/sfSimpleForumTopicAdmin
+ http://myproject/backend_dev.php/sfSimpleForumPostAdmin
http://myproject/backend_dev.php/sfSimpleForumRankAdmin
Configuration
@@ -24,7 +24,7 @@ class sfDoctrineSimpleForumPluginConfiguration extends sfPluginConfiguration {
*/
public function initialize()
{
- foreach (array('sfSimpleForumCategoryAdmin', 'sfSimpleForumForumAdmin','sfSimpleForumRankAdmin') as $module)
+ foreach (array('sfSimpleForumCategoryAdmin', 'sfSimpleForumForumAdmin', 'sfSimpleForumRankAdmin', 'sfSimpleForumPostAdmin', 'sfSimpleForumTopicAdmin') as $module)
{
if (in_array($module, sfConfig::get('sf_enabled_modules', array())))
{
@@ -48,6 +48,44 @@ static public function addRouteForCategoryAdmin(sfEvent $event)
)));
}
+ /**
+ * Adds an sfDoctrineRouteCollection collection to manage posts.
+ *
+ * @param sfEvent $event
+ * @static
+ */
+ static public function addRouteForPostAdmin(sfEvent $event)
+ {
+ $event->getSubject()->prependRoute('post_admin', new sfDoctrineRouteCollection(array(
+ 'name' => 'post_admin',
+ 'model' => 'sfSimpleForumPost',
+ 'module' => 'sfSimpleForumPostAdmin',
+ 'prefix_path' => 'forum/post',
+ 'with_wildcard_routes' => true,
+ 'collection_actions' => array('filter' => 'post', 'batch' => 'post'),
+ 'requirements' => array(),
+ )));
+ }
+
+ /**
+ * Adds an sfDoctrineRouteCollection collection to manage posts.
+ *
+ * @param sfEvent $event
+ * @static
+ */
+ static public function addRouteForTopicAdmin(sfEvent $event)
+ {
+ $event->getSubject()->prependRoute('topic_admin', new sfDoctrineRouteCollection(array(
+ 'name' => 'topic_admin',
+ 'model' => 'sfSimpleForumTopic',
+ 'module' => 'sfSimpleForumTopicAdmin',
+ 'prefix_path' => 'forum/topic',
+ 'with_wildcard_routes' => true,
+ 'collection_actions' => array('filter' => 'post', 'batch' => 'post'),
+ 'requirements' => array(),
+ )));
+ }
+
/**
* Adds an sfDoctrineRouteCollection collection to manage categories.
*
@@ -13,7 +13,7 @@ generator:
config:
actions: ~
fields: ~
-
+
list:
title: Category Administration
display: [=name, description, rank]
@@ -0,0 +1,16 @@
+<?php
+
+require_once dirname(__FILE__).'/../lib/sfSimpleForumPostAdminGeneratorConfiguration.class.php';
+require_once dirname(__FILE__).'/../lib/sfSimpleForumPostAdminGeneratorHelper.class.php';
+
+/**
+ * sfSimpleForumPostAdmin actions.
+ *
+ * @package forum
+ * @subpackage sfSimpleForumPostAdmin
+ * @author Your name here
+ * @version SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $
+ */
+class sfSimpleForumPostAdminActions extends autosfSimpleForumPostAdminActions
+{
+}
@@ -0,0 +1,24 @@
+generator:
+ class: sfDoctrineGenerator
+ param:
+ model_class: sfSimpleForumPost
+ theme: admin
+ non_verbose_templates: true
+ with_show: false
+ singular: ~
+ plural: ~
+ route_prefix: post_admin
+ with_doctrine_route: true
+
+ config:
+ actions: ~
+ fields: ~
+ list:
+ title: Posts Administration
+ display: [=title, _forum, _topic]
+ sort: [id, desc]
+ filter:
+ display: [title, forum_id, topic_id]
+ edit:
+ title: Edit post "%%title%%"
+ display: [title, content]
@@ -0,0 +1,4 @@
+all:
+ metas:
+ title: Posts Administration
+ stylesheets: [/sfSimpleForumPlugin/css/admin.css: { position: last } ]
@@ -0,0 +1,13 @@
+<?php
+
+/**
+ * sfSimpleForumPostAdmin module helper.
+ *
+ * @package sfSimpleForumPlugin
+ * @subpackage sfSimpleForumPostAdmin
+ * @author Fabien Potencier
+ * @version SVN: $Id: sfSimpleBlogCommentAdminGeneratorConfiguration.class.php 12896 2008-11-10 19:02:34Z fabien $
+ */
+class sfSimpleForumPostAdminGeneratorConfiguration extends BaseSfSimpleForumPostAdminGeneratorConfiguration
+{
+}
@@ -0,0 +1,13 @@
+<?php
+
+/**
+ * sfSimpleForumPostAdmin module helper.
+ *
+ * @package sfSimpleForumPlugin
+ * @subpackage sfSimpleForumPostAdmin
+ * @author Fabien Potencier
+ * @version SVN: $Id: sfSimpleBlogCommentAdminGeneratorHelper.class.php 12896 2008-11-10 19:02:34Z fabien $
+ */
+class sfSimpleForumPostAdminGeneratorHelper extends BaseSfSimpleForumPostAdminGeneratorHelper
+{
+}
@@ -0,0 +1 @@
+<?php echo link_to($sf_simple_forum_post->getsfSimpleForumForum()->getName(), 'sfSimpleForumForumAdmin/edit?id='.$sf_simple_forum_post->getsfSimpleForumForum()->getId()) ?>
@@ -0,0 +1 @@
+<?php echo link_to($sf_simple_forum_post->getsfSimpleForumTopic()->getTitle(), 'sfSimpleForumTopicAdmin/edit?id='.$sf_simple_forum_post->getsfSimpleForumTopic()->getId()) ?>
@@ -0,0 +1,16 @@
+<?php
+
+require_once dirname(__FILE__).'/../lib/sfSimpleForumTopicAdminGeneratorConfiguration.class.php';
+require_once dirname(__FILE__).'/../lib/sfSimpleForumTopicAdminGeneratorHelper.class.php';
+
+/**
+ * sfSimpleForumTopicAdmin actions.
+ *
+ * @package forum
+ * @subpackage sfSimpleForumTopicAdmin
+ * @author Your name here
+ * @version SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $
+ */
+class sfSimpleForumTopicAdminActions extends autosfSimpleForumTopicAdminActions
+{
+}
@@ -0,0 +1,24 @@
+generator:
+ class: sfDoctrineGenerator
+ param:
+ model_class: sfSimpleForumTopic
+ theme: admin
+ non_verbose_templates: true
+ with_show: false
+ singular: ~
+ plural: ~
+ route_prefix: topic_admin
+ with_doctrine_route: true
+
+ config:
+ actions: ~
+ fields: ~
+ list:
+ title: Topics Administration
+ display: [=title, _forum, nb_posts, nb_views, nb_recommandations, is_sticked, is_locked]
+ sort: [id, desc]
+ filter:
+ display: [title, forum_id, is_sticked, is_locked]
+ edit:
+ title: Edit topic "%%title%%"
+ display: [title, is_sticked, is_locked]
@@ -0,0 +1,4 @@
+all:
+ metas:
+ title: Posts Administration
+ stylesheets: [/sfSimpleForumPlugin/css/admin.css: { position: last } ]
@@ -0,0 +1,13 @@
+<?php
+
+/**
+ * sfSimpleForumTopicAdmin module helper.
+ *
+ * @package sfSimpleForumPlugin
+ * @subpackage sfSimpleForumTopicAdmin
+ * @author Fabien Potencier
+ * @version SVN: $Id: sfSimpleBlogCommentAdminGeneratorConfiguration.class.php 12896 2008-11-10 19:02:34Z fabien $
+ */
+class sfSimpleForumTopicAdminGeneratorConfiguration extends BaseSfSimpleForumTopicAdminGeneratorConfiguration
+{
+}
@@ -0,0 +1,13 @@
+<?php
+
+/**
+ * sfSimpleForumTopicAdmin module helper.
+ *
+ * @package sfSimpleForumPlugin
+ * @subpackage sfSimpleForumTopicAdmin
+ * @author Fabien Potencier
+ * @version SVN: $Id: sfSimpleBlogCommentAdminGeneratorHelper.class.php 12896 2008-11-10 19:02:34Z fabien $
+ */
+class sfSimpleForumTopicAdminGeneratorHelper extends BaseSfSimpleForumTopicAdminGeneratorHelper
+{
+}
@@ -0,0 +1 @@
+<?php echo link_to($sf_simple_forum_topic->getsfSimpleForumForum()->getName(), 'sfSimpleForumForumAdmin/edit?id='.$sf_simple_forum_topic->getsfSimpleForumForum()->getId()) ?>

0 comments on commit 784a105

Please sign in to comment.