We’re putting the band back together!

Well, “band” may be over-selling it a little… Anyhow, Andy B and I had a bit of jam yesterday. Sad, really, how little actual ability I have to play the bass. Maybe I should practice some time. But at least it got me out of the house for a couple of hours, and it’s always good to stretch the brain cells in a different direction to usual.

Speaking of the home front, it has been an action packed couple of weeks, with Kian’s birthday and easter and all. He’s very excited about being four. Temma has also been developing in leaps and bounds, and is now crawling all over the house with great aplomb. She’d really prefer to be walking, I think, but will have to wait until she has a bit more balance.

Jo has uploaded tons of photos to the family website so be sure to check them out. I’ve upgraded the site to Drupal 4.4. This included a small patch to the image module to give me a block that lists image galleries, so the navigation has changed a little.

A patch to the Drupal image module

I wrote a small patch to the Drupal image module that provides a block to list the top-level image taxonomy terms (the set of galleries you get when you browse to .../image):

Index: modules/image/image.module
 ===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/image.module,v
retrieving revision 1.107
diff -u -r1.107 image.module
--- modules/image/image.module  7 Mar 2004 12:52:19 -0000   1.107
+++ modules/image/image.module  10 Apr 2004 01:43:02 -0000
@@ -66,6 +66,22 @@
 }

 /**
+ * Image block
+ */
+function image_block($op = "list", $delta = 0) {
+    // listing of blocks, such as on the admin/system/block page
+    if ($op == "list") {
+   $blocks[0]["info"] = t("Image Gallery");
+    } else {
+   // our block content
+   $blocks["subject"] = t(variable_get("image_block_title", "Image Galleries"));
+   $albums = taxonomy_get_children($tid, variable_get("image_nav_vocabulary", ""));
+   $blocks["content"] = theme_image_block($albums);
+    }
+    return $blocks;
+}
+
+/**
  * Node descriptor
  */
 function image_node_name() {
@@ -152,6 +168,8 @@

   $output .= form_select(t("Disable Image Caching"), "image_random_suffix",  \
    variable_get("image_random_suffix", "0"), array("0" => "disabled",    \
    "1" => "enabled"), t("Enabling this will add random parameters "      \
    . "to image URIs which will prevent the browser from caching."));

+  $output .= form_textfield(t("Title for image block"), "image_block_title", \
        variable_get("image_block_title", "Image Galleries"), 20, 80,         \
    t("The title to display in the image block, if enabled"));
+
   return $output;
 }

@@ -1401,6 +1419,18 @@
   return '<hr>' . theme("pager", $tags, $limit, $element, $attributes);
 }

+/**
+ * Theme function to render the image block contents
+ */
+function theme_image_block($albums) {
+    $output = "<div class=\"menu\"><ul>";
+    foreach ($albums as $album) {
+   $output .= "<li class=\"collapsed\">" . l($album->name, "image/tid/"  \
           . $album->tid) . "</li>";
+    }
+    $output .= "</ul></div>";
+    return $output;
+}
+
 /****
 ***** admin function and friends
 ****/

A nice enhancement would be to allow control over the depth of taxonomy terms to include (that is, display child galleries in the block, to a user-defined level).

Drupal module - summary

My first “official” open source contribution: a module for Drupal that I threw together for the family web site called summary. It’s intent is to allow a summary page for a drupal site, displaying headlines for recent photos and stories.

It has since been taken over and completey revamped by Nedjo Rogers, somewhat for the better I hasten to add. As well as making it much more theme- and drupal-compliant, Nedjo moved the lists of headlines into a block, making layout control easier.

I still hope to contribute to the module, and other drupal development, in the future.