Bamboo’s Community Central application provides a number of capabilities that enhance and extend the social features found in SharePoint out-of-the-box. Specifically, users can rate Threads, Posts, and even Blogs through any one of several different UI choices using Bamboo Rating. This information is tracked in Bamboo Rating based on a Site Member’s activities relating to the Total Number of Ratings and the Average Rating. In addition, Community Central provides customization opportunities that allow users to show analytics different from those available out of the box. In this article, we’ll demonstrate how to create one such custom Web Part to display the Top Rated topics (i.e., those rated 5 stars) based on user activities and Average Rating. This can be accomplished through four steps:
Step 1: Create a schema to get the data source from List Rollup:
Go to the forums: //<communitysite>/forums/> and add the List Rollup Schema Designer on one of the pages. For this example, we will be adding it to the List Rollup Configuration page:
Creating the New Schema:
- Select the Aggregation Service: SharePoint Aggregation Service (Recommended)
- Configure Discovery Mode: Automatically Find Lists in sub-Sites
- Select a list: Select one of the existing Discussion Board Plus lists
- Click Include List in Rollup
- Select columns: ID, Rating, and Subject (link to item). Make sure you check the checkboxes for both List Name AND Site Name.
- Define a Filter: Select the Some items option and paste the following CAML Query into the CAML Query textbox:
1: <Where><Gt><FieldRef Name="BambooRating_x003a__x0020_Count" /><Value Type="Number">0</Value></Gt></Where><OrderBy><FieldRef Name="Rating" Ascending="FALSE" /></OrderBy>
2:
- Schema and Genera setting: Type a Schema name and Description (In this example, we’re using Top 10 Rating)
- Click Create/Update schema
Click on the preview data button to view the following result:
Go to Site Actions > View All Site Contents > Bamboo List Rollup Configuration. There will be five (5) schemas, including the new schema.
Edit the item you created above named Top 10 Rating
In the query XML textbox, find the following string:
<LRList Name=”Setup_x0020_and_x0020_Install_x0020_SharePoint_x0020_2010” ID=”” ListType=”108″/>
(Please note that Setup_x0020_and_x0020_Install_x0020_SharePoint_x0020_2010 is the list name that is selected at the design schema time)
and replace it with:
<LRList Name=”Forum_x0020_Master_x0020_List” ID=”” ListType=”108″/>
Next, find the string:
<Master URL=”_x002E__x002F_” Name=”Setup_x0020_and_x0020_Install_x0020_SharePoint_x0020_2010” >
and replace it with:
<Master URL=”_x002E__x002F_” Name=”Forum_x0020_Master_x0020_List” >
You can likewise replace the Query XML in the QueryXML field with the following text (please note that a version of the text below that can be copied and pasted has been attached to this post for your use).
1: <QueryXml><LRListType>108</LRListType><LRSite URL="_x002E__x002F_" ID=""><LREntity Type="DYNAMIC"><LRList Name="Forum_x0020_Master_x0020_List" ID="" ListType="108"/><Settings><Match>LISTTYPE</Match><Crawl>SUBSITE</Crawl></Settings></LREntity></LRSite><ExcludeLists></ExcludeLists><Recurrence></Recurrence><ItemLimit></ItemLimit><Master URL="_x002E__x002F_" Name="Forum_x0020_Master_x0020_List" ><CAML><Where><Gt><FieldRef Name="BambooRating_x003a__x0020_Count" /><Value Type="Number">0</Value></Gt></Where><OrderBy><FieldRef Name="Rating" Ascending="FALSE" /></OrderBy></CAML><LRColumns><LRColumn InternalName="ID" Type="Counter" DisplayName="ID"><Field ID="{1d22ea11-1e32-424e-89ab-9fedbadb6ce1}" ColName="tp_ID" RowOrdinal="0" ReadOnly="TRUE" Type="Counter" Name="ID" PrimaryKey="TRUE" DisplayName="ID" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ID" FromBaseType="TRUE"/></LRColumn><LRColumn InternalName="Rating" Type="BambooRating" DisplayName="Rating"><Field DisplayName="Rating" Type="BambooRating" Required="FALSE" EnforceUniqueValues="FALSE" StaticName="BambooRating" Name="Rating" RelatedField="BambooRating_x003a__x0020_User" RowOrdinal="0" Percentage="FALSE" Decimals="1" Group="Bamboo Solutions" Customization="" ShowInDisplayForm="TRUE" ID="{3ef65453-aa6b-4a1a-a4d2-1a7c2a0b3e58}" SourceID="{d345e7b5-7170-4c06-95d7-afcd01e4d30b}" BaseRenderingType="Number" ColName="float4" ScaleSize="FiveStar" StarSkin="Default" IsAllowHalfStar="True" AllowAnonymousRating="False" ShowRating="OverallRatingStar" Version="1"><Customization><ArrayOfProperty><Property><Name>ScaleSize</Name><Value xmlns:q1="http://www.w3.org/2001/XMLSchema" p4:type="q1:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">FiveStar</Value></Property><Property><Name>IdentificationType</Name><Value xmlns:q2="http://www.w3.org/2001/XMLSchema" p4:type="q2:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance" /></Property><Property><Name>Positive</Name><Value xmlns:q3="http://www.w3.org/2001/XMLSchema" p4:type="q3:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance" /></Property><Property><Name>Negative</Name><Value xmlns:q4="http://www.w3.org/2001/XMLSchema" p4:type="q4:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance" /></Property><Property><Name>StarSkin</Name><Value xmlns:q5="http://www.w3.org/2001/XMLSchema" p4:type="q5:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">Default</Value></Property><Property><Name>IsAllowHalfStar</Name><Value xmlns:q6="http://www.w3.org/2001/XMLSchema" p4:type="q6:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">true</Value></Property><Property><Name>AverageDecimal</Name><Value xmlns:q7="http://www.w3.org/2001/XMLSchema" p4:type="q7:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">None</Value></Property><Property><Name>IsResetItem</Name><Value xmlns:q8="http://www.w3.org/2001/XMLSchema" p4:type="q8:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">false</Value></Property><Property><Name>UserReset</Name><Value xmlns:q9="http://www.w3.org/2001/XMLSchema" p4:type="q9:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance" /></Property><Property><Name>AllowAnonymousRating</Name><Value xmlns:q10="http://www.w3.org/2001/XMLSchema" p4:type="q10:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">false</Value></Property><Property><Name>InternalRatingID</Name><Value xmlns:q11="http://www.w3.org/2001/XMLSchema" p4:type="q11:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">BambooRating_x003a__x0020_User</Value></Property><Property><Name>InternalRatingCountID</Name><Value xmlns:q12="http://www.w3.org/2001/XMLSchema" p4:type="q12:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">BambooRating_x003a__x0020_Count</Value></Property><Property><Name>ShowRating</Name><Value xmlns:q13="http://www.w3.org/2001/XMLSchema" p4:type="q13:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">OverallRatingStar</Value></Property></ArrayOfProperty></Customization></Field></LRColumn><LRColumn InternalName="LinkDiscussionTitleNoMenu" Type="Computed" DisplayName="Subject"><Field ID="{3ac9353f-613f-42bd-98e1-530e9fd1cbf6}" Name="LinkDiscussionTitleNoMenu" SourceID="http://schemas.microsoft.com/sharepoint/v3" DisplaceOnUpgrade="TRUE" Group="$Resources:_FeatureId2a05cbcb-6b59-4d52-b601-a923fa2f0d21,Base_Columns;" Type="Computed" DisplayName="Subject" DisplayNameSrcField="Title" ReadOnly="TRUE" AuthoringInfo="(linked to item)" StaticName="LinkDiscussionTitleNoMenu"><FieldRefs><FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title"/><FieldRef ID="{bc91a437-52e7-49e1-8c4e-4698904b2b6d}" Name="LinkTitleNoMenu"/><FieldRef ID="{30bb605f-5bae-48fe-b4e3-1f81d9772af9}" Name="FSObjType"/><FieldRef ID="{998b5cff-4a35-47a7-92f3-3914aa6aa4a2}" Name="Created_x0020_Date"/><FieldRef ID="{94f89715-e097-4e8b-ba79-ea02aa8b7adb}" Name="FileRef"/><FieldRef ID="{39360f11-34cf-4356-9945-25c44e68dade}" Name="File_x0020_Type"/><FieldRef ID="{03e45e84-1992-4d42-9116-26f756012634}" Name="ContentTypeId"/></FieldRefs><DisplayPattern><IfEqual><Expr1><LookupColumn Name="FSObjType"/></Expr1><Expr2>1</Expr2><Then><Switch><Expr><GetVar Name="RecursiveView"/></Expr><Case Value="1"><Column Name="Title" HTMLEncode="TRUE" Default="(no title)"/></Case><Default><SetVar Name="DiscussionFilterLink"><SetVar Name="RootFolder"><HTML>/</HTML><LookupColumn Name="FileRef"/></SetVar><SetVar Name="FolderCTID"><FieldSwitch><Expr><ListProperty Select="EnableContentTypes"/></Expr><Case Value="1"><Column Name="ContentTypeId"/></Case></FieldSwitch></SetVar><FilterLink Default="" Paged="FALSE"/></SetVar><HTML><![CDATA[<a onfocus="OnLink(this)" href="]]></HTML><GetVar Name="DiscussionFilterLink" HTMLEncode="TRUE"/><HTML><![CDATA[" onclick='BLOCKED SCRIPTGoToDiscussion("]]></HTML><ScriptQuote NotAddingQuote="TRUE"><GetVar Name="DiscussionFilterLink"/></ScriptQuote><HTML><![CDATA[");BLOCKED SCRIPTreturn false;'>]]></HTML><Column Name="Title" HTMLEncode="TRUE" Default="(no title)"/><IfEqual><Expr1><GetVar Name="ShowAccessibleIcon"/></Expr1><Expr2>1</Expr2><Then><HTML><![CDATA[<img src="/_layouts/images/blank.gif" class="ms-hidden" border="0" width="1" height="1" alt="Use SHIFT+ENTER to open the menu (new window)."/>]]></HTML></Then></IfEqual><HTML><![CDATA[</a>]]></HTML></Default></Switch><IfNew><HTML><![CDATA[<img src="/_layouts/1033/images/new.gif" alt="]]></HTML><HTML>New</HTML><HTML><![CDATA[" class="ms-newgif" />]]></HTML></IfNew></Then><Else><Field Name="LinkTitleNoMenu"/></Else></IfEqual></DisplayPattern></Field></LRColumn></LRColumns></Master><LoadTemplate><ListName>true</ListName><SiteName>true</SiteName></LoadTemplate><LoadExclude></LoadExclude></QueryXml>
2:
Please note that this blog post details how to manually create a schema to get the data source from List Rollup. After doing so, should you attempt to edit the schema using the List Rollup Schema Designer (which you should not), you may receive an error. In the schema, for the property named “Name” in the tag “LRList,” you can type any text (because when we use List Rollup Schema Designer to create a schema, we must specify a list that exists in the site). And you will get an error like this:
You may receive this error message because once a community site, forum site, and blog site have been created, all of those schemas would already exist in the forum site, blog site, etc. But now, the Discussion Board Plus/forum list has not been created, so the app does not know the exact name of the Discussion Board Plus master list. Consequently, in the schema, you will see “Forum Master List” instead of a specific name.
Step 2: Add the Web Part to show the Top Rated:
Go to the Forum site. Edit and add the Web Part named Most Viewed Threads in Forum Site (Forum Site) to the page:
Open the Web Part tool pane and change the name (title) to Top Rated Forums (used here) or any other name:
Step 3: Create a XSLT file to display data:
To create a XSLT file for the Top Rated Forums, you will need to do the following:
- Download the file Bamboo.MostViewedForum.xsl from the Skin/Xsl folder of your site.
- Rename the file to Bamboo.TopRatedForum.xslt
- Search for the following string:
1: <span class="SA15_Pdleft5">
2: <xsl:attribute name="title">
3: <xsl:if test="substring-before(translate(@DisplayViewCountPlus,'',''), '.') = ''">0</xsl:if>
4: <xsl:value-of select="substring-before(translate(@DisplayViewCountPlus,'',''), '.')"/>
5: <xsl:value-of select="' '"/>
6: <xsl:value-of select="/dsQueryResponse/@TopicPostedViewed" disable-output-escaping="yes"/>
7: </xsl:attribute>
8: <xsl:value-of disable-output-escaping="yes" select="@LinkDiscussionTitleNoMenu"/>
9: </span>
Remove the extra parameter for the xsl:attribute:
1: <xsl:attribute name="title">
2: <xsl:if test="substring-before(translate(@DisplayViewCountPlus,'',''), '.') = ''">0</xsl:if>
3: <xsl:value-of select="substring-before(translate(@DisplayViewCountPlus,'',''), '.')"/>
4: <xsl:value-of select="' '"/>
5: <xsl:value-of select="/dsQueryResponse/@TopicPostedViewed" disable-output-escaping="yes"/>
6: </xsl:attribute>
In the end, it looks like this:
<span class=”SA15_Pdleft5″>
<xsl:value-of disable-output-escaping=”yes” select=”@LinkDiscussionTitleNoMenu”/>
</span>
- Save and upload this file into Skin/Xsl of your site.
Step 4: Configure the Web Part:
Use SharePoint Designer 2010 to open your Forum site:
- On the left navigator, click on All Files
- Back up a copy of the default.asp
- Right-click on the default.aspx and select Edit file in Advanced Mode
- In the split mode, use Control + F and locate the Web Part titled Top Rated Forums. Change the property named SortBy to Rating. Change SchemaName to Top 10 Rating.
- Change the XSLT file to Bamboo.TopRatedForum.xslt
- Refresh the page. It should now appear similar to the image shown below for the Top Rated Forums:
Please note that you can also show the Top Rated Forums using the List Rollup Grid View Web Part pointing to the Top 10 Rating schema, as shown at the top of the screenshot above.
Continue reading the Community Central User’s Guide.