This documentation relates to the latest version of Confluence.
If you are using an earlier version, please go to the documentation home page and select the relevant version.

Web UI Plugins

All Versions

Confluence 3.0 Documentation

Web UI plugin modules allow you to insert links, tabs and sections of links into the Confluence web interface. They're not much use on their own, but when combined with XWork-WebWork Plugins they become a powerful way to add functionality to Confluence.

On this page:

Sections and Items

Web UI plugins can consist of two kinds of plugin modules:

  • Web Item modules define links that are to be displayed in the UI at a particular location.
  • Web Section modules define a collection of links to be displayed together, in a 'section'.

Web items and web sections (referred to collectively as 'web fragments') may be displayed in a number of different ways, depending on the location of the fragment and the theme under which it is being displayed.

Locations

In a number of places in the Confluence UI, there are lists of links representing operations relevant to the content being viewed.

Please be aware that the Descriptions below relate to the default Confluence theme. Bold text used in each description relates to a component on the product interface.

These are the locations that you can customise:

Location key Themeable? Sectioned? Description Availability
Common Locations        
Page-related        
system.attachment The links on the right of an Attachments list 2.8
system.comment.action The links within each comment listed at the end of pages and blogs. The sections include the primary section on the lower-left of a comment (i.e. the Edit, Remove and Reply links) and the secondary section on the lower-right (i.e. the Permanent link icon) 2.8
system.content.action The menu items on the Tools drop down menu available on pages and blogs. The sections of this menu include primary, marker, secondary and modify 2.8
User-related        
system.profile The tabs above user profile views 2.2
system.profile.view These links are only visible to Confluence administrators and appear either beneath views of user profiles without personal spaces or beneath their own profile view. For example, Administer User 2.9
system.user The menu items on the 'username' drop down menu available in the top bar of all pages. The sections of this menu include user-preferences, user-content and user-operations 2.8
Other        
system.content.add The menu items in the Add drop down menu available in pages, blogs and areas of the Space Admin and other Browse Space tabs. The sections of this menu include space and page 2.8
system.dashboard The action section on the lower-left of the global dashboard. This section appears below the Spaces list on this dashboard 2.10.2
system.labels The View sub-categories of the global All Labels / Popular Labels area 2.2
Space Admin and other Browse Space tabs        
system.space The Space Admin and other Browse Space tabs 2.2
system.space.actions In versions of Confluence prior to and including version 2.9, these action icons appear in the top-right of most space-related views. However, from Confluence 2.10, this location key has been deprecated and has been superseded by 'system.content.add' 2.2
system.space.admin The links in the left-hand menu of the Space Admin tab area 2.2
system.space.advanced The links in the left-hand menu of the Advanced tab area 2.2
system.space.labels The View sub-categories of the Labels tab area 2.2
system.space.pages The View sub-categories of the Pages tab area 2.2
Administration Console        
system.admin The links in the left-hand menu of the global Administration Console 2.2
  • Those locations marked as being 'themeable' can be moved around, reformatted or omitted by Theme Plugins. The descriptions above refer to where they are located in the default theme.
  • Locations marked as being 'sectioned' require that web items be grouped under web sections. In sectioned locations, web items that are not placed under a section will not be displayed.
  • It is possible for themes to make any themeable locations sectioned, even when the default theme does not. We do not recommend this, as it would mean any plugin taking advantage of this would only be compatible with a particular theme.
Theme Compatibility
Themes based on Confluence versions prior to 2.2 will continue to function with Confluence 2.2, but will not be able to display any custom Web UI fragments until they are updated.

Web Section Definition

You may choose to create your own web sections or add to Confluence's predefined ones, if it makes logical sense to do that.

Here is a sample atlassian-plugin.xml fragment for a web section:

<web-section key="mail" name="Mail" location="system.space.admin" weight="300">
    <label key="space-mail" />
    <condition class="com.atlassian.confluence.plugin.descriptor.web.conditions.NotPersonalSpaceCondition"/>
</web-section>

Here is another sample:

<web-section key="page" name="Add Page Content" location="system.content.add" weight="200">
    <label key="page.word" />
</web-section>

The above example will create a new section on the 'Add' menu. You can then add a web item in the section. The location of this section depends on the relative weight compared to the other sections that have already been defined by Confluence or by other installed plugins.

Take a look at the full configuration of Web Section plugin modules.

