By Mick Moignard
This is the third part in our "Building an automated signature generator application" series. If you haven't read Part I, all about the user experience, or Part II, all about creating templates, you'll find a link to both at the end of this article. In this week's installment, we'll learn how the application actually works.
And how does it work?
I'm not going to show you exactly how all of it works. I'm assuming that you've downloaded the thing, and if you haven't, go ahead and do it (the link's at the end of this article), then explore it. But I will call out a few features that help it on its way.
First of all, the intention is that the end-users are Readers in the ACL. This basically means that they can't update anything in it, but in fact that's not true; their signature data is stored as public documents, and the end-users can read and write public documents via the -Default- entry in the ACL.
You'll see a $PublicAccess field in the signature data documents. End-users are not able to see the Admin view of all users data, because that area of the Left Page page is hidden from anyone with Reader or below access level. It's not secure, but then it's not intended to be. It just keeps other people's signature data away from most prying eyes. They can only interact with their own.
The administrator, who is anyone with access greater than Reader, can see all the data. This is useful for helping people who are having trouble.
When any user, regular end-user or Administrator, clicks on "My Signature", an agent called (MYSIG) is run. This locates a document in the (USERS) view, keyed on the end-user's abbreviated name. If there is one present, it is displayed in edit mode. If not, one is created, and opened in edit. This means that there will be one and only one document for each user, by abbreviated Notes name.
The signature templates are just Notes documents. The only clever bit is the placeholder piece. As you've seen in the example above, placeholders are added into the text bounded by the characters #%..%#. Inserting a placeholder is done with the following formula code -- of which the meat is the five @commands at the end.
"Logo Alt 2":"User Name":"Email":"Job Title":"Phone":"Fax":"Site Address":"Map Street":
"Map Country":"Map City":"Map PostCode":"Department":"Room":"Company":"Cell Phone":
fieldname := @Prompt([OkCancelList]; "Select Field"; "Select the fieldname to insert as a placeholder"; "";promptlist);