Extension:Rating Bar

From MediaWiki.org

Jump to: navigation, search

             

Manual on MediaWiki Extensions
List of MediaWiki Extensions
Crystal Clear action run.png
Rating Bar

Release status: beta

RatingBar.png

RatingBarStars.PNG|
sorry no other way to insert 2 picturespx]]

Implementation  Tag, Ajax, Database
Description Display a rating bar, display many tables such as top-rated titles or top voters and add a special page.
Author(s)  Franck Dernoncourt, David Dernoncourt
Last Version  1.1-b1 (2009-05-03)
MediaWiki  1.13, 1.14 (maybe earlier versions, but not tested)
License GNU GPL v3 or later
Download Official website
Example  Extension page on Wiki4Games

check usage (experimental)

The Rating Bar extension provides a rating system. It includes two tags, one for displaying the rating bar and another one for displaying all kinds of tables related to the ratings.

Contents

[edit] Functionality overview

  • Display a rating bar. Scale: 0 to 100%.
  • Display top rated items.
  • Display top voters.
  • List voters for one item.
  • Display latest votes.
  • Display user's votes.

[edit] Usage

This page details all possible usages.
Two files can be edited by the administrator to configure the extension: config.php and styles.css (although it would be a better idea to edit MediaWiki:Common.css instead of styles.css so style customizations won't be lost when upgrading the extension). specialpage.php can also be easily edited.

A few examples:

  • To display rating bar: <w4g_ratingbar/> or <w4g_ratingbar idpage="Wiki4Games:RatingBar"/>
  • Top rated pages: <w4g_ratinglist numberofitems="10"/>
  • Latest votes: <w4g_ratinglist latestvotes="5"/>

[edit] Installation

  1. Create a new folder (directory) in the following location:
    wiki-install-folder/extensions/RatingBar
  2. Download the source code archive and extract it in the new folder.
  3. Edit config.php. You have to set at least:
    • database connection information: $ratingbar_dbhost (database host, most often "localhost"), $ratingbar_dbuser (database user), $ratingbar_dbpass (database password) and $ratingbar_dbname (database name)
    • the table name prefix: $table_prefix must be set to the same value as the $wgDBprefix setting from LocalSettings.php
    • your database name: $site_name (this name will be changed to a more appropriate one in future releases ;)) must be set to the same value as the $wgDBname setting from LocalSettings.php
  4. Run the following SQL query.
CREATE TABLE  `wg_ratingbar` (
 `user_id` INT( 10 ) UNSIGNED NOT NULL ,
 `rating` TINYINT( 3 ) UNSIGNED NOT NULL ,
 `page_id` VARCHAR( 255 ) NOT NULL ,
 `time` INT( 10 ) NOT NULL ,
 `ip` VARBINARY( 40 ) NOT NULL ,
PRIMARY KEY (  `user_id` ,  `page_id` ,  `time` ,  `ip` )
) ENGINE = MYISAM
NB: don't forget to replace wg_ in wg_ratingbar with your own table prefix.
5. Add the following code at the end of LocalSettings.php:
require_once( $IP."/extensions/RatingBar/ratingbar.php");
(replace, of course, with the proper path!)

[edit] Who's using it?

(Please add your URL to the bottom of the list.)

[edit] History

  • 2009-05-03 (1.1-b1): added a star-style version of the rating bar.
  • 2009-04-26 (1.1-dev2): bugfix nightly + a new hook w4g_ratingraw to display the average rating of an item standalone.
  • 2009-02-27 (1.0-rc1): first release candidate.