Extension talk:W4G Rating Bar

Have Rating column appear first
When displaying top lists is there any way to have the rating column display first?

If using WYSIWYG Extension, editing a page with Rating List screws up the code


If I want to display a list of ratings as above then when using FCKEditor or WYSIWYG Extension and I edit the page, the table code gets screwed up like this:

Your old extension Rating_Bar did not have that problem. At the moment I have to include the code from a template to prevent this problem but that's annoying. Is there any way to fix this problem or is there any way I can use some sort of special tag to prevent the editor from screwing up the code?

Bug in read-only mode
Mediawiki 0.16: When in read-only mode, going to a page with a rating bar will print out a whole HTML page of Special:Lockdb screenshot (some content removed)

The ... is returned from the AJAX query. I see you have some code in SpecialW4GRB_body.php for handling read-only requests, so presume it works in earlier versions of MW. Possibly an issue with MW AJAX requests in read-only mode?

As a very cheap and incomplete workaround I've replaced w4g_rb.php:617

with

Bcoughlan 00:57, 26 December 2010 (UTC)
 * Nicely spotted, thanks. Fixed in next version. Patheticcockroach 17:29, 26 December 2010 (UTC)

Bug (w/ workaround): rating bar does not show when a page is created
If you create a page and put a rating bar in it, it will not show up the first time.

This is caused by: if(!$page_obj->setFullPageName($fullpagename)) { return array(''.wfMsg('w4g_rb-no_page_with_this_name',$fullpagename).' ', 'noparse' => true, 'isHTML' => true); }

in function W4GrbShowRatingBar (w4g_rb.php).

Only happens when you put a rating bar in while creating a page, doesn't happen when editing an existing page.

Workaround:

In w4g_rb.php, add a line at the start of function W4GrbShowRatingBar with the text "$parser->disableCache;" Bcoughlan 00:57, 26 December 2010 (UTC)


 * Yup, the problem with this solution is that it will disable the cache on all pages which use the extension. I guess I could make it an option, though, until I find better... Patheticcockroach 23:03, 23 December 2010 (UTC)
 * I think the problem has to do with the page not existing when the bar is generated. Perhaps it's possible to disable the cache only if the page doesn't exist? Something like $title = Title::newFromText($parser->getTitle->mPrefixedText); if (!$title) $parser->disableCache; (Haven't tested that) Bcoughlan 00:57, 26 December 2010 (UTC)
 * Thanks again and a lot, I can't believe I didn't think about that and am now in the process of slamming my head against the wall ;) Fixed in the next version too. Patheticcockroach 17:38, 26 December 2010 (UTC)
 * Hehe, glad to help. It's only an issue for me because I have a bot generating a lot of pages with rating bars in them. Thanks. Bcoughlan 19:18, 26 December 2010 (UTC)

Can not be downloaded~
I found the download page "official page"(this page),but I can not download it from that page. I can not unzip it.(.7z)--Xlsoul 04:47, 30 July 2010 (UTC)
 * The current development builds are packed often and kept as back-ups, so I used a rather common, open source archiver that gave a much better compression (7-Zip). Here's version 1.9-dev-19 as a zip. Patheticcockroach 05:54, 30 July 2010 (UTC)
 * Thanks a lot!This is my first-time asking for help on talk page.I am not good at English.Actually,I mean that I can download the 7zip document but I can not unzip it normally,like "Unsupported compression method for xxx.js".I think that it's my computer's issues.(My friend download it and unzip it easily).Thank you.In addition,can W4G Rating Bar be used as a star like AjaxRatingScript?That extension can only show one rating in one page and it's mandatory so it's not used for me.Rating Bar can do it.Can W4G do it too?--Xlsoul 11:31, 30 July 2010 (UTC)
 * Yeah, I guessed it was more of a decompression problem ;). We even used LZMA2 so maybe old 7-Zip versions don't like it (not sure though, as it seems my old IZarc can deal with them). Anyway, the star style is, as mentioned in "Features removed compared to the previous version", not available in this extension. We had to focus on one single style to put everything in place and make sure an unlimited number of bars can work together on a same page. The stars are not scheduled to come back yet. The first priorities are fixing the bugs we might still find, and then improve the current bar layout (I got some ideas but couldn't implement them yet). When all that is done and solidly tested, maybe we'll be introducing back some of the removed features. This choice of simplicity over features was made to reduce code complexity and chances of bugs: no more big features until we're sure we have a very stable version to rely on, which is what we really lacked with the previous Rating Bar 1.1. Patheticcockroach 14:22, 30 July 2010 (UTC)

