January 2008 - Posts

One of the DNM guys asked this morning if we could limit the "What's New" section on the homepage to display only blog posts (no forum posts, recent photos, files, etc).  I figure there is probably a way to filter the data being bound to the IndexPostList control on the homepage, but a simpler way for me was to copy/paste over the existing WeblogPostList control from the Blogs page.  After applying a little CSS magic, I came up with this:

<CSBlog:WeblogPostList runat="Server">

    <QueryOverrides PagerID="Pager" IsAggregate="true" />


        <p />

        <h2 class="CommonTitle"><CSControl:ResourceControl ResourceName="default_homepage_recentposts" runat="server" /></h2>

        <div class="CommonContent">

        <ul class="CommonSearchResultList">



        <CSControl:ConditionalContent runat="server">

            <ContentConditions Operator="Not"><CSBlog:WeblogPostPropertyValueComparison runat="server" ComparisonProperty="IsExternal" Operator="IsSetOrTrue" /></ContentConditions>

            <TrueContentTemplate><li class="BlogPostArea"></TrueContentTemplate>

            <FalseContentTemplate><li class="BlogPostArea External"></FalseContentTemplate>


            <div class="CommonSearchResultArea Weblog">

                <CSBlog:WeblogPostData Property="Subject" LinkTo="Post" Tag="H4" CssClass="CommonSearchResultName" runat="server" />

                <CSBlog:WeblogPostData Property="Excerpt" Tag="Div" CssClass="CommonSearchResult" runat="server" />

                <div class="CommonSearchResultDetails">

                    <CSBlog:WeblogPostData Property="UserTime" LinkTo="Post" IncludeTimeInDate="true" runat="server" />

                    <CSControl:ResourceControl runat="server" ResourceName="Weblog_Aggregate_By" />

                    <CSBlog:WeblogPostData Property="DisplayName" LinkTo="AuthorUrl" runat="server" />

                    <CSControl:ResourceControl runat="server" ResourceName="To" />

                    <CSBlog:WeblogData Property="Name" LinkTo="HomePage" runat="server" />

                    <CSBlog:WeblogPostTagEditableList runat="server" EditorLinkCssClass="CommonTextButton" EditorCssClass="CommonInlineTagEditor" Tag="Div" />









I replaced the IndexPostList control in home.aspx with this and removed the code from OnInit that bound data to the post list and that's all there was to it!

Looks like I already have an opportunity to blog about an unexpected topic - Community Server!  When we switched the DotNetMafia site over to CS2007, the first thing I realized that we needed was a new theme.  Nothing against the default, but it's pretty generic and doesn't really say "mafia" to me. :)

Theming CS2007 could merit a blog in and of itself (in fact, http://getben.com/ and http://community.hydrussoftware.com/blogs/jeffesp/default.aspx both appear to touch on the subject quite regularly).  So I'll leave most of the details to them.  But I was proud enough of myself for figuring out how to add a list of blogs to the homepage that I decided to write a quick blog post about it.

First, you'll need to start with a custom theme.   Get|Ben has a good post covering the process of creating a new theme here.  For this post, I'll assume you're starting with a copy of the default theme.  Inside your theme's folder, there is a Common folder containing the master pages as well as the homepage (home.aspx) for your site. Open the homepage and scroll to the bottom of the file.  In my case, I wanted to add the blog list as a "bubble" on the sidebar - similar to the tag cloud that was already there.  At the bottom of home.aspx, you can see the <CSControl:TagCloud runat="server"... tag.  I inserted some "hello world" text below that, saved the file, and brought up my site's homepage.  Sure enough, that's where I want my blog list.

So - how's it done? If you're going to mess with theming much, you will want to download a copy of the Community Server 2007 Chameleon Control API help file.  I found it on the Community Server site here.  What's not immediately obvious when you open this help file is that the CSControl, CSBlog, CSForum, etc tag prefixes relate to the CommunityServer.Controls, CommunityServer.Blogs.Controls, etc namespaces documented within this file (the tag prefixes are registered in CS2007's web.config file if you're curious).  Anyhow, what I did was look through this help file for something that looked like a blog list.  What I found was CommunityServer.Blogs.Controls.WeblogList.  Could it be that simple?  I went back to home.aspx and replaced my "hello world" with <CSBlog:WeblogList runat="server" /> and refreshed my browser.  Sure enough, now I have a list of the site's blogs!

Ok well, it's just a bullet list and still doesn't look like a "bubble" like the other stuff in the sidebar.  It was a pretty simple matter of looking at the CSS used in the TagCloud control above to come up with this:

        <div class="CommonSidebarArea">

            <div class="CommonSidebarRoundTop"><div class="r1"></div><div class="r2"></div><div class="r3"></div><div class="r4"></div></div>

            <div class="CommonSidebarInnerArea">

                <h4 class="CommonSidebarHeader">Our Blogs</h4>

                <div class="CommonSidebarContent">

                    <CSBlog:WeblogList runat="server" />



            <div class="CommonSidebarRoundBottom"><div class="r1"></div><div class="r2"></div><div class="r3"></div><div class="r4"></div></div>


And voilĂ , a blog list in a bubble.

I hope to do some more cool stuff with Community Server themes as I find the time.  If I do, I'll be sure to write about it here!

Ok, time for the usual lame first blog post to test that everything is set up properly, yada yada...  Maybe an introduction?  I'm currently working as a consultant doing .NET and web development work in Tulsa, OK.  I have worked with lots of programming languages over the years including C/C++, Python, Java, VB, C#, and others.  I've developed for various Unix platforms, done some Mac development, lots of web development, and for Windows of course.

No idea what exactly I'll be writing about on this blog.  Right now, I'm playing with an open source .NET CMS called Umbraco as well as messing with using Cocoa# to put native Mac GUIs on my .NET programs, so those topics are sure to show up.  I also work with the Sitecore CMS a lot at work, so that might show up here as well.