[Mailman-Developers] Skinning Mailman (how to add a customer UI in five minutes or less...)

Chuq Von Rospach chuqui@plaidworks.com
Fri, 11 May 2001 21:47:38 -0700


    
I've got this running now, so I figured I'd toss out a cookbook recipe on it
while it's fresh.

I've always hacked Mailman to install a custom interface on it so it matches
the rest of my sites (for instance, see
www.hockeyfanz.com/mailman/listinfo). The downside to this is that every
time a new release comes out, you have to repatch all your changes.

This makes  it more work to upgrade than it should be, so I've been keeping
an eye out for a better way to do this (and it gets worse -- on one of my
sites, I also have a web board that needs custom patching, my mhonarc
rcfiles that need patching, and the standard files that need tweaking every
time the UI or graphics get revamped, and I'm not always in control of when
they get redone...)

I finally found a tool that takes care of this for me -- it's called
mod_layout (www.tangent.org), and it's an apache module, so this is apache
specific. 

If you run your apache with DSO (and if you don't, you're crazy...),
installation is trivial. Download the thing, unpack it, then run "make" and
"make install". It uses APXS to handle everything.

To get it running, I added these lines to the httpd.conf. In my case,
they're in the <virtualhost> declaration (it supports all fo the apache
stuff, so it recognizes and honors virtual hosts, directories, etc... Very
flexible beast)

# stuff to wire in mod_layout
    LayoutMerge On
    LayoutFooter /home/httpd/html/footer.incl
    LayoutHeader /home/httpd/html/header.incl

(I also have some lines causing it to NOT tweak files in directories I want
left alone -- it can be configured on a file or directory basis, host basis,
or systemwide)

Then create the header and footer, and restart apache.

What mod_layout does (as configured here) is put itself in the middle of
everything, and when it sees the <BODY> declaration, it inserts the header.
And when it sees </BODY> it inserts the footer before it. For the CGI or
html page, it's completely transparent, and you don't have to worry about
screwing up CSS or javascript, and it leaves cookies alone. It also doesn't
affect your HTML, since it comes after the <BODY> so it can't interrupt
tables or other location sensitive things.

Very nice hack, IMHO, and allows you to wrap an interface around mailman
quite nicely -- as well as most other CGI-based stuff that doesn't support
templating. And even nicer, IMHO, is that if you need to change things, you
change the included files -- and it magically propogates, no need to even
restart apache. 

This gives me control over almost all of Mailman (and, hint hint) --
hopefully Barry will add the configuration for the rest down the road.

One is that some of the text-box colors are hard-coded (see, for instance,
/mailman/admin/listname/general/. It'd be nice (and it seems to be easy to
do) to turn those into globals that can be set in mm_cfg.py instead of
requiring someone to whack all of the source files they're sprinkled in.

The other key one for me are some of the admin messages
(Mailman/Handlers/Hold.py). I've modified some of the messages for various
reasons, and it'd be nice if I could simply override their definitions in
the mm_cfg.py file

And the third place I've made custom changes are in some of the list
templates (most radically templates/listinfo.html) -- but that's why they're
template; you simply keep a copy somewhere and watch out for additions to
the updated copy...

It took me about three days and a couple of exchanges with the author of
mod_layout to get it going the way I wanted (the documentation is still
being fleshed out), but it's a nice improvement to the old way of doing
things -- and since I know others build custom skins around their
installations, I'd thought I'd pass this one along.

If you want to see a version of mailman with mod_layout, see
www.plaidworks.com. My mailman set up the old way is www.hockeyfanz.com (for
now. I'll be working to move this to all my stuff over time...)

Chuq