Home > Business, Collaboration, Innovation, SharePoint, Technology > How to configure a SharePoint Blog Rating System

How to configure a SharePoint Blog Rating System

November 10th, 2008

Applies to:

  • Microsoft Office SharePoint Portal Server
  • Microsoft SharePoint Designer 2007

Summary:

Using SharePoint Designer 2007, customize a Microsoft Windows SharePoint Blog site to allow users to vote on and rank Blog posts.

You may download a 60-day trial of Microsoft SharePoint Designer 2007 at
Microsoft’s website - http://office.microsoft.com/en-us/sharepointdesigner.

Set up your SharePoint Blog and Survey List

1. Create a new Blog site within your SharePoint site.
2. Click View All Site Content from the Quick Launch Menu

SharePoint Voting

 

3. Click Create from the Menu bar

SharePoint Voting

4. Click Survey from the Tracking list

SharePoint Voting

5. Create a new Survey with the following settings:
a. Name: Ranking
b. Display Survey on the Quick Launch? No
c. Show user names in survey results? Yes
d. Allow multiple responses? Yes
6. Click Next

SharePoint Blog Voting

7. Create a new question in the survey with the following settings:
a. Question: Post
b. The Type of answer to this question is: Single line of text
c. Require a response to this question? Yes
d. Maximum number of characters: 255 (default)
8. Click Next Question

SharePoint Voting and Ranking

9. Create a new question in the survey with the following settings:
a. Question: Ranking
b. The Type of answer to this question is: Choice (menu to choose from)
c. Require a response to this question? Yes
d. Type each choice on a separate line: 1 2 3 4 5
e. Display choices using: Radio Buttons
f. Allow ‘Fill-in’ choices: No
10. Click Finish

SharePoint Ranking and Voting

Add a survey response
11. Click Respond to this Survey
12. Type Welcome to your Blog! (the default Blog post title).
13. Select a Rank from the list.
14. Click Finish.

SharePoint Voting and Ranking

SharePoint Blog Ranking and Voting

Calculate the Blog post’s Average Rank

1. Open the site using SharePoint Designer 2007.
2. Right Click the default.aspx page and Select Check Out.
3. Right Click the Blog entry ListViewWebPart and Select Convert to XSLT Data View.

SharePoint XSLT DataView

SharePoint XSLT DataView
Once converted, you will be able to edit the ListViewWebPart.
4. Click the white space after the Blog post’s date/time field and add a vertical
bar - |
.

SharePoint Ranking and Voting

Create a Linked Data source

5. Select Data Source Library from the Task Panes menu
6. Select Create a new Linked Source from the Linked Sources section of the Data Source Library list.

SharePoint Blog Ranking and Voting

SharePoint Blogging
7. Click Configure Linked Source…

SharePoint Blog Voting and Ranking


8. Highlight Posts and Ranking from the Available Data Sources list on the Left.
9. Click Add >>
 
 
 

 

SharePoint Blog

10. Click Next to continue
11. Select Join the contents of the data sources by using the Data Source Details to insert data views and joined subviews.
12. Click Finish

SharePoint Blog

13. Click the General tab and type Post Ranks as the Name.
14. Click OK

SharePoint Blogging

15. Select Data Source Details from the Task Panes menu.

SharePoint Blog Voting
16. Select Link to another data source… from the Related Data Sources dropdown menu.

Link to another data source
17. Click OK

Microsoft SharePoint Designer
18. Select Posts and Post Ranks from the Available Data Sources list.
19. Click Add
20. Click Next and Finish

Link Data Sources Wizard

Insert the Blog Post’s Rank

21. Place the cursor to the right of the vertical bar near the Blog Post’s date and time.
22. Select the Ranking Row from the Ranking Data Source.
23. While Ranking is selected, Click Insert Selected Fields as… > Item(s).

Blog Post Ranking

24. Highlight the newly inserted ranking Item.
25. Right Click on the Item and Select Edit Formula.

Edit Formula

Edit Formula
26. Replace the XPath expression:

../../../Post_Ranks/Ranking/Rows/Row/@Ranking

with

(sum(../../../Post_Ranks/Ranking/Rows/Row[@Post=current()/@Title]/@Ranking) div
count(../../../Post_Ranks/Ranking/Rows/Row[@Post=current()/@Title]/@Ranking))

Insert Formula

New Formula

27. Right Click on the Item again, point to Format Item as, and Select Number…
28. Add one decimal place to the Format Number Option.

Format Item As...

Update Ranking

29. Add “Ranked” before the Item Ranking and “out of 5.” after the Item Ranking.
The full sentence should read, “Ranked x.x out of 5.”
30. Save your work and press F12 to preview the page.

Ranked 5.0 out of 5.

Click Yes if you receive a Site Definition Page Warning message.

Site Definition Page Warning

 

Use Parameters to Connect a Vote Now link to the Ranking Survey

1. In the Folder List, Right Click on NewForm.aspx within the Ranking folder and Select Check Out.
2. Open the NewForm.aspx document to Edit it.

SharePoint Designer Check Out

Ranking - Respond to this Survey

3. Right Click on the Ranking Web Part and select Web Part Properties.
4. Check the Hidden box under Layout.

Web Part Properties

Ranking

5. Right Click under the Hidden Ranking Web Part, Point to Insert, and Select Row Below.
6. Place the cursor in the newly inserted row.

Insert Row

7. On the Insert menu, point to SharePoint Controls, and then click Custom List Form…

Insert Custom List Form

8. Select Ranking as the List, Ranking as the Content type, and New item form as the Type of form to create..
9. Click OK.

List or Document Library Form

10. Right Click the Post field, Point to Format Item as, and click Text Box

SharePoint Blog

11. Highlight the Post text box, then set the ReadOnly attribute in the Tag Properties window to True.

Tag Properties

12. Click the small icon near the top Cancel button, select Common Data View Tasks, and then select Parameters…

Common Data View Tasks

13. Create a New Parameter with the following settings:
a. Name: Post
b. Parameter Source: Query String
c. Query String Variable: Post
14. Click OK.

Data View Parameters

15. Highlight the Post text box. In the Code view, change text=”{@Post}” to
text=”{$Post}” . The @ should be change to a $.

Change Code View

Save your work. Click Yes if you receive a Site Definition Page Warning message.

Site Definition Page Warning

16. Type Vote Now! after the Ranked x.x out of 5. text.
17. Select Vote Now!
18. On the Insert menu, select Hyperlink.
19. In the Address field, type - Lists/Ranking/NewForm.aspx?Post={@Title}
20. Click OK.
21. Click Save and press F12 to preview the page.

SharePoint Blog Post - Vote Now!

Edit Hyperlink

Click Vote Now!

Click Vote Now!

The Blog Post Title is automatically passed as a parameter to the Post field.

Blog Post Title

The rank is automatically calculated.

22. Create a new Blog Post.

Create a new blog post

Since there are no votes for the new Post, no Rank is displayed.

No rank on new post

 

 

Use Conditional Formatting to Rank Posts with No Votes

1. Type a zero (0) after the current Rank.
⇒ Ranked 5.00 out of 5.

Conditional Formatting

2. On the Task Panes menu, select Conditional Formatting.

Select Conditional Formatting

3. With the zero (0) highlighted, click Create on the Conditional Formatting Task Pane, and then select Show content…
4. Click Advanced… to enter an Advanced Condition.

Conditional Criteria

The Advanced Condition will show a zero (0) whenever the Rank Count is equal to zero.

(count(../../../Post_Ranks/Ranking/Rows/Row[@Post=current()/@Title]/@Ranking))=0

5. Enter the above XPath expression and click OK.
6. Click OK again.

Advanced Condition

Condition Criteria

The zero (0) should disappear from the design view.

Save your work and press F12 to preview the page. The zero (0) is now displayed on
your new PostRanked 0 out of 5.

Ranked 0 out of 5

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Facebook
  • LinkedIn

Business, Collaboration, Innovation, SharePoint, Technology , , , , , , ,

  1. No comments yet.
  1. No trackbacks yet.