Fatal error
I install 2.0b2 in mediawiki 1.15.4 which is installed in XAMPP 1.7.2(php 5.3.0+apache 2.2+MySql 5.1.37) but got following errors: Fatal error: Call to undefined method OutputPage::getTitle in D:\xampp\htdocs\mediawiki-1.15.4\extensions\W4GRatingBar\w4g_rb.php on line 143
 * Hi, this extension requires MediaWiki 1.16. Yet this error is strange because we didn't get it when testing on MW 1.15.4... But still, try upgrading to 1.16 first :) Patheticcockroach 14:50, 6 August 2010 (UTC)

You can't display more than 1 rating bar(s) on the same page.
I had my administrator install the W4G rating bar, but when I try to use it I get the above error. Here is my page: http://www.vtk.org/Wiki/VTK/Sandbox/Ratings - anyone have any idea what is going wrong? Daviddoria 16:41, 2 September 2010 (UTC)
 * Hi, did he configure $wgW4GRB_Settings['max-bars-per-page'] properly? (default is currently 1, ie limits to 1 bar per page) Patheticcockroach 19:37, 2 September 2010 (UTC)
 * I'm sure he didn't change anything from the defaults. The default of 1 sounds fine - but it seems to be allowing 0, right? Is there a way for me, as a user, to check the value of that variable? Daviddoria 11:57, 3 September 2010 (UTC)
 * Actually, I do see a working rating bar on the page you link to. (I misread, I thought you wanted to add one more.) As a user the only way to check that variable is to try to display more than the maximum allowed amount of rating bars. Patheticcockroach 16:14, 3 September 2010 (UTC)
 * What the heck, it is working now. That is very strange... but great! Sorry for the noise and thanks for the help. Daviddoria 18:55, 3 September 2010 (UTC)

You can't display more than 1 rating bar(s) on the same page (ONLY WHEN LOGGED IN!)
There were too many indents above to continue :). When I am not logged in to the wiki, the voting bar is displayed properly. When I am not logged in (anonymously viewing), the bar is not displayed, but rather I see "You can't display more than 1 rating bar(s) on the same page". Thoughts on this? Daviddoria 19:01, 3 September 2010 (UTC)
 * That's really weird, for me the bar was visible when anonymous but not when logged in (but when logged in I could see it in preview mode). I then purged the page and now I can see it in both cases... Patheticcockroach 06:48, 4 September 2010 (UTC)
 * Hm, you're right. I added it to another page, it didn't work, I purged, and then it worked. Is this a bug? This could be quite annoying to do for hundreds of pages haha. Daviddoria 13:13, 4 September 2010 (UTC)
 * Actually, this time I purged and now there is an error "you need to enable java script to vote" http://www.vtk.org/Wiki/VTK/Examples/Cxx/SimpleOperations/DistanceBetweenPoints - Thoughts? Daviddoria 13:24, 4 September 2010 (UTC)
 * About the Javascript issue, it's caused by the £%!#!** parser which adds a stupid paragraph within the script tag when the bar is loaded in a div... to fix it simply add a line break in w4g_rg.php on line 633 just after (ie, before the ). About the bar count, I really don't see what the problem can be, I don't manage to reproduce it on my test installation... I guess the easiest way would be to configure the limit to 2. Patheticcockroach 16:46, 4 September 2010 (UTC)

