Wednesday, April 28, 2010

CS 2008.5 Navigation in Telligent community 5

To restore the CS2008.5 navigation - where you specified navigation through the control panel.

1. Make a backup of your existing ~/utility/headerfragments/core/groupnavigation.ascx ~/themes/fiji/theme.config files and ~/controlpanel/settings/themeconfiguration.aspx files
2. Replace the ~/utility/headerfragments/groupnavigation.ascx file with the below


<%@ Control Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="CommunityServer.Components"%>

<script runat="server">
   
protected ThemeConfigurationData themeData = CSContext.Current.ThemePreviewCookie.IsPreviewing(SiteThemeContext.Instance()) ? ThemeConfigurationDatas.GetThemeConfigurationData(SiteThemeContext.Instance(), "fiji", CSContext.Current.ThemePreviewCookie.PreviewID, true) : ThemeConfigurationDatas.GetThemeConfigurationData(SiteThemeContext.Instance(), "fiji", true);

public bool IsOneBarNavigation()
{
    return themeData.GetBoolValue("onebarnavigation", false);
}
   
</script>

<div id="ParentGroupListContainer" class="parent-container" style="width: 100%" runat="server">
<div class="parent-sub-container">
    <CSControl:NavigationList runat="server" Property="navigationItems" Theme="<%= themeData.ThemeName %>" Level="0" RenderChildrenInContextMenu="false"  >  
        <LeaderTemplate>
            <div class="navigation-list-header"></div>
            <ul class="navigation-list parent">
        </LeaderTemplate>
        <ItemTemplate>
            <CSControl:ConditionalContent runat="server">
                <ContentConditions><CSControl:CSLinkPropertyValueComparison runat="server" ComparisonProperty="IsSelected" Operator="IsSetOrTrue" /></ContentConditions>
                <TrueContentTemplate><li class="navigation-item selected entry"></TrueContentTemplate>
                <FalseContentTemplate><li class="navigation-item entry"></FalseContentTemplate>
            </CSControl:ConditionalContent>
            <CSControl:CSLinkData runat="server" LinkTo="Link" Property="Text" />
        </ItemTemplate>
        <TrailerTemplate>
            </ul>
            <div class="navigation-list-footer"></div>
        </TrailerTemplate>
    </CSControl:NavigationList>
</div>
</div>
<CSControl:NavigationList runat="server" Theme="<%= themeData.ThemeName %>"  Property="navigationItems" Level="1" ShowHeaderFooterOnNone="false">  
    <DisplayConditions><CSControl:CustomCondition CustomResult="<%# !IsOneBarNavigation() %>" runat="server" /></DisplayConditions>
    <NoneTemplate></NoneTemplate>
    <HeaderTemplate>
        <div id="ChildGroupListContainer">
            <div class="navigation-list-header"></div>
            <ul class="navigation-list child">
    </HeaderTemplate>
        <ItemTemplate><CSControl:CSLinkData runat="server" CssClass="navigation-item entry" Tag="Li" LinkTo="Link" Property="Text" /></ItemTemplate>
        <FooterTemplate>
            </ul>
            <div class="navigation-list-footer"></div>
        </div>
    </FooterTemplate>
</CSControl:NavigationList>


3. Add the following into ~/themes/fiji/theme.config

<propertyGroup resourceName="Navigation" resourceFile="ThemeResources.xml">
    <property id="navigationItems" resourceName="NavigationItems" resourceFile="ThemeResources.xml" dataType="Custom" descriptionResourceName="NavigationItems_Description" descriptionResourceFile="ThemeResources.xml" controlType="CommunityServer.Controls.DynamicNavigationCustomControl, CommunityServer.Controls" maximumDepth="2" />
</propertyGroup>


4. Add the following into the <script> block at the top of /controlpanel/settings/themeconfiguration.aspx - this is to work around an issue with the Dynamic Navigation Configuration Control.
function ContentFragments_Update(cfConfigurationData) {
    if (cfConfigurationData != null && _contentFragments_currentContentFragmentId) {
        var cfState = document.getElementById('ContentFragments_' + _contentFragments_currentContentFragmentId);
        if (cfState)
            cfState.value = cfState.value.split(':')[0] + ':' + cfConfigurationData;
    }

   _contentFragments_currentContentFragmentId = null;
}     

Taken from the post of Alex Chrome "http://telligent.com/community/ideas/f/532/t/1057775.aspx"


Happy coding.