Using a Configuration File with CS2008.5 Navigation Menus

I’m upgrading some of my client sites to Community Server 2008.5, and have nothing but good things to say about the latest and greatest version of Community Server.  I’m even feeling okay about navigating around in the Control Panel, and that’s saying something.

Speaking of a different type of navigation, I needed to change how Community Server 2008.5 handled the configuration of the navigation menus on a site upgrade this morning.  Ben Tiedt’s Dynamic Navigation add-on is now integrated into CS2008.5, which is very cool.  I blogged about Ben’s add-on with CS2008 quite recently, in fact. The problem with the CS2008.5 implementation (for me, anyway) is that the copy-n-paste menu structure configuration of Ben’s Add-On has been replaced with a drag-n-drop menu creation widget.

The old followed by the new.

The new UI is great if you have a few menu items and you’re dealing with a single site, but I needed several submenu items for each menu item, and I needed to not only replicate the menu structure across many sites, but modify it for each site as well.  Spending as much as an hour or more typing into the “Add Menu Item” form (below) on each new Community Server site wasn’t going to happen. 

Theme configuration properties entered here are stored in a set of Property Key and Value fields in the cs_themeConfigurationData table.  I’m a big fan of property key and value storage. It’s very efficient, but it’s tough to manipulate on-the-fly.  So I decided to bypass the cs_themeConfigurationData altogether and go with a configuration file to manage my site navigation menus instead.

Customization was a snap.  I copied the CS.Controls.NavigationList control and Navigation class into my custom project and changed a total of four lines of code. Seriously, only four lines.  I changed a line in the NavigationList control to hand off menu input string processing to DBVT.Navigation, and two lines in the Navigation class to read the configuration file. I also changed a Split() parameter, which made it four line changes.

That was the extent of the backend coding.  Less is more!  The DBVT.Navigation.config file is human friendly enough, matching the stored serialized menu string structure but with line breaks and no unicode.

The final step was of course telling Master.master to use the DBVT NavigationList control.

Using a configuration file approach to populating the CS2008.5 menu allows me to have an extensive menu structure on new sites simply by dropping a .config file and performing a single Find-Replace for the new site layout.  For Community Server site setups, an hour here, an hour there and after a while it adds up to real time.

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.