Sort pages by rank
I plan to put these on hundreds of pages - is there a way to "show all pages with a rating bar and sort them in order of their ranking?" Daviddoria 19:01, 3 September 2010 (UTC)
 * The top list can list all pages with a least a vote, but otherwise there's no way to list pages with the bar on but with no votes. The syntax for this would be like  (and you'd need to configure the max number of items, too) Patheticcockroach 07:06, 4 September 2010 (UTC)
 * Perfect, this is exactly what I wanted. Daviddoria 13:13, 4 September 2010 (UTC)

NC
Is it okay to put this extension on a website that will be supported through ads and/or donations? Smile Lee 04:54, 1 October 2010 (UTC)
 * The license seems actually unclear about that. My original intention was just to apply it to how you use/distribute the code itself or to patent commercial usages, for instance:
 * you can't sell the code or create modified versions of it
 * you can't make a commercial service that revolves essentially around the code
 * But you can use the extension as is to enrich a MediaWiki site as long as it's free (gratis), even if it contains ads or is funded by non-mandatory donations. Patheticcockroach 09:51, 1 October 2010 (UTC)

Thank you so much for clearing that up. Awesome extension btw.

p.s. I used Wiki4Games for a quick brush-up before I did recent run of Sonic & Knuckles. Smile Lee 10:25, 1 October 2010 (UTC)
 * No problem, don't hesitate to add yourself to the "who's using it" list ;) Patheticcockroach 07:14, 2 October 2010 (UTC)

Star style rating
Hi there.

Why was the star rating style removed? It was what my users want! Now I can't move to this newer version. Which is a real shame as I like the look of the new security. I would have thought Star ratings were far more common that percentages.

Thanks mitchelln 15:41, 8 October 2010 (UTC)
 * Hi, the star style was removed because it was a real pain to get it working along with the other style (among other things, the crazy MediaWiki parser didn't help - it's indeed the cause of the last big bug of 2.0-rc1, reported a bit higher by Daviddoria). With the tiny development time I had, a choice had to be made, and naturally I chose what I use on Wiki4Games. Of course, this choice has its downsides, but at least now the code is crystal clear (kind of ^^) while the old one was a total mess. Patheticcockroach 10:09, 17 October 2010 (UTC)

Hi, Does anyone else have time to modify the ajax to use stars? I too would rather have stars as well(or any image file at that as then I can swap it out to other images). I would love for someone to take this one. Let me know if anyone has a further update. info@trailwiki.us --Fox15rider 00:49, 7 December 2011 (UTC)

Database prefixes
If you integrate the installer for this into update.php (see LiquidThreads and ConfirmAccount for examples), you can put /*$wgDBprefix*/ in the SQL and the updater will handle prefixes automatically. :-) —Emufarmers(T 22:44, 12 February 2011 (UTC)
 * Ah for some reason I stopped receiving notifications for the talk page... I'll have a look at that, I've always wondered how to include automated database actions into extension but never knew where to start. Patheticcockroach 09:51, 9 March 2011 (UTC)

New core feature: "Article feedback"
Article feedback may be the way to go. I'm glad I waited ;) --Subfader 16:25, 21 February 2011 (UTC)
 * Well, this extension is primarily developed for a video game rating system, not for rating articles. So yeah, if you need to rate articles, that Article feedback thing is probably better for you :) Patheticcockroach 10:07, 9 March 2011 (UTC)

Multiple votes for different items on one page?
Hi, Does this extension support voting for different items on the one page?

I know about the max-bars-per-page setting - but I assume that is just displaying the same vote widget multiple times on the one page?

I want something that allows you to set multiple questions for one wiki page. ie A poll which counts votes for different aspects of the page subject.

Can this extenstion do that?

PS if not, can you make it do it as a paid job?

