Skip to content
This repository
Browse code

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...
commit 784a105b76e5deea20365e8981922d58910bac4f 1 parent e8225fb
Jeremy authored January 17, 2012
6  README.markdown
Source Rendered
@@ -4,7 +4,7 @@ This is a port of sfSimpleForumPlugin for Doctrine & Symfony 1.4
4 4
 
5 5
 It relies on an already working registration process (using sfDoctrineGuardPlugin)
6 6
 
7  
-Screenshots are available [in the wiki](https://github.com/j0k3r/sfDoctrineSimpleForumPlugin/wiki/Screenshots).
  7
+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).
8 8
 
9 9
 
10 10
 Requirements
@@ -90,13 +90,15 @@ If you want to enable the plugin administration interface, you have to enable tw
90 90
     # in myproject/apps/backend/config/settings.yml
91 91
     all:
92 92
       .settings:
93  
-        enabled_modules:        [sfSimpleForumCategoryAdmin, sfSimpleForumForumAdmin, sfSimpleForumRankAdmin, default]
  93
+        enabled_modules:        [sfSimpleForumCategoryAdmin, sfSimpleForumForumAdmin, sfSimpleForumTopicAdmin, sfSimpleForumPostAdmin, sfSimpleForumRankAdmin, default]
94 94
 ```
95 95
 
96 96
 Configure the plugin categories and forums by browsing to the administration modules default pages (assuming your backend application is called _backend_):
97 97
 
98 98
     http://myproject/backend_dev.php/sfSimpleForumCategoryAdmin
99 99
     http://myproject/backend_dev.php/sfSimpleForumForumAdmin
  100
+    http://myproject/backend_dev.php/sfSimpleForumTopicAdmin
  101
+    http://myproject/backend_dev.php/sfSimpleForumPostAdmin
100 102
     http://myproject/backend_dev.php/sfSimpleForumRankAdmin
101 103
 
102 104
 Configuration
2  config/sfDoctrineSimpleForumPluginConfiguration.class.php
@@ -24,7 +24,7 @@ class sfDoctrineSimpleForumPluginConfiguration extends sfPluginConfiguration {
24 24
    */
25 25
   public function initialize()
26 26
   {
27  
-    foreach (array('sfSimpleForumCategoryAdmin', 'sfSimpleForumForumAdmin','sfSimpleForumRankAdmin') as $module)
  27
+    foreach (array('sfSimpleForumCategoryAdmin', 'sfSimpleForumForumAdmin', 'sfSimpleForumRankAdmin', 'sfSimpleForumPostAdmin', 'sfSimpleForumTopicAdmin') as $module)
28 28
     {
29 29
       if (in_array($module, sfConfig::get('sf_enabled_modules', array())))
30 30
       {
38  lib/routing/sfDoctrineSimpleForumRouting.class.php
@@ -49,6 +49,44 @@ static public function addRouteForCategoryAdmin(sfEvent $event)
49 49
   }
50 50
 
51 51
   /**
  52
+   * Adds an sfDoctrineRouteCollection collection to manage posts.
  53
+   *
  54
+   * @param sfEvent $event
  55
+   * @static
  56
+   */
  57
+  static public function addRouteForPostAdmin(sfEvent $event)
  58
+  {
  59
+    $event->getSubject()->prependRoute('post_admin', new sfDoctrineRouteCollection(array(
  60
+      'name'                => 'post_admin',
  61
+      'model'               => 'sfSimpleForumPost',
  62
+      'module'              => 'sfSimpleForumPostAdmin',
  63
+      'prefix_path'         => 'forum/post',
  64
+      'with_wildcard_routes' => true,
  65
+      'collection_actions'  => array('filter' => 'post', 'batch' => 'post'),
  66
+      'requirements'        => array(),
  67
+    )));
  68
+  }
  69
+
  70
+  /**
  71
+   * Adds an sfDoctrineRouteCollection collection to manage posts.
  72
+   *
  73
+   * @param sfEvent $event
  74
+   * @static
  75
+   */
  76
+  static public function addRouteForTopicAdmin(sfEvent $event)
  77
+  {
  78
+    $event->getSubject()->prependRoute('topic_admin', new sfDoctrineRouteCollection(array(
  79
+      'name'                => 'topic_admin',
  80
+      'model'               => 'sfSimpleForumTopic',
  81
+      'module'              => 'sfSimpleForumTopicAdmin',
  82
+      'prefix_path'         => 'forum/topic',
  83
+      'with_wildcard_routes' => true,
  84
+      'collection_actions'  => array('filter' => 'post', 'batch' => 'post'),
  85
+      'requirements'        => array(),
  86
+    )));
  87
+  }
  88
+
  89
+  /**
52 90
    * Adds an sfDoctrineRouteCollection collection to manage categories.
53 91
    *
54 92
    * @param sfEvent $event
2  modules/sfSimpleForumCategoryAdmin/config/generator.yml
@@ -13,7 +13,7 @@ generator:
13 13
     config:
14 14
       actions: ~
15 15
       fields: ~
16  
-      
  16
+
17 17
       list:
18 18
         title:              Category Administration
19 19
         display:            [=name, description, rank]
16  modules/sfSimpleForumPostAdmin/actions/actions.class.php
... ...
@@ -0,0 +1,16 @@
  1
+<?php
  2
+
  3
+require_once dirname(__FILE__).'/../lib/sfSimpleForumPostAdminGeneratorConfiguration.class.php';
  4
+require_once dirname(__FILE__).'/../lib/sfSimpleForumPostAdminGeneratorHelper.class.php';
  5
+
  6
+/**
  7
+ * sfSimpleForumPostAdmin actions.
  8
+ *
  9
+ * @package    forum
  10
+ * @subpackage sfSimpleForumPostAdmin
  11
+ * @author     Your name here
  12
+ * @version    SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $
  13
+ */
  14
+class sfSimpleForumPostAdminActions extends autosfSimpleForumPostAdminActions
  15
+{
  16
+}
24  modules/sfSimpleForumPostAdmin/config/generator.yml
... ...
@@ -0,0 +1,24 @@
  1
+generator:
  2
+  class:                    sfDoctrineGenerator
  3
+  param:
  4
+    model_class:            sfSimpleForumPost
  5
+    theme:                  admin
  6
+    non_verbose_templates:  true
  7
+    with_show:              false
  8
+    singular:               ~
  9
+    plural:                 ~
  10
+    route_prefix:           post_admin
  11
+    with_doctrine_route:    true
  12
+
  13
+    config:
  14
+      actions: ~
  15
+      fields: ~
  16
+      list:
  17
+        title:              Posts Administration
  18
+        display:            [=title, _forum, _topic]
  19
+        sort:               [id, desc]
  20
+      filter:
  21
+        display:            [title, forum_id, topic_id]
  22
+      edit:
  23
+        title:              Edit post "%%title%%"
  24
+        display:            [title, content]
4  modules/sfSimpleForumPostAdmin/config/view.yml
... ...
@@ -0,0 +1,4 @@
  1
+all:
  2
+  metas:
  3
+    title: Posts Administration
  4
+  stylesheets: [/sfSimpleForumPlugin/css/admin.css: { position: last } ]
13  modules/sfSimpleForumPostAdmin/lib/sfSimpleForumPostAdminGeneratorConfiguration.class.php
... ...
@@ -0,0 +1,13 @@
  1
+<?php
  2
+
  3
+/**
  4
+ * sfSimpleForumPostAdmin module helper.
  5
+ *
  6
+ * @package    sfSimpleForumPlugin
  7
+ * @subpackage sfSimpleForumPostAdmin
  8
+ * @author     Fabien Potencier
  9
+ * @version    SVN: $Id: sfSimpleBlogCommentAdminGeneratorConfiguration.class.php 12896 2008-11-10 19:02:34Z fabien $
  10
+ */
  11
+class sfSimpleForumPostAdminGeneratorConfiguration extends BaseSfSimpleForumPostAdminGeneratorConfiguration
  12
+{
  13
+}
13  modules/sfSimpleForumPostAdmin/lib/sfSimpleForumPostAdminGeneratorHelper.class.php
... ...
@@ -0,0 +1,13 @@
  1
+<?php
  2
+
  3
+/**
  4
+ * sfSimpleForumPostAdmin module helper.
  5
+ *
  6
+ * @package    sfSimpleForumPlugin
  7
+ * @subpackage sfSimpleForumPostAdmin
  8
+ * @author     Fabien Potencier
  9
+ * @version    SVN: $Id: sfSimpleBlogCommentAdminGeneratorHelper.class.php 12896 2008-11-10 19:02:34Z fabien $
  10
+ */
  11
+class sfSimpleForumPostAdminGeneratorHelper extends BaseSfSimpleForumPostAdminGeneratorHelper
  12
+{
  13
+}
1  modules/sfSimpleForumPostAdmin/templates/_forum.php
... ...
@@ -0,0 +1 @@
  1
+<?php echo link_to($sf_simple_forum_post->getsfSimpleForumForum()->getName(), 'sfSimpleForumForumAdmin/edit?id='.$sf_simple_forum_post->getsfSimpleForumForum()->getId()) ?>
1  modules/sfSimpleForumPostAdmin/templates/_topic.php
... ...
@@ -0,0 +1 @@
  1
+<?php echo link_to($sf_simple_forum_post->getsfSimpleForumTopic()->getTitle(), 'sfSimpleForumTopicAdmin/edit?id='.$sf_simple_forum_post->getsfSimpleForumTopic()->getId()) ?>
16  modules/sfSimpleForumTopicAdmin/actions/actions.class.php
... ...
@@ -0,0 +1,16 @@
  1
+<?php
  2
+
  3
+require_once dirname(__FILE__).'/../lib/sfSimpleForumTopicAdminGeneratorConfiguration.class.php';
  4
+require_once dirname(__FILE__).'/../lib/sfSimpleForumTopicAdminGeneratorHelper.class.php';
  5
+
  6
+/**
  7
+ * sfSimpleForumTopicAdmin actions.
  8
+ *
  9
+ * @package    forum
  10
+ * @subpackage sfSimpleForumTopicAdmin
  11
+ * @author     Your name here
  12
+ * @version    SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $
  13
+ */
  14
+class sfSimpleForumTopicAdminActions extends autosfSimpleForumTopicAdminActions
  15
+{
  16
+}
24  modules/sfSimpleForumTopicAdmin/config/generator.yml
... ...
@@ -0,0 +1,24 @@
  1
+generator:
  2
+  class:                    sfDoctrineGenerator
  3
+  param:
  4
+    model_class:            sfSimpleForumTopic
  5
+    theme:                  admin
  6
+    non_verbose_templates:  true
  7
+    with_show:              false
  8
+    singular:               ~
  9
+    plural:                 ~
  10
+    route_prefix:           topic_admin
  11
+    with_doctrine_route:    true
  12
+
  13
+    config:
  14
+      actions: ~
  15
+      fields: ~
  16
+      list:
  17
+        title:              Topics Administration
  18
+        display:            [=title, _forum, nb_posts, nb_views, nb_recommandations, is_sticked, is_locked]
  19
+        sort:               [id, desc]
  20
+      filter:
  21
+        display:            [title, forum_id, is_sticked, is_locked]
  22
+      edit:
  23
+        title:              Edit topic "%%title%%"
  24
+        display:            [title, is_sticked, is_locked]
4  modules/sfSimpleForumTopicAdmin/config/view.yml
... ...
@@ -0,0 +1,4 @@
  1
+all:
  2
+  metas:
  3
+    title: Posts Administration
  4
+  stylesheets: [/sfSimpleForumPlugin/css/admin.css: { position: last } ]
13  modules/sfSimpleForumTopicAdmin/lib/sfSimpleForumTopicAdminGeneratorConfiguration.class.php
... ...
@@ -0,0 +1,13 @@
  1
+<?php
  2
+
  3
+/**
  4
+ * sfSimpleForumTopicAdmin module helper.
  5
+ *
  6
+ * @package    sfSimpleForumPlugin
  7
+ * @subpackage sfSimpleForumTopicAdmin
  8
+ * @author     Fabien Potencier
  9
+ * @version    SVN: $Id: sfSimpleBlogCommentAdminGeneratorConfiguration.class.php 12896 2008-11-10 19:02:34Z fabien $
  10
+ */
  11
+class sfSimpleForumTopicAdminGeneratorConfiguration extends BaseSfSimpleForumTopicAdminGeneratorConfiguration
  12
+{
  13
+}
13  modules/sfSimpleForumTopicAdmin/lib/sfSimpleForumTopicAdminGeneratorHelper.class.php
... ...
@@ -0,0 +1,13 @@
  1
+<?php
  2
+
  3
+/**
  4
+ * sfSimpleForumTopicAdmin module helper.
  5
+ *
  6
+ * @package    sfSimpleForumPlugin
  7
+ * @subpackage sfSimpleForumTopicAdmin
  8
+ * @author     Fabien Potencier
  9
+ * @version    SVN: $Id: sfSimpleBlogCommentAdminGeneratorHelper.class.php 12896 2008-11-10 19:02:34Z fabien $
  10
+ */
  11
+class sfSimpleForumTopicAdminGeneratorHelper extends BaseSfSimpleForumTopicAdminGeneratorHelper
  12
+{
  13
+}
1  modules/sfSimpleForumTopicAdmin/templates/_forum.php
... ...
@@ -0,0 +1 @@
  1
+<?php echo link_to($sf_simple_forum_topic->getsfSimpleForumForum()->getName(), 'sfSimpleForumForumAdmin/edit?id='.$sf_simple_forum_topic->getsfSimpleForumForum()->getId()) ?>

0 notes on commit 784a105

Please sign in to comment.
Something went wrong with that request. Please try again.