Separating the Home and Dashboard page

Community Server

Group for Content about my AlexCrome.CS addon package for Community Server 2008

Separating the Home and Dashboard page

  • Comments 16

imageThe CS2008 logged in home page.  A wonderful page, just not in the right place.  I don't like the idea of having the homepage significantly different for logged in and anonymous users - I can see the calls from users asking where's the homepage.  However, it's too good a page to lose. 

Now's a time to crack open the theme files and make some modifications.

For those of you who want this modification ready to go, here's one I made earlier .

The first step is to create a copy of the home page, so open up ~/Themes/Hawaii/Common, and make a copy of home.aspx (make sure to make a copy of the .aspx file, not the . master file), and rename this dashboard.aspx.

Create the Home Page

Open up the homepage (home.aspx).  The first is to simplify the CSControl:Title element.  Remove the ConditionalContent control and just replace it with our Home string,giving

<CSControl:Title runat="server" EnableRendering="true" IncludeSiteName="true"
Tag="H1" CssClass="CommonTitle">
    <ContentTemplate>Home</ContentTemplate>
</CSControl:Title>

Since the real homepage doesn't have anything in the left sidebar, the next task is to totally remove the lcr Content Region.

Next up is to remove content from the main section - the bcr Content Region - and the right sidebar - the rcr Content Region.  Each contains one ConditionalContent control.  Remove the TrueContentTemplate, and the control markup, leaving just what was contained within the control's FalseContentTemplate

Finally we want to remove the Page_Load method from the file as it only provides anything when the homepage is in dashboard view, instead throwing an exception.

Now we have a simple, and consistent homepage for all our users.

image 

Create the Dashboard Page

Now open up the dashboard page (dashboard.aspx).  The first change is to simplify the CSControl:Title element - remove the ConditionalContent control, just keeping the TrueContentTemplate, giving

<CSControl:Title runat="server" EnableRendering="true" IncludeSiteName="true"
Tag="H1" CssClass="CommonTitle">
    <ContentTemplate><CSControl:UserData UseAccessingUser="true" runat="server"
Property="DisplayName" /></ContentTemplate>
</CSControl:Title>

As the homepage provides nothing in the left sidebar, just remove the markup surrounding the Placeholder's Content Template in the lcr content region.

Finally, for both the main section and right sidebar - bcr content region, rcr content region respsectively - only keep the TrueContentTemplate markup for the Conditional Content controls in each region.

Show off your Hard Work

We now have a fully functional dashboard page with one major problem - HOW THE HELL DO I ACCESS IT!  The easiest way to access the page is to navigate directly to it - http://yourwebsite.com/themes/hawaii/common/dashboard.aspx but that's not a very friendly URL - a URL such as http://yourwebsite.com/dashboard.aspx is preferable.  In comes a siturls modification.  To ease upgrading, we'll add this through a siteurls_override.config entry.  To your existing siteurls_override.config file, add the following (if you do not have one, use the file included in the download files above)

<Override xpath="/SiteUrls/locations/location[@name='common']" mode="add">
    <url name="user_Dashboard" path="dashboard.aspx" pattern="dashboard.aspx"
                    physicalPath="##themeDir##" vanity="{2}"
page="dashboard.aspx"indexable="false" />
</Override>

Save the file, and touch your web.config, and you should be able to visit your dashboard page  at http://yourwebsite.com/dashboard.aspx.

 

We still have two problems - users cannot easily find the page, and anonymous users can access the page.  This is where the guide moves away from the realms of providing step by step instructions, to giving suggestions.  You could use a combination of any of the below methods, or use a totally different method, the choice is yours.  To solve the second problem, simply add the folowing code to the Dashboard's Page_Load() method

//If we have an anonymous user, redirect him to the login page.
if (CommunityServer.Components.CSContext.Current.User.IsAnonymous)
    Response.Redirect(CommunityServer.Components.SiteUrls.Instance().Login);

 

Add a Dashboard link to the navigation.

There are two stages required here.  The first is to add the navigation item to Siteurls.  That's very easy and only requires the following to be added to siteurls_override.config

<!-- Navigation Links 
        We want the Dashboard link immediately after the Home link.  The easiest way
        to do that is to update the Home link, to add the Home link back, and then
        the Dashboard link
