diff --git a/src/applications/maniphest/controller/ManiphestReportController.php b/src/applications/maniphest/controller/ManiphestReportController.php --- a/src/applications/maniphest/controller/ManiphestReportController.php +++ b/src/applications/maniphest/controller/ManiphestReportController.php @@ -384,6 +384,43 @@ ); } + private function makeLinkToEntry($handle, $project_handle, $priority) { + $project_phids = array(); + + if ($project_handle) { + $project_phids[] = $project_handle->getPHID(); + } + + $link = '/maniphest/?status=open()'; + + switch ($this->view) { + case 'project': + if ($handle) { + $project_phids[] = $handle->getPHID(); + } + if (empty($project_phids)) { + $link .= '&projects=null()'; + } + break; + case 'user': + if ($handle) { + $link .= '&assigned='.$handle->getPHID(); + } else { + $link .= '&assigned=none()'; + } + break; + } + + if (!empty($project_phids)) { + $link .= '&projects='.implode(',', $project_phids); + } + + if ($priority !== null) { + $link .= '&priority='.$priority; + } + return $link; + } + public function renderOpenTasks() { $request = $this->getRequest(); $viewer = $request->getUser(); @@ -488,10 +525,11 @@ } $tasks = idx($result, $handle->getPHID(), array()); + $link = $this->makeLinkToEntry($handle, $project_handle, null); $name = phutil_tag( 'a', array( - 'href' => $base_link.$handle->getPHID(), + 'href' => $link, ), $handle->getName()); $closed = idx($result_closed, $handle->getPHID(), array()); @@ -507,16 +545,34 @@ $row = array(); $row[] = $name; $total = 0; + $total_tasks = array(); foreach (ManiphestTaskPriority::getTaskPriorityMap() as $pri => $label) { - $n = count(idx($tasks, $pri, array())); + $pri_tasks = idx($tasks, $pri, array()); + $total_tasks = array_merge($total_tasks, $pri_tasks); + $n = count($pri_tasks); if ($n == 0) { $row[] = '-'; } else { - $row[] = number_format($n); + $link = $this->makeLinkToEntry($handle, $project_handle, $pri); + + $row[] = phutil_tag( + 'a', + array( + 'href' => $link, + 'target' => '_blank', + ), + number_format($n)); } $total += $n; } - $row[] = number_format($total); + + $row[] = phutil_tag( + 'a', + array( + 'href' => $this->makeLinkToEntry($handle, $project_handle, null), + 'target' => '_blank', + ), + number_format($total)); list($link, $oldest_all) = $this->renderOldest($taskv); $row[] = $link;