DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:rater

rate Plugin

Compatible with DokuWiki

  • 2014-09-29 "Hrun" yes
  • 2014-05-05 "Ponder Stibbons" unknown
  • 2013-12-08 "Binky" yes
  • 2013-05-10 "Weatherwax" yes

plugin a simple rate and vote syntax plugin

Last updated on
2015-02-05
Provides
Syntax
Repository
Source

Similar to stars

Tagged with rate, rating, vote

Intro

This is a very simple plugin that will allow the inclusion of single or multiple Star Rating or Voting Systems on one page. The rating details within an expandable box answering how many visitors vote per star level. It utilises small text files to store its required information instead of a database. It also delivers a configurable IP voting restriction and the ability to set how many times a single IP may vote.

To see the plugin in action please visit: fcon- Rater examples

Installation

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

Or just download and extract it as folder “rater” into your “\lib\plugins” directory.

:!: External requirements:

  • none

Attention !
The update to version 2011-09-27 needed a change in “.rating” file names. To reuse the former “.rating” files please change the filenames
in “…/data/meta”-directory according following concept:

old filename format converted filename
rater_[ID][NAME][TYPE].rating rater_[ID]_[NAME]_[TYPE].rating
rater_1test1rate.rating rater_1_test1_rate.rating

Configuration and Settings

Configuration of rater plugin can be done easily.

  1. Log in as administrator into DW
  2. click on Admin action link to open the Admin tools
  3. change to Configuration Settings
  4. jump to Rater Plugin Settings to adjust the options.

The following can be configured:

Item default value
restrict ip address voting true
allowed user votes 1
Exceeded user rate attempts msg You have already rated this item. You were allowed %s vote(s).
Missing rate value msg You have not selected a rating value.
Thank you for msg Thank you for voting.
generic item text this item
end of line character (OS specific) \n

There is also a css file but it is related to thumb output only.

Syntax

The following line contains all parameter and possible values:

{(rater>id=1|name=item1|type=rate/vote/stat/localstat|trace=user/ip|end=09/25/10 / 25.09.2011|tracedetails=0/1|img= :taggic.png|zoom=30x30|headline=off/on|rater_hdl=test)})}

Parameters

idmandatory, uniquean id to differ between the rate/vote
namemandatory, uniqueusually the item name what will be voted/rated
typemandatorydefines of rate, vote or stat use case
traceoptionalcan be set to user or ip, where user is to be preferred for closed wikis
endoptionaldefines the end date of the rate/vote action, can be any valid date expression
tracedetailsoptionalcan be 0 or 1 and defines if the rate or vote details will be displayed
(:!: vote + tracedetails will display real user name or its ip ⇒ be carefully with this combination)
headlineoptionalcan be on or off to show or hide the headline of the rating
(if not set it is set to on - works only for the type “rate”)
rater_hdloptionala free-text headline to substitute that defined in language.php
imgoptionaldefines the DW path to the media file to include it into the ater box, pipe extensions and curly brackets are not allowed
zoomoptionalon statistics to define size of Image thumbnails when img is defined, follows media link definition

It is allowed to place more than one rate/vote function into the same page but I dont know about the performance impacts if you will place there hundreds.

Examples/Usage

Attention !
Please take care that the identifiers like item1 must not contain space characters ! Instead of a space use an underline if needed (i.e. item_1).

5 Star Rating

This delivers a picture of 5 stars and radio buttons below to rate. The rating will be counted and stored to a file at …dat/meta/*.rating
The code base is picked up from PHP, 5 Star Rating System \\ (using hReview) as mentioned within forum post Rating plugin.

{(rater>id=1|name=item1|type=rate)}

Voting

This delivers up/down thumbs to vote for a certain topic.

{(rater>id=1|name=item1|type=vote)}

Rater Statistic

Flam & Loleg asked for a statistic feature to see a list of all raters of a site sorted by highest rate. This is now implemented and the following syntax will deliver it (see also Examples). There are no more parameter necessary. From “Adora Belle” onwards the list can be sorted by click on column header.

{(rater>type=stat)}

The list layout can be customized within style.css. The list shows the Star rater first and the Voting below, all sorted according their value. The list shows only rater objects currently referenced on pages. Orphan rater object files cannot be detected (currently). Rater syntax inside code blocks will be ignored.

If you want to consider just the rater objects of the same page then use following syntax:

{(rater>type=localstat)}

Development

Change Log

Known Bugs and Issues

ToDo/Wish List

[developers roadmap]

FAQ

a small FAQ is provided at: Rater plugin - FAQ

Sites using this Plugin

Discussion

Please use only the DokuWiki Forum for discussion and Rater issues to raise your problems. You can mention it here but this page is not regularily tracked and if something is solved it will be cleaned from this page (better to use the forum due to automated notifications).

Use with URL rewrite

If the instance you are using this plugin with is set up to do URL Rewriting (Option 1: via Web server) you will get redirection issues when it comes to a user clicking on the vote button as the code is set to always start with doku.php?id=. To workaround this change the following lines:

action.php Line 171 to:

echo '<meta http-equiv="refresh" content="2; URL='.$_SERVER['REDIRECT_URL'].'#'.$anker_id.'"><div class="thumb__positive_feedback">'.$rater_ip.' : '.$rater_msg.'<br />'.
'<a href="'.$_SERVER['REDIRECT_URL'].'#'.$anker_id.'" />'.$alink_Back.'</a></div>';

syntax.php Line 351 to:

$ret .= $addMSG.'<a class="thumbup tup" href="?do=rate_voteup&rater_id='.$rater_id.'&rater_ip='.$rater_ip.'&rater_end='.$data['rater_end'].'&anker='.$anker_id.'&rater_name='.$rater_name.'"></a>'.
'<span id="vote1_1" style="color:#5b8f22">('.$vote1.')&nbsp;</span>'.
'<a class="thumbdown tdn" href="?do=rate_votedown&rater_id='.$rater_id.'&rater_ip='.$rater_ip.'&rater_end='.$data['rater_end'].'&anker='.$anker_id.'&rater_name='.$rater_name.'"></a>'.
'<span id="vote1_2" style="color:#FF1822">('.$vote2.')</span>';
plugin/rater.txt · Last modified: 2015-02-05 22:05 by 87.158.123.50