Extension talk:AjaxRatingScript

Author B.Vahrmeijer
I've cleaned up the code by using standard hooks instead of manual hooks.
 * 1) It works for all versions
 * 2) The AJAX element works fine now.
 * 3) The script is now downloadable and working at promotionwiki.com and leerwiki.nl

if you have MW installed in a subsite like www.yourdomain.com/wiki/index.php and the rating script does not work please read the manual at leerwiki.nl and the discussion site.

Hello and thanks for your extension
I installed it on my site : http://www.wikinouvelles.fr It works fine but something doesn't: When a user clicks on a vote, then navigate on the site and go back to the voted page, the vote doesn't appear. To make it appear, i have to clear the mozilla cache, and then the vote appear. Strange no ?

No, this isnt strange.. please read the posts the discussion at http://www.leerwiki.nl/Overleg:Ajax_script_for_Mediawiki_1.10

Thank you for your answer. I have read this forum, else i wouldn't have asked my question here, but didn't found the answer i wanted. I am going to read it again. Bye

Installation
I think installation steps are not enough.

I completed all of them and still do not know, do I have to edit some templates and where to put ?

193.2.84.34 12:14, 7 April 2009 (UTC)

problems

 * I also followed the installation instructions but it doesn't seem to work. Why is the installation so different then it was 2 months ago? No localsettings.php changes? And there should be an explenation, where to insert what to get the stars on your site, on the extension site. AndiRay 11:26, 4 May 2009 (UTC)
 * To install you must add require_once("$IP/extensions/RateArticle.php"); to the LocalSettings.php file. When I finally find out how to install this I will write what steps are missing or are confusing AndiRay 14:18, 5 May 2009 (UTC)

Settings
The extension looks nice however I don't understand why we have to predefine the Database Settings in _config-rating.php like dbhost, dbuser, dbpass and etc. Can we just take advantage of LocalSettings.php? In the way is it now we have to update this file every time if we change our database settings. I also wanted to include wfLogDBError wfDebug in rpc.php. Seem like the file loads directly via javascript and doesn't have access to the global mediawiki functions. Is there any way that this can be fixed? Thanks

You have your wiki build up like this: www.yourdomain.com/wiki/index.php this has consequences for the script code
to emphasize the 5! different paths which are important:

good luck
 * RateArticle.php: path to js/behavior.js
 * RateArticle.php: path to js/rating.js
 * RateArticle.php: path to css/rating.css
 * Ratings/drawrating.php: path to db.php
 * Ratings/js/rating.js: path to rpc.php

Yes, thanks, we finally found it, and made redirection in LocalSettings.php towards www.yourdomain.com/wiki And now it works. Thank you.

Good job: put your wiki on the first page plz thnx

Limit to Specific Pages
Hi, this extension is very good, but I would like to use this only on pages which I want and where I want by using some tag. Is it possible? I think that many users of mediawiki would welcome such alteration.--Sevela.p 13:22, 14 December 2007 (UTC)


 * Yes you can. Edit RateArticle.php and change the line (~44) that looks like this:


 * You can make the logic whatever you like. You can have it only apply to pages in a specific namespace like this:


 * Or you can make it match a specific set of titles like this:


 * There are better ways to do it but this should get you started. --Christian 17:29, 26 December 2007 (UTC)


 * I use an adaptation of the $myImportantNamespace tweak. It works partly, because the rating do not appears on classical page and do on the allowed namespaces, but it also appears on the Category and Help Namespaces... Any ideas ? --Rmatt 23:58, 21 March 2008 (UTC)

author
I have not included a parser hook yet

Suggestion
This is a very nice extension. However, I would like to say, wouldn't it be nice if visitors could remove their votes then revote? As the pages are increasing in quality, the person may wish to change their opinion of the page. Just a tip. --NorthStar 18:06, 5 January 2008 (UTC)


 * I think it would be good to configure an option to delete the ratings after a certain number of days. I personally think that a vote should not be valable more than one year on a wiki. This would be a good improvement ! Rmatt, 20 March 2008

After using the AjaxRating, I have some suggestion: --Mints 07:23, 15 May 2009 (UTC)
 * Rerating, better if the same user can rerating after some period of time.
 * Rating base, better if rating based on login user(if login) otherwise based on ip address, not ip address only
 * Rating history, record rating history will be much better.

