Use do-plugin's user task button w/ overlay

Motivation
----------
Since we do not have a dashboard it would be useful to directly see
one's task on click upon the respective icon. Also this is most likely
the dominating reason of the dashboard-usage.

Implementation Decisions
------------------------
* Use SVG: Since we move towards using SVG everywhere in DokuWiki, I
decided to use a SVG icon here as well. This makes it compatible with
other templates too, without introducing an icon-font there.
* Using a `<span>` instead of a `<strong>`: I do not see the semantic reason
behind using a `<strong>` here.

Other Changes
-------------
* The styles related to the do-plugin have been moved from
css/area_nav-usertools.less to css/plugins/do_tasks.less

This needs the respective pull request merged from the do-plugin:
https://github.com/cosmocode/do/pull/31

SPR-962
This commit is contained in:
Michael Große 2017-04-24 19:23:48 +02:00
commit 211de8a54a
No known key found for this signature in database
GPG key ID: 7E31028FBFEACC79
5 changed files with 67 additions and 63 deletions

View file

@ -23,25 +23,12 @@
/** @var \helper_plugin_do $doplugin */
$doplugin = plugin_load('helper','do');
if ($doplugin !== null && isset($_SERVER['REMOTE_USER'])) {
$tasks = $doplugin->loadTasks(array('status' => array('undone'),'user' => $_SERVER['REMOTE_USER']));
$num = count($tasks);
if ($num === 0) {
$title = tpl_getLang('tasks_user_none');
} else {
$title = sprintf(tpl_getLang('tasks_user_intime'), $num);
$icon = $doplugin->tpl_getUserTasksIconHTML();
if ($icon) {
echo '<li class="user-task">' . $icon . '</li>';
}
$doInner = "<span class=\"prefix\">".tpl_getLang('prefix_tasks_user')." </span><span class=\"num\">".count($tasks)."</span>";
$userpage = $doplugin->getConf('userpage');
if ($userpage && $_SERVER['REMOTE_USER'] && $num > 0) {
$linktarget = sprintf($userpage, $_SERVER['REMOTE_USER']) . ':' . 'dashboard';
$linktarget = str_replace('::', ':', $linktarget);
echo '<li class="user-task" title="'.$title.'"><a href="'.wl($linktarget).'">'.$doInner.'</a></li>';
} else {
echo '<li class="user-task" title="'.$title.'"><strong>'.$doInner.'</strong></li>';
}
} ?>
}
?>
</ul>
</nav><!-- #dokuwiki__usertools -->