Dave Burke : Freelance .NET Web Developer specializing in Online Communities

Using Custom Objects in Chameleon Display Conditional Testing

Ben Tiedt's Chameleon is one of my favorite aspects of developing in Community Server.  With it's hierarchical contextual awareness and library of smart ASPNET controls, sophisticated UI's can be created in very little time.  Of course, using CodeSmith templates to bang out the underlying class structures helps facilitate the process, too.

Chameleon makes heavy use of <CSControl:Placeholders /> which display content using a <DisplayConditions> property.  As an example, the DisplayCondition test to display page content to registered users only would be


<DisplayConditions>
        <CSControl:UserInRoleCondition Role="Registered Users" UseAccessingUser="true" runat="server" />
</ DisplayConditions>


If registered, thus in the "Registered Users" role, the content would display.  You wouldn't think of being able to use non-native Community Server objects for this sort of conditional testing (at least I wouldn't have), so when I did it a couple days ago I had to say, "sweeet!"

I wanted to restrict the display of two Telligent.Glow.TabPanel tabs in my Jobs Management Application to users in the OfficeAdministrator role.  To all other users those tabs would be hidden.




Because I extended Community Server's User object with new properties and employed a custom RolesConfiguration class I was able to perform a quick and powerful display conditional test shown below.

 

<CSControl:PlaceHolder ID="PlaceHolder1" runat="server">
    <DisplayConditions>
   <DBVT:UserPropertyValueComparison ComparisonProperty="IsOfficeAdministrator"
    Operator="IsSetOrTrue" runat="server" UseAccessingUser="True" />
    </DisplayConditions>
    <ContentTemplate>
    yousa!
    </ContentTemplate>
 </CSControl:PlaceHolder>

 

The <DBVT:UserPropertyValueComparison /> statement represents objects located in a custom class library outside of the Community Server base package, yet leveraged in Chameleon like any native CSControl object.

For the Community Server Intelligentsia out there, no, this didn't work to control tab display, only because the Placeholder could not be placed between TabbedPane elements.  I went with the page-behind to get it done.

 

if (!jobUser.IsOfficeAdministrator)
{
    ((Telligent.Glow.TabbedPane)DayTabs.Panes[12]).Tab.Visible = false;
    ((Telligent.Glow.TabbedPane)DayTabs.Panes[13]).Tab.Visible = false;
}

Comments (0) | Post RSS RSS comment feed

Posted on 6/5/2008 7:56:52 PM by Dave Burke
Categories: Community Server | Jobs Management App

Related posts

Comments are closed

Copyright © 2008 Dave Burke Consulting  |  All Rights reserved.