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

How can you add Space Tools code to a custom left navigation in Confluence 5.4.3

Matt Boesch April 24, 2014

Like many older Confluence instances, we modified the page layout to have the pagetree macro on the left side for easy space navigation and space search. We also had the pagetree expanded by default. Now that we are migrating from 3.5.16 to 5.4.x, we still want the same functionality. With 5.4.x, the default theme has a new sidebar that offers a pagetree, but I do not believe you can set it to expand all automatically and there is no space search. They also added the space tools in the sidebar. I would like to keep the old left navigation with the pagetree macro and code to add the space tools. Is this possible?

I know that removing the following code from the default page layout removes the contents of the new sidebar, including the space tools section.

#foreach ($webPanel in $webInterfaceManager.getDisplayableWebPanels("atl.page.left.sidebar", {"page": $confPage, "context": $context}))
     $!webPanel.getHtml($action.context)
     #end

I know that only removing the following code from the default page layou keeps the Space Tools section in the sidebar, but removes the Overview, Permissions, Content Tools, Look and Feel and Integrations options from the Space Tools menu. It keeps the Reorder Pages and Configure Sidebar options.

#parse("/template/includes/space-tools-web-items.vm")

Is there code that can allow me to add the Space Tools menu with the Overview, Permissions, Content Tools, Look and Feel and Integrations options to my custom left navigation with the pagetree macro? I have read https://confluence.atlassian.com/pages/viewpage.action?pageId=330796984and think I could live without the other functionality teh sidebar provides, but it would good if there was code where you could add each feature individually if wanted.

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Matthias Schouten January 6, 2015

I have had a simillar problem as you described it here. Donno if you found a fix for this but I have fixed it by implementing the menu myself. I have added it into the admin menu. This is the code i used for implementing the icon that includes the menu

#set ($spaceKey = $sitemeshPage.getProperty("page.spacekey"))
#set ($space = $spaceManager.getSpace($spaceKey))
#set ($isAdmin = $permissionHelper.isSystemAdministrator($action.getAuthenticatedUser()))
#set ($isSpaceAdmin = ($spaceKey && $permissionHelper.canAdminister($action.getAuthenticatedUser(), $space)))
#if ($isAdmin || $isSpaceAdmin)
<a id="admin-menu-link" class="aui-nav-link aui-dropdown2-trigger" href="#" aria-haspopup="true" aria-owns="admin-menues" title="Administration">
    <span class="aui-icon aui-icon-small aui-iconfont-configure">
        Administration
    </span>
</a>                      
#end

 

and this is the menu itself further below in the VMD file

 

<div style="visibility:hidden">

    <nav data-dropdown2-alignment="left" id="admin-menues" class="aui-dropdown2 aui-style-default" aria-hidden="false">
        #if ($isAdmin)
            <div class="aui-dropdown2-section">
                <strong>$i18n.getText('administration.global.menu.label')</strong>
                <ul id="admin-menu-link-conf-admin"
                    class="aui-list-truncate section-conf-admin first">
                    <li class="first"><a id="administration-link"
                        href="$req.contextPath/admin/viewgeneralconfig.action" class="active"
                        title="$i18n.getText('browse.admin')">
                            $i18n.getText('system.admin.generalconfiguration') 
                        </a></li>
                    <li><a id="manage-users-link"
                        href="$req.contextPath/admin/users/browseusers.action" class=""
                        title="$i18n.getText('system.admin.users.desc')"> 
                            $i18n.getText('system.admin.users.vanilla')
                        </a></li>
                    <li class="last"><a id="plugin-administration-link"
                        href="$req.contextPath/plugins/servlet/upm" class=""
                        title="$i18n.getText('system.admin.plugins.desc')">
                            $i18n.getText('system.admin.plugins') 
                        </a></li>
                </ul>
            </div>
        #end
        #if ($isSpaceAdmin)
            <div class="aui-dropdown2-section">
                <strong>$i18n.getText('space.tab.admin')</strong>
                <ul class="space-tools-navigation">
                    <li><a
                        href="$req.contextPath/spaces/viewspacesummary.action?key=$spaceKey&src=spacetools"
                        title="$i18n.getText('action.space.overview')">$i18n.getText('action.space.overview') </a></li>
                    <li><a
                        href="$req.contextPath/spaces/spacepermissions.action?key=$spaceKey&src=spacetools"
                        title="$i18n.getText('action.space.permissions')">$i18n.getText('action.space.permissions')</a></li>
                    <li><a
                        href="$req.contextPath/pages/templates2/listpagetemplates.action?key=$spaceKey&src=spacetools"
                        title="$i18n.getText('action.space.content.tools') ">$i18n.getText('action.space.content.tools') </a></li>
                    <li><a
                        href="$req.contextPath/spaces/choosetheme.action?key=$spaceKey&src=spacetools"
                        title="$i18n.getText('action.space.lookandfeel') ">$i18n.getText('action.space.lookandfeel') </a></li>
                </ul>
            </div>
        #end
    </nav>
    
</div>

plus ofcourse some CSS. You cann adapt the menu itself with any other menu field if it is nessecary. Furthermore it think there is for sure a nicer way to implement it, but for us / me this worked fine.

 Hope this helps

 

Cheers,

Theresa Rinehart February 4, 2015

Thanks Matthias. I need to look back on what I did, but it was not elegant, but it works. I think I used some CSS and just overlaid the pagetree macro on top of the default left nav. I am upgrading a second instance of Confluence soon, so I will take a look at your solution to see if it works better for me.

Matt Boesch February 4, 2015

Sorry, I was logged in as my supervisor, as I was using her account to look at our licenses and `download the source code for JIRA. The comment above was from me.

0 votes
Matthew Choy February 5, 2015

Hi, had the same issue and found an answer yesterday.

  • Change your theme to "Documentation theme"
  • Go To Browse->Space Admin->Themes->Configure Theme
  • Untick Page Tree in Navigation (this is the default one)
  • Add the following code to the Navigation Box
    "{pagetree:startDepth=2}"

You can configure your sidebar with other macros similarly, I am using a LiveSearch Box and an Image.

TAGS
AUG Leaders

Atlassian Community Events