How do I render an xwork action inside a space admin page?

Brett Ryan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 8, 2012

I've got the web-item configured, have the xwork package and action working correctly, however when I click the menu option in the space admin to open my action it navigates away from the space admin section instead of rendering to the right of the space admin menu.

I can't figure out what I've done to stop this from rendering correctly.

My web-item:

<web-item key="configure-purge-attachments-space"
          name="Configure Purge Attachments (Space)"
          section="system.space.admin/spaceops"
          weight="40">
  <label key="Attachment Purging" />
  <link>/spaces/configure-purge-attachments-space.action?key=$helper.space.key</link>
  <condition class="com.drunkendev.confluence.plugins.attachments.ConfigurePurgeAttachmentsSpaceCondition"/>
</web-item>

My xwork section:

<xwork key="configure-purge-attachments"
       name="Configure Purge Attachments">
  <package name="purge-attachments-space"
           extends="default"
           namespace="/spaces">
    <default-interceptor-ref name="validatingStack" />
    <action name="configure-purge-attachments-space"
            class="com.drunkendev.confluence.plugins.attachments.ConfigurePurgeAttachmentsSpaceAction">
      <result name="success" type="velocity">/templates/purge-attachments/config/configure-purge-attachments-space.vm</result>
    </action>
  </package>
</xwork>

My action class:

public class ConfigurePurgeAttachmentsSpaceAction
        extends AbstractSpaceAction implements SpaceAware {

    @Override
    public boolean isSpaceRequired() {
        return true;
    }

    @Override
    public boolean isViewPermissionRequired() {
        return true;
    }

    @Override
    public boolean isPermitted() {
        return getRemoteUser() != null
                && getSpace() != null
                && permissionManager.hasPermission(
                        getRemoteUser(),
                        Permission.ADMINISTER,
                        getSpace());
    }

}

Page template

<?xml version="1.0" encoding="UTF-8"?>

<html>
  <head>
     <title>$action.getText("com.drunkendev.confluence.plugins.attachment-tools.config.title")</title>
  </head>
  <body>
    <p>To implement</p>
  </body>
</html>

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Brett Ryan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 9, 2012

My apologies, just worked it out. Needed to add the decorators to show the admin panels:

#applyDecorator("root")
      #decoratorParam("helper" $action.helper)
      #decoratorParam("mode" "view-space-administration")
      #decoratorParam("context" "space-administration")
    #applyDecorator ("root")
      #decoratorParam ("context" "spaceadminpanel")
      #decoratorParam ("selection" "configure-purge-attachments-space")
      #decoratorParam ("title" "Attachment Purging")
      #decoratorParam ("selectedTab" "admin")
      #decoratorParam("helper" $i18n.helper)

Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 16, 2012

More detail in this related answer - https://answers.atlassian.com/questions/67072/how-to-modify-custom-confluence-page-so-that-its-viewable-like-default-options/67376

You also need to #end the #applyDecorator calls.

TAGS
AUG Leaders

Atlassian Community Events