This page last changed on Mar 05, 2007 by jnolen.

Planning Ahead

The initial requirements for the userinfo plugin are that I need to:

  1. Gather contact data from users, somehow.
  2. Display it, somehow.

In this part of the tutorial, I'm going to cover the first step. But in order to do so, I need to decide how I'm going to gather this information.

The traditional wiki way to do this would be through "magic markup". We would define some special Confluence markup (in Confluence that would be a macro) that users could insert into a page to set their contact information, and have the macro save that somewhere for later retrieval. This approach makes the programmatic interface very simple (you're only ever writing macros), but it doesn't make life particularly easy for users who have to remember, or continually look up, some obscure wiki syntax.

Metadata Plugin

The Metadata Plugin is an excellent Confluence plugin that does just this. It allows arbitrary metadata to be added to any page through a macro, and then allows you to collate, tabulate and aggregate that data in some pretty cool ways. If we wanted to go the "magic markup" route, I could just stop the tutorial now and say "use the Metadata Plugin instead".

The Metadata Plugin was written by the Pantero Corporation, and won an honourable mention in our first ever plugin development competition.

Confluence has powerful plugin module types that allow you to modify not only the content of wiki pages, but the functionality of the Confluence application itself. It's those modules that we will be using to gather our users' contact information:

  1. XWork-WebWork Plugins to provide the web form
  2. Web UI Plugins to add links to the form into the Confluence UI

In this second part of the tutorial, we will concentrate on using an XWork plugin to display a form to the user, and store and retrieve the information they submit.

Writing the Code

The End Result

Compiling and uploading the plugin I've written so far gives me the ability to set and edit my user information:

It's a bit ugly, though:

  • I have to navigate to the edit URL myself – /users/userinfo/edituserinfo.action – there's no link from the Confluence UI.
  • The page doesn't look like it's integrated into Confluence very well. It doesn't fit in to the right navigational structure.

I'll fix those problems in the part three of the tutorial.

Downloads

  1. The source code for this tutorial: userinfo-src-2.tgz
  2. The compiled plugin jar for this tutorial: plugins-userinfo-2.jar

userinfo-src-2.tgz (application/x-gzip)
plugins-userinfo-2.jar (application/java-archive)
userinfo-plain.png (image/png)
Document generated by Confluence on Dec 20, 2007 19:02