Integrate Vanilla 2 Into Your Akelos App

Integrate Vanilla 2 into your Akelos App

Description

This is a How-to about integrating the awesome Vanilla 2 Forum Framework into Akelos.
In this manual, Vanilla 2 is being rewritten as an Akelos-Module named forum inside an existing Akelos Application.

It is based on Vanilla 2.0 Release Candidate 1 (Vanilla_2.0_rc1, vanillaforums-Garden-cb12ba2)

Installation

  1. Setup your application: Windows | Mac OS X
  2. Install the Akelos module Admin Plugin
  3. Download the Vanilla 2-Source
  4. Install a Vanilla 2 environment (http://yourhost.com/vanillaforums/)

Overview

Models

Model Vanilla Akelos /models/
Category /models/class.categorymodel.php
/modules/class.categoriesmodule.php
forum_category.php
Comment /models/class.commentmodel.php forum_comment.php
Discussion /models/class.discussionmodel.php
/modules/class.bookmarkedmodule.php
forum_discussions.php
Draft /models/class.draftmodel.php
/modules/class.draftsmodule.php
forum_drafts.php
Search /models/class.vanillasearchmodel.php forum_search.php
Vanilla /models/class.vanillamodel.php forum_vanilla.php

Controllers

Controller Vanilla Akelos /controllers/
forum - forum_controller.php
categories /controllers/class.categoriescontroller.php /forum/categories_controller.php
discussions /controllers/class.discussioncontroller.php
/controllers/class.discussionscontroller.php
/forum/disscussions_controller.php
drafts /controllers/class.draftscontroller.php /forum/drafts_controller.php
post /controllers/class.postcontroller.php /forum/post_controller.php
settings /controllers/class.settingscontroller.php /forum/settings_controller.php
vanilla /controllers/class.vanillacontroller.php /forum/vanilla_controller.php
Validate

Make sure in the forum_controller.php it reads:

class ForumController extends ApplicationController
    {
        // Your Code here...
    }

And in all module specific Controllers (everything in /forum/*_controller.php):

class Forum_CategoriesController extends ForumController
    {
        // Your Code here...
    }

Installers

  • /installers/forum/category_installer.php
  • /installers/forum/comment_installer.php
  • /installers/forum/discussion_installer.php
  • /installers/forum/draft_installer.php
  • /installers/forum/search_installer.php
  • /installers/forum/vanilla_installer.php
Validate

Make sure that in all module specific Installers (everything in /installers/forum/*_installer.php) it reads:

class CategoryInstaller extends AkInstaller
    {
        var $module = 'forum';
 
        // Your Code here...
 
    }

Views

View Vanilla Akelos /views/
categories /views/categories/ /forum/categories/
discussions /views/discussion/
/views/discussions/
/forum/discussions/
drafts /views/drafts/ /forum/drafts/
post /views/post/ /forum/post/
settings /views/settings/ /forum/settings/

Setup

Routes

  • Add the following Route directive to /your_akelos_app/config/routes.php (in the very top before all other routes!):
/**
 * Vanilla 2 Forum
 */
$Map->connect('/forum/:controller/:action/:id', array('module' => 'forum', 'controller' => 'discussions', 'action' => 'index'));

Categories

  • Generate Model & Controller
  ./script/generate model Forum::Category
  ./script/generate controller Forum::categories
  • Add the Table-scheme to the /installers/forum/category_installer.php:
$this->createTable('forum_categories', "
	id,
	parent_id,
	discussion_count,
	do_allow_discussion integer(4) default 1,
	name string(30),
	urlcode string(30),
	description,
	sort_by,
	created_by integer not null,
	created_at datetime not null,
	updated_by,
	updated_at
");
  • Migrate using:
  ./script/migrate forum::category install

Comments

  • Generate Model
  ./script/generate model Forum::Comment
  • Add the Table-scheme to the /installers/forum/comment_installer.php:
$this->createTable('forum_comments', "
	id,
	discussion_id,
	created_by,
	created_at,
	updated_by,
	updated_at,
	deleted_by,
	deleted_at,
	body text not null,
	format string(20),
	flag integer(4) default 0,
	score float(10.2),
	attribs
");
  • Migrate using:
  ./script/migrate forum::comment install

Discussions

  • Generate Model & Controller
  ./script/generate model Forum::Discussion
  ./script/generate controller Forum::discussions
  • Add the Table-scheme to the /installers/forum/discussion_installer.php:
$this->createTable('forum_discussions', "
	id,
	category_id,
	created_by integer not null,
	created_at datetime not null,
	updated_by,
	updated_at,
	last_comment_by,
	last_comment_at,
	last_comment_id,
	name string(100) not null,
	body text not null,
	format string(20),
	comment_count integer default 1,
	closed integer(1) default 0,
	announce integer(1) default 0,
	sink integer(1) default 0,
	score float(10.2),
	attribs
");
  • Migrate using:
  ./script/migrate forum::discussion install

Draft

  • Generate Model & Controller
  ./script/generate model Forum::Draft
  ./script/generate controller Forum::drafts

Post Actions

  • Generate Controller
  ./script/generate controller Forum::post

Search

  • Generate Model
  ./script/generate model Forum::Search

Settings

  • Generate Controller
  ./script/generate controller Forum::settings

Vanilla

  • Generate Model & Controller
  ./script/generate model Forum::Vanilla
  ./script/generate controller Forum::vanilla

Various

Javascript
  • Move all JS files from /vanilla/applications/vanilla/js/ → /your_akelos_app/public/javascripts/
 
how-to-vanilla2.txt · Last modified: 2010/05/18 13:07 by 213.144.156.246
 

The Akelos Framework was created by Bermi Ferrer and other contributors.
Potions of the code and documentation have been ported from Ruby on Rails.

The Akelos Framework is released under the LGPL license.

"Akelos", "Akelos Framework", and the Akelos logo are trademarks of Bermi Labs All rights reserved.

Wiki driven by DokuWiki