From 89974b3a67d675b99ff02aa09d25de0bb5544747 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 10 Dec 2006 21:10:21 +0000 Subject: [PATCH] r1347: Votes can now be displayed on the bug grid. We are now closing off all the issues relating to the bug grid stuff. --- docs/changes.txt | 2 ++ docs/todo.txt | 3 --- includes/class_sort.php | 32 ++++++++++++++++++++++++++------ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 5f2198d..ffeec6d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -4,6 +4,8 @@ - Added the ability to show all the users in a paginated list in the admin section (bug://report/55) - Can export search results to an XML file (bug://report/41) - Links in comments are now parsed if the user so desires (bug://report/2) +- Components can now be displayed on the bug grid (bug://report/43) +- Votes can now be displayed and sorted on the bug grid (bug://report/13) 1.1.4 =============================== diff --git a/docs/todo.txt b/docs/todo.txt index 30d5737..fb0979d 100755 --- a/docs/todo.txt +++ b/docs/todo.txt @@ -5,12 +5,9 @@ SVN: $Id$ ############################################################################### BUGDAR 1.2 -- Allow users and admins to specify columns and their order - Mark products/versions as obsolete so bugs cannot be filed against them - Have a favourite queries list - Mass updates and deletes -- Ability to show votes on bug listings (bug://report/13) -- Ability to show components on bug listings (bug://report/43) - Importing from other bug systems (bug://report/41) - Workflow interface diff --git a/includes/class_sort.php b/includes/class_sort.php index 8d5fac0..0093ed6 100644 --- a/includes/class_sort.php +++ b/includes/class_sort.php @@ -138,7 +138,9 @@ class ListSorter case 'reporter': case 'lastpost': $query = " - SELECT * FROM " . TABLE_PREFIX . "bug AS bug + SELECT bug.*, vote.votefor, vote.voteagainst FROM " . TABLE_PREFIX . "bug AS bug + LEFT JOIN " . TABLE_PREFIX . "vote AS vote + ON (bug.bugid = vote.bugid) WHERE $basewhere" . (is_array($where) ? " AND " . implode("\nAND ", $where) : "") . " @@ -152,14 +154,28 @@ class ListSorter case 'resolution': case 'priority': case 'severity': + $key = ($this->sortkey != 'component' ? $this->sortkey : 'product'); $query = " - SELECT * FROM " . TABLE_PREFIX . "{$this->sortkey} AS {$this->sortkey} + SELECT $key.*, bug.*, vote.votefor, vote.voteagainst FROM " . TABLE_PREFIX . "$key AS $key RIGHT JOIN " . TABLE_PREFIX . "bug AS bug - ON (bug.{$this->sortkey} = {$this->sortkey}.{$this->sortkey}id) + ON (bug.$key = $key.{$key}id) + LEFT JOIN " . TABLE_PREFIX . "vote AS vote + ON (bug.bugid = vote.bugid) WHERE $basewhere" . (is_array($where) ? " AND " . implode("\nAND ", $where) : "") . " - ORDER BY {$this->sortkey}.displayorder " . strtoupper($this->direction) . ", bug.$querykeys[lastpost] " . strtoupper($this->direction) . ($limit ? " + ORDER BY $key.displayorder " . strtoupper($this->direction) . ", bug.$querykeys[lastpost] " . strtoupper($this->direction) . ($limit ? " + LIMIT $limit" : ""); + break; + case 'votes': + $query = " + SELECT bug.*, vote.votefor, vote.voteagainst FROM " . TABLE_PREFIX . "bug AS bug + LEFT JOIN " . TABLE_PREFIX . "vote AS vote + ON (bug.bugid = vote.bugid) + WHERE $basewhere" . + (is_array($where) ? " + AND " . implode("\nAND ", $where) : "") . " + ORDER BY vote.votefor " . strtoupper($this->direction) . ", vote.voteagainst " . strtoupper($this->fetch_opposite_sort_direction()) . ", bug.$querykeys[lastpost] " . strtoupper($this->direction) . ($limit ? " LIMIT $limit" : ""); break; } @@ -187,11 +203,13 @@ class ListSorter 'summary' => _('Summary'), 'reporter' => _('Reporter'), 'product' => _('Product'), + 'component' => _('Component'), 'version' => _('Version'), 'status' => _('Status'), 'resolution' => _('Resolution'), 'priority' => _('Priority'), - 'severity' => _('Severity') + 'severity' => _('Severity'), + 'votes' => _('Votes') ); if ($key === false) @@ -367,7 +385,7 @@ class ListSorter function constructRow($bug, $params = null) { $this->_processColumns(); - + foreach ($this->columns AS $columns) { if (sizeof($columns) > 1) @@ -410,6 +428,8 @@ class ListSorter return ($bug['userid'] ? $bug['username'] : _('Guest')); case 'lastpost': return $bug['lastposttime'] . "\n\t\t
" . _('by') . ' ' . ($bug['lastpost'] ? $bug['lastpost'] : _('Guest')); + case 'votes': + return '
' . _('For:') . ' ' . $bug['votefor'] . "
\n\t\t
" . _('Against:') . ' ' . $bug['voteagainst']; default: return $bug["$column"]; } -- 2.22.5