1<?php
2/**
3* projects Action Plugin: hijack the ACTION_ACT_PREPROCESS events for admin action
4*
5* @author     Junling Ma <junlingm@gmail.com>
6*/
7
8require_once(dirname(__FILE__).'/../lib/project.php');
9require_once DOKU_PLUGIN.'action.php';
10
11class action_plugin_projects_editformselect extends DokuWiki_Action_Plugin {
12
13    function getInfo(){
14    return array(
15        'author' => 'Junling Ma',
16        'email'  => 'junlingm@gmail.com',
17        'date'   => '2012-08-13',
18        'name'   => 'Projects',
19        'desc'   => 'Create HTML edit form for projects wiki represented file contents',
20        'url'    => 'http://www.math.uvic.ca/~jma'
21        );
22    }
23
24    /**
25    * Register its handlers with the DokuWiki's event controller
26    */
27    function register(&$controller) {
28        $controller->register_hook('HTML_EDIT_FORMSELECTION', 'BEFORE', $this,
29                'select');
30    }
31
32    function select(&$event, $param) {
33        if ($event->data['target'] != 'projects_wiki_file') return;
34        global $conf;
35        if ($conf['compress'])
36            $event->data['form']->addElement('<div class=error>CodeMirror is not compactable with Javascript and CSS compression. Please set compress to off in <a href="?do=admin&page=config"> Admin/Configuration Settings</a>".</div>');
37        $event->data['form']->addHidden('projects_wiki_lang', $_REQUEST['lang']);
38        $event->data['target'] = 'section';
39    }
40
41}
42
43?>