The diagrams below illustrate the web sections available in the Confluence dropdown menus.


Web sections for location system.content.action



Web sections for location system.content.add

Web Item Definition

Here's a sample atlassian-plugin.xml fragment for a web item:

<web-item key="spacelogo" name="Space Logo" section="system.space.admin/looknfeel" weight="40">
    <label key="configure.space.logo" />
    <link>/spaces/configurespacelogo.action?key=$space.key</link>
    <icon height="16" width="16">
        <link>/images/icons/logo_add_16.gif</link>
    </icon>
    <condition class="com.atlassian.confluence.plugin.descriptor.web.conditions.NotPersonalSpaceCondition"/>
</web-item>

Take a look at the full configuration of Web Item plugin modules.

Q and A

How do I make use of sections or web items in my own themes?

Take a look at how they are used in the default themes, you should be able to get a good idea of the necessary code. For example, here is some sample code from space.vmd:

#set ($webInterfaceContext = $action.webInterfaceContext)
#foreach ($item in $action.webInterfaceManager.getDisplayableItems("system.space", $webInterfaceContext))
    <li><a href="$item.link.getDisplayableUrl($req, $webInterfaceContext)" #if ($context == $item.key) class="current" #end>
        $item.label.getDisplayableLabel($req, $webInterfaceContext)
    </a></li>
#end

Can I create new locations for web UI plugins in my own themes?

Yes. Just pick a new key for the location or section parameters of your plugin modules. By convention, you should probably use the standard 'inverted domain name' prefix so as not to clash with anyone else's plugins. We reserve all system.* locations for Confluence's core use.

Once again, however, we don't recommend this as you end up with plugins that are only useful in your own themes. Try to at least provide an alternative set of UI modules for people who are using other themes and still want to access the same functionality. You could, for example, define alternative UI plugin modules that placed your functions in Confluence's standard locations, but have a <condition> that disabled them in favour of your custom locations if your theme was installed.

If I create a Web Item that links to my custom action, how do I make it appear in the same tabs/context as the other items in that location?

The best way is to look at the .vm file of one of the existing items in that location. You are most interested in the #applyDecorator directive being called from that file. For example viewpage.vm, which defines the "View" tab in the system.page location has the following #applyDecorator directive:

#applyDecorator("root")
    #decoratorParam("helper" $action.helper)
    #decoratorParam("mode" "view")
    #decoratorParam("context" "page")

    <!-- some stuff... -->

#end

If you were writing a plugin that was destined to be added as another item in the page tabs, your Velocity file for that action would also have to have a similar decorator directive around it:

#applyDecorator("root")
    #decoratorParam("helper" $action.helper)
    #decoratorParam("mode" "myPluginKey")
    #decoratorParam("context" "page")

    <!-- some stuff... -->

#end

Note that you should put you Web Item's plugin key as the 'mode'. This way, Confluence will make sure that the correct tab is highlighted as the active tab when people are viewing your action.
In some cases, such as the browse space tabs, you may have to use 'context' instead of 'mode'.

My web UI link isn't appearing when I use the Adaptavist Theme Builder plugin - why?

Theme Builder uses completely customisable navigation and as such can't automatically display web UI links because this would likely lead to duplication of many other, more common links.

You can, however use the {menulink} macro to insert any web UI link using the following notation:

{menulink:webui|location=XXXX|key=YYYY}webui link{menulink}

Theme Builder 2.0.8 and above now supports a growing number of third party plugins as standard - for more information see the online documentation. If you have a publicly available plugin and want an in-built menulink location for it, please contact Adaptavist.

The breadcrumb trail for my web UI administration/space administration/tab plugin is showing the class name — how do I fix it?

In the atlassian-plugin.xml:
<!--Make sure each name is unique-->
       <resource type="i18n" name="i18n-viewreview"
location="resources/ViewReviewAction" />
In the java:
//in an action
I18NBean i18NBean = getI18n();

//or in a macro or other sort of plugin
 ThemeHelper helper = this.getHelper();
               ConfluenceActionSupport action = (ConfluenceActionSupport) helper.getAction();
               Locale locale = action.getLocale();
               I18NBean i18nBean = i18NBeanFactory.getI18NBean(locale);

//and
   public void setI18NBeanFactory(I18NBeanFactory i18NBeanFactory)
   {
       this.i18NBeanFactory = i18NBeanFactory;
   }

Use a normal properties file and locate it as follows:

