How to configure a SharePoint Blog Rating System
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

3. Click Create from the Menu bar

4. Click Survey from the Tracking list

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

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

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

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.


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.


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 - |.

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.


7. Click Configure Linked Source…
8. Highlight Posts and Ranking from the Available Data Sources list on the Left.
9. Click Add >>

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

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

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

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

17. Click OK

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

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).

24. Highlight the newly inserted ranking Item.
25. Right Click on the Item and Select 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))


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.


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.

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

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.


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


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.

7. On the Insert menu, point to SharePoint Controls, and then click 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.

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

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

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

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.

15. Highlight the Post text box. In the Code view, change text=”{@Post}” to
text=”{$Post}” . The @ should be change to a $.
Save your work. Click Yes if you receive a Site Definition Page Warning message.

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.


Click Vote Now!
The Blog Post Title is automatically passed as a parameter to the Post field.


22. Create a new Blog Post.

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

Use Conditional Formatting to Rank Posts with No Votes
1. Type a zero (0) after the current Rank.
⇒ Ranked 5.00 out of 5.

2. On the Task Panes menu, 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.

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.


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 Post – Ranked 0 out of 5.





