Extension:AjaxRatingScript: Difference between revisions
Appearance
Content deleted Content added
| Line 149: | Line 149: | ||
* [http://www.socialopedia.org Socialopedia, l'encyclopédie collaborative des socialistes] Politic wiki on french (MW1.12, Rating limited to Namespaces : 'Motion:' and 'Proposition:') |
* [http://www.socialopedia.org Socialopedia, l'encyclopédie collaborative des socialistes] Politic wiki on french (MW1.12, Rating limited to Namespaces : 'Motion:' and 'Proposition:') |
||
* [http://john.bryntze.net/jbkb/ John Bryntze Knowledge Base] IT articles |
* [http://john.bryntze.net/jbkb/ John Bryntze Knowledge Base] IT articles |
||
* [http://asianmediawiki.com AsianMediaWiki] Asian Movie Database |
* [http://asianmediawiki.com AsianMediaWiki] Asian Movie Database |
||
* [http://www.nlpedia.de/ NLPedia] German NLP Wiki |
* [http://www.nlpedia.de/ NLPedia] German NLP Wiki |
||
* [http://www.freecoffee.de Freecoffee] German Freeware-Wiki |
* [http://www.freecoffee.de Freecoffee] German Freeware-Wiki |
||
Revision as of 13:30, 8 May 2009
Release status: stable |
|
|---|---|
| File:Ratingscript.gif | |
| Implementation | Page action, Ajax |
| Description | Ajax script with 2 to 10 stars Review/Rating possibilities |
| Author(s) | User:Dynasource |
| Latest version | 2.0 (2007-09-13) |
| MediaWiki | 1.10.1, 1.11, 1.14 |
| Licence | GPL Licence |
| Download | Version 2 Version 1.x |
| Example | Live Example |
Extension:AjaxRatingScript is a social rating extension.
AjaxRatingScript V2 tested on different versions of MediaWiki
- MediaWiki 1.14 - Working
- MediaWiki 1.6.12 - error: unexpected T_OBJECT_OPERATOR in RateArticle.php on line 21:
if $wgArticle->getTitle()->mNamespace != 0) return $out;
Installation
For installation of version 1.x follow instructions on http://www.leerwiki.nl/How_to_get_rating_script_work
For older versions of MediaWiki try this link or check the instructions at the end of the RateArticle.php V2 file.
For installation of version 2:
- Create the RateArticle.php (www.leerwiki.nl - author's site) file and include it in your mediawiki extensions directory
- Set the $pathToRating variable in RateArticle.php according to your mediawiki path
- Download the Unobtrusive AJAX Star Rating Bar files to your mediawiki extensions/Ratings folder
- Edit _config-rating.php in the extensions/Ratings folder according to your database user settings
- Add the usual line to the end of your LocalSettings.php:
require_once("$IP/extensions/RateArticle/RateArticle.php");
- Create the table ratings in your mediawiki db
CREATE TABLE `ratings` (
`id` varchar(11) NOT NULL,
`total_votes` int(11) NOT NULL default '0',
`total_value` int(11) NOT NULL default '0',
`used_ips` longtext,
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=3 ;
- TADAA
RateArticle.php V2
<?php
require('Ratings/_drawrating.php');
if ( ! defined( 'MEDIAWIKI' ) )
die();
$wgExtensionCredits['parserhook'][] = array(
'name' => 'AJAX RATING BAR V2 14-07-2007 Based on Masugadesign',
'author' => 'Boudewijn Vahrmeijer',
'url' => 'http://www.leerwiki.nl',
'version' => '1.11,1.10.1/1.9.3/1.9.2/1.8.2',
'description' => 'Ajax Rating Bar for MediaWiki',
);
$pathToRating='/extensions/Ratings/';
$wgHooks['BeforePageDisplay'][] = array("wfRateArticleForm");
function wfRateArticleForm(&$out) {
global $wgArticle,$pathToRating;
if ($wgArticle == null) return $out;
if ($wgArticle->getTitle()->mNamespace != 0) return $out;
$out->mBodytext.='<script type="text/javascript" language="javascript" src="'.$pathToRating.'js/behavior.js"></script>';
$out->mBodytext.='<script type="text/javascript" language="javascript" src="'.$pathToRating.'js/rating.js"></script>';
$out->mBodytext.='<link rel="stylesheet" type="text/css" href="'.$pathToRating.'css/rating.css" />';
$out->mBodytext.=rating_bar($wgArticle->getID(),5);
return $out;
}
$wgExtensionFunctions[] = 'setupSpecialToprating';
function setupSpecialToprating() {
global $IP, $wgMessageCache;
require_once($IP.'/includes/SpecialPage.php');
SpecialPage::addPage(new SpecialPage('RatingOverview', '', true, 'spTopList', false));
# Messages used in this extension
$wgMessageCache->addMessage('ratingoverview', 'A Top Rating Overview');
}
function spTopList() {
global $wgOut, $wgParser, $wgUser;
require('Ratings/_config-rating.php');
$result=mysql_query("SELECT * FROM $rating_dbname.$rating_tableName ORDER BY total_value DESC")or die(" Error: ".mysql_error());
$i='<table border="1" style="border:1px;border-color:black;">
<tr><td>Position</td><td>Title</td><td>Value</td><td>Total Votes</td></tr>';
while ($row = mysql_fetch_assoc($result)) {
#####FOR VERSIONS 1.11 #################:
$title=Title::newFromID($row["id"]);
#####FOR LOWER VERSIONS AS 1.93
// $atitle=Title::newFromID($row["id"]);
// if(is_object($atitle)){
// $title=$atitle->getIndexTitle();
// }
#######################################
if(!$title==''){
$a=$a+1;
$i.= '<tr><td>'.$a.'</td>';
$i.= '<td>[['.$title.']]</td>';
$i.= '<td>'.$row["total_value"].'</td>';
$i.= '<td>'.$row["total_votes"].'</td></tr>';
}
}
$i.='</table>';
$wgOut->addWikiText($i);
}
?>
Who's using it?
Please add your working-wiki here!
Creator:
- LeerWiki.nl : Learn handy stuff
Users:
- Piemontewireless.net ComputerScience, Electronics, Mathematics and more Wiki
- DarlingWiki.com A guide for events and resources for parents and kids
- NasiLL.com : howto sources for turkish users "howto"
- Stoopid Wiki : A fun source for all things "stoopid"
- HTPCnz : Home Theatre PC Wiki - Chat - Forums - Blogs
- AlaskaMountainForum.com : Alaska Mountain Forum Wiki
- IpbWiki.com : IpbWiki
- CaptainWiki.com : Sailing Wiki
- Wereldpagina.nl : World-wide travel guide
- Atheist Encyclopedia Freethought wiki
- hobby-planet.de : XBox 360 Wiki (Solutions, etc.)
- wikiknitting.com Knitting Knowledgebase and Free Patterns
- Wikinouvelles.fr Ideas
- WikiPH Public health Wiki
- Emunity Elders Community Older Peoples Local Community Wiki based in Brent UK
- Vietnamese Library of Science Ajax Rating for pages + a summary special page
- Socialopedia, l'encyclopédie collaborative des socialistes Politic wiki on french (MW1.12, Rating limited to Namespaces : 'Motion:' and 'Proposition:')
- John Bryntze Knowledge Base IT articles
- AsianMediaWiki Asian Movie Database
- NLPedia German NLP Wiki
- Freecoffee German Freeware-Wiki
- Guitarpedia Free Guitar index and lessons
- Spielwiki ein Wiki für Spiele - Partyspiele, Brettspiele, Kartenspiele...
- pcwelt-tipps.de Tips and Howtos from pcwelt.de (german language)
- Venicewiki.org The People's Guide to Venice
- GayWiki LGBT Wiki of Turk Gay ClubOffical Site
- citroen-sm.org Citroen SM Wiki
