-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPlugin.php
99 lines (79 loc) · 3.62 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
<?php
namespace Kanboard\Plugin\DefinitionOfDone;
use Kanboard\Core\Plugin\Base;
use Kanboard\Core\Translator;
use Kanboard\Plugin\DefinitionOfDone\Controller\DefinitionOfDoneController;
class Plugin extends Base
{
private $dodtemplate = "";
public function initialize()
{
$this->template->setTemplateOverride('event/DefinitionOfDone_create', 'DefinitionOfDone:Event/create');
$this->template->setTemplateOverride('event/DefinitionOfDone_delete', 'DefinitionOfDone:Event/delete');
$this->template->setTemplateOverride('event/DefinitionOfDone_toggle', 'DefinitionOfDone:Event/toggle');
$this->template->setTemplateOverride('event/DefinitionOfDone_update', 'DefinitionOfDone:Event/update');
$this->template->hook->attach('template:task:show:before-subtasks', 'DefinitionOfDone:DefinitionOfDone/show');
$this->template->hook->attach('template:task:form:first-column', 'DefinitionOfDone:DefinitionOfDone/creation');
$this->template->hook->attach('template:task:dropdown:after-send-mail', 'DefinitionOfDone:DefinitionOfDone/checkall');
$this->template->hook->attach('template:board:task:icons', 'DefinitionOfDone:DefinitionOfDone/hover');
$this->hook->on('model:task:creation:prepare', function (&$values) {
if (isset($values['dod-templates'])) {
$this->dodtemplate = $values['dod-templates'];
unset($values['dod-templates']);
}
});
$this->hook->on('model:task:creation:aftersave', function ($task_id) {
if ($this->dodtemplate == "") {
return;
}
$controller = new DefinitionOfDoneController($this->container);
$controller->loadTemplateInternal($this->dodtemplate, $task_id);
});
$this->hook->on('template:layout:js', array('template' => 'plugins/DefinitionOfDone/Assets/js/functions.js'));
$this->hook->on('template:layout:css', array('template' => 'plugins/DefinitionOfDone/Assets/css/result.css'));
$this->hook->on('model:task:project_duplication:aftersave', function ($hook_values) {
$this->definitionOfDoneModel->copyAll($hook_values['source_task_id'], $hook_values['destination_task_id']);
});
$this->hook->on('model:task:duplication:aftersave', function ($hook_values) {
$this->definitionOfDoneModel->copyAll($hook_values['source_task_id'], $hook_values['destination_task_id']);
});
$this->api->getProcedureHandler()->withCallback('GetReleaseNotes', function() {
return $this->definitionOfDoneModel->collectReleaseNotes();
});
}
public function onStartup()
{
Translator::load($this->languageModel->getCurrentLanguage(), __DIR__.'/Locale');
}
public function getPluginName()
{
return 'DefinitionOfDone';
}
public function getClasses()
{
return array(
'Plugin\DefinitionOfDone\Model' => array(
'DefinitionOfDoneModel',
),
'Plugin\DefinitionOfDone\Controller' => array(
'DefinitionOfDoneController',
),
);
}
public function getPluginDescription()
{
return 'Add a Definition-Of-Done system - extended subtasks';
}
public function getPluginAuthor()
{
return 'Tomas Dittmann';
}
public function getPluginVersion()
{
return '1.3.1';
}
public function getPluginHomepage()
{
return 'https://github.com/Chaosmeister/DefinitionOfDone';
}
}