Wednesday, August 14, 2013

"Mark as Answer" feature in SharePoint 2010 Discussion boards

SP 2010 Discussion boards is enhanced from earlier versions, still it is just another type of list template which enables saving posts and replies. The gap between the SharePoint forum lists and real Discussion Boards services (like those available on the internet) is quite big, and include some very basic and critical missing features such as:
·         There is no discussion board index that enables managing multiple discussion boards under groups/subjects.
·         Editing capabilities are very limited
·         No ability to control the visibility of specific discussion boards
·         No out-of-the-box ability to manage abusive posts
·         Limited Look N feel - very far from Internet-style forums
·         Rank, like/dislike
If we have to extend all rich functions, we need to opt for “Third party tools”. However, some of the features (with limited look N feel) can be managed by few customizations. Below customization is to achieve “Mark as Answer” feature without much custom coding.
Steps to extend this Function: 
1)      Create List (OOTB) of type “Discussion boards
2)      By default,
a.       It contains two content types, “Message” & “Discussion”. Add new column of type “Yes/No” with name “MarkedAnswer” under “Message” content type.
b.      List contains three views (Flat, Subject, and Threaded). Edit the “Flat” View and make newly added column “MarkedAnswer” as visible. It would appear as below..
3)      Discussion boards use “Thread.xsl” to display above layout.
4)       Take a backup of “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\XSL” folder before updating any xsl file, as it will impact globally to farm.
5)      Open “Thread.xsl” file and find template “<xsl:template name="StatusBar">”
6)      Add below code between <td> and <div> tag to highlight background

----Highlight status bar---
<xsl:attribute name="style">
          <xsl:choose>
            <xsl:when test="$thisNode/@MarkedAnswer = 'Yes'">background-color: #00bb00</xsl:when>
          </xsl:choose>
          </xsl:attribute>
------OR---------Add add answered image as below-----------------
<xsl:choose>
            <xsl:when test="$thisNode/@Mark_x0020_as_x0020_answer = 'Yes'">
              <img src='/_layouts/images/kpinormal-0.gif' alt='' />
            </xsl:when>
          </xsl:choose>
       7)   Save the Thread.xsl file and “Restart IIS” to reflect this change on site. This should display as below…

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...