1<?php
2/**
3 * Action Component for the POT Plugin
4 */
5
6// must be run within Dokuwiki
7if(!defined('DOKU_INC')) die();
8
9if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
10require_once(DOKU_PLUGIN.'action.php');
11
12class action_plugin_pot extends DokuWiki_Action_Plugin {
13
14    /**
15     * register the eventhandlers
16     */
17    function register(Doku_Event_Handler $controller){
18        $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'handle_toolbar', array ());
19    }
20
21    function handle_toolbar(Doku_Event $event, $param) {
22
23        $event->data[] = array (
24            'type' => 'picker',
25            'title' => $this->getLang('picker'),
26            'icon' => '../../plugins/pot/images/pot.png',
27            'list' => array(
28                array(
29                    'type'   => 'format',
30                    'title'  => $this->getLang('formula'),
31                    'icon'   => '../../plugins/pot/images/pot_formula.png',
32                    'open'   => '<pot>',
33                    'close'  => '</pot>',
34                    'sample'  => '1',
35                ),
36                array(
37                    'type'   => 'format',
38                    'title'  => $this->getLang('text'),
39                    'icon'   => '../../plugins/pot/images/pot_text.png',
40                    'open'   => '<POT>',
41                    'close'  => '</POT>',
42                    'sample'  => 'my text',
43                ),
44                array(
45                    'type'   => 'format',
46                    'title'  => $this->getLang('table'),
47                    'icon'   => '../../plugins/pot/images/pot_table.png',
48                    'open'   => '<pot #table ! >',
49                    'close'  => '</pot>',
50                    'sample'  => '1000.00 * -2',
51                ),
52                array(
53                    'type'   => 'format',
54                    'title'  => $this->getLang('hidden'),
55                    'icon'   => '../../plugins/pot/images/pot_hidden.png',
56                    'open'   => '<pot display=none>',
57                    'close'  => '</pot>',
58                    'sample'  => '1',
59                ),
60                array(
61                    'type'   => 'format',
62                    'title'  => $this->getLang('set'),
63                    'icon'   => '../../plugins/pot/images/pot_set.png',
64                    'open'   => '<pot set=1 | potid=set | display=none | decimals=2 | currency=€ | width=100px | color-=black | color-=black  | sepdec=, | sepmil=. | formula=false>',
65                    'close'  => '</pot>',
66                    'sample'  => 'hidden',
67                ),
68            )
69        );
70    }
71}
72