Saturday, October 1, 2005

Adding templates to the automated signature generator

PROGRAMMING POWER

By Mick Moignard

This is the second part in our "Building an automated signature generator application" series. If you haven't read Part I, all about the user experience, you'll find a link at the end of this article. In this week's installment, we'll learn how to add templates to the system.

What the Administrator can do

The Administrator's job is to maintain the templates and the site documents. This isn't a Notes administrator job, but more a departmental admin job, though, as you will see, the signature templates do require some thought, particularly the HTML ones.

There's no reason why this cannot be done by anyone with the relevant skills and knowledge. As we'll see later, to make someone an Administrator, all you need to do is make them an Editor in the ACL.

Site documents are easy; standard Notes forms that you fill in. Figure A shows one open in edit mode.

FIGURE A

As an admin, you can go ahead and define the various sites of your organization. (click for larger image)

You can see that there are a couple of title fields, and then there are fields to describe a couple of http links, each with a main URL and a secondary one, and an ALT tag.

The idea is that in the signature itself you can display a logo, which is sourced from the logo URL, and when clicked it goes to the main URL, and also has an ALT tag for completeness. There are actually two sets of these, and you can see how they are filled in for my company (Unipart Group) and my business unit (UALS). The template I use for my current signature doesn't actually use them.

You should also note that there are site address fields, and also map locator fields, postcode/zip code, country, town and street. These can be used ultimately as plug-in values to a map locator URL, if that makes sense for you.

Note that all of this is optional. You can have as few or as many sites as you need, and you will enter what is relevant to each one. All that they are used for is to populate fields in the signature block when the user clicks the "Click to get your site details" link at the top of the screen. Saves a user from typing your company URLs and getting them wrong.

Then there are templates. We'll look at a text one first, because it's easier to explain the basic principles. Figure B shows a text template in edit mode. You give each template a descriptive name, and then get creative with the block itself.

FIGURE B

Now, you can start creating dynamic signature templates. (click for larger image)

The one you can see shows the fixed text in black, and placeholders for replaceable items in red. This is done using a rich text field, so that I can display the placeholders in a different colour to the static text, but don't get too excited here. Notes itself uses a plain text field to store the text signature, so there is little point in getting fancy. In fact, no point at all, because in this application, we also render the text signatures in plain text.