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 it's 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: Rater examples
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:
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 of rater plugin can be done easily.
Log in as administrator into DW
click on Admin action link to open the Admin tools
change to Configuration Settings
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.
The following line contains all parameters 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)})}
Following parameters:
id | mandatory, unique | an id to differ between the rate/vote |
name | mandatory, unique | usually the item name what will be voted/rated |
type | mandatory | defines of rate, vote, stat or localstat use case |
trace | optional | can be set to user or ip, where user is to be preferred for closed wikis |
end | optional | defines the end date of the rate/vote action, can be any valid date expression |
tracedetails | optional | can 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) |
headline | optional | can 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_hdl | optional | a free-text headline to substitute that defined in language.php |
img | optional | defines the DW path to the media file to include it into the ater box, pipe extensions and curly brackets are not allowed |
zoom | optional | on statistics to define size of Image thumbnails when img is defined, follows media link definition |
sid | optional | on statistics to Show a column containing the raters id |
ns | optional | statistic will be provided for rater objects from given namespace and ist sub-namespaces.
You can specify a txt file, which is the source of a page. In this case just the rater objects of the specific page will be considered. |
It is allowed to place more than one rate/vote function into the same page but I don't know about the performance impacts if you will place there hundreds.
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
).
This delivers a picture of 5 stars and radio buttons below to rate. The rating will be countet 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)}
This delivers up/down thumbs to vote for a certain topic.
item213 |
(273) (239)(Details)
(273) 79.207.154.112 79.216.240.228 79.249.57.194 79.249.57.194 79.249.57.194 66.249.66.162 66.249.66.104 66.249.66.162 66.249.71.69 66.249.71.69 66.249.71.69 188.128.122.99 86.182.252.212 66.249.66.104 87.99.47.115 66.249.72.200 66.249.66.211 217.91.160.111 61.196.230.6 61.196.230.6 183.174.200.162 66.249.66.117 221.20.114.13 66.249.72.182 213.186.127.12 66.249.72.180 66.249.72.249 66.249.68.27 66.249.66.150 66.249.68.23 180.76.5.96 180.76.5.181 199.87.252.21 180.76.5.162 180.76.5.158 207.46.204.191 66.249.71.113 180.76.5.186 180.76.6.212 94.112.35.93 180.76.6.28 180.76.5.147 111.13.8.113 180.76.5.165 180.76.5.99 180.76.5.155 110.139.83.86 180.76.5.48 180.76.5.98 180.76.5.178 180.76.5.91 180.76.5.180 180.76.5.157 180.76.5.153 180.76.5.100 180.76.5.59 180.76.5.181 180.76.5.63 180.76.5.166 180.76.5.64 212.113.35.162 180.76.5.196 180.76.5.192 180.76.5.65 180.76.6.231 66.249.68.27 180.76.5.175 180.76.5.191 180.76.5.107 180.76.5.97 91.201.64.24 180.76.5.162 180.76.5.138 180.76.5.170 180.76.5.146 180.76.5.89 180.76.5.50 180.76.5.176 180.76.5.183 180.76.5.142 180.76.5.143 180.76.5.147 180.76.5.66 180.76.6.29 180.76.5.88 66.249.66.135 180.76.6.227 180.76.5.111 180.76.5.172 213.186.127.3 189.6.165.55 189.6.165.55 180.76.6.212 180.76.5.144 213.186.122.2 66.249.66.67 66.249.66.73 66.249.66.131 66.249.68.79 66.249.72.213 180.76.5.59 180.76.5.151 180.76.5.151 180.76.5.172 180.76.5.61 180.76.5.54 180.76.5.65 180.76.5.92 180.76.5.53 180.76.5.187 180.76.5.94 180.76.5.53 180.76.5.92 180.76.5.101 66.249.72.145 180.76.5.64 180.76.5.185 180.76.5.157 180.76.5.64 180.76.5.159 180.76.5.62 180.76.5.107 66.249.72.250 66.249.71.52 66.249.71.51 180.76.5.154 180.76.5.145 180.76.6.20 180.76.5.154 180.76.5.145 180.76.5.184 180.76.6.20 180.76.5.184 180.76.6.20 180.76.5.93 180.76.5.142 180.76.6.232 180.76.5.184 180.76.6.232 180.76.5.90 180.76.5.141 180.76.5.141 180.76.5.58 180.76.5.103 180.76.5.163 180.76.5.61 180.76.5.58 180.76.5.149 212.113.37.105 180.76.5.61 180.76.5.190 180.76.5.197 180.76.5.101 180.76.5.163 180.76.5.67 180.76.5.87 180.76.6.233 180.76.6.222 180.76.5.186 180.76.5.139 180.76.5.136 180.76.5.67 180.76.5.190 180.76.5.148 180.76.5.57 180.76.5.188 66.249.72.244 180.76.5.166 212.118.224.148 180.76.5.97 180.76.5.165 180.76.5.161 180.76.5.95 180.76.5.60 180.76.5.180 180.76.5.113 180.76.5.169 180.76.5.54 180.76.5.193 180.76.5.168 180.76.5.158 180.76.5.153 180.76.5.137 180.76.5.95 180.76.5.52 180.76.5.194 180.76.5.169 180.76.5.156 180.76.5.113 180.76.5.177 180.76.6.213 180.76.6.28 180.76.6.37 180.76.5.52 180.76.5.189 180.76.5.185 180.76.5.49 180.76.5.189 180.76.5.140 180.76.5.150 180.76.5.55 180.76.6.225 199.87.253.106 180.76.6.230 180.76.5.167 180.76.5.51 180.76.6.223 180.76.5.50 180.76.5.56 180.76.6.225 180.76.5.171 180.76.5.183 180.76.5.56 180.76.5.179 180.76.5.171 66.249.66.3 66.249.66.147 180.76.6.26 180.76.5.160 180.76.5.182 180.76.5.103 180.76.5.191 180.76.5.62 180.76.6.211 180.76.6.21 180.76.6.35 66.249.66.83 199.87.252.145 180.76.5.138 180.76.5.155 180.76.6.224 180.76.5.110 180.76.6.231 66.249.66.76 199.87.253.73 66.249.72.177 66.249.72.176 109.87.138.75 176.9.58.140 180.76.5.140 180.76.5.177 66.249.66.205 180.76.5.139 180.76.5.179 180.76.6.26 213.186.122.3 180.76.5.87 66.249.66.53 93.199.228.117 93.199.228.117 93.199.228.117 66.249.66.240 66.249.66.57 66.249.71.68 66.249.66.58 66.249.66.72 66.249.66.70 66.249.66.45 66.249.66.250 66.249.66.85 85.235.204.210 85.235.204.210 66.249.66.5 66.249.66.28 66.249.76.56 173.199.116.171 46.4.95.140 66.249.66.4 66.249.66.88 66.249.66.65 46.4.95.140 173.199.114.115 173.199.116.51
(239) 66.249.66.162 207.46.13.93 66.249.66.104 66.249.66.101 207.46.13.93 188.128.122.99 66.249.66.228 87.99.47.115 66.249.72.200 66.249.66.211 91.205.96.13 66.249.66.101 213.186.127.12 195.42.102.25 66.249.72.182 213.186.127.12 66.249.72.180 66.249.72.249 77.88.27.26 66.249.66.150 66.249.68.27 66.249.68.23 180.76.5.96 180.76.5.181 180.76.5.155 180.76.5.98 66.249.71.113 180.76.5.178 180.76.5.186 180.76.6.212 180.76.5.158 180.76.5.91 180.76.5.180 111.13.8.113 180.76.5.165 180.76.5.99 180.76.5.162 111.13.8.113 180.76.5.48 180.76.5.59 180.76.5.89 180.76.5.147 180.76.6.28 180.76.5.166 180.76.5.157 180.76.5.153 180.76.5.100 180.76.5.63 180.76.5.192 212.113.35.162 180.76.5.111 180.76.6.227 180.76.5.196 180.76.5.175 180.76.5.142 180.76.6.231 91.201.64.24 180.76.5.146 180.76.6.29 180.76.5.170 180.76.5.88 180.76.5.66 180.76.5.143 180.76.5.172 180.76.5.183 180.76.5.144 180.76.5.50 180.76.5.107 66.249.66.135 180.76.5.178 180.76.5.191 180.76.5.97 213.186.127.3 180.76.5.176 180.76.5.138 213.186.122.2 66.249.66.73 66.249.66.67 66.249.66.131 66.249.68.79 66.249.72.213 180.76.5.96 180.76.5.151 180.76.5.175 180.76.5.91 180.76.5.92 180.76.5.53 180.76.5.187 66.249.72.145 77.88.27.26 180.76.5.65 180.76.5.94 180.76.5.185 180.76.5.94 180.76.5.149 180.76.5.159 180.76.5.159 180.76.5.149 180.76.5.143 180.76.5.145 66.249.72.250 66.249.71.52 66.249.71.51 180.76.5.62 180.76.5.154 180.76.5.192 180.76.5.101 180.76.5.195 180.76.5.48 180.76.5.195 180.76.5.63 180.76.5.195 180.76.5.93 180.76.5.146 180.76.6.232 180.76.5.88 180.76.5.113 180.76.5.100 180.76.5.141 180.76.5.90 180.76.5.93 180.76.5.197 180.76.5.66 212.113.37.105 180.76.6.222 180.76.5.197 180.76.6.37 180.76.5.67 180.76.5.194 180.76.5.176 180.76.5.188 180.76.6.222 180.76.5.163 180.76.5.60 180.76.5.170 180.76.5.148 180.76.6.233 180.76.5.161 66.249.72.244 180.76.5.95 180.76.5.58 180.76.5.169 180.76.5.168 180.76.5.136 180.76.5.144 180.76.5.156 180.76.6.227 180.76.5.150 180.76.5.57 180.76.5.52 180.76.5.190 180.76.5.156 180.76.5.99 180.76.6.225 180.76.6.29 180.76.5.177 180.76.5.193 180.76.5.137 180.76.5.54 180.76.5.139 180.76.5.57 180.76.5.87 180.76.5.171 180.76.5.103 180.76.5.55 180.76.5.140 199.87.251.91 180.76.5.189 180.76.6.213 180.76.6.230 199.87.253.106 180.76.5.51 180.76.6.35 180.76.6.37 180.76.6.230 180.76.5.49 180.76.6.213 180.76.5.111 180.76.6.21 180.76.6.223 180.76.5.167 180.76.5.194 180.76.5.49 180.76.5.56 180.76.6.223 66.249.66.3 66.249.66.147 180.76.5.167 180.76.5.89 180.76.5.160 180.76.5.188 180.76.5.196 180.76.5.98 180.76.6.211 213.186.127.3 66.249.66.83 199.87.252.145 180.76.6.26 180.76.6.224 66.249.66.76 180.76.6.211 199.87.253.73 66.249.72.177 66.249.72.176 180.76.5.161 180.76.5.90 213.186.122.3 176.9.58.140 180.76.5.150 66.249.66.83 66.249.66.205 66.249.66.76 66.249.72.176 66.249.72.177 66.249.66.205 66.249.66.53 66.249.66.240 66.249.66.57 66.249.71.68 66.249.66.58 66.249.66.72 66.249.66.53 66.249.66.70 66.249.66.45 66.249.66.250 66.249.66.85 77.88.27.26 66.249.66.5 66.249.66.28 173.199.116.171 66.249.76.56 66.249.66.240 46.4.95.140 66.249.66.4 66.249.66.88 66.249.66.65 173.199.116.51 173.199.114.115 157
|
{(rater>id=1|name=item1|type=vote|tracedetails=1)}
{(rater>id=1|name=Ein schräg schöner Übermorgen|img= :taggic.png?45% |type=vote)}
The image is included inside the rater box and zoomed at 45% of its original size. To handover the image the beginning of the media link is used without curly brackets and pipe extension. Special charachters are handled if the replacements are prvided within lang.php file.
|
Ein schräg schöner Übermorgen |
|
Flam & Loleg asked for a statistic feature to see a list of all rater 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. Please take care that table sorting by Header click is just possible with newer DokuWiki Version (providing the jQuery capability), older DW versions do not sort it.
{(rater>type=stat|sort=value|)}
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 ollowing syntax:
{(rater>type=localstat)}
If you want to have the statistic of a dedicated namespace ten use the ns-option. All rater objects of the ns rater:tst will be considered (incl. sub-namespaces, if existing).
{(rater>id=7|type=stat|ns=rater:tst)}
If you specify a dedicated page then you will have the same result as localstat but you can call it from a different page somewhere in your DokuWiki. Please take care to append the .txt that the plugin knows you refer to the page file.
{(rater>id=7|type=stat|ns=rater:tst:ratertest.txt)}
Furthermore if you provide a zoom option like for media links, then the lit will contain thumbnails of that size of the rater objects (if immages provided inside the box).
The zoom parameter decides if thumbnails will be displayed and what size.
Take care:
No zoom Option = no thumbs !
No rates/votes no entry !
No Image within rater box = no thumbs !
So think about the usage and style that it will not that being crauted like following table:
{(rater>id=66|type=localstat|zoom=30x30|sid=on|sort=value|)}
Yes, of course. The rater plugin allows you as many as you want. Therefore you have to define by syntax unique id's. All 3 parameters will be used together as filename.
All information are stored into files. So you don't need to use a database. The files are within the \dokuwiki\data\meta folder and have a suffix .rating .
The filename containing the id, item and type parameter from syntax.
Example:
The syntax {(rater>id=1|name=issuetracker|type=vote)} cause information storage to a file named rater_1_issuetracker_vote.rating .
Currently the style of rate details expandable box and statistic layout can be customized by style.css stored in the rater plugin folder. How to use css and what parameter are possible is explained many times by articles in the internet (e.g. W3C school).
The rating-details-css defaults are
.rating__details {
border: 1px #BDBEC1 solid;
font-size: 0.85em;
text-align: right;
background-color: #F2F2F2;
padding-right: 10px;
padding-left: 10px;
margin-left: 0.75em;
margin-right: 0.75em;
border-radius: 5px;
box-shadow: 3px 3px #666;
}
That is the case if you have set trace=ip. Web provider may give their users dynamic ip's, changing per day. For closed wiki you could use the trace=user option where the real user name is logged.
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 |
This is possible by using following syntax within your __template.txt file. It is better to use the ID replacement pattern instead of PAGE to prevent mismatch of file names caused by multiple same named pages in different namespaces.
{(rater>id=1|name=@ID@|type=rate|trace=ip)}
Further information on namespace templates can be found here ...
If you click to rate/vote and following Warnings appear:
Warning: explode() [function.explode]: Empty delimiter in ....../wiki/lib/plugins/rater/syntax.php on line ...
Warning: Invalid argument supplied for foreach() in ...../wiki/lib/plugins/rater/syntax.php on line ...
Warning: Division by zero in ...wiki/lib/plugins/rater/syntax.php on line ...
This explains that the data strings cannot be split into the necessary parts due to a configuration setting is empty. Therefore please check your plugin settings via Configuration Manager. The related parameter is 'eol_char'. This should be set to '\n'.
Future Versions (beyond 2012-09-21) will set this parameter to default '\n' if configuration attribute is empty.