If we're talking about actions:
The properties file with the same name as the relevant action can go in the same directory as the action. So, if you had XYZAction.java, then XYZAction.properties could live in the same directory. And you would not have to do anything in the atlassian-plugin.xml file.

If you don't want it to live there, or if you're not talking about an action:
Define a resource in the atlassian-plugin.xml and tell it to live wherever you want. The standard is resources.

  • In the source: etc/resources
  • In the jar: resources/

The property that handles the breadcrumb has to be the fully qualified name of the class plus .action.name

So, for a SharePointAdmin property you might use: com.atlassian.confluence.extra.sharepoint.SharePointAdmin.action.name=SharePoint Admin

RELATED TOPICS

Web Section Plugin Module
Web Item Plugin Module
Writing Confluence Plugins
Installing and Configuring Plugins Manually

Labels

webui webui Delete
links links Delete
plugin plugin Delete
builder builder Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Apr 30, 2006

    Dan Hardiker says:

    The label element is required, and is the i18n key that will be used to look up ...

    The label element is required, and is the i18n key that will be used to look up the textual representation and mouse-over text of the link.

    If I add a menu item to the admin menu (through the system.admin key), and I give it the label key of "myPlugin.link.text" ... how do I provide a value for it? If I want to have the text resolve into multiple languages, can I do that too?

    1. Apr 30, 2006

      Mike Cannon-Brookes says:

      Mate - the value is simply provided in the i18n properties files with your plugi...

      Mate - the value is simply provided in the i18n properties files with your plugin. Bundled as a <resource> type="i18n" from memory.

      1. May 01, 2006

        Dan Hardiker says:

        A ha! An example of this can be seen on the Report Plugin Module page ... a cle...

        A ha!

        An example of this can be seen on the Report Plugin Module page ... a clearer example of i18n in plugins may be worth while for newbies, as even I had trouble figuring out what goes where. (Granted, I've not worked with any i18n implementation that I hadn't written myself though.)

        1. Nov 10, 2006

          Laura Kolker says:

          FYI: Looks like web ui plugin + resources don't work in 2.2 http://jira.atlassi...

          FYI: Looks like web ui plugin + resources don't work in 2.2

          http://jira.atlassian.com/browse/CONF-6317

          (Just a reference, as I spent way too much time poking at this.)

  2. Apr 30, 2006

    Dan Hardiker says:

    The above tells me lists the various areas I can link into (system.admin for exa...

    The above tells me lists the various areas I can link into (system.admin for example) but doesnt list the sections available ... there is only one in your example which is system.space.admin/looknfeel but doesn't list which others there are.

    1. Apr 30, 2006

      Dan Hardiker says:

      For reference, you can find the built in sections available in confluence-2.2-so...

      For reference, you can find the built in sections available in confluence-2.2-source/confluence/src/etc/java/plugins if you have source access, or confluence-2.2/confluence/WEBINF/classes/plugins if you have the dist. They are listed in the *-sections.xml files.

  3. May 09, 2006

    Michelle A. Hoyle says:

    So can I use this to replace the nasty hard-coded additions I had to make to con...

    So can I use this to replace the nasty hard-coded additions I had to make to confluence/template/includes/macros.vm? Every time I upgrade Confluence, I have to go back and manually reapply the following changes:

    1) #macro (usernameLink $username): This is used to modify the usernameLink to include a clickable icon which takes you to the person's Guild Profile page in addition to the standard (and, for our purposes, mostly useless) Confluence user profile page.

    Original Code
    #macro (usernameLink $username)
    #if ($username != "")
        #if ($action.getUserFullName($username))
            <a href="$!req.contextPath/display/~$generalUtil.
            doubleUrlEncode($username)">
            $action.getUserFullName($username)</a>
        #else
    
    Changed Code
    #macro (usernameLink $username)
    #if ($username != "")
        #if ($action.getUserFullName($username))
            <a href="$!req.contextPath/display/PROFILE/
            $generalUtil.doubleUrlEncode($action.
            getUserFullName($username))" 
            title="Visit $action.getUserFullName($username)'s 
            Guild Profile page">
            <img src="$req.contextPath/images
            /icons/droplet_16.png" 
            height="16" width="16" 
            border="0" align="middle" alt="" /></a>
           <a href="$!req.contextPath/display/~$generalUtil.
           doubleUrlEncode($username)" 
           title="View $action.getUserFullName($username)'s 
           Confluence profile">
           $action.getUserFullName($username)</a>
        #else
    

    2) usernavbar: added code to include guild profile page edit droplet and link to Java chat applet page.

    Original Code
    <a href="$req.contextPath/display/~$generalUtil.
    doubleUrlEncode($user.name)">Profile</a> |
    
    Changed Code
    <a href="$req.contextPath/display/PROFILE/$generalUtil.
    doubleUrlEncode($user.fullName)" title="Visit your Guild Profile 
    page"><img src="$req.contextPath/images/icons/droplet_16.png" 
    height="16" width="16" border="0" align="absmiddle" alt="" 
    style="margin: 0 3px 0 0;" class="none" /></a><a 
    href="$req.contextPath/display/~$generalUtil.
    doubleUrlEncode($user.name)">Profile</a> | 
    <a href="http://www.wowkindness.com/cgi-bin/chat/index.php?nick=
    $generalUtil.doubleUrlEncode($user.fullName)" title="Multi-Chat">Chat</a> |
    

    3) usernavbar: Added code to put inactive "Chat" link into nav bar when not logged in.

    Original Code
               <a href="$seraph.getLinkLoginURL($req)">Log In</a>
    
    Changed Code
        Chat |
                <a href="$seraph.getLinkLoginURL($req)">Log In</a>
    

    It's a pain in the butt but I didn't see an easy way around it previously. Will this new UI plugin help at all?

    1. May 09, 2006

      Jonathan Nolen says:

      Yep! This is exactly the usecase we built this feature for. It should do the tri...

      Yep! This is exactly the usecase we built this feature for. It should do the trick.

      Cheers,
      Jonathan

  4. Nov 16, 2006

    Laura Kolker says:

    Quote from above: Note that you should put you Web Item's plugin key as the "mod...

    Quote from above:

    Note that you should put you Web Item's plugin key as the "mode". This way, Confluence will make sure that the correct tab is highlighted as the active tab when people are viewing your action. In some cases, such as the browse space tabs, you may have to use "context" instead of "mode"

    I've found if I'm creating a new space tab, that I run into some difficulties here.
    If I don't make the context equal to "space", then the tabs don't show.
    But the space decorator (space.vmd) shows that it's the context == plugin.key that determines which tab is highlighted:

    ## line 29 in space.vmd
    <li><a href="$item.link.getDisplayableUrl($req, $helper)" #if ($context == $item.key)
     class="current" #end>$item.label.getDisplayableLabel($req, $helper)</a></li>
    

    Just for thoroughness, I checked setting the mode to my plugin key, and that appears to have no effect.

    I've found the following JIRA issue,
    http://jira.atlassian.com/browse/CONF-6853

    which seems related, but no one's responded to Dan Hardiker's request for clarification on whether related space issues have been resolved.

    In the meantime, I've got a work-around, which is more than a bit of kludge, but it'll do until I hear of a better solution.

    //add this in the body of your velocity file
            <script type="text/javascript">
               function fixTab() {
                 var tablist = document.getElementById('foldertab');
                 for (var i = 0; i < tablist.childNodes.length; i++) {
                    var liElement = tablist.childNodes[i];
                    if (liElement.childNodes[0] == null) {
                       continue;
                    }
                    if (liElement.childNodes[0].href.match("something.unique.in.my.action.name")) {
                       liElement.childNodes[0].className = "current";
                       
                    }
                 }
               }
               fixTab();
            </script>
    
    1. Nov 16, 2006

      Laura Kolker says:

      I just thought of a better solution: root.vmd shows the following #elseif (...

      I just thought of a better solution:

      root.vmd shows the following

      #elseif ($context.startsWith("space-"))           
      ## Space tabs (Friday afternoon hack)
            #applyInlineDecorator("space" $body $params)
      

      So, all you have to do is make the plugin key start with space- (and still be unique, and then when you make the context equal to, the highlighting works correctly.

      1. Dec 08, 2006

        Jean Marois says:

        I have a similiar issue with tabs added to the User Profile, but can't use the "...

        I have a similiar issue with tabs added to the User Profile, but can't use the "simpler" hack, so I used a modified version of your previous solution:

                <script type="text/javascript">
                   function fixTab() {
                     var tablist = document.getElementById('foldertab');
                     for (var i = 0; i < tablist.childNodes.length; i++) {
                        var liElement = tablist.childNodes[i];
                        if (liElement.childNodes[0] == null) {
                           continue;
                        }
                        if (liElement.childNodes[0].href.match("/path/to/myplugin.action*")) {
                           liElement.childNodes[0].className = "current";
                        }
                        else { 
                           liElement.childNodes[0].className = "";
                        }
                     }
                   }
                   fixTab();
        </script>
        

        I added the else statement to make sure no other tab is set as the current.

        1. Dec 08, 2006

          Jean Marois says:

          I forgot to explain why I need to unset the current tab. The global.vm will not ...

          I forgot to explain why I need to unset the current tab. The global.vm will not display your page unless you set your decorator mode parameter to one of the existing tabs, i.e. view-profile, edit-profile, ... There is no else block in the profile context section.

                          #elseif ($context == "profile")
          ...
                              ##MODE - VIEW-PROFILE
                              #if ($mode == "view-profile")
          ...
                              ##MODE - EDIT-PROFILE || CHANGE-PASSWORD-PROFILE
                              #elseif ($mode == "edit-profile" || $mode == "change-password-profile")
          ...
                              #elseif ($mode == "configure-rss-feed" || $mode == "my-labels" || $mode == "edit-notifications-profile")
          ...
                              #elseif ($mode == 'drafts')
          
          ...
                              #end
                    #elseif ($context == "labels")
          ...
          
  5. Feb 16, 2007

    Laura Kolker says:

    Condition elements must contain a class attribute with the fully-qualified name...

    Condition elements must contain a class attribute with the fully-qualified name of a Java class. The referenced class:
    must implement com.atlassian.confluence.plugin.descriptor.web.Condition

    This appears to be out of date as of Confluence 2.3.
    Anyone know what the new class is?

    Thanks
    Laura

    1. Feb 17, 2007

      Jean Marois says:

      I believe its actually been com.atlassian.confluence.plugin.descriptor.web.condi...

      I believe its actually been com.atlassian.confluence.plugin.descriptor.web.conditions.AbstractConfluenceCondition since at least 2.2.9.

      Jean

      1. Feb 19, 2007

        Laura Kolker says:

        Hi Jean, Thanks for the tip. re: 2.2.9 Interesting. The Condition class was,...

        Hi Jean,

        Thanks for the tip.

        re: 2.2.9

        Interesting. The Condition class was, however, still usable in 2.2.9
        Perhaps it was deprecated at that time?

        Laura

  6. Aug 31, 2007

    Anonymous says:

    For the record, the linked actions Classes must implement either SpaceAware or P...

    For the record, the linked actions Classes must implement either SpaceAware or PageAware so they are properly decorated...

    Regards,

    robertowhospentwaytoomanyhourstofigurethisout

  7. Apr 14, 2008

    Roberto Dominguez says:

    Err, what happened with system.page.actions web items, as per Web UI Plugins? Ar...

    Err, what happened with system.page.actions web items, as per Web UI Plugins? Are they getting ignored?

  8. Sep 01, 2008

    Shannon Krebs says:

    It looks like the system.user location doesn't work in confluence 2.8 as claimed...

    It looks like the system.user location doesn't work in confluence 2.8 as claimed. I'm guessing this is because it only became sectioned in 2.9, thus it doesn't understand the sectioned web item that is working in 2.9... ?

    It would be good to add a screenshot of the sections for the user menu as well.

    1. Sep 08, 2008

      Ming Giet Chong says:

      Hi Shannon, I have done quick try at my side and the system.user location key i...

      Hi Shannon,

      I have done quick try at my side and the system.user location key is working fine in Confluence 2.8 and 2.9. You should be able to see the new tab added to the user drop down menu for each page.

      For development query, I would suggest you to join the Confluence developer forum for further discussion:

      Regards,
      MG

  9. Oct 01, 2008

    Thomas Junghans says:

    Hi Confluence I'm missing the <styleClass> attribute under "Web Item Def...

    Hi Confluence

    I'm missing the <styleClass> attribute under "Web Item Definition" further up on this page. I found out about this handy value by looking at Confluence source files.

     Regards

     Thomas

  10. Nov 25, 2008

    Anonymous says:

    I am not able to see these menu using the "classic theme". I am new to confluenc...

    I am not able to see these menu using the "classic theme". I am new to confluence. Is there any tutorial explaining how I can enable this plugin?

    Thanks

Add Comment


Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution 2.5 Australia License.