Extension:AjaxRatingScript: Difference between revisions
Appearance
Content deleted Content added
No edit summary |
+ archive |
||
| (166 intermediate revisions by 89 users not shown) | |||
| Line 1: | Line 1: | ||
{{ArchivedExtension|911636|VoteNY}} |
|||
{{Extension |
|||
|name=Ajax RatingScript Unobtrusive |
|||
|author=B.Vahrmeijer & C.D.Pollard |
|||
|image=Ratingscript.gif |
|||
|version=1.6 |
|||
|status=released |
|||
|update=May 2nd 2007 |
|||
|mediawiki=1.8.2 + 1.9.3(new) |
|||
|download=[http://upload.grungemedia.com/418AjaxRatingScriptV1.6.zip Download] |
|||
|readme= |
|||
|changelog= |
|||
|description=Ajax script with 2 to 10 stars Review/Rating possibilities |
|||
|parameters=none |
|||
|rights=GNU open source |
|||
|example= [http://www.ingamedex.com/ Live Example] | [http://www.ingamedex.com/How_to_port_Unobtrusive_AJAX_Star_Rating_Bar_to_MediaWiki Download at www.LeerWiki.nl] |
|||
}} |
|||
== Update: Working AJAX Stars. No loading == |
|||
I have updated this extension as well as provided a download package that already has all the edits need to make these stars '''actually''' AJAXed. --[[User:Cdpollard|Cdpollard]] 05:02, 3 May 2007 (UTC) |
|||
=== Step 1: Download the script first === |
|||
Download the AJAX Rating Script package and install it under... |
|||
extensions/Ratings |
|||
=== Step 2: Create extension === |
|||
Then create a new file in your extensions directory called '''RateArticle.php''' |
|||
==== RateArticle.php ==== |
|||
<pre> |
|||
<?php |
|||
require('Ratings/_drawrating.php'); |
|||
if ( ! defined( 'MEDIAWIKI' ) ) |
|||
die(); |
|||
$wgExtensionCredits['parserhook'][] = array( |
|||
'name' => 'AJAX RATING BAR', |
|||
'author' => 'Boudewijn Vahrmeijer', |
|||
'url' => 'http://www.leerwiki.nl', |
|||
'version' => '1.9.3/1.9.2/1.8.2', |
|||
); |
|||
$wgHooks['AfterArticleDisplayed'][] = array("wfRateArticleForm"); |
|||
function wfRateArticleForm($DIVRATING,$AID) { |
|||
global $wgArticle, $out; |
|||
if ($wgArticle == null) return; |
|||
$URLRIGHTPART= $_SERVER['REQUEST_URI']; |
|||
if(substr_count($URLRIGHTPART,"Hoofdpagina")==1||substr_count($URLRIGHTPART,"LeerWiki")==1||substr_count($URLRIGHTPART,"action=edit")==1||substr_count($URLRIGHTPART,"Overleg")==1) |
|||
{ |
|||
$UITZOND= 1; |
|||
} |
|||
if (isset ($UITZOND ) && $UITZOND != 1){ |
|||
$DIVRATING=rating_bar($AID,5); |
|||
} |
|||
} |
|||
?> |
|||
</pre> |
|||
=== Step 3: Enable it === |
|||
Simply called the extension from your LocalSettings.php |
|||
require_once("$IP/extensions/RateArticle.php"); |
|||
=== Step 4: Display it === |
|||
Now in order to make it show in your wiki, You must edit your skin file. |
|||
==== MonoBook.php ==== |
|||
Add this after function execute() { |
|||
function execute() { |
|||
global $wgArticle; |
|||
if ($wgArticle){ |
|||
$AID=$wgArticle->getID(); |
|||
} |
|||
Add this to the end of the head. |
|||
<script type="text/javascript" language="javascript" src="extensions/Ratings/js/behavior.js"></script> |
|||
<script type="text/javascript" language="javascript" src="extensions/Ratings/js/rating.js"></script> |
|||
<link rel="stylesheet" type="text/css" href="extensions/Ratings/css/rating.css" /> |
|||
</head> |
|||
Put this in where you want it displayed. |
|||
<?php echo rating_bar($AID,5); ?> |
|||
=== Step 5: Core File Edit === |
|||
Replace in: includes/Skintemplate.php |
|||
==== Skintemplate.php ==== |
|||
Replace |
|||
<pre> |
|||
$tpl->set( 'bottomscripts', $this->bottomScripts() ); |
|||
$printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n"; |
|||
$out->mBodytext .= $printfooter ; |
|||
</pre> |
|||
With |
|||
<pre> |
|||
$tpl->set( 'bottomscripts', $this->bottomScripts() ); |
|||
//### START RATING ############### |
|||
if ( $wgOut->isArticle() and (!isset( $oldid ) or isset( $diff )) and 0 != $wgArticle->getID() ) |
|||
{ |
|||
$AID=$wgArticle->getID(); |
|||
wfRunHooks( 'AfterArticleDisplayed', array( &$DIVRATING,&$AID)); |
|||
} |
|||
else |
|||
{ |
|||
$DIVRATING='';}$printfooter = $DIVRATING."<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n"; |
|||
//#### END RATING ################ |
|||
$out->mBodytext .= $printfooter ; |
|||
</pre> |
|||
=== Step 6: Finished === |
|||
Upload all your changes and enjoy enhanced ajax rating on your articles. |
|||
== Who's using it? == |
|||
Please add your '''working'''-wiki here! |
|||
* [http://www.ingamedex.com/ inGameDex.com] : inGame Encyclopedia |
|||
* [http://www.wereldpagina.nl/ Wereldpagina.nl] : World-wide travel guide |
|||
* [http://www.leerwiki.nl/ LeerWiki.nl] : Success Manuals |
|||
* [http://www.hobby-planet.de hobby-planet.de] : XBox 360 Wiki (Solutions, etc.) |
|||
* [http://www.ds-xtra.com/DS_Homebrew_Directory/ www.ds-xtra.com] Homebrew directory for the DS-Xtreme ([http://www.ds-xtra.com/DS-Xtra:Rating_Script running custom version]) |
|||
* [http://www.newwayswiki.org/index.php?title=Main_Page www.newwayswiki.org] Progressive Ideas Database |
|||
* [http://wikiknitting.com wikiknitting.com] Knitting Knowledgebase and Free Patterns ([http://www.ds-xtra.com/DS-Xtra:Rating_Script running custom version]) |
|||
How to port Unobtrusive AJAX Star Rating Bar to MediaWiki. Go to: http://www.leerwiki.nl/How_to_port_Unobtrusive_AJAX_Star_Rating_Bar_to_MediaWiki |
|||