Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do add space shortcuts to my space blueprint?

aires I'm New Here Dec 08, 2020

I'm creating a customized space blueprint, but can't seem to figure out how to add automatic space shortcuts (or quick links). I tried following this tutorial: but it doesn't work.

This is code I used from the tutorial:

atlassian-plugin.xml

<web-item key="space-admin-quick-link-manager" name="Quick Link Manager in Space Admin" section="system.space.tools/addons" weight="100">
<label key="space.admin.quick.link.manager" />
<link linkId="space-admin-quick-link-manager-id">/plugins/${project.artifactId}/add-link.action?key=$generalUtil.urlEncode($helper.spaceKey)</link>
<condition class="com.atlassian.confluence.plugin.descriptor.web.conditions.SpaceSidebarCondition"/>
</web-item>

<xwork name="Example Actions" key="example-actions">
<description>Examples of actions</description>
<package name="space-links-xwork-package" extends="default" namespace="/plugins/${project.artifactId}">
<default-interceptor-ref name="validatingStack"/>

<action name="add-link" class="com.project.plugins.racyics.confluence.projectspacebp.MyAction" method="doCreate">
<result name="input" type="velocity">/templates/add-link-action.vm</result>
<result name="success" type="velocity">/templates/add-link-action.vm</result>
</action>
</package>
</xwork>

 

 

MyAction.java

public class MyAction extends AbstractSpaceAction {
private SidebarLinkService sidebarLinkService;
private String message;
private String confirm;

public String doCreate() throws Exception { 


if (!"true".equals(confirm)) {
message = "Please confirm you want to add a link to this space.";
return INPUT;
}


Space space = getSpace();
if (space == null) {
message = "The Space wasn't found.";
return INPUT;
}
long id = space.getHomePage().getId();
boolean exists = sidebarLinkService.hasQuickLink(this.getSpaceKey(), id);


if (!exists){
sidebarLinkService.create(getSpaceKey(), id, null, null);
message = "Link added";
}
else {
message = "Link already exists";
}

return SUCCESS;
}

 

Thanks in advance for the help.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

156 views 0 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you