Skip to content

Instantly share code, notes, and snippets.

@sovcik
Created January 19, 2011 19:12
Show Gist options
  • Save sovcik/786663 to your computer and use it in GitHub Desktop.
Save sovcik/786663 to your computer and use it in GitHub Desktop.
Confluence page layout containing additional sidebar showing pagetree (velocity script)
## PAGE SPECIFIC DECORATOR
## Here the context is the page. Modes are 'view', 'edit', 'edit-preview', 'view-information', and 'view-attachments'.
#set ($helper = $params.get("helper"))
#set ($mode = $params.get("mode"))
#set ($context = $params.get("context"))
#set ($confPage = $helper.page)
#infoPanelInitFromParams()
## GENERAL PAGE DECORATING BEGINS
#requireResourcesForContext("page")
#if ($mode != "edit" && $mode != "edit-preview")
#parse ("/decorators/includes/content-navigation.vm")
#end
#if ($infoPanelRequired)
<content tag="sidebar">
#infoPanel(true true true true)
</content>
#end
<div id="content" class="page $!mode">
#parse ("/template/includes/actionerrors.vm")
#parse("/decorators/includes/link-to-this-page.vm")
#parse ("/template/includes/page-move-templates.vm")
#parse ("/pages/includes/page-permissions.vm")
## MODE SPECIFIC DECORATING BEGINS
#*
Display page based on mode: currently 'view', 'edit', 'preview-edit', 'info' and 'attachments.
See the individual page templates (viewpage.vm, editpage.vm, etc.) for the setting of the mode parameter.
*#
## VIEW
#if ($mode == "view")
<fieldset class="hidden parameters">
<input type="hidden" title="parentPageId" value="$!parentPage.id">
</fieldset>
#if ($space.personal)
#set ($usernameFromSpaceKey = $spaceUtils.getUsernameFromPersonalSpaceKey($spaceKey))
#if ($permissionHelper.canView($action.remoteUser, $action.getUser($usernameFromSpaceKey)))
<content tag="show-personal-sidebar">true</content>
#end
#end
#requireResourcesForContext("viewcontent")
#set ($labelable = $page)
#permitSearchEngines()
#if ($helper.isHistoricalVersion())
<content tag="suppressPdfLink">true</content>
#end
#parse ("/decorators/includes/page-metadata.vm")
#if ($helper.isHistoricalVersion() || $helper.action.navigatingVersions)
#versionInfo()
#end
<fieldset class="hidden parameters">
## If you choose to move page it's being done from view mode
<input type="hidden" title="browsePageTreeMode" value="view">
</fieldset>
## ============ CUSTOMIZATION TO DISPLAY NAVIGATION PAGE
#if ($action.isPrintableVersion() == false)
## SPLIT PAGE INTO THREE COLUMNS
<table cellspacing="2" cellpadding="5">
<tr>
## COLUMN 1 will be loaded from wiki page called 'LeftPanel'
<td class="noprint leftPanel">
<div class="tabletitle">Table of Contents</div>
<div class="spacetree">
#includePage($helper.spaceKey "LeftPanel")
</div>
</td>
## COLUMN 2 is the page
<td "class="pagecontent centerPanel">
<div class="wiki-content">
$body
</div>
</td>
## COLUMN 3 will be loaded from wiki page called 'RightPanel'
<td class="noprint rightPanel">
<div class="spacetree">
#includePage($helper.spaceKey "RightPanel")
</div>
</tr>
</table>
#else
<div class="wiki-content">
$body
</div>
#end
## ============= END OF CUSTOMIZATION
#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
#parse ("/labels/labels-editor.vm")
#renderChildren()
#applyDecorator("root")
#decoratorParam("sitemeshPage" $sitemeshPage)
#decoratorParam("page" $page)
#decoratorParam("context" "comments")
#end
## EDIT || PREVIEW-EDIT
#elseif ($mode == "edit" || $mode == "edit-preview")
$body
## INFO
#elseif ($mode == "view-information")
#requireResourcesForContext("viewinformation")
$body
## ATTACHMENTS
#elseif ($mode == "view-attachments" || $mode == "move-attachments")
#requireResourcesForContext("viewattachments")
$body
#elseif ($mode == "view-attachment")
#requireResourcesForContext("viewattachments")
<content tag="title-text-span">$i18n.getText("properties.attachment", ["$generalUtil.htmlEncode($newFileName)"])</content>
$body
## FOR CUSTOM WEB-ITEMS
#else
$body
#end
## MODE SPECIFIC DECORATING ENDS
</div>
## GENERAL PAGE DECORATING ENDS
#parse ("/pages/page-breadcrumbs.vm")
#menuMacros_renderBrowseMenu()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment