Archive for the 'plugins' Category

Note: I've reorganized this site to use tags; the category archive remains to support old links. Only posts prior to April, 2006 are categorized. Tag Archive »

Storystate 0+1i

My very first published plugin for Blosxom. You can download it here.

Storystate provides a number of convenience variables for use with the interpolate_fancy plugin by Blosxom author Rael Dornfest. It was designed to be especially useful with writeback. Storystate also allows presence of a meta-writeback tag to control if writebacks are open or closed. It’s basically useless without interpolate_fancy.

NOTE: best if used with interpolate_fancy version 2003-09-07 or later.

Excerpt from the POD docs:

Just drop it in your $plugin_dir. Optionally, you can adjust the values of the configuration variables at the top of the file. There are covered later.

Most of the variables are simple boolean indicators, using undef for false. This allows them to be used with interpolate_fancy’s and constructs. Some variables are story specific, (updated for each story), while others are based on the request url and are valid in the head and foot as well.

The request flag variables are:

  • $permalink true if request url is a subdir permalink, e.g. /this/that/story.html
  • $datepermalink true if request url is a date permalink, e.g. /2003/09/07/story.html
  • $anypermalink true if request url is either of above
  • $blogroot true if request is for blog’s root e.g. / or /index.html
  • $archive true if request if date style, e.g. /2003/09
  • $category true if request is subdir style, e.g. /this/that

The story-specific flag variables are:

  • $writeback_closed true if writebacks are closed for story (see below)
  • $permalink_wbopen true if !$writeback_closed and $permalink
  • $permalink_wbclosed true if $writeback_closed and $permalink

The idea of closing writebacks is that you are no longer accepting comments for a given story. Just add meta-writeback: on or meta-writeback: off to the header of the story. If no meta-writeback header is found, the value of the config variable $writeback_default is used instead. Values are on (writebacks open) and off (writebacks closed). This is of course dependant upon you implementing checks against these variables in our story template, see the example below.

There is also a story-specific text variable:

  • $writeback_message description of writeback state for story

This is useful for links to your writeback page. It returns (by default):

  • ‘Add the first comment’ If writebacks are open for story and no comments exist
  • ‘No Comments’ if writebacks are close and no comments exist
  • ‘1 comment’ if only one comment
  • ‘n comments’ if >1 comment, n=$writeback::count

These messages are configurable, see the config variables at the top of the file, they are documented inline.

See the POD docs for an example of usage, I just can’t get sample HTML to play nice with Textile2.