Extension:CommunityVoice

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
CommunityVoice

Release status: beta

Description
Author(s) Trevor Parscal (Trevor_Parscaltalk)
Last version 0.1.0
License GPL
Download
Example Wikimedia, Wikimama
Iwikia
Hooks used
AjaxAddScript

BeforePageDisplay

Check usage (experimental)

Contents

[edit] 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.

[edit] Setup

[edit] 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/

[edit] 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:
    php extensions/CommunityVoice/CLI/Initialize.php --confirm=yes
    
    or in later versions, the update.php maintenance script.
  3. Finally, in your LocalSettings.php file, add the following line for the CommunityVoice extension:
    require_once( "$IP/extensions/CommunityVoice/CommunityVoice.php" );
    

[edit] How to use

The syntax to use is <ratings:scale>.

  • Category = Specify the properly category.
  • Title = Specify a title reference.
<ratings:scale category="CATEGORY" title="TITLE" />

Example:

<ratings:scale category="Extension Survey/Extension Nomination/Editing" title="MarkitUp MW" />

Alternate syntax (works with templates):

{{#tag:ratings:scale||category="Articles"|title="{{PAGENAME}}"}}

[edit] Little tips

[edit] Recieving an error

If you recieve and error like this:

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.

\php Initialize.php --confirm=yes

This will rebuild the tables required to run the extension.

[edit] 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, {{{1}}} 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:

<ratings:scale category="YOURWIKI:Votes/{{{1}}}" title="{{{1}}}" />
CommunityVoice Screenshot

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

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

[edit] Strange behavior

When you refresh a page does it contain one rating value, you see <communityvoice-ratings-scale-stats> 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.

[edit] 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.

[edit] See also


Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox