Plugins (000002)

Plugins provide extra functionality and can be installed through LuaRocks. Among other things plugins can add new nodes, including prototypes. Work is under way break sputnik into core and plugins.

For now, here is a proof of concept: a plugin that offers simple bug-tracking. (As a bug-tracking tool this plugin will need some more work, so I am showing it now as a proof of concept.)

Install the plugin with:

$SPUTNIK_DIR/luarocks install sputnik-tickets.

Then go to the page called "Tickets". (E.g., http://localhost/cgi-bin/sputnik.cgi/Tickets.) Note that this page didn't exist before you installed the plugin, and now it does. If you click on "Create New Ticket", you will be taken to an edit form for a new page ("Ticket:000001"), which has it's prototype pre-set to "@Ticket" and because of this has a custom edit form. Note that "@Ticket" is again a new page, which got installed by the plugin.

More specifically, what the plugin does is add four new modules:

sputnik/actions/tickets.lua
sputnik/node_defaults/@Ticket.lua
sputnik/node_defaults/Tickets.lua
sputnik/node_defaults/_translations_for_ticket.lua.lua

The first is a real module that provides a new "show" action for the "Tickets" page. The other three modules just hold the data for the new pages. The actual Versium pages will be created on the fly when they are accessed.

Powered by Sputnik | XHTML 1.1