Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Adding content to JIRA admin views -- WebWork and Velocity woes

Jared Cohen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 4, 2018

I'm trying to add content to one of the JIRA admin-only views -- specifically, adding an item to each of the Actions dropdown menus on the "User Browser" page (/jira/secure/admin/user/UserBrowser.jspa). This has proven to be difficult, because while most of the normal JIRA views are written in Velocity and provide convenient hooks to inject your own content (via the location/websection mechanism), the admin-only views...don't. They're WebWork actions, implemented in JSP and making heavy use of taglibs from AUI, WebWork, and Sitemesh, and they don't provide any kind of extension/injection points that I could find. It seems like they just weren't written with extensibility in mind. So in order to add my own content to this view, it looks like I have no choice but to override it, by rewriting the entire view myself and using the same alias to replace the bundled view with my own.

This comes with its own set of issues, because the documentation for WebWork actions says that I should use a Velocity template rather than a JSP, since "JSP views cannot be used from inside plugins; they can be used if they are installed into the JIRA webapp, but this complicates installation, upgrading, and troubleshooting. Use Velocity if you can." That's all well and good, but it means that I don't have access to the aforementioned taglibs from AUI/WW/Sitemesh. So I've had to rewrite THOSE as well, as Velocimacros. This is made more difficult by Velocity's inherent weaknesses when it comes to macros, such as the inability to specify named arguments and omit the ones I'm not interested in, the lack of decent null-handling, and the lack of proper scope awareness causing variable values to "bleed" into the surrounding scope. To get around those issues, I've been implementing the macros using a single arguments map, rather than individual arguments; it works, but it's clunky.

Now, having said all that...I wonder if I'm making this more difficult than it needs to be. I'm basically reinventing the wheel, duplicating the functionality of dozens of decorators and templates and taglibs...all to add a single item to a dropdown that already exists. It seems like it should not be this hard!

Which brings me to the actual point of this post. I have three questions for you:

  1. Is there, in fact, a way to inject my own content into these existing WebWork action views, without having to rewrite the whole thing from scratch?
  2. If the answer to #1 is "no", then is there a way to use the existing WebWork taglibs within a Velocity template? I've seen people refer to a project called "VeloTags", but it seems to be defunct and none of the links I've found work.
  3. If the answers to #1 and #2 are both "no", then is there at least a way to configure Velocity to provide proper scope awareness? The Velocity configuration documentation repeatedly mentions making changes to a file called "velocity.properties", including several properties that claim to provide better scope control...but it makes no mention of where this file is supposed to be located. How can I create this file so that it is actually recognized by the Velocity engine?

Any assistance would be most appreciated.

0 answers

Suggest an answer

Log in or Sign up to answer