Panel Show

This macro is used for showing or hiding content based on the context of the page or theme.

Usage

Storage Format

<ac:macro ac:name="panel-show"> <ac:parameter ac:name="parameter">value</ac:parameter> <ac:rich-text-body> <!-- content here --> </ac:rich-text-body> </ac:macro>

Wiki Markup

{panel-show:parameter=value} <!-- content here --> {panel-show}

When nesting Panel Show, you do not need to number the macros as done in Builder Show.

ParameterNameDescriptionTypeDefaultRequired

mode

Mode

Only show the content for specific modes, e.g., ViewEdit, etc.

string


context

Context

Only show the content for a specific context(s), e.g., PageGlobal, etc.

string


decorator

Decorator

Only show the content when a specific decorator is used, e.g., Printable, etc.

string


action

Action

Only show the content for specific action(s), e.g., viewpage. NB: The .action part of the action name should not be included.

string


label

Page has Label

Only show the content if the current location (PageNews, etc.) has the specified label(s), e.g., my:favouriteMeetings, etc.

string


spacelabel

Space has Label

Only show the content if the current space has the specified label(s), e.g., Meetings, etc.

string


teamlabel

Space has Team Label

Only show the content if the current space has the specified team label(s), e.g., SalesMarketing, etc.

string


metadata

Page has metadata

Metadata associated with the current location in the format: myKey1:myValue1myKey1:myValue1, etc., when checking for a key with a specific value. To check for the existence of metadata with any value, supply a comma-separated list of key names, e.g., mykey1mykey2mykey3, or mix & match mykey1mykey2:myvalue2

string


exists

Page Exists

Only show the content if a specific page (referred to by the page title) exists. @parent can be used to show data if the page is not at the root level; @child can be used to show data if the page has children.

string


hastitle

Has Title

Only show the content if the current page has a specific title

string


pluginkey

Plugin Enabled

The key of a plugin, which must be enabled for the content to be shown

string


space

Space Exists

Only show the content if a specific space (referred to by the Space Key) exists.

spacekey


user

Username Is

Matches against the current user (NB: modified by withuser) - A comma-separated list of usernames. Use @anonymous for anonymous users only, @creator for the creator of the current space, @author for the author of the current page.

string


group

Group Membership

A comma-separated list of user groups that the current user (NB: modified by withuser) should be a member of

string


restriction

Page Restriction

Display content if the page has a restriction in place (none/view/edit/vieworedit/viewandedit - recursive)

string


permission

User has permission

A comma-separated list of content permissions that the user must have (NB: modified by withuser). Possible values:

view - user has view permission
comment - user can add comments
createpage - user can create pages
createnews - user can create news
edit - user can edit pages or news
remove - user can remove (delete) pages, news, or comments
attach - user can attach files
export - user can export pages or the space
createspace - user can create spaces
spaceadmin - user is a space admin
siteadmin - user is a site admin

string


useragent

User-agent

A comma-separated list of tokens to match against the user agent string of the requesting browser.

string


attachment

Attachment

A comma-separated list of filenames must be attached to the current page to display the content.

string


olderthan

Older Than

Content is shown if the current page was modified before the given time period from the current date. The date is shown in this format: olderthan=1y6m1d1h (year/month/day/hour)

string


newerthan

Newer Than

Content is shown if the current page was modified after the given time period from the current date. The date is shown in this format: newerthan=1y6m1d1h (year/month/day/hour)

string


ip

Requesting IP

A comma-separated list of IP addresses to match against the request

string


skin

Current Skin

A comma-separated list of skins, one of which must be the current skin.

string


parameters

Request Parameters

The request must contain the key or key:value to match

string


locale

Locale

The user's locale matches

string


resource

Resource

The named resource in SKINID. ::resource.ext or @current/@parent::resource.ext formats are available

string


panel

Panel

A list of panels, one of which must exist and be enabled

string


recurse

Recurse

Should parent pages (if applicable) be checked for Title_Labels and Metadatafalse - only check the current page (default) true - also check parent pages, e.g., does the current page or any of its parents have the specified label?

boolean

false

spacekey

Space Key

The space against which permission checks will be made. Default is current space

string


pagetitle

Page Title

The page against which permission checks will be made Default is the current page.

string


withuser

With User

A username that User, Group, and Permission checks should be run against. This includes @anonymous@creator@author, and @current

string


flag

Flag

A comma-separated list of flags to check will only show if at least one of the flags is present: </li>

string


notflag

Not Flag

A comma-separated list of flags to check will only show if none of the flags are present: </li>

string


Parameter Logic

  • While none of the parameters are mandatory, you must specify at least one of them for this macro to work.

  • All contexts and modes specified must match for the macro content to show.

    • In logic terms, this means if you wish to test against two different parameters that may be exclusive, you must use a Show macro for each list of parameters.

    • For example, testing against users and groups: A user must be in one of the groups mentioned, or the logic will not work. If the user is not in a group mentioned in the parameters test for the group permissions in the first Panel Show macro, add another Panel Show macro inside that checks for the user names.

  • You can specify multiple values for any parameter, for example:

    {panel-show:mode=view,edit|context=page,blogpost} stuff to show {panel-show}
    • In the example above, stuff to show will only be shown if the content is shown in View or Edit mode and is either a Page or Blogpost.

Contexts, Modes, and Decorators

You can determine the context and mode for any page by viewing the page source using your browser. An HTML comment output at the top of all pages shows the context and mode for each page.

Example

If you view the HTML source of a ThemeBuilder web page you’ll see similar to the following:

<!-- main.vmd themebuilder : 'com.adaptavist.confluence.sitebuilder.SiteBuilderVelocityHelper@524c9770'/'$themebuilder.initialise' spaceKey : 'USERGUIDE' pageId : '10583' currentURL : '/pages/viewpage.action?spaceKey=USERGUIDE&title=builder-show+macro&focusedCommentId=11666379' contextPath : '' spaceName : 'User Guides' decorator : '$decorator' printable : 'false' mailId : '$mailId' mode : 'view' context : 'page' -->

As shown in the usage example earlier, you can specify multiple contexts and modes by separating them with commas.

Example

Show a message on the user profile page. Code is placed on the ThemeBuilder Content panel.

<ac:macro ac:name="panel-show"> <ac:parameter ac:name="decorator">profile</ac:parameter> <ac:rich-text-body> This is the user profile page. </ac:rich-text-body> </ac:macro> {panel-show:decorator=profile} This is the user profile page. {panel-show}

Result


On this page