Problem with installation
Hi, this extension is great and it works fine, but when I start a new Page on the edit window I have the rating stars for this Topic. Is there any possibillity to hide the rating stars in the edit mode?
 * lol same here. cannot add new pages :D Man this extension has so many bugs and installation requires so many tweaks, the status shouldn't be stable. --Subfader 14:29, 30 March 2008 (UTC)

i cant get it to work
i have the version 1.12 of mediawiki this is my be the problem? --www.guitarpedia.co.il 08:50, 10 May 2008 (UTC)

How i can add the rating in specific pages?
I already read the comment before that talks about it but my question is:

How i can add the rating thing in certain pages by just add some tags to the page like:

i mean to add that tags in every pages which i want the users to rate. thank u.

Script Error "viewer has no properties"
First, thanks for the extension. It work's so far on my site http://pcwelt-tipps.de. But only after a manual purge of each single page (.../index.php?title=testpage&action=purge).

Without manual purge it gives a Javascript error in rating.js ("viewer has no properties"). It seems that the rating div isn't included in the cached content. I tried purging all pages with a script, But this doesn't work either. The site runs on MediaWiki 1.11.1 with AJAX RATING BAR V2 14-07-2007. I also used the newer script V2.5: same result. The site is working with URLs like http://pcwelt-tipps.de/wiki/page. --piggy 09:03, 28 May 2008 (UTC)

I answer my own question: to make it work i changed 'extension/Ratings/rpc.php' to '/extension/Ratings/rpc.php' in ratings.js (line 65)

--piggy 23:13, 8 June 2008 (UTC)

how can i translate this rating thing
which file i need to edit?

you have to change RateArticle.php (v2.5 '$wgMessageCache' Special Page)

_drawrating.php: $tense, $rater

rpc.php: $tense, $new_back

maybe there are more strings. Try 'find' in your text editor.

--piggy 23:20, 8 June 2008 (UTC)

Rating SpecialPage and placement
I think it would be nice to have a Rating page that showed top Rated articles, that would be available in the Special Pages section.

Also, I think it would be better if you could allow customizeable placement of the rating section (e.g. if the stars showed up in the upper right of the article, next to the title)

Using it to simply vote for an article (kind of digg-like)
We're going to have some proposals for people to vote on, each of which will be on a page potentially. According to docs, it sounds like you can't vote only 1 star - but that's what we'd like to do: 1 star (=yes), or don't vote (0 stars). Is this possible to modify? Also, does this let people vote only once? Thanks. --Charlener 19:32, 27 August 2008 (UTC)

Non valide chez moi !
line 258 column 317 - Erreur: document type does not allow element "link" here

V2 in MediaWiki 1.6.12
I get this: unexpected T_OBJECT_OPERATOR in RateArticle.php on line 21: Razool 09:11, 30 March 2009 (UTC)
 * Are you missing one "(" and the "{" "}" ? (I have no clue what T_OBJECT_OPERATOR means)
 * AndiRay 11:34, 4 May 2009 (UTC)

Display error
It is almost not possible to install the extension with the explainations given on this site or leerwiki... I only managed that it displays something ,not working, that looks like this:
 * Currently 0.00/5

1 2  3  4  5  1536 Rating: 0.0/5 (0 votes cast) If anyone knows how to fully install this extension I would be glad to read it.
 * It might be an Ajax problem check out for ajax.js in your browser's view source. what MW version are you using? or maybe it cannot find the images.Razool 11:58, 8 May 2009 (UTC)
 * It worked for me on MW 1.14. I don't know what else to say. Try deactivating all other extensions and leave only this one to exclude any interferences. Have you set the $pathtoratings function to point to your Ratings folder in ratearticle.php??And clear your browser's cache and cookies!! It might helpRazool 18:17, 10 May 2009 (UTC)

I am using 1.13 and I found out how to make it work (when you klick 1 2 3) its in the line 80 from the _drawrating.php (I guess they use a Richeditor, there i had the same problem with the & sign) //original line //changed line But still no stars are displayed, so maybe its the $pathToRating as you said (or more & problems in the code). I tryed following without any effect: 'mediawiki/extensions/Ratings/' '/extensions/Ratings/' 'extensions/Ratings/' '$IP/extensions/Ratings/' And another big problem occured that I can't access my Spezial page anymore, but I dont know after which step this happened :) and how do I clear the cache? AndiRay 07:28, 11 May 2009 (UTC)
 * I fixed the special page problem and also managed to display the extension on the sites I want, see below. But still no stars :( AndiRay 08:47, 11 May 2009 (UTC)
 * Does nobody else have this problem? Maybe its a css problem, but i have no idea what exactly. I guess most people dont look in the discussion page of a WikiExtension if they installed it successfully :( AndiRay 07:39, 15 May 2009 (UTC)

There is a hard-coded path near the top of RateArticle.php which looks something like: That line has to be changed to match the URL you present to your users, or you will not be seeing stars. This is in addition to all of the other hard-coded paths in this extension which are already documented somewhere. --Carlb 06:45, 14 September 2009 (UTC)

Displaying Ajax on Every site except from...
If you want to display the Ratingstars on every site except from some specific ones and all sites that have 'Diskussion' in the link then look at this ^^ All changes are made in the RateArticle.php in the wfRateArticleForm function. If I forgot something or whatever please ask. PS: everything that is german you can change of course ^^ AndiRay 09:17, 11 May 2009 (UTC)

Ratings not refreshing
Similar to above, I was able to install this after fixing all the things that are not mentioned in the instructions but which this page helps fix, but after rating a page on my wiki (on an intranet), revisting that page does not show the updated rating (i.e. it shows 0 votes). I can "work around" this by adding ?action=purge to the end of the URL to purge the cache, but is there some way to do this automatically when a vote occurs? I can't expect my users to know how to do this. A response refers to a forum, but the site is not in English, so I don't know how to find the answer. --DavidBiesack 19:26, 26 May 2009 (UTC)

This is buggy...
Tried this extension on a MW1.16alpha site, Special:RatingOverview quickly looks like:

Position	Title	Value	Total Votes 1	Object id #132	0	0 2	Object id #130	0	0 3	Object id #132	0	0 4	Object id #130	0	0 5	Object id #132	0	0 [...] 275	Object id #130	0	0 [...]

The titles are all rubbish "Object id #130, 132" values and the database is rapidly flooded with hundreds of `ratings` entries for every page viewed, even if they never received even one vote up or down. Aesthetically, the data could've been displayed much less obtrusively on the individual pages too (this should be in the sidebar, with much smaller symbols for the stars, instead of 'kludged' onto the bottom of each page).

As there is no pagination and no means of limiting the number of table entries displayed at once on the Special:RatingOverview page (as currently implemented) it very rapidly grows very long... especially since there is one entry for every unique page to have ever been viewed since the extension was installed, votes or no votes. On a large wiki, one can rack up several thousand lines of naughts in short order and for no good end.

I also don't like that this is making database writes for every page view - even for anon-IP visitors, even if nothing is changed and no vote is cast. For large sites, a database write costs far more than a read, as it must wait for other writes in progress to complete and as any site large enough to have master/slave MySQL servers can read from any but must write (via the master) to all to update any database record. --Carlb 08:02, 14 September 2009 (UTC)

Once an page has been voted on, another user cannot vote on it
I think I've set up the extension properly, but whenever a page is voted on by one user, other users can no longer vote for it. Has anybody else experienced this issue? If so, how do you fix it?--209.250.159.90 20:00, 13 August 2009 (UTC)


 * Is your wiki behind a Squid, Varnish or other reverse cache? If so, the extension may be seeing the address of your server's cache instead of the X-Forwarded-For IP of the actual user - so everyone appears to be coming from the same address(es). The extension, instead of being called from MediaWiki code (which would have checked $wgSquidServers to remove the addresses of your server's reverse proxies) is run directly from the target page, obtaining the "remote IP" at various points using Similar codes exist in all of db.php, rpc.php and _drawrating.php; any fix would require patching every one of these files.

Replace:

with:

Don't do this unless your server configuration requires it - if you're not behind a server-side reverse proxy, the patch will only make it easier to falsify the IP address by submitting nonsense in the X-forwarded_for header. This code does not distinguish between a trusted local proxy (as listed in $wgSquidServers or $wgSquidServersNoPurge) and an untrusted external server.

Nonetheless, without the patch I'm seeing *everything* come in from 192.168.0.1, the non-routeable address of a local Varnish cache on one of the web servers. That sort of error could be a serious bug for all but the smallest sites. :( --Carlb 06:49, 14 September 2009 (UTC)