Extension:AjaxRatingScript: Difference between revisions
Dynasource (talk | contribs) No edit summary |
Dynasource (talk | contribs) |
||
| Line 120: | Line 120: | ||
Please add your '''working'''-wiki here! |
Please add your '''working'''-wiki here! |
||
Creator: |
Creator: |
||
* [http://www.leerwiki.nl/ LeerWiki.nl] : Success Manuals |
* [http://www.leerwiki.nl/ LeerWiki.nl] : Success Manuals |
||
Revision as of 09:04, 11 May 2007
Release status: unknown |
|
|---|---|
| File:Ratingscript.gif | |
| Description | Ajax script with 2 to 10 stars Review/Rating possibilities |
| Author(s) | B.Vahrmeijer & C.D.Pollard |
| Latest version | 1.6 (May 2nd 2007) |
| MediaWiki | 1.8.2 + 1.9.3(new) |
|
none |
|
|
GNU open source |
|
| Licence | No licence specified |
| Download | Download |
| Example | Live Example |
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. --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
<?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);
}
}
?>
Step 3: Enable it
Simply call 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() {
You can search for: "} // end of execute() method"
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
$tpl->set( 'bottomscripts', $this->bottomScripts() ); $printfooter = "<div class=\"printfooter\">\n" . $this->printSource() . "</div>\n"; $out->mBodytext .= $printfooter ;
With
$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 ;
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!
Creator:
- LeerWiki.nl : Success Manuals
Users:
- CaptainWiki.com : Sailing Wiki (customized version)
- inGameDex.com : inGame Encyclopedia
- Wereldpagina.nl : World-wide travel guide
- hobby-planet.de : XBox 360 Wiki (Solutions, etc.)
- www.ds-xtra.com Homebrew directory for the DS-Xtreme (running custom version)
- www.newwayswiki.org Progressive Ideas Database
- wikiknitting.com Knitting Knowledgebase and Free Patterns (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
