NAME

Contentment::Content::Node - Handy module for storing common data

DESCRIPTION

Borrowing from so many other content management systems (esp. Drupal and Everything), the node concept is that most content can be treated similarly. All content records are associated with the node. When creating content in other modules, content modules should create a node object and refer to it for generic content information.

Overall this module is a bit primitive and doesn't offer much. I'm still building it up to the pinacle of glory it should eventually assume.

NODE DATA

TODO Add documentation for the Node schema.

NODE/REVISION FEATURES

Each node record inherits from the security of the module record it is associated with. Thus, if a user cannot access the module record, they cannot access any Node information. When creating a Node record, the Node will fail to create if the module field has been set to a module for which the user is not permitted to create, then Node creation will also fail. The same is true for Revisions.

NOTE: It is important that all revisions of a node have the same security. This is because Contentment::Content::Node is only able to use the head revision module object for security checking.

On update, the Node will automatically set the appropriate time and user fields to the current time and the current user (as defined by DateTime->now and Contentment::Context::current_user). These are the ctime, creator, mtime, updater, dtime, and deleter fields. The ctime, creator, mtime, and updater fields are set when a node is created. The mtime and updater fields are set whenever the node is updated and enabled is true. The dtime and deleter fields are set whenever the node is updated and enabled is false. The same is true for Revisions.

I would also like to note that a notably absent field are some extra fields like "published" or "sticky" or "promoted" or "moderated," etc. These fields are part of nodes in many frameworks, but not here. Those are workflow related and the node API doesn't enforce any workflow concepts. As of this writing, I haven't yet worked out the details of the workflow system I'd like to add, but I have decided to hold the general idea of nodes separate from the workflow at this time (this, of course, is subject to change).

Also notably absent are titles and other data. I'd like to keep anything beyond the very basics in custom node modules rather than make node a container for data.

NODE METHODS

In order to make this API a little more usable, several features have been added to the typical SPOPS features.

$obj = $node->module_object

This method returns the object represented by the node's module field. This method will call the module's load_node_revision() method to retrieve the object for the head revision.

$node->touch

This method should not be called directly as it is called the Contentment::Content::Revision::touch. This method calls the save method to trigger time and user field updates.

REVISION DATA

TODO Add documentation for the Revision schema.

REVISION METHODS

$obj = $revision->module_object

This method returns the object represented byt he node's module field. This method will call the module's load_node_revision() method to retrieve the object for this revision.

$revision->touch

This method should be called whenever a node module calls save. This should be performed within a transaction so that the update to node, revision, and module all succeed or all fail. This method automatically calls Contentment::Content::Node::touch, so the module should not.

$revision->revive

This method causes this revision to become the "current" revision for the node.

SEE ALSO

Contentment::Content::VFS

AUTHOR

Andrew Sterling Hanenkamp, <hanenkamp@users.sourceforge.net>

COPYRIGHT AND LICENSE

Copyright 2005 Andrew Sterling Hanenkamp. All Rights Reserved.

Contentment is licensed and distributed under the same terms as Perl itself.