Content Management with CatalystX::CMS

Peter Karman

http://www.peknet.com/~karpet/slides/fp/cms

What CatalystX::CMS Is Not

  • Shrink-wrapped magic pill
  • Drupal
  • Workflow nirvana

What CatalystX::CMS Offers

  • Template editor (with YUI Rich Text Editor)
  • CatalystX::CMS::Action class
  • Template Toolkit
  • Subversion

Simple case

package MyApp::Controller::Foo;
use base qw( CatalystX::CMS::Controller );

# view the foo/bar.tt file with
# /foo/bar

# edit the foo/bar.tt file with
# /foo/bar?cxcms=edit

sub bar : Local { }

Less simple case

package MyApp::Controller::Foo;
use base qw( CatalystX::CMS::Controller );

__PACKAGE__->config( 
    action_class_per_action => 1 
);

# view the foo/bar.tt file with
# /foo/bar
# edit the foo/bar.tt file with
# /foo/bar?cxcms=edit

sub bar : Local ActionClass('CMS') { }

# can't edit /foo/bing
sub bing : Local { }

Under the hood



xkcd ftw

ActionClass

Catalyst::Action::CMS isa CatalystX::CMS::Action
sub bar : Local ActionClass('CMS') { }

Configuration: classes

 package MyApp;
 MyApp->config(
    cms => {
        model_name             => 'CMS',
        view_name              => 'CMS',
        actionclass_per_action => 0,
    }
 );

Configuration: GUI options

 package MyApp;
 MyApp->config(
    cms => {
        use_editor             => 1,
        use_layout             => 1,
        editor                 => {
            height => '300',
            width  => '550',
        },
    }
 );

Configuration: model and storage

 package MyApp;
 MyApp->config(
    cms => {
        default_type    => 'html',
        default_flavour => 'default',   
        lock_period     => 3600,
        root => {
            r  => [ MyApp->path_to('root') ],
            rw => [ '/path/to/svn/workdir' ],
        },      
    }
 );

Model: Manager

CatalystX::CMS::Model

  • isa CatalystX::CRUD::Model::File
  • returns CatalystX::CRUD::Page objects

Model: Object

CatalystX::CMS::Page

  • isa CatalystX::CRUD::Object
  • delegates to CatalystX::CMS::File

Model: Storage

CatalystX::CMS::File

  • isa SVN::Class::File
  • isa Path::Class::File::Lockable
  • TODO: other storage classes?

Model: Subversion

SVN::Class

  • isa Path::Class
  • uses IPC::Cmd and the 'svn' command

Model: Locking

Path::Class::File::Lockable

  • isa Path::Class::File
  • non-binding, advisory locks
  • uses File::NFSLock to get lock files

View: TT

CatalystX::CMS::View

  • isa Catalyst::View::TT
  • type and flavour
  • sets CMS hashref with relevant paths

View: YUI

Yahoo User Interface toolkit

http://developer.yahoo.com/yui/
  • Rich Text Editor
  • Layout Manager
  • TreeView
  • Resizable
  • Buttons and Animation
  • Docs and Examples

Oh yeah. Workflow.

TMTOWTDI

  • Subversion branching
  • Multiple workspaces

Credits

  • Bridget Kromhout for reviewing these slides
  • Minnesota Supercomputing Institute for sponsoring development.
  • https://svn.msi.umn.edu/sw/perl/