Stars2 Plugin

By the same author

Compatible with DokuWiki

  • 2012-01-25 "Angua" yes
  • 2011-05-25 "Rincewind" yes
  • 2010-11-07 "Anteater" yes

plugin The Stars2 plugin let you add Rating, Difficulty, etc. stars

Last updated on
2012-01-10
Provides
Syntax

Similar to howhard

Tagged with difficulty, rating, star, stars, toolbar

This Plugins was inspired by the original stars plugin. the improvements contain a better compatibility, nicer graphics, a toolbar integration and more syntax options.

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.

  • Download “Stars2 plugin” and unzip file locally
  • Transfer to server holding Dokuwiki
    • Copy subfolder “stars” to: ..your..dokuwiki…/lib/plugins

Syntax/Usage

Stars can be created with two methods:

  1. With the Toolbarbutton Stars 1-5
  2. With Syntax code as shown below
{{stars>num}}
{{stars>}}
{{stars>-1/5}}
{{stars>-5/5}}
{{stars>1/5}}
{{stars>2/5}}
{{stars>3/5}}
{{stars>4/5}}
{{stars>5/5}}
{{stars>5.5/7}}
{{stars>700/1000}}

The Plugin can be seen in action here

Possible Problems

No Toolbar button

Did you install another Toolbar plugin? It only work with the original toolbar

Change Log

  • 2011-03-18
    • Initial release
  • 2012-01-10
    • Added negative rating to get ? stars, as “Not Yet Rated” option

Known Bugs and Issues

Let me know

Toolbar doesn't work for me, I had to modify action.php like this for this toolbar to work :

<?php
/**
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Andreas Gohr <andi@splitbrain.org>
 * @author     Zahno Silvan <zaswiki@gmail.com>
 */
 
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
 
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_PLUGIN.'action.php');
 
class action_plugin_stars extends DokuWiki_Action_Plugin {
 
    /**
     * return some info
     */
    function getInfo(){
        return array(
            'author' => 'Zahno Silvan',
            'email'  => 'zaswiki@gmail.com',
            'date'   => '2011-02-17',
            'name'   => 'Stars',
            'desc'   => 'Embedding Rating Stars',
            'url'    => 'http://zawiki.dyndns.org/doku.php/tschinz:dw_stars',
        );
    }
 
    /**
     * register the eventhandlers
     *
     * @author Andreas Gohr <andi@splitbrain.org>
     */
    function register(&$controller){
        $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'handle_toolbar', array (5));
    }
 
    function handle_toolbar(&$event, $param) {
        $event->data[] = array (
            'type' => 'picker',
            'title' => $this->getLang('star'),
            'icon' => '../../plugins/stars/images/toolbar/star.png',
            'list' => array(
                array(
                    'type'   => 'insert',
                    'title'  => $this->getLang('star1'),
                    'icon'   => '../../plugins/stars/images/toolbar/star1.png',
                    'insert'   => '{{stars>1/5}}',
 
                ),
                array(
                    'type'   => 'insert',
                    'title'  => $this->getLang('star2'),
                    'icon'   => '../../plugins/stars/images/toolbar/star2.png',
                    'insert'   => '{{stars>2/5}}',
 
                ),
                array(
                    'type'   => 'insert',
                    'title'  => $this->getLang('star3'),
                    'icon'   => '../../plugins/stars/images/toolbar/star3.png',
                    'insert'   => '{{stars>3/5}}',
 
                ),
                array(
                    'type'   => 'insert',
                    'title'  => $this->getLang('star4'),
                    'icon'   => '../../plugins/stars/images/toolbar/star4.png',
                    'insert'   => '{{stars>4/5}}',
 
                ),
                array(
                    'type'   => 'insert',
                    'title'  => $this->getLang('star5'),
                    'icon'   => '../../plugins/stars/images/toolbar/star5.png',
                    'insert'   => '{{stars>5/5}}',
 
                ),
                array(
                    'type'   => 'insert',
                    'title'  => $this->getLang('star_not_rated'),
                    'icon'   => '../../plugins/stars/images/toolbar/starnry.png',
                    'insert'   => '{{stars>-1/5}}',
 
                ),
            )
        );
    }
}

I replace 'type' ⇒ 'format' with 'type' ⇒ 'insert', then replace 'open' with 'insert' and remove line 'close'

I don't know if it's really the way it should be write (cf toolbar) but it works fine. This is also the way I use for a plugin I'm developing.

Fabrice 04/02/2012 11:15

ToDo/Wish List

Let me know

FAQ

None

Discussion

Discuss here

plugin/stars2.txt · Last modified: 2012/02/04 11:30 by 90.1.229.195
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
WikiForumIRCBugsGitXRefTranslate