A Simple CMS for Grails

  • Tags: cms
  • Latest: 0.1.7.8
  • Last Updated: 21 August 2009
  • Grails version: 1.1.1 > *
  • Authors: null
3 votes
Dependency:
compile ":cms:0.1.7.8"

 Documentation

Summary

Installation

As usual "grails install-plugin cms"

There is an issue with the fckeditor plugin on Linux. If you get an error about missing dependencies:
  • uninstall the cms plugin
  • install fckeditor 0.9.1 "grails install-plugin fckeditor 0.9.1"
  • install the cms plugin

Description

This plugin is no longer maintained. I have shifted users over to the weceem plugin. Thank you

I have begun the process of integrating the functionality from this plugin into a series of plugins for the weceem cms plugin. This will provide needed functionality and flexibility to both plugins as well as combining development resources.

I will be writing migration documentation as well as scripts for people using this plugin to the new plugins. If you have any questions, please feel free to write to the email address listed at the bottom of this document.

Provides basic CMS functionality. For example, you can create nodes of different types and access them from multi-level menus. Nodes can be displayed as blocks or pages. The plugin also provides for nodes in multiple languages. In short, this plugin provides a 'Developers CMS'

Several tags are provided to so that CMS components can be used anywhere in the site. This allows the site to be built as a full or partial CMS site.

This plugin was developed with two goals, provide a simple flexible way for developers to provide CMS functionality without having to work around a framework and provide a high performance CMS.

Major Features

  • Create nodes of any type easily
  • Create/display tree menus that can point to nodes or external urls
  • Menus can be displayed at any level
  • WYSIWYG editing with fckeditor
  • Images are stored outside of the project to allow for portability
  • Create your own templates to work with nodes quickly using tags for common fields
  • Restrict access based on roles
  • Nodes in different languages are related with 'outdated translation' notification
  • CSS styling is very easy. All nodes/menus.. are surrounded by divs that include classes and unique ids

Screencasts

Note: .ogv is higher quality

I mistakenly set hideTitle=false in the integration video, should be hideTitle=true

Quickstart Guide

The best way to get started is to install the plugin into a new grails application and make a couple of simple changes. To see how to create new node types, checkout the source code and look at class StandardNode.

Add the following to Config.groovy

fckeditor {
    upload {
        overwrite = false
        link {
            browser = true
            upload = true
            allowed = []
            denied = ['html', 'htm', 'php', 'php2', 'php3', 'php4', 'php5', 'phtml', 'pwml', 'inc', 'asp', 'aspx', 'ascx', 'jsp',
                      'cfm', 'cfc', 'pl', 'bat', 'exe', 'com', 'dll', 'vbs', 'js', 'reg',
                      'cgi', 'htaccess', 'asis', 'sh', 'shtml', 'shtm', 'phtm']
        }
        image {
            browser = true
            upload = true
            allowed = ['jpg', 'gif', 'jpeg', 'png']
            denied = []
        }
        flash {
            browser = false
            upload = false
            allowed = ['swf']
            denied = []
        }
        media {
            browser = false
            upload = false
            allowed = ['mpg','mpeg','avi','wmv','asf','mov']
            denied = []
        }
    }
}

environments { production { fckeditor.upload.basedir = "/var/www/html/resources" fckeditor.upload.baseurl = "http://smartwebsystems.biz/resources" staticresources.production.resource.prefix = "http://smartwebsystems.biz/resources" }

development { fckeditor.upload.basedir = "${System.properties['user.dir']}/static/" fckeditor.upload.baseurl = "http://localhost:8088" }

test { fckeditor.upload.basedir = "${System.properties['user.dir']}/static/" fckeditor.upload.baseurl = "http://localhost:8088" } }

Replace main.gsp in layouts with the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="${resource(dir:'css',file:'main.css')}" /> <cms:cmsHead /> <g:javascript library="jquery" /> <title><g:layoutTitle /></title> <g:layoutHead /> </head> <body> <div id="demo"> <div class="header"> <cms:searchBox /> <cms:languageSwitch /> <h1>CMS Plugin</h1> </div> <div id="sidebar"> <cms:menu name="primary" /> <cms:menu name="admin" /> </div> <div id="content"> <g:layoutBody /> </div> </div> </body> </html>

Run the newly created grails application

Default admin username/password is 'admin'/'admin'

Plugins used by the CMS plugin

The CMS plugin uses several plugins:

  • acegi - User authentication and roles
  • formHelper - Form elements
  • fckeditor - Editing of content
  • searchable - Searching content
  • staticResources - storing of images and documents

Tags

<cms:cmsHead>

Adds some css and javascript needed for the cms admin pages

<cms:searchBox>

Adds the search box

Attributes

  • label - the label to put on the search box (default: 'Search:')

<cms:imageSelect>

Adds a image select box to a node edit template. The directory where images are selected from is the same directory that fckeditor uses for images.

Attributes

  • label - The label to put on the image select widget (optional)
  • name - A unique name for the loading container

<cms:node>

Displays a node from the database given either the node object or the path of the node to display

Attributes

  • node - the Node object to display (optional)
  • path - the path assigned to the node to display (optional)

<cms:nodeArchive>

Displays a node archive list similar to most blogs

Attributes

  • maxMonths - The maximum number of months to display (defaults to 12)
  • type - The node type to display archive for

<cms:nodeSummary>

Displays a summary of the most recent nodes created. Similar to most blogs

Attributes

  • max - The maximum number of nodes to list
.h2. <cms:commonNodeFields>

Displays the common fields used when creating and editing a node. Should be placed in custom node templates

Attributes

  • node - The node to update

<cms:nodeLayout>

This tag should be placed around all nodes. It is the node wrapper that includes the named divs and the option buttons for the node. The content of the node goes in the body of this tag.

Attributes

  • node - The node requiring layout

<cms:adminMenu>

Renders the admin menu for the CMS based on the permissions of the current user

Attributes

None

<cms:menu>

Renders a menu. Menus can be multi-level or from a single level.

Attributes

You must provide either a menu object or a name of a menu
  • menu - The menu object to render
  • name - The name of the menu to render
  • minLevel - The minimum menu level to render (used for secondary menus, default: 0)
  • maxLevel - The maximum level to render (default: 100)
  • hideTitle - Hide the menu title (true or false)

<cms:nodeBody>

Renders the body part of a node. Used to un-tokenize certain parts of the body that are tokenized before they are saved to aid in database portability

Attributes

  • node - The node to extract the body from

<cms:nodeTitle>

Renders the node title only if the hideTitle property is not set on the node.

Attributes

  • node - The node to extract the title from

<cms:languageSwitch>

Renders the language switch used to switch between languages.

<cms:ifLanguage>

Renders the body of the tag only if the current language is the language passed in the attribute

Attributes

  • language - The language code (eg. 'en')

Additional Notes

The cms plugin does not work well with Grails 1.2-M1 due to a issue with Hibernate. This issue was resolved in Grails 1.2-M2.

Contact: scott at bulldoginfo dot com

Contributors to the project are very welcome