Show more descriptive titles for the do-icons

This should also fix an occasional fatal-error when all tasks on a page
are done.

We remove here also the $class from the button in the usertools, since
it served no apparent purpose.

SPR-936
This commit is contained in:
Michael Große 2017-04-20 12:11:54 +02:00
parent c22ee858b3
commit 1140677f44
No known key found for this signature in database
GPG key ID: 7E31028FBFEACC79
3 changed files with 15 additions and 13 deletions

View file

@ -38,7 +38,11 @@ $lang['quality_trigger'] = 'toggle page analysis';
$lang['prefix_tasks'] = 'open tasks: '; $lang['prefix_tasks'] = 'open tasks: ';
$lang['prefix_tasks_user'] = 'your open tasks: '; $lang['prefix_tasks_user'] = 'your open tasks: ';
$lang['prefix_tasks_page'] = 'open tasks for this page: '; $lang['prefix_tasks_page'] = 'open tasks for this page: ';
$lang['tasks_page_none'] = 'no open tasks for this page'; $lang['tasks_page_none'] = 'There are no open tasks for this page.';
$lang['tasks_page_intime'] = 'There are %1$d open tasks on this page.';
$lang['tasks_page_late'] = 'There are %1$d open tasks on this page, %2$d are late.';
$lang['tasks_user_none'] = 'You have no open tasks.';
$lang['tasks_user_intime'] = 'You have %1$d open tasks.';
$lang['discussion'] = 'Discussion'; $lang['discussion'] = 'Discussion';
$lang['back_to_article'] = 'Back to article'; $lang['back_to_article'] = 'Back to article';

View file

@ -27,15 +27,15 @@ if($doPlugin !== null) {
$title = tpl_getLang('tasks_page_none'); $title = tpl_getLang('tasks_page_none');
} elseif($count['undone'] == 0) { // all tasks done } elseif($count['undone'] == 0) { // all tasks done
$class = 'do_done'; $class = 'do_done';
$title = $this->getLang('title_alldone'); $title = $doPlugin->getLang('title_alldone');
} elseif($count['late'] == 0) { // open tasks but none late } elseif($count['late'] == 0) { // open tasks but none late
$class = 'do_undone'; $class = 'do_undone';
$title = sprintf(tpl_getLang('title_intime'), $count['undone']); $title = sprintf(tpl_getLang('tasks_page_intime'), $count['undone']);
} else { // late tasks } else { // late tasks
$class = 'do_late'; $class = 'do_late';
$title = sprintf(tpl_getLang('title_late'), $count['undone'], $count['late']); $title = sprintf(tpl_getLang('tasks_page_late'), $count['undone'], $count['late']);
} }
$markup = "<li class=\"plugin__do_pagetasks " . $class . "\" title=\"'.$title.'\"><strong><span class=\"prefix\">" . tpl_getLang('prefix_tasks_page') . " </span><span class=\"num\">" . $num . "</span></strong></li>"; $markup = "<li class=\"plugin__do_pagetasks $class\" title=\"$title\"><strong><span class=\"prefix\">" . tpl_getLang('prefix_tasks_page') . " </span><span class=\"num\">$num</span></strong></li>";
echo $markup; echo $markup;
} }

View file

@ -25,12 +25,10 @@
if ($doplugin !== null && isset($_SERVER['REMOTE_USER'])) { if ($doplugin !== null && isset($_SERVER['REMOTE_USER'])) {
$tasks = $doplugin->loadTasks(array('status' => array('undone'),'user' => $_SERVER['REMOTE_USER'])); $tasks = $doplugin->loadTasks(array('status' => array('undone'),'user' => $_SERVER['REMOTE_USER']));
$num = count($tasks); $num = count($tasks);
switch ($num) { if ($num === 0) {
case 0: $class = 'noopentasks'; break; $title = tpl_getLang('tasks_user_none');
case 1: $class = 'opentask'; break; } else {
default: $title = sprintf(tpl_getLang('tasks_user_intime'), $num);
$class = 'opentask opentasks';
break;
} }
$doInner = "<span class=\"prefix\">".tpl_getLang('prefix_tasks_user')." </span><span class=\"num\">".count($tasks)."</span>"; $doInner = "<span class=\"prefix\">".tpl_getLang('prefix_tasks_user')." </span><span class=\"num\">".count($tasks)."</span>";
@ -38,9 +36,9 @@
$userpage = $doplugin->getConf('userpage'); $userpage = $doplugin->getConf('userpage');
if ($userpage && $_SERVER['REMOTE_USER'] && $num > 0) { if ($userpage && $_SERVER['REMOTE_USER'] && $num > 0) {
$linktarget = sprintf($userpage, $_SERVER['REMOTE_USER']) . ':' . 'dashboard'; $linktarget = sprintf($userpage, $_SERVER['REMOTE_USER']) . ':' . 'dashboard';
echo '<li class="user-task '.$class.'"><a href="'.wl($linktarget).'">'.$doInner.'</a></li>'; echo '<li class="user-task" title="'.$title.'"><a href="'.wl($linktarget).'">'.$doInner.'</a></li>';
} else { } else {
echo '<li class="user-task '.$class.'"><strong>'.$doInner.'</strong></li>'; echo '<li class="user-task" title="'.$title.'"><strong>'.$doInner.'</strong></li>';
} }
} ?> } ?>