-->
<Override xpath="/SiteUrls/navigation/link[@name='home']" mode="update" >
    <link name="home" resourceUrl="home" resourceName="home" roles="Everyone" />
    <link name="dashboard" resourceUrl="user_dashboard" text="Dashboard" roles="Registered Users"   />
</Override >

The next step is to modify the Dashboard page so the the Dashboard link is highlighted when viewing the page.  To do this change the page's Master Page from home.master to master.master.  Then add the following markup to the page.

<asp:Content runat="server" ContentPlaceHolderID="HeaderRegion" >
    <CSControl:SelectedNavigation runat="server" Selected="Dashboard" />
</asp:Content>

Add a Dashboard link to the UserWelcome area

Open up ~/Themes/Hawaii/Common/UserWelcome.ascx, and add the following markup in the appropiate location

<CSControl:SiteUrl runat="server" UrlName="user_Dashboard" Text="Dashboard" >
    <LeaderTemplate><span class="sub">| </LeaderTemplate>
    <TrailerTemplate></span></TrailerTemplate>
</CSControl:SiteUrl>

 

Link Username in UserWelcome area to Dashboard Page

Open up ~/Themes/Hawaii/Common/UserWelcome.ascx, find the following line

<CSControl:UserData runat="server" LinkTo="Profile" Property="DisplayName"></CSControl:UserData>

and replace it with

<CSControl:SiteUrl runat="server" UrlName="user_Dashboard" Text="Dashboard" >
    <ContentTemplate><CSControl:UserData runat="server" Property="DisplayName" /></ContentTemplate>
</CSControl:SiteUrl>

 

Modify Login page to direct to Dashboard

Find the line that looks like

<CSControl:GoToSiteUrlAction UrlName="home" runat="server" />

and change the UrlName to "user_Dashboard".

 

You can download the outcome of these modifications here.  This copy has separated  the home and dashboard page, added a navigation link to the Dashboard page and changed the username in the UserWelcome area to link to the dashboard page.

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Post
  • Great guide and very well detailed. I'll definitely be taking this one on when I eventually upgrade to CS2008.

  • This is what I was looking for! Awesome work and so important for end user usability.

    Thank you for sharing your knowledge.

  • As you say, the dashboard is an excellent page, it's just in the wrong place.

    Personally I don't mind the home pages being different for logged in and non-logged in users so much.

    But as a logged-in user of the site I don't want arrive at the home page to see a summary of MY blog posts and MY media gallery files. I want to know what I've missed, what's new, what other people have done (not just my friends).

  • Alex,

    Do you know a simple way of adding a "Generic Content" sidebar widget to the home page?

    Thanks in advance

  • End of Week Community Server Riff for October 5, 2008

  • Separating the Home and Dashboard page : Ask Crome can use similar techniques to accomplish other nav

  • Separating the Home and Dashboard page : Ask Crome can use similar techniques to accomplish other nav

  • why i haven&#39;t been getting to my to-do list

  • Alex,

    I face this error when brows the dasboard.aspx:

    Parser Error

    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

    Parser Error Message: Unknown server tag 'CSControl:SectionMembershipList'.

    Source Error:

    Line 78: <FooterTemplate></ul></FooterTemplate>

    Line 79: </CSBlog:WeblogPostList>

    Line 80: <CSControl:SectionMembershipList runat="server" ShowHeaderFooterOnNone="true">

    Line 81: <QueryOverrides QueryType="AccessingUserMembership" SectionApplicationType="Weblog" MembershipType="Owner" PageSize="5" PageIndex="0" />

    Line 82: <HeaderTemplate><ul class="CommonContentBoxList Seperator"></HeaderTemplate>

    Source File: /CS/themes/hawaii/common/dashboard.aspx Line: 80

  • Sweetpotato, these instructions are for CS2008 not CS2008.5. As you're running CS2008.5 you'll need to follow the manual instructions to complete the procedure. However with CS2008.5, the true and false templates have been switched.

  • Alex, Where is exactly the instruction for CS 2008.5?

    Thank,

  • Sorry, I wasn't clear. The downloadable file is only for CS2008. The instructions will work for CS2008.5.

  • A really usefull post. I just like to know what it takes to be able to do the same with CS 2008.5 (SP1). Thanks.

  • Very nice.  I spent only 30 minutes to make everything to work.  Now the homepage is worth the time to put something into.

  • So, is this working on CS 2008.5 (SP1)???

Page 1 of 2 (16 items) 12
Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Post