-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathPlugin.php
executable file
·115 lines (96 loc) · 5.46 KB
/
Plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
namespace Kanboard\Plugin\Wiki;
use Kanboard\Core\Plugin\Base;
use Kanboard\Core\Security\Role;
use Kanboard\Core\Translator;
class Plugin extends Base
{
public function initialize()
{
// access map
$this->projectAccessMap->add('WikiController', '*', Role::PROJECT_MEMBER);
$this->projectAccessMap->add('WikiAjaxController', '*', Role::PROJECT_MEMBER);
$this->projectAccessMap->add('WikiFileController', '*', Role::PROJECT_MEMBER);
$this->projectAccessMap->add('WikiFileViewController', '*', Role::PROJECT_MEMBER);
$this->applicationAccessMap->add('WikiController', array('readonly','detail_readonly'), Role::APP_PUBLIC);
// page routes wiki pages
$this->route->addRoute('/wiki/index', 'WikiController', 'index', 'wiki');
$this->route->addRoute('/wiki/project/:project_id', 'WikiController', 'show', 'wiki');
$this->route->addRoute('/wiki/project/:project_id/readonly', 'WikiController', 'readonly', 'wiki');
$this->route->addRoute('/wiki/project/:project_id/detail/:wiki_id', 'WikiController', 'detail', 'wiki');
$this->route->addRoute('/wiki/project/:project_id/detail/:wiki_id/readonly', 'WikiController', 'detail_readonly', 'wiki');
$this->route->addRoute('/wiki/project/:project_id/editions/:wiki_id', 'WikiController', 'editions', 'wiki');
// $this->route->addRoute('/wiki/project/:project_id/breakdown', 'WikiController', 'breakdown', 'wiki');
$this->route->addRoute('/wiki/project/:project_id/create', 'WikiController', 'create', 'wiki');
$this->route->addRoute('/wiki/edit/:wiki_id', 'WikiController', 'edit', 'wiki');
$this->route->addRoute('/wiki/project/:project_id/remove/:wiki_id', 'WikiController', 'confirm', 'wiki');
$this->route->addRoute('/wiki/project/:project_id/restore/:wiki_id/:edition', 'WikiController', 'confirm_restore', 'wiki');
$this->route->addRoute('/wiki/project/:project_id/purge/:wiki_id/:edition', 'WikiController', 'confirm_purge', 'wiki');
// page routes wiki files
$this->route->addRoute('/wiki/file/:project_id/create/:wiki_id', 'WikiFileController', 'create', 'wiki');
$this->route->addRoute('/wiki/file/:project_id/screenshot/:wiki_id', 'WikiFileController', 'screenshot', 'wiki');
$this->route->addRoute('/wiki/file/:project_id/remove/:wiki_id/:file_id', 'WikiFileController', 'confirm', 'wiki');
$this->route->addRoute('/wiki/file/:file_id', 'WikiFileViewController', 'show', 'wiki');
$this->route->addRoute('/wiki/file/:file_id/image', 'WikiFileViewController', 'image', 'wiki');
$this->route->addRoute('/wiki/file/:file_id/thumbnail', 'WikiFileViewController', 'thumbnail', 'wiki');
$this->route->addRoute('/wiki/file/:file_id/browser', 'WikiFileViewController', 'browser', 'wiki');
$this->route->addRoute('/wiki/file/:file_id/download', 'WikiFileViewController', 'download', 'wiki');
// template hooks
$this->template->hook->attach('template:config:sidebar', 'Wiki:config/sidebar');
$this->template->hook->attach('template:project:dropdown', 'wiki:project/dropdown');
$this->template->hook->attach('template:header:dropdown', 'wiki:header/dropdown');
$this->template->hook->attach('template:project-header:view-switcher', 'Wiki:project_header/views');
// template overrides
$this->template->setTemplateOverride('board/view_public', 'wiki:board/view_public');
$this->template->setTemplateOverride('file_viewer/show', 'wiki:file_viewer/show');
// CSS + JS
$this->hook->on('template:layout:css', array('template' => 'plugins/Wiki/Asset/css/wiki.css'));
$this->hook->on('template:layout:js', array('template' => 'plugins/Wiki/Asset/Javascript/main.js'));
// $this->template->setTemplateOverride('wiki', 'wiki:wiki/layout');
// can't figure out how to register helper template
// $this->layout->register('wiki', '\Kanboard\Plugin\Wiki\Helper\layout');
// $this->helper->register('wiki', '\Kanboard\Plugin\Wiki\Helper\layout');
// helpers
$this->helper->register('wikiHelper', '\Kanboard\Plugin\Wiki\Helper\WikiHelper');
}
public function onStartup()
{
Translator::load($this->languageModel->getCurrentLanguage(), __DIR__ . '/Locale');
}
public function getClasses()
{
return array(
'Plugin\Wiki\Controller' => [
'WikiAjaxController'
],
'Plugin\Wiki\Model' => array(
'WikiModel',
'WikiFileModel'
),
);
}
public function getPluginName()
{
return 'Wiki';
}
public function getPluginDescription()
{
return t('Wiki to document projects');
}
public function getPluginAuthor()
{
return 'lastlink';
}
public function getPluginVersion()
{
return '0.4.0';
}
public function getPluginHomepage()
{
return 'https://github.com/funktechno/kanboard-plugin-wiki';
}
public function getCompatibleVersion()
{
return '>=1.0.37';
}
}