Extension:CommunityVoice

Description
This extension allows an editor to place a ratings scale anywhere in a wiki page, and then users can give 1-5 star ratings. Each ratings scale has a category and title attribute which will later be used by the ratings list tag, displaying top-rated titles in a category. Anyone can view the current rating, however if you are logged in you may also vote.

Has a dependency on Extension:ClientSide that provides functions for generating code in client-side formats such as HTML, CSS and JavaScript.

Download
You can download the CommunityVoice code directly via SVN from the MediaWiki source code repository, at http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/CommunityVoice/

From a command line, you can call the following:

svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/CommunityVoice/

Installation
Note once again that, before you install CommunityVoice, you must have ClientSide installed as well.


 * 1) After you've created a 'CommunityVoice' directory (either by extracting a compressed file or downloading via SVN), place this directory within the main MediaWiki 'extensions' directory.
 * 2) Next, run either the initialization script to create the propper tables in the database:  or in later versions, the   maintenance script.
 * 3) Finally, in your LocalSettings.php file, add the following line for the CommunityVoice extension:

How to use
The syntax to use is   .


 * Category = Specify the properly category.
 * Title = Specify a title reference.



Example: 

Alternate syntax (works with templates):

Receiving an error
If you receive an error like:

Error returned by MySQL database is «1146: Table 'YOURWIKI.cv_ratings_votes' doesn't exist (localhost)».

Check your privileges, one of the possibles reasons it is the user have enough rights to create the tables required. Then try to run manually the Initialize.php through the shell. Go to the MediaWiki extensions folder and write the following code.

This will rebuild the tables required to run the extension.

Using a template to run the extension
Maybe in the future will be a good way to run properly the extension, it will be using a template, right now it's not possible because the extension don't support variables, it saves the variable value as a value, then it's not correct. Which is to say, the fields included as template parameters cannot be passed through reliably when the user clicks to vote -- eg, often ends up in the SQL db instead of the title, and an "error sending" message appears on the page. Do not use templates for this!

Create a simple template labeled Votes that contain the following code:

 Then to use the extension, it's easy use the template   and you will see the same thing of the screenshot.

Consider the use of template as a test, but not it to use seriously.

Strange behavior
When you refresh a page does it contain one rating value, you see  message instead of the correct message 0 / 5 (0 votes cast). If you introduce several rating values below of this, then the following rating messages are correct, but the first rating show an incorrect message. Right now it's unknown how to resolve this strange behavior.

None of the points above have solved my problem
If your are reading that, maybe your wiki is not running correctly the CommunityVoice, remember to check the files extension, for example. Sometimes the javascript files extension (.js) are changed to text files extension (.txt), then the javascript file is not executed. It's very particular for the file CommunityVoice.js.txt, if you see this then rename it to CommunityVoice.js.