From 4eedaa49885521771bb1ace367e6c8c75053cf85 Mon Sep 17 00:00:00 2001 From: LarsDW223 Date: Sun, 19 Feb 2017 15:34:24 +0100 Subject: [PATCH 1/2] Added posibility to set the priority colors using the "Template Style settings" page. The admin can set the configuration option "layout" to "built-in", this will use the normal layout (as before). If the option is set to "template" then the priority colors are taken from less-CSS-values: __plugin_task_priority1_color__ __plugin_task_priority2_color__ __plugin_task_priority3_color__ To make this work the following needs to be done manually in the DokuWiki template: In file "style.ini", add these lines: ;- Styling settings for task plugin --------------------------------------- __plugin_task_priority1_color__ = "#fff7e8" __plugin_task_priority2_color__ = "#fff1d9" __plugin_task_priority3_color__ = "#ffe9c2" In template langauge file "en/lang.php", add these lines: $lang['__plugin_task_priority1_color__'] = 'Plugin Task: choose color for priority "medium"'; $lang['__plugin_task_priority2_color__'] = 'Plugin Task: choose color for priority "high"'; $lang['__plugin_task_priority3_color__'] = 'Plugin Task: choose color for priority "critical"'; --- conf/default.php | 7 ++++--- conf/metadata.php | 4 ++++ helper.php | 8 ++++++++ lang/de/settings.php | 4 +++- lang/en/settings.php | 2 ++ style.css | 4 ++++ syntax/task.php | 10 +++++++++- 7 files changed, 34 insertions(+), 5 deletions(-) diff --git a/conf/default.php b/conf/default.php index ab13163..99e1d84 100644 --- a/conf/default.php +++ b/conf/default.php @@ -2,8 +2,9 @@ /** * Options for the Task Plugin */ -$conf['datefield'] = 1; // entry field for due date in form -$conf['tasks_formposition'] = 'bottom'; // position of new task form -$conf['tasks_newestfirst'] = 0; // show newest tasks first in tasks list +$conf['datefield'] = 1; // entry field for due date in form +$conf['tasks_formposition'] = 'bottom'; // position of new task form +$conf['tasks_newestfirst'] = 0; // show newest tasks first in tasks list +$conf['layout'] = 'built-in'; // use standard layout/colors //Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/conf/metadata.php b/conf/metadata.php index f444d6e..64f51e6 100644 --- a/conf/metadata.php +++ b/conf/metadata.php @@ -11,5 +11,9 @@ '_choices' => array('none', 'top', 'bottom') ); $meta['tasks_newestfirst'] = array('onoff'); +$meta['layout'] = array( + 'multichoice', + '_choices' => array('built-in', 'template') + ); //Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/helper.php b/helper.php index 58d84fa..53107ed 100644 --- a/helper.php +++ b/helper.php @@ -134,6 +134,13 @@ function getTasks($ns, $num = NULL, $filter = '', $user = NULL) { elseif (($date + 86400 > time()) && ($filter == 'overdue')) continue; } + if ($this->getConf('layout') == 'template') { + $class = 'template_priority'.$task['priority']; + } else { + // let pagelist plugin set the class, will be 'priority' + $class = NULL; + } + $result[$task['key']] = array( 'id' => $id, 'date' => $date, @@ -143,6 +150,7 @@ function getTasks($ns, $num = NULL, $filter = '', $user = NULL) { 'perm' => $perm, 'file' => $task['file'], 'exists' => true, + 'class' => $class, ); } diff --git a/lang/de/settings.php b/lang/de/settings.php index d99f9fe..8010062 100644 --- a/lang/de/settings.php +++ b/lang/de/settings.php @@ -14,4 +14,6 @@ $lang['tasks_formposition_o_top'] = 'oben'; $lang['tasks_formposition_o_bottom'] = 'unten'; -//Setup VIM: ex: et ts=2 enc=utf-8 : \ No newline at end of file +$lang['layout'] = 'Welches Layout/Farben sollen benutzt werden?'; + +//Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/lang/en/settings.php b/lang/en/settings.php index 7f320fc..c797eda 100644 --- a/lang/en/settings.php +++ b/lang/en/settings.php @@ -16,4 +16,6 @@ $lang['tasks_newewstfirst'] = 'show newewst tasks first in tasks list'; +$lang['layout'] = 'which layout/colors shall be used?'; + //Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/style.css b/style.css index 829ec65..2bac852 100644 --- a/style.css +++ b/style.css @@ -59,6 +59,10 @@ div.dokuwiki tr.priority1 { background-color: #fff7e8; } div.dokuwiki tr.priority2 { background-color: #fff1d9; } div.dokuwiki tr.priority3 { background-color: #ffe9c2; } +div.dokuwiki tr.template_priority1 { background-color: __plugin_task_priority1_color__; } +div.dokuwiki tr.template_priority2 { background-color: __plugin_task_priority2_color__; } +div.dokuwiki tr.template_priority3 { background-color: __plugin_task_priority3_color__; } + div.dokuwiki div.vcalendar fieldset.due { border: 1px solid #ffa200; } div.dokuwiki div.vcalendar fieldset.overdue { border: 1px solid #ff0040; } diff --git a/syntax/task.php b/syntax/task.php index 0013410..b0d538e 100644 --- a/syntax/task.php +++ b/syntax/task.php @@ -84,7 +84,15 @@ function render($mode, Doku_Renderer $renderer, $data) { } $class = ' class="vtodo'; - if ($priority) $class .= ' priority' . $priority; + if ($priority) { + if ($this->getConf('layout') == 'template') { + // Take layout from DokuWiki template + $class .= ' template_priority' . $priority; + } else { + // Use built-in layout + $class .= ' priority' . $priority; + } + } if ($due) { $class .= ' '.$due; $due = ' class="'.$due.'"'; From 98534c0d4b6d5397192c173998861c9b8e5ee2ad Mon Sep 17 00:00:00 2001 From: LarsDW223 Date: Sun, 19 Feb 2017 18:30:39 +0100 Subject: [PATCH 2/2] Added styling for tasklist width (using extra pagelist table class). This requires a change in the pagelist plugin. --- style.css | 4 ++++ syntax/tasks.php | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/style.css b/style.css index 2bac852..c50a751 100644 --- a/style.css +++ b/style.css @@ -42,6 +42,10 @@ div.dokuwiki div.vcalendar table.blind th { background-color: transparent; } +div.dokuwiki div.page table.plugin_task_tasklist { + width: __plugin_task_tasklist_width__; +} + div.dokuwiki div.newtask_form table.blind td, div.dokuwiki div.vcalendar table.blind td { width: 50%; diff --git a/syntax/tasks.php b/syntax/tasks.php index dd5df95..cd76ae4 100644 --- a/syntax/tasks.php +++ b/syntax/tasks.php @@ -124,7 +124,11 @@ function render($mode, Doku_Renderer $renderer, $data) { $pagelist->addColumn('task', 'status'); // output list - $pagelist->startList(); + $class = NULL; + if ($this->getConf('layout') == 'template') { + $class = 'plugin_task_tasklist'; + } + $pagelist->startList($class); if($this->getConf('tasks_newestfirst')) { $pages = array_reverse($pages); }