Jump to content

Extension:AjaxRatingScript: Difference between revisions

From mediawiki.org
Content deleted Content added
Dynasource (talk | contribs)
Dynasource (talk | contribs)
No edit summary
Line 1: Line 1:
{{Extension
{{Extension
|name=Ajax RatingScript Unobtrusive
|name=Ajax RatingScript Unobtrusive
|author=B.Vahrmeijer & C.D.Pollard
|author=B.Vahrmeijer
|image=Ratingscript.gif
|image=Ratingscript.gif
|version=1.6
|version=1.6
Line 16: Line 16:
}}
}}


== 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)


==Installation==
=== Step 1: Download the script first ===
For installation and continious updates see http://www.leerwiki.nl/How_to_get_rating_script_working_in_Mediawiki_1.9.x
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 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
<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? ==
== Who's using it? ==

Please add your '''working'''-wiki here!
Please add your '''working'''-wiki here!



Revision as of 09:10, 11 May 2007

MediaWiki extensions manual
Ajax RatingScript Unobtrusive
Release status: unknown
File:Ratingscript.gif
Description Ajax script with 2 to 10 stars Review/Rating possibilities
Author(s) B.Vahrmeijer
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


Installation

For installation and continious updates see http://www.leerwiki.nl/How_to_get_rating_script_working_in_Mediawiki_1.9.x

Who's using it?

Please add your working-wiki here!

Creator:

Users:

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