1<?php
2/**
3 * Action Plugin: Inserts a button into the toolbar to add file tags
4 *
5 * @author F.Schonack
6 */
7
8if (!defined('DOKU_INC')) die();
9if (!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN', DOKU_INC . 'lib/plugins/');
10require_once (DOKU_PLUGIN . 'action.php');
11
12class action_plugin_codebutton_ext extends DokuWiki_Action_Plugin {
13
14    /**
15     * Return some info
16     */
17    function getInfo() {
18        return array (
19            'author' => 'F.Schonack',
20            'date' => '2010-09-06',
21            'name' => 'Toolbar Code Button',
22            'desc' => 'Inserts a code choice into the toolbar',
23            'url' => 'http://shony.de/downloads/dokuwiki/plugins/codebutton_ext.zip',
24        );
25    }
26
27    /**
28     * Register the eventhandlers
29     */
30    function register(&$controller) {
31        $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'handle_toolbar', array ());
32    }
33
34    /**
35     * Inserts the toolbar button
36     */
37
38
39/**abap, actionscript-french, actionscript, actionscript3, ada, apache, applescript, asm, asp, autoit, avisynth, -bash, basic4gl,
40 bf, bibtex, blitzbasic, bnf, boo, -c, c_mac, caddcl, cadlisp, cfdg, cfm, cil, cmake, cobol, cpp, cpp-qt, csharp, css, d, dcs, delphi,
41 diff, div, dos, dot, eiffel, email, erlang, fo, fortran, freebasic, genero, glsl, gml, gnuplot, groovy, gettext, haskell, hq9plus, html,
42 idl, ini, inno, intercal, io, java5, java, javascript, kixtart, klonec, klonecpp, latex, lisp, locobasic, lolcode, lotusformulas, lotusscript,
43 lscript, lsl2, lua, m68k, make, matlab, mirc, modula3, mpasm, mxml, mysql, nsis, oberon2, objc, ocaml-brief, ocaml, oobas, oracle8, oracle11,
44 pascal, perl, per, php-brief, php, pic16, pixelbender, plsql, povray, powershell, progress, prolog, properties, providex, python, qbasic, rails,
45 rebol, reg, robots, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, tcl, teraterm, text, thinbasic, tsql, typoscript, vbnet,
46 vb, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, winbatch, whois, xml, xorg_conf, xpp, z80**/
47
48    function handle_toolbar(& $event, $param) {
49        $event->data[] = array (
50            'type' => 'picker',
51            'title' => $this->getLang('insertcode'),
52            'icon' => '../../plugins/codebutton_ext/pix/code_select.png',
53	'list' => array(
54                array(
55                    'type'   => 'format',
56                    'title'  => $this->getLang('bash'),
57                    'icon'   => '../../plugins/codebutton_ext/pix/File-bash-32.png',
58                    'open'   => '<code bash downloadname.sh>\n',
59                    'close'  => '\n</code>',
60                ),
61
62                array(
63                    'type'   => 'format',
64                    'title'  => $this->getLang('ansi-C'),
65                    'icon'   => '../../plugins/codebutton_ext/pix/File-c-32.png',
66                    'open'   => '<code c downloadname.c>\n',
67                    'close'  => '\n</code>',
68                ),
69
70                array(
71                    'type'   => 'format',
72                    'title'  => $this->getLang('css'),
73                    'icon'   => '../../plugins/codebutton_ext/pix/File-css-32.png',
74                    'open'   => '<code css downloadname.css>\n',
75                    'close'  => '\n</code>',
76                ),
77
78			array(
79                    'type'   => 'format',
80                    'title'  => $this->getLang('html'),
81                    'icon'   => '../../plugins/codebutton_ext/pix/File-html-32.png',
82                    'open'   => '<code html downloadname.html>\n',
83                    'close'  => '\n</code>',
84                ),
85
86			array(
87                    'type'   => 'format',
88                    'title'  => $this->getLang('xml'),
89                    'icon'   => '../../plugins/codebutton_ext/pix/File-xml-32.png',
90                    'open'   => '<code xml downloadname.xml>\n',
91                    'close'  => '\n</code>',
92		 ),
93
94			array(
95                    'type'   => 'format',
96                    'title'  => $this->getLang('javascript'),
97                    'icon'   => '../../plugins/codebutton_ext/pix/File-javascript-32.png',
98                    'open'   => '<code javascript downloadname.js>\n',
99                    'close'  => '\n</code>',
100                ),
101
102			array(
103                    'type'   => 'format',
104                    'title'  => $this->getLang('java'),
105                    'icon'   => '../../plugins/codebutton_ext/pix/File-java-32.png',
106                    'open'   => '<code java downloadname.java>\n',
107                    'close'  => '\n</code>',
108                ),
109
110			array(
111                    'type'   => 'format',
112                    'title'  => $this->getLang('php'),
113                    'icon'   => '../../plugins/codebutton_ext/pix/File-php-32.png',
114                    'open'   => '<code php downloadname.php>\n',
115                    'close'  => '\n</code>',
116                ),
117
118
119			array(
120                    'type'   => 'format',
121                    'title'  => $this->getLang('latex'),
122                    'icon'   => '../../plugins/codebutton_ext/pix/File-latex-32.png',
123                    'open'   => '<code latex downloadname.tex>\n',
124                    'close'  => '\n</code>',
125                ),
126
127			array(
128                    'type'   => 'format',
129                    'title'  => $this->getLang('winbatch'),
130                    'icon'   => '../../plugins/codebutton_ext/pix/File-winbatch-32.png',
131                    'open'   => '<code winbatch downloadname.bat>\n',
132                    'close'  => '\n</code>',
133                ),
134
135			array(
136                    'type'   => 'format',
137                    'title'  => $this->getLang('sql'),
138                    'icon'   => '../../plugins/codebutton_ext/pix/File-sql-32.png',
139                    'open'   => '<code sql downloadname.sql>\n',
140                    'close'  => '\n</code>',
141                ),
142
143			array(
144                    'type'   => 'format',
145                    'title'  => $this->getLang('vb'),
146                    'icon'   => '../../plugins/codebutton_ext/pix/File-vb-32.png',
147                    'open'   => '<code vb downloadname.vb>\n',
148                    'close'  => '\n</code>',
149                ),
150
151			array(
152                    'type'   => 'format',
153                    'title'  => $this->getLang('vhdl'),
154                    'icon'   => '../../plugins/codebutton_ext/pix/File-vhdl-32.png',
155                    'open'   => '<code vhdl downloadname.vhdl>\n',
156                    'close'  => '\n</code>',
157                ),
158
159		)
160
161        );
162    }
163
164}
165