Confluence Docs 3.0 : UPT 2 - Getting the Data This page last changed on Mar 05, 2007 by jnolen. ### Planning Ahead The initial requirements for the userinfo plugin are that I need to: Gather contact data from users, somehow. 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: XWork-WebWork Plugins to provide the web form 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 UPT 2.1 - The UserInfo Bean UPT 2.2 - The XWork Action Class UPT 2.3 - The Velocity Template UPT 2.4 - Defining the XWork Plugin Module ### 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 The source code for this tutorial: userinfo-src-2.tgz The compiled plugin jar for this tutorial: plugins-userinfo-2.jar Attachments: userinfo-src-2.tgz (application/x-gzip) plugins-userinfo-2.jar (application/java-archive) userinfo-plain.png (image/png)

Document generated by Confluence on Nov 05, 2009 23:34