Thanks 219.89.99.217
 * Hi, and sorry for the late reply, the notification got once again lost somewhere on the Internet... or more likely was never sent :s I'm not really sure of what you mean:
 * if you want to rate different aspects of the same page, I suggest you have a look at what Subfader posted above: Article feedback
 * if you want to rate several different pages on the same page, the extension can do it (that's the point of max-bars-per-page)
 * Patheticcockroach 08:33, 26 March 2011 (UTC)

ND, really?
You do not allow people to make improvements to the code?! --Jeroen De Dauw 12:29, 22 March 2011 (UTC)
 * Hi, I agree that's a bit extreme, but the last time I published a GPL extension it ended up on MW's SVN with the link in the credits removed... Fool me once, shame on you; fool me twice, shame on me (plus I eventually found out MW doesn't really have a clean record on respecting authors' wishes as long as the license doesn't clearly impose them), so I thought now I'll pick a license which does protect attribution properly, with an extra lock. It doesn't prevent you from submitting patches to me, but it prevents them from popping up in forks here and there. SMF-ish ^^ Patheticcockroach 08:33, 26 March 2011 (UTC)


 * Did you talk to anybody about this? Extensions in SVN should include attribution regardless of what license is being used (and, in general, people should avoid committing extensions without contacting the author).
 * I'm not sure what your link is supposed to be indicating; maybe I'm missing the backstory. —Emufarmers(T 21:11, 27 March 2011 (UTC)


 * Well, seeing how all other extensions in SVN seem to have no credit link pointing elsewhere than to MediaWiki, I just assumed this was standard policy to edit links for extensions in SVN... I was told when the extension had been placed in SVN, though, but didn't check the changes immediately. So when I noticed like a year later that the link was gone, I thought it wasn't worth the trouble and that I'd just be more careful with my future license choices.
 * The link to BOUML was just to give an example of the kind of license drama which I really don't want to have to deal with. I stumbled upon it after the fire (just looking for an UML editor ^^), read a bit about it, and came to just a simple conclusion: if the license allows it, then there's always a possibility that Wikipedia/MediaWiki will do it. Even though I like the GPL, I have to admit that I find it highly unclear on attribution (among other things). If I had more time and money, surely I'd consider reading it several times with some lawyers in order to be able to both use it and protect the work I do, but unfortunately I don't. The CC-BY-NC-ND, on the other hand, is crystal clear... Less time spent on the law, more time spent on the code :) Patheticcockroach 20:23, 28 March 2011 (UTC)
 * As an aside, the BOUML issue is an issue the author is having with Wikimedia Commons, which is kind of separate from MediaWiki. (MediaWiki is the software, Wikimedia Commons is a website that happens to use the software. Both are supported by the Wikimedia Foundation, and their userbase has a lot of overlap, but at the end of the day they are separate projects). Furthermore, it seems kind of irrelevant to the situation at hand (The commons admins are arguing the logo is ok to keep because its too simple to be copyrighted. That argument applies no matter if the logo is GPL, cc-by-sa-nc-nd, or all rights reserved. Your extension on the other hand is obviously a creative work, so such an argument would not apply). However, with that said you should of course chose whatever license you feel comfortable with. As you say people will use whatever permissions you give them, so you should only give them the permissions you're comfortable with. Note: All extensions on SVN should have attribution. Normally this is done by a comment at the top of the php files, as well as code in $wgExtensionCredits to make it show up on special:version. If someone is committing an extension by someone else, usually they will also mention the author in the commit message. Removing attribution to the respective authors in an extension would be something that is considered extremely serious. Bawolff 21:02, 28 March 2011 (UTC)

Characters in page name create error
I am using a template to display a rating bar on certain pages and I am receiving an error on page names that include a symbol (ex: & ', ").

Example: Oops! No page seems to have this name (Mexico's Drug Industry). If you are just previewing a new or very recently created page, this error message is normal and will disappear once the page is created and propagated to slave databases. The given value was not understood.

--Dgennaro 19:45, 31 March 2011 (UTC)
 * Hm, are you passing the page name as an argument or are you just letting the extension figure out? Here the special characters don't seem to trouble the extension: http://www.wiki4games.com/Wiki4Games:Sandbox/That%27s_sp%26cial_characters. Patheticcockroach 22:07, 31 March 2011 (UTC)


 * I have a template displaying the rating bar and using the magic word.




 * I appreciate your help. Thanks, --Dgennaro 13:15, 1 April 2011 (UTC)


 * Any particular reason why you don't just use ? Otherwise, the proper variable would be  , but even that seems to get broken when dealing with special characters... Which is weird because entering the very same string "manually" does work. I don't really know what seems to be the problem :/ Patheticcockroach 13:39, 1 April 2011 (UTC)


 * Removing the solved the issue. Thank you for your swift response. --Dgennaro 14:09, 1 April 2011 (UTC)

Help!
Hi, I am ShermanTheMythran from the Lego Universe Stories Wiki, and am looking to include this extension on the wiki. However, I'm not clear on how to install it. The instructions about "making a folder" for the files don't make much sense to me, even though I am a Bureaucrat. Sorry for the newbie question, but how do I install it, if I can? Thanks in advance! - ShermanTheMythran


 * You can't do it yourself, ask Wikia staff. Max Semenik 16:26, 4 May 2011 (UTC)


 * Thanks much! - ShermanTheMythran

Sidebar rating
Is it possible to show the bar in the sidebar? How could I do that? --Krusher 13:35, 11 May 2011 (UTC)
 * Hi, this is not possible at the moment. Actually, I think the bar (101 x 2px + a few more to display the percentage) wouldn't fit in the sidebar. Patheticcockroach 14:05, 11 May 2011 (UTC)

Wrong Link by clicking page names in list
how ca i fix the problem that this extension provides links in the summary-lists with "...?title=/wiki/regRed/index.php/Test&action=edit&redlink=1" and not only with "...?title=Test&action=edit&redlink=1" ? At the moment all my Toplinks to pages go wrong because of the wrong Link-Syntax. Is there any solution?
 * Hm, that's weird: those links are produced using standard functions from the MediaWiki environment, I think... Doesn't this problem occur also in other areas of your wiki? Might be related to badly configured pretty URLs or something. Otherwise, could you provide a link to your wiki? Patheticcockroach 08:14, 24 May 2011 (UTC)
 * I try it in our Live-Environment and give an answer. --192.166.53.200 08:56, 24 May 2011 (UTC)
 * everything works fine now. apache restart, maybe there was a problem with the conf. --192.166.53.200 09:43, 24 May 2011 (UTC)

FCK Editor turns dynamic Summary-Lists into fixed tables
A summary-page will become a static table page by open the page with the extension "FCK Editor" WITHOUT changing anything. if i switch back to wiki editor, there are table tags. is there an solution to save the rating URL like  --192.166.53.200 08:56, 24 May 2011 (UTC)
 * Ow... I guess I'll have to try out that FCK Editor then... the main things I'm wondering is whether or not the same issue will occur with other tag-based extension. Patheticcockroach 09:22, 24 May 2011 (UTC)
 * It seems so, the extension "ImageMap" produces in FCK also an error and the page is useless after saving. ahhh --192.166.53.200 09:42, 24 May 2011 (UTC)
 * Most likely a bug with FCK then. From their site they still seem fairly experimental. Notably they say they take great care to replace HTML markup with wiki markup, probably the process isn't very polished yet and tags are expanded and eventually converted into inert tables... Patheticcockroach 10:31, 24 May 2011 (UTC)

Switched skin from Monobook & can't see the rating bar just msg
Hello I was dabbling with switching from the default Monobook skin and noticed when I do switch to another skin (erudite) the W4G Rating Bar says " You need to enable JavaScript to vote". The "Current user rating: 74/100 (4 votes)" part shows just not the slider. Would you have any ideas how to get it to work in other skins besides monobook?
 * Well I'm currently using it with Vector... running it with any skin shouldn't be an issue, I don't know what could be causing the problem. Could you post a link to your wiki? Patheticcockroach 13:09, 17 June 2011 (UTC)
 * Hello NM - somehow it works fine now! Not sure what I did but works like a charm thank you for such a great extension!

Using this outside of a wiki
OK, weird (maybe stupid) question, but humor me:

The story is, I've been working on a website that I've realized is not actually suited for a wiki, and shouldn't run under MediaWiki at all.

However, I love this rating bar, and I've invested a fair amount of time into creating/tweaking images and the Javascript to my particular needs, and I really don't want to throw the baby (Rating Bar) out with the bathwater (MW).

As someone who is close to novice when it comes to PHP, I haven't figured it out yet, but is it even possible to tweak or rewrite the code somehow such that this extension can be decoupled from, and run independently of, MediaWiki?

- Chris

After moving a wiki
After moving a wiki to a new server I see this instead of the rating bar:

'''Oops! No page seems to have this name (Object). If you are just previewing a new or very recently created page, this error message is normal and will disappear once the page is created and propagated to slave databases.'''

An example of page with rating bar

How to fix it?
 * That's quite weird actually. The only thing that comes to my mind is that maybe when moving to your "new" server you downgraded PHP to an unsupported or buggy version. I see you're running PHP 5.1.6: it reached EOL a while ago, and actually even PHP 5.2.x is unsupported now. I'm not sure about MW 1.16, but MW 1.17 requires PHP 5.2.x. The extension wasn't tested with PHP 5.1.x either. Patheticcockroach 07:14, 30 August 2011 (UTC)
 * You are right, thanks.

Auto-Include feature
Is there a way to use the Auto-Include feature, but don't show it at the Main Page?

Btw, I tried to use an extension to show it on every page, but it shows "You need to enable JavaScript to vote". But when I change the auto-include feature to True, it works.

Any Ideas?

P.S.: I tried add a line break, but didn't work.

load HTML output outside bodyContent
The HTML output of W4GRB is loaded on the end of the bodyContent, just before the display of category. I want the HTML to be loaded on another spot. Where is stated that the output should be loaded in bodyContent and how can I change it to another div. For instance into a div with id=whatsinaname Hans2103 12:48, 17 November 2011 (UTC)

Removing The % Sign From The Rating
I run a website called TrailWIKI.us and for me having a rating of say 67 is better then 67%. So I removed the % sign from the W4G Rating Bar. There is a couple of places you need to remove this from. Open the following three files in a txt editor. I recommend Notepa++ as it gives you line count and highlighted code. Open SpecialW4GRB_body.php, w4g_rb.php, and w4g_rb.js in Notepad++. One small note before you begin, If you upgrade W4G Rating Bar to a new release you will overwrite these files and have to make the changes again.

On line 210 of SpecialW4GRB_body.php echo wfMsg('w4g_rb-you_voted').' bar_id.'">'.$vote_sent.' %'; Change this line to echo wfMsg('w4g_rb-you_voted').' bar_id.'">'.$vote_sent.' ';

On line 270 of SpecialW4GRB_body.php $out .= wfMsg('w4g_rb-you_voted').' bar_id.'">'.$existing_vote.' %'; Change this line to $out .= wfMsg('w4g_rb-you_voted').' bar_id.'">'.$existing_vote.' ';

On line 312 of w4g_rb.php .' '.$row->vote.' ' Change this line to .' '.$row->vote.' '

On line 357 of w4g_rb.php .' '.$row->vote.' ' Change this line to .' '.$row->vote.' '

On line 412 of w4g_rb.php .' '.$row->vote.' ' Change this line to .' '.$row->vote.' '

On line 502 of w4g_rb.php .($hideavgrating? '' : ' '.round($row->avg).'% ') Change this line to .($hideavgrating? '' : ' '.round($row->avg).' ')

On line 502 of w4g_rb.php .($wgW4GRB_Settings['show-voter-names']? ' '.round($row->avg).'% ' : '') Change this line to .($wgW4GRB_Settings['show-voter-names']? ' '.round($row->avg).' ' : '')

On line 1 of w4g_rb.js at the very end modify .innerHTML="&amp;nbsp;"+c+"%"}; Change this last little part of the code to .innerHTML="&amp;nbsp;"+c+""};

Also if you wish for the numbers to be centered in the grey space on the right of the rating bar add a few more non breaking line spaces like the example below. .innerHTML="&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"+c+""};

Move Article will W4G follow?
When I move a page to a new page name W4G Rating Bar does not follow. If the page previously had votes I have to go into the database and change the database entry to the new name. Is there a way to do this automatically? --TrailWIKI.us 20:01, 12 January 2012 (UTC)