Purpose

This create a Confluence button that starts a Page creation below a specified space/page combination(that must be valid).

An alternative to the standard "Create" button that alway creates below the current page.

 

Details

Macro Name

create-below-page

Macro-TitleCreate Page below Parent
DescriptionThis Macro creates a button that initiates a new Page creation under a specific existing Page
CategoriesConfluence Content
Documentation URLhttp://www.mos-eisley.dk/x/EIDzAg

Definition of User Macro

(tick)No macro body
(error)Escaped
(error)Unrendered
(error)Rendered

 

In Custom HTML, the button can be styled as:

.aui-button-below-page {
padding: 0px !important;
padding-left: 5px !important;
width: 20px !important;
height: 20px !important; }

 

Macro Code

## @param pagetitle:title=Page Title|type=string|required=true|desc=
## @param spacekey:title=Space Key|type=string|required=false|desc=
## @param buttontitle:title=Button Title|type=string|required=false|desc=
## @param buttonhelptext:title=Button Helptext|type=string|required=false|desc=
## @param buttoncolor:title=Button color|type=string|required=false|desc=
## @param buttontextcolor:title=Button Textcolor|type=string|required=false|desc=

#set ($pageManager=$action.getPageManager())

#if (${paramspacekey})
#set($spacekey=${paramspacekey})
#else
#set($spacekey=$renderContext.getOriginalContext().getSpaceKey())
#end

#set($pageid=$pageManager.getPage($spacekey,"${parampagetitle}").getId())
#if (${parambuttontitle} == "")
#set($buttontitle="Create Content")
#else
#set($buttontitle=${parambuttontitle})
#end

#if ($pageid)
<a href="/pages/createpage.action?spaceKey=${spacekey}&fromPageId=$pageid" class="#header aui-button aui-style aui-button-primary aui-nav-imagelink aui-button-below-page" style="background: ${parambuttoncolor}; color: ${parambuttontextcolor};" title="${parambuttonhelptext}">$buttontitle</a>
#else
<a href="Javascript:;" title="Error in create-below-page macro: Space/page does not exist"><font color=red>ERROR</font></a>
#end