#foreach( $childNode in $contentNode.getChildren() )
#pageHierarchy($childNode $name)
#end
#end
#end
#*
PARAMETERS:
request - the http request
title - the text of the link
url - the URI to link to
selected - the nav item will be selected if this link matches request.getServletPath().startsWith(selected)
tooltip - an optional phrase to be used as the tooltip for the navitem link.
*#
#macro( navitem $title $url $selected $tooltip $accessKey)
## only hide the javascript if it is IE or Mozilla (not netscape or Opera) - Fixes JRA-1427
#if ($webReqUtils.isGoodBrowser($req) && $textUtils.noNull($req.getHeader("USER-AGENT")).indexOf("Opera") == -1)
#set ($captureJavascript = true)
#end
#if ($req.servletPath.startsWith($selected))
## css hack as described here: http://www.fo3nix.pwp.blueyonder.co.uk/tutorials/css/hacks/
## only good browsers recognise that 'return false' isn't killing the tag. So don't 'return false' in netscape 4
#end
#* this can only be used with page titles that are safe to append to a URL *#
#* must check existance of page before $permissionCheckDispatcher, otherwise dispatcher will throw an IllegalStatementException *#
#macro (includePage $spaceKey $pageTitle)
#if ($generalUtil.isAllAscii($pageTitle))
#if ($renderBean.pageExists($spaceKey, $pageTitle))
#if ($permissionCheckDispatcher.isPermitted("/pages/viewpage.action?spaceKey=$spaceKey&title=$pageTitle"))
$renderBean.render($spaceKey, $pageTitle)
#else
You do not have sufficient privileges to include this page.
#end
#else
Page not found
#end
#else
The includePage macro can only be used with ASCII titles. For other titles use the includePageWithId macro.
#end
#end
#macro (includePageWithId $pageId)
#if ($renderBean.pageExists($pageId))
#if ($permissionCheckDispatcher.isPermitted("/pages/viewpage.action?pageId=$pageId"))
$renderBean.render($pageId)
#else
You do not have sufficient privileges to include this page.
#end
#else
Page not found
#end
#end
#*
Link to a user's profile page, given their username. If the username doesn't exist, "Anonymous" is printed
*#
#macro (usernameLink $username)
#if ($username != "")
#if ($action.getUserFullName($username))$generalUtil.htmlEncode($action.getUserFullName($username))#else$username#end
#else Anonymous#end
#end
#macro (usernameLinkWithCustomBaseUrl $username $baseurl)
#if ($username != "")
#if ($action.getUserFullName($username))$generalUtil.htmlEncode($action.getUserFullName($username))#else$username#end
#else Anonymous#end
#end
#macro (usernameLinkParentWindow $username)
#if ($username)
$generalUtil.htmlEncode($action.getUserFullName($username))
#else
Anonymous
#end
#end
#macro (emailUserLink $user $baseurl)
#if ($user)
$generalUtil.htmlEncode($user.fullName)
#else
Anonymous
#end
#end
#macro (userNonLink $user)
#if($user && $user.name)$generalUtil.htmlEncode($action.getUserFullName($user.name))#else Anonymous #end
#end
#macro (siteTitle)$settingsManager.globalSettings.siteTitle#end
#*
Prints the search result pagination info.
*#
#macro(pagination $paginationSupport $actionContext)
#set ($previousIndexes = $paginationSupport.previousStartIndexes)
#set ($nextIndexes = $paginationSupport.nextStartIndexes)
#end
#*
Prints the search result pagination info. for a pager object (i.e. with total size unknown).
*#
#macro(entityPagination $paginationSuppor $actionContext)
#set ($previousIndexes = $paginationSupport.previousStartIndexes)
#set ($nextIndexes = $paginationSupport.nextStartIndexes)
#end
#*
Prints the search box (if Confluence is setup)
*#
#macro(searchbox)
#if ($bootstrap.isSetupComplete())
#end
#end
#*
Prints the breadcrumbs
*#
#macro(breadcrumbs)
#if ($sitemeshPage.getProperty("page.breadcrumbs"))
$sitemeshPage.getProperty("page.breadcrumbs")
#end
#end
#macro(usernavbar)
#if ($bootstrap.isSetupComplete())
#if ($user)
Welcome $generalUtil.htmlEncode($user.fullName) |
#if ($userHistory)
#set ($windowHeight = 100 + (25 * $userHistory.content.size()))
History |
#end
Profile |
#if ($permissionHelper.isGlobalAdministrator($user))
Administration |
#end
Log Out
#else
#* for the login link, we want it to carry the current page the user is viewing anonymously, so that once they login they will be taken back
to this page. However, we do not want to do this if they are on the logout/signup page/forgot password pages *#
Log In
#if (!$settingsManager.getGlobalSettings().isExternalUserManagement())
#if (!$settingsManager.getGlobalSettings().isDenyPublicSignup())
| Sign Up
#end
#end
#end
#end
#end
#macro(helpicon)
#end
#macro(printableicon)
#if ($sitemeshPage && $sitemeshPage.req)
#end
#end
#macro(pdficon)
#set ($pageId = $sitemeshPage.getProperty("page.pageId"))
#if ($sitemeshPage && $req && $pageId && $permissionCheckDispatcher.isPermitted("/pages/doexportpage.action?pageId=$pageId&type=TYPE_PDF"))
#else
#end
#end
#macro(pagetitle $class)
#if ($bootstrap.isSetupComplete() && $sitemeshPage.getProperty("page.spacename"))
#end
#macro (trackbackRdf $identifier $title $ping)
#end
#macro (onoff $test)
#if ($test) ON #else OFF #end
#end
#macro (yesno $test)
#if ($test) YES #else NO #end
#end
## Expects a javascript function as a variable which can be excecuted in this script.
#macro (fielderrorExecuteFunction $fieldname $javascriptFunction)
#set ($fieldErrors = $action.fieldErrors)
#if ($fieldErrors)
#if ($fieldErrors.get($fieldname))
#foreach ($error in $fieldErrors.get($fieldname))
#end
#end
#end
#end
#*
Sets up variables which are used to determine whether or not the help panel
should be displayed.
*#
#macro(infoPanelInit)
#if ($sitemeshPage.getProperty("meta.help-path"))
#set ($helpPath = $sitemeshPage.getProperty("meta.help-path"))
#end
#if ($sitemeshPage.getProperty("page.help-content"))
#set ($helpContent = $sitemeshPage.getProperty("page.help-content"))
#end
## decide whether or not to include the right nav bar
#if ($helpPath || $helpContent)
#set ($helpAvailable = true)
#end
#if ($sitemeshPage.getProperty("meta.infopanel-width"))
#set ($panelWidth = $sitemeshPage.getProperty("meta.infopanel-width"))
#end
#set ($infoPanelRequired = $helpAvailable)
#end
#*
Sets up variables which are used to determine whether or not the help panel
should be displayed, using the parameter object passed by the inline decorator
directive: applyDecorator
*#
#macro(infoPanelInitFromParams)
#if ($params.get("help-path"))
#set ($helpPath = $params.get("help-path"))
#end
#if ($params.get("help-content"))
#set ($helpContent = $params.get("help-content"))
#end
## decide whether or not to include the right nav bar
#if ($helpPath || $helpContent)
#set ($helpAvailable = true)
#end
#if ($params.get("infopanel-width"))
#set ($panelWidth = $params.get("infopanel-width"))
#end
#set ($infoPanelRequired = $helpAvailable)
#end
#macro(standardHeader)
##infoPanelInit() we now initialize the info panel in the content decorator
#if ($sitemeshPage.getProperty("page.spacekey"))
#else
#end
#if (!$sitemeshPage.getProperty("page.allowindex"))
#end
#if ($sitemeshPage.getProperty("page.rssautodiscovery"))
$sitemeshPage.getProperty("page.rssautodiscovery")
#end
#if ($sitemeshPage.getProperty("page.headsection"))
$sitemeshPage.getProperty("page.headsection")
#end
#end
#macro(rssautodiscovery $rssDescriptor)
#if($rssDescriptor)
#end
#end
#macro(infoPanel $incomingLinks $trackbacks $referrers $externalReferences)
#end
#* passes the url to the permissionDispatcher first. if user has permissions to see link, this macro will display it
* $url: the url of the action. You must drop the contextPath off the url before passing it in here.
* $linkTextKey: the i18n key for the name of the link
*#
#macro (confluenceLink $url $linkTextKey)
#if ($permissionCheckDispatcher.isPermitted($url))
$action.getText($linkTextKey)
#end
#end
#macro (confluenceLink2 $url $linkTextKey $prefix $suffix)
#if ($permissionCheckDispatcher.isPermitted($url))
$prefix $action.getText($linkTextKey) $suffix
#end
#end
#macro (showPermissionsHeader)
Pages
News
Comments
Attachments
Mail
Space
View
Create
Export
Restrict
Remove
Create
Remove
Create
Remove
Create
Remove
Remove
Export
Admin
#end
#*
* Macro for getting the URL of a resource from within a themed decorator
*#
#macro (themeResource $resourcePath)$req.contextPath$sitemeshPage.getProperty("theme.resource.path")$resourcePath#end
#*
* This macro is quite messy but is neater than simply copying and pasting the HTML three times on two different
* screens to represent view and edit views of permissions for groups, users, and anonymous entities.
*
* Note - this macro renders form elements when in edit mode but you must wrap it in a form element yourself.
*
* $who: list containing the following symbols - "g" (group), "u" (user), "a" (anonymous), "e" (everyone).
* Each symbol is a directive to print out symbolized information in the order in which the symbols are expressed.
* Note - "e" is actually ["g", "u", "a"]
*
* $action: an object carry functionality to support calls for group, user, and anonymous permissions; for example
* com.atlassian.confluence.security.actions.EditSpacePermissionsAction .
*
* $edit: string literal; if set to "true" it will output input boxes for each permission listing, otherwise it will
* use a tick or cross image for read-only.
*#
#macro (showPermissions $who $action $edit )
#if ($who == ["e"])
#set ($who = ["g", "u", "a"])
#end
#foreach( $entity in $who )
#* -- outputting group permissions from $action -- *#
#if ($entity == "g")
#set ($groups = $action.activeGroups)
#if ($groups.size() > 0)
#showPermissionsHeader()
#foreach ($group in $groups)
#end
#macro (editReport)
Added by #usernameLink ($page.creatorName),
#if ($page.isLatestVersion() == true)last#end edited by #usernameLink ($page.lastModifierName) on $generalUtil.format( $page.lastModificationDate )
#if ($page.isLatestVersion())
#if ($page.previousVersions.size() != 0)
#set($length = $page.previousVersions.size() - 1)
#set($prevVersionId = $page.previousVersions.get($length).id)
(view change)
#end
#end
#if ($page.isVersionCommentAvailable())
show commenthide comment
#versionComment()
#end
#end
#macro (labelsWithNone $labels $showNone)
#if ($labels.size() > 0) #foreach($label in $labels)#if($velocityCount > 1), #end #labelLink($label)#end
#elseif ($showNone) (None) #end
#end
#*
Renders a comma seperated list of labels limited by a max amount.
If there are more than max labels it shows: ... x $message.
*#
#macro (labelsMax $labels $max $message)
#if ($labels.size() > 0)
#set($remaining = $labels.size() - $max)
#foreach($label in $labels)#if($velocityCount <= $max)#if($velocityCount > 1), #end #labelLink($label)#end#end
#if($remaining > 0)
... $remaining $message
#end
#end
#end
#macro (labels $labels)
#labelsWithNone ($labels true)
#end
## label links shown in the context of a space should take the user to a page that contains content for that space only
## to do this, we need to pull the space key either from the $helper or from the $action
## neither of these are available for the $label.urlPath method (which contains the intelligence to display a i18n label properly by id)
## the compromise is to move $label.urlPath logic into here (and also append a spacekey at the end of the i18n friendly url)
## please use this macro to generate url's for labels where ever possible
#macro (labelLinkUrl $label)#*
*##if ($generalUtil.isSafeTitleForUrl($label.realTitle))#*
*#$req.contextPath/label/#if($helper.spaceKey)$helper.spaceKey/#elseif($spaceKey)$spaceKey/#end$webwork.urlEncode($label.realTitle)#*
*##else#*
*#$req.contextPath$label.urlPath#if($helper.spaceKey)&key=$helper.spaceKey#elseif($spaceKey)&key=$spaceKey#end#*
*##end#*
*##end
#macro (labelLink $label)$label.realTitle#end
## Displays the label link without the namespace
#macro (labelLinkBasic $label)$label.name#end
#macro (labelString $labelable)#if ($labelable.labels.size() > 0) #foreach($label in $labelable.labels)#if($velocityCount > 1), #end$label.name#end#end
#macro (mailOperations $helper)
#end
#* ----------------------------------------------- LOGO MACROS ----------------------------------------------- *#
## only returns the image url of the appropriate logo
#macro (logo $spaceKey)#*
*##if ($textUtil.stringSet($spaceKey) && $resourceManager.getResourceWithSpaceKey("logo", $spaceKey))#*
*#$req.contextPath/download/userResources/$spaceKey/logo#*
*##elseif ($resourceManager.getResource("logo", null))#*
*#$req.contextPath/download/userResources/logo#*
*##else#*
*#$req.contextPath/images/confluence_logo.gif#*
*##end#*
*##end
## checks if space preferences to determine if the logo has been disabled, and then displays it.
## include href link just in case we want to customize this part based on some preference in the future (without breaking people's stuff again)
#macro (logoBlock $spaceKey)#*
*##if ($textUtil.stringSet($spaceKey))#*
*##spaceLogoBlock($spaceKey)#*
*##else#*
*##globalLogoBlock()#*
*##end#*
*##end
## private - use #logoBlock
#macro (spaceLogoBlock $spaceKey)#*
*##if ($settingsManager.getSpaceSettings($spaceKey).isDisableLogo())#* render nothing
*##else#*
*##if($resourceManager.getResourceWithSpaceKey("logo", $spaceKey))#* check if a space logo exists so we know if we need to defer to global logo settings
*##*
*##else#*
*##globalLogoBlock()#*
*##end#*
*##end#*
*##end
## private - use #logoBlock
#macro (globalLogoBlock)#*
*##if ($settingsManager.getGlobalSettings().isDisableLogo())#* render nothing
*##else#*
*##*
*##end#*
*##end
#* ----------------------------------------------- SIMPLE LINK MACROS -----------------------------------------------
Store macros which render a one line link here.
*#
#macro (tinyLink )
$helper.domainName/x/$helper.tinyUrl
#end
#*
Renders a link and image for removing the current page.
*#
#macro (removePageLinkAndImage )
#end
#*
Renders a link for removing the current page.
*#
#macro (removePageLink)
Remove
#end
#*
Renders a link and image for removing the current blogpost.
*#
#macro (removeBlogPostLinkAndImage )
#end
#*
Renders a link for removing the current blogpost.
*#
#macro (removeBlogPostLink )
Remove
#end
#macro (browseSpaceLinkAndImage)
#set ($spaceKey = $helper.spaceKey)
#if (!$spaceKey && $space)
#set ($spaceKey = $space.key)
#end
#if ($permissionCheckDispatcher.isPermitted("/pages/listpages.action?key=$spaceKey"))
Browse Space
#end
#end
#macro (browseSpaceLink)
#set ($spaceKey = $helper.spaceKey)
#if ($permissionCheckDispatcher.isPermitted("/pages/listpages.action?key=$spaceKey"))
Browse Space
#end
#end
#macro (addPageLinkAndImage)
#set ($spaceKey = $helper.spaceKey)
#if ($permissionHelper.canCreatePage($remoteUser, $space))
## if user currently viewing a page, add page automatically creates a new page with that page is the parent
#if ($helper.page.id && !$helper.page.postingDay)
Add Page
#else
Add Page
#end
#end
#end
#macro (addPageLink)
#set ($spaceKey = $helper.spaceKey)
#if ($permissionHelper.canCreatePage($remoteUser, $space))
## if user currently viewing a page, add page automatically creates a new page with that page is the parent
#if ($helper.page.pageId && !$helper.page.postingDay)
Add Page
#else
Add Page
#end
#end
#end
#macro (addNewsLinkAndImage)
#set ($spaceKey = $helper.spaceKey)
#if ($permissionCheckDispatcher.isPermitted("/pages/createblogpost.action?spaceKey=$spaceKey"))
#if ($helper.page.id)
#set ($fromPageParam = "&fromPageId=$helper.page.id")
#else
#set ($fromPageParam = "")
#end
Add News
#end
#end
#macro (addNewsLink)
#set ($spaceKey = $helper.spaceKey)
#if ($permissionCheckDispatcher.isPermitted("/pages/createblogpost.action?spaceKey=$spaceKey"))
#if ($helper.page.id)
#set ($fromPageParam = "&fromPageId=$helper.page.id")
#else
#set ($fromPageParam = "")
#end
Add News
#end
#end
#macro (viewPageLink )
#if ($helper.page.id)
#if ( $permissionCheckDispatcher.isPermitted("/pages/viewpage.action?pageId=$pageId") )
View
#end
#end
#end
#macro (attachmentsLink)
#if ( $permissionCheckDispatcher.isPermitted("/pages/viewattachments.action?pageId=$pageId") )
Attachments ($!helper.numberOfAttachments)
#end
#end
#macro (recentlyUpdatedListLink)
Recently Updated
#end
#macro (alphabeticalListLink)
Alphabetical
#end
#macro (contentTreeLink)
Tree
#end
#macro (pluginStylesheet $pluginCompleteKey $stylesheetName)
#end
#macro (node $p $idsToExpandAsList $openId)
#if ($action.hasPermittedChildren($p))
#if($idsToExpandAsList.contains($p.id))
#else
#end
#else
#end
#if ($p.id == $openId)
#contentLinkWithAnchor($p 'selectedPageInHierarchy')
#else
#contentLink2 ($p true false)
#end
#if ($idsToExpandAsList.contains($p.id))
#foreach ($child in $action.getPermittedChildren($p))
View the rest of this thread. Most recent comment: #if ($generalUtil.isInLastDays($comment.threadChangedDate, 60)) $generalUtil.getRelativeTime($comment.threadChangedDate) #else $generalUtil.format($comment.threadChangedDate) #end
$comment.descendantsCount more comments by: #nameList($comment.descendantAuthors)
#end
#end
#end
#end
#macro (searchResultContentLink $content)
#contentIcon($content)
## Render the search result link
#if ($content.type == "attachment")
$webwork.htmlEncode($content.realTitle)
#elseif ($content.type == "comment")
$webwork.htmlEncode($content.realTitle)
#else
$webwork.htmlEncode($content.realTitle)
#end
## Render the context of the search result (what space it was in, etc)
#if ($content.type == "page" || $content.type == "blogpost")
#if ($content.originalVersion)
v. $content.version ($content.originalVersion.space.name)
#else
($content.space.name)
#end
#elseif ($content.type == "comment")
($content.page.space.name > $webwork.htmlEncode($content.page.realTitle))
#elseif ($content.type == "spacedesc")
(Space Description)
#elseif ($content.type == "userinfo")
($content.username)
## If it is a profile attachment, display the username (CONF-4272)
#elseif ($content.type == "attachment" && $content.content.type == "userinfo")
($content.content.username)
#elseif ($content.type == "attachment")
($content.content.space.name > $webwork.htmlEncode($content.content.realTitle))
#elseif ($content.type == "mail")
($content.space.name)
#end
#end
#macro (searchResult $searchResultWithExcerpt $showExcerpts)
#set ($content = $searchResultWithExcerpt.resultObject)
#set ($contentBody = $searchResultWithExcerpt.content)
#searchResultContentLink($content)
#if ('true' == $showExcerpts)
#if ($content.type != "attachment")
#set ($summary = $generalUtil.makeSummary($contentBody, $action.searchQuery.getSearchWords()))
#elseif ($content.type == "attachment" && $contentBody)
#set ($summary = $generalUtil.makeSummary($contentBody, $action.searchQuery.getSearchWords()))
#elseif ($content.type == "attachment" && $content.comment)
#set ($summary = $generalUtil.makeSummary($content.comment, $action.searchQuery.getSearchWords()))
#end
#if ($summary)
## this is all one one line so that fragments are concatenated properly without spaces
#foreach ($fragment in $summary.fragments)#if ($fragment.isHighlight() == true)$generalUtil.htmlEncode($fragment.toString())#else$generalUtil.htmlEncode($fragment.toString())#end#end
#end
#end
#if ($content.type == 'attachment')
#if ($content.niceType)
$content.niceType -
#end
$content.niceFileSize -
#end
$generalUtil.format($content.lastModificationDate)
#if ($content.type == 'attachment')
- Download
- All Attachments
#elseif ($content.type == 'comment')
- All Comments
#elseif ($content.type == 'blogpost')
- All News
#elseif ($content.type == 'mail')
- All Mail
#end
#end
#if ($content.labels.size() > 0)
Labels: #labelsMax($content.labels 5 'more labels.')
#end
#end
#macro (commaDelimitedList $list)
#foreach($item in $list)#if($velocityCount != 1), #end$item#end
#end