From 1140677f445af8d22b4c4984c69123bec72f3202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Gro=C3=9Fe?= <grosse@cosmocode.de> Date: Thu, 20 Apr 2017 12:11:54 +0200 Subject: [PATCH] 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 --- lang/en/lang.php | 6 +++++- tpl/nav-page-attributes.php | 8 ++++---- tpl/nav-usertools-buttons.php | 14 ++++++-------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lang/en/lang.php b/lang/en/lang.php index 3b01cd1..e360cfa 100755 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -38,7 +38,11 @@ $lang['quality_trigger'] = 'toggle page analysis'; $lang['prefix_tasks'] = 'open tasks: '; $lang['prefix_tasks_user'] = 'your open tasks: '; $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['back_to_article'] = 'Back to article'; diff --git a/tpl/nav-page-attributes.php b/tpl/nav-page-attributes.php index 6fceac4..b4bace3 100755 --- a/tpl/nav-page-attributes.php +++ b/tpl/nav-page-attributes.php @@ -27,15 +27,15 @@ if($doPlugin !== null) { $title = tpl_getLang('tasks_page_none'); } elseif($count['undone'] == 0) { // all tasks done $class = 'do_done'; - $title = $this->getLang('title_alldone'); + $title = $doPlugin->getLang('title_alldone'); } elseif($count['late'] == 0) { // open tasks but none late $class = 'do_undone'; - $title = sprintf(tpl_getLang('title_intime'), $count['undone']); + $title = sprintf(tpl_getLang('tasks_page_intime'), $count['undone']); } else { // late tasks $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; } diff --git a/tpl/nav-usertools-buttons.php b/tpl/nav-usertools-buttons.php index efd0dd4..626032f 100755 --- a/tpl/nav-usertools-buttons.php +++ b/tpl/nav-usertools-buttons.php @@ -25,12 +25,10 @@ if ($doplugin !== null && isset($_SERVER['REMOTE_USER'])) { $tasks = $doplugin->loadTasks(array('status' => array('undone'),'user' => $_SERVER['REMOTE_USER'])); $num = count($tasks); - switch ($num) { - case 0: $class = 'noopentasks'; break; - case 1: $class = 'opentask'; break; - default: - $class = 'opentask opentasks'; - break; + if ($num === 0) { + $title = tpl_getLang('tasks_user_none'); + } else { + $title = sprintf(tpl_getLang('tasks_user_intime'), $num); } $doInner = "<span class=\"prefix\">".tpl_getLang('prefix_tasks_user')." </span><span class=\"num\">".count($tasks)."</span>"; @@ -38,9 +36,9 @@ $userpage = $doplugin->getConf('userpage'); if ($userpage && $_SERVER['REMOTE_USER'] && $num > 0) { $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 { - echo '<li class="user-task '.$class.'"><strong>'.$doInner.'</strong></li>'; + echo '<li class="user-task" title="'.$title.'"><strong>'.$doInner.'</strong></li>'; } } ?>