How to enable content rating on the web site

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

The content rating web part gives users the possibility of rating a document. It has three default appearance modes:

 

Stars

 

devguide_clip0515

 

 

Radio-buttons

 

devguide_clip0516

 

 

Drop-down

 

devguide_clip0517

 

It is also possible to create other appearance modes by creating your custom controls. These must be placed in ~/CMSAdminControls/ContentRating/Controls/ and inherit from ExtendedControls.AbstractRatingControl.cs, just like the default ones.

 

You can place the web part on any page of your website to enable users rate the content of this particular page. In the following example, we will add the web part to a news item on the sample Corporate site.

 

1. Sign in to CMS Desk as administrator (blank password by default). Switch to the Design mode and select News -> Your first news from the content tree.

 

2. Click the Add web part (AddWebPart) icon at the top right corner of the zoneLeft web part zone. Select the Content rating -> Content rating web part and click OK.

 

3. In the web part properties window, you can set the following specific properties:

 

Rating type - appearance of the web part; Stars, Radio-buttons or Drop-down list as depicted above can be chosen
Max rating value - size of the rating scale; e.g. if 7 is entered, rating will be possible on a scale from 1 to 7

 

Show results - if checked, overall rating results will be displayed; if unchecked, users can rate, but don't see the results
Result message - message showing overall rating results; the {0} macro shows overall rating (for one decimal rounding, you can use {0:0.#} ); {1} displays the total number of votes
Message after rating - text message displayed after the user submits her rating; macros that can be used: {0} your rating, {1} overall rating, {2} overall number of votes

 

Check permissions - if checked, permissions set by the Allow for public and Hide to unauthorized roles properties will be checked
Allow for public - if checked, rating will be allowed to public unauthorized users; if unchecked, all users will be allowed to rate
Check if user rated - if checked, users will be allowed to vote only once; to indicate that the user already voted, Kentico CMS stores a DocRated cookie in your web browser, the cookie contains NodeIDs of the rated documents divided by vertical bars (e.g. |4|61|229|230|228|369|)
Hide to unauthorized users - if checked, the web part will be hidden to unauthorized users

 

For the purposes of this example, it is also advisable to set the value of the Show for document types property to cms.news. This ensures that the web part will be displayed only for the particular news items and not for the list of news on the News section title page.

 

Enter the values and click OK.

 

4. Sign out of the administration interface and view the Your first news news item. You should see the web part below the news text as in the screenshot below. Now try rating!

 

devguide_clip0518

 

5. If you switch back to CMS Desk and view Properties of the news item, you should see the Rating property on the General tab. This property reflects the current rating of the selected document. All ratings are recalculated to 10 step scale and displayed as stars here, no matter what the settings of the web part are. You can reset the value using the Reset button.

 

devguide_clip0546

 

Page url: http://devnet.kentico.com/docs/devguide/index.html?how_to_enable_content_rating_on_the_web_site.htm