1<?php
2/**
3 * DokuWiki Plugin ExtTab3 (Action component)
4 *
5 * Allows extended (MediaWiki-style) tables inside DokuWiki
6 *
7 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
8 * @author     Satoshi Sahara <sahara.satoshi@gmail.com>
9 */
10class action_plugin_exttab3 extends DokuWiki_Action_Plugin
11{
12    /**
13     * register the eventhandlers
14     */
15    public function register(Doku_Event_Handler $controller)
16    {
17        $controller->register_hook(
18            'TOOLBAR_DEFINE', 'AFTER', $this, 'handle_toolbar', array ()
19        );
20    }
21
22    public function handle_toolbar(Doku_Event $event, $param)
23    {
24        $event->data[] = array (
25            'type' => 'picker',
26            'title' => 'extended table typical patterns',
27            'icon' => DOKU_REL.'lib/plugins/exttab3/images/table.png',
28            'list' => array(
29                array(
30                    'type'   => 'format',
31                    'title'  => 'Definition table',
32                    'icon'   => DOKU_REL.'lib/plugins/exttab3/images/d.png',
33                    'sample' => 'term',
34                    'open'   => '\n{|\n|-\n! ',
35                    'close'  => ' || description\n|}\n',
36                    'block'  => true
37                ),
38                array(
39                    'type'   => 'format',
40                    'title'  => 'longer cell content',
41                    'icon'   => DOKU_REL.'lib/plugins/exttab3/images/table.png',
42                    'sample' => 'table caption',
43                    'open'   => '\n{| style=""\n|+ ',
44                    'close'  => '\n!\nA1\n!\nB1\n|-\n|\nA2\n|\nB2\n|}\n',
45                    'block'  => true
46                ),
47            )
48        );
49    }
50}
51
52