Approaching Community Server site replication with Chameleon

One of the Community Server projects I manage is designed to be replicated many times.  Don’t worry, the licenses have already been purchased.  🙂  That’s not my concern.  What is my concern is scaling out the site as efficiently as possible, and that efficiency has a lot to do with Chameleon and the construction of application SiteUrls.

For instance, let’s say each of the Community Server sites has a specific Weblog Group that should appear on a certain page.  Are we going to use GroupIDs in the <QueryOverrides /> statement?  In Development the groupID is 16, so we enter GroupID=”16″ in the Chameleon control HTML QueryOverride statement, but the groupid of the weblog group is “19” on SiteA, “23” on SiteB…you get the idea.  It would be a nightmare to manage.

There are two variables to manage here:  1) GroupIDs used in the queries to generate WeblogList, WeblogPostList, GroupList or other application-specific Chameleon List controls, and 2) Parameters passed to SiteUrls that create our custom hyperlinks.

In both cases a custom DBVTConfiguration class that extends the CSConfiguration architecture with its DBVT.config is an essential ingredient.  The DBVT.config, like its big brother the CommunityServer.config, holds site-wide Core application values and settings.  So in our DBVT.config <Core /> area we’ll store the GroupID for site-wide access to our custom Weblog GroupID.

<Core
   ….
    publicForumSectionID=”21″
    privateForumSectionID=”8″
    siteFeedbackForumSectionID=”22″
    publicBlogGroupID=”16″
/>

To specify the site’s Public Blog Group’s ID in the Chamelon control we’ll use a specific value, something with “69” in it as a personal preference of mine.  How about GroupID=”6969″?  Yeah, that works.

With our DBVTConfiguration class in place, we’ll look for “6969” upon applying our Query Overrides in our custom Chameleon Control, and if so, we’ll set the query.GroupID to the value of publicBlogGroupID found in the DBVT.config.

First we’ll list the designated GroupID in the <QueryOverride />

<DBVT:PublicWeblogList runat=”server”>
    <QueryOverrides GroupID=”6969″ />
    <LeaderTemplate>

 

Then check for it in our custom List control’s DataSource() method.

if (this.QueryOverrides != null)
    this.QueryOverrides.ApplyQueryOverrides(query);

if (query.GroupID == 6969)
    query.GroupID = DBVTConfiguration.GetConfig().PublicBlogGroupID;

From a management perspective, this means that the Chameleon web pages require no modification when copying to multiple sites and we have a single update point unique to each site, the publicBlogGroupID property in DBVT.config.

What about the SiteUrl Parameter passed to CSControl:SiteUrl controls?  Here our custom DBVTUrls class comes into play, in this case working in conjunction with its DBVTConfiguration cousin.

To generate a url for our Public Blog List page in our DBVTUrls class we obtain the site publicBlogGroupID value which we’ll use with FormatUrl() on our SiteUrls.config url.

 

public virtual string PublicBlogList
{
    get
    {
    int publicBlogGroupID = DBVTConfiguration.GetConfig().PublicBlogGroupID;
    return FormatUrl(“dbvt_weblog_GroupHome”, publicBlogGroupID);
    }
}

Then on the HTML side we can either do something like

 

<a href=”<%= DBVTUrls.Instance().PublicBlogList %>” class=”DBVTSubHeadingLink”>
               <CSControl:ResourceControl ID=”ResourceControl4″
                 ResourceName=”DBVT_Blogs_Subheading” ResourceFile=”DBVT.xml”
                 runat=”server” />

or use a SiteUrl Control specifying the DBVT.config value as the Parameter.

 

<CSControl:SiteUrl ID=”SiteUrl2″ UrlName=”dbvt_weblog_GroupHome”
           Parameter1='<%# DBVTConfiguration.GetConfig().PublicBlogGroupID %>’
            runat=”server” CssClass=”DBVTSubHeadingLink” Text='<%# ResourceManager.GetString
           (“DBVT_Blogs_Subheading”,”DBVT.xml”) %>’ />

 

This post needs a Queensryche Stamp of Hard Core Geeky Approval.

[Queensryche]

There ya go.

Article written by

A long time developer, I was an early adopter of Linux in the mid-90's for a few years until I entered corporate environments and worked with Microsoft technologies like ASP, then .NET. In 2008 I released Sueetie, an Online Community Platform built in .NET. In late 2012 I returned to my Linux roots and locked in on Java development. Much of my work is available on GitHub.