Class V Software Logo

Blosxom Plugins

Blosxom is a simple, powerful, expandable, perlable blogging system. In getting my feet wet I wanted to write a simple plugin for it and created the amazing three line uniqueid plugin to generate unique ids based on current time and process id. That allows me to use this link to add new entries to the blog:
<A HREF="$url$path/file_$uniqueid::uniqueid.wikieditish">Add new entry</A>
(Which, obviously, uses the wikieditish plugin to do the real work.

And I really liked wikieditish but wanted to add a couple features. The version here adds the option to upload files (presumably graphics) (and optionally build a thumbnail with ImageMagick) and lock out edits if too many bad passwords are used too quickly.

As AJAX started to be the "thing," I found what I think is a good use for it: the comments. It was trivial to set up Scriptaculous (I have a posting about it with some follow-up comments). But I discovered some compatibility issues (as noted in the comments to that post). My eventual solution was an extra function for blosxom to switch the default flavour based on browser User Agent. Here's the function:

#David's browser User Agent-based flavour setter:
sub set_second_default() {
    my $sNewDefault = $default_flavour;
    my $sUserAgent = $ENV{HTTP_USER_AGENT};
    if(defined($sUserAgent)) {
	my $iBad = 0;
	my @aBad;
	$aBad[$iBad++] = "Nokia6133";
	$aBad[$iBad++] = "N770/SU-18";
	for($iBad = 0; $iBad <= $#aBad; $iBad++) {
	    if($sUserAgent =~ /$aBad[$iBad]/){
		$sNewDefault = "mhtml";

And this needs to added after the default flavour is set near the top of the script:
#David's hack to set default flavour based on broswer user agent:
$default_flavour = set_second_default();

With that in place, I just created a set of *.mthml templates (for the mhtml flavour) which did not use any AJAX stuff. Not to hard once I got the idea clear in my head.

RedHat Logo