From f8d1e773e300c24257deb9c5e7b77e1f9fe3a1f8 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Fri, 10 Aug 2012 14:57:05 -0400 Subject: small changes to My Dashboard --- extensions/MyDashboard/Extension.pm | 38 +++----------------- .../en/default/pages/mydashboard.html.tmpl | 41 ---------------------- 2 files changed, 4 insertions(+), 75 deletions(-) (limited to 'extensions') diff --git a/extensions/MyDashboard/Extension.pm b/extensions/MyDashboard/Extension.pm index 3eea207f2..a0a5e36cf 100644 --- a/extensions/MyDashboard/Extension.pm +++ b/extensions/MyDashboard/Extension.pm @@ -19,6 +19,8 @@ use Bugzilla::Status; use Bugzilla::Field; use Bugzilla::Search::Saved; +use Bugzilla::Extension::MyDashboard::Util qw(open_states closed_states + quoted_open_states quoted_closed_states); use Bugzilla::Extension::MyDashboard::TimeAgo qw(time_ago); use DateTime; @@ -56,7 +58,7 @@ sub QUERY_DEFS { heading => "In Progress Reported by You", description => 'You reported the bug, the developer accepted the bug and is hopefully working on it.', params => { - 'bug_status' => [ map { $_->name } grep($_->name ne 'NEW' && $_->name ne 'MODIFIED', _open_states()) ], + 'bug_status' => [ map { $_->name } grep($_->name ne 'NEW' && $_->name ne 'MODIFIED', open_states()) ], 'emailreporter1' => 1, 'emailtype1' => 'exact', 'email1' => $user->login @@ -156,44 +158,12 @@ sub page_before_template { # Switch to shadow db since we are just reading information Bugzilla->switch_to_shadow_db(); - _active_product_counts($vars); _standard_saved_queries($vars); _flags_requested($vars); $vars->{'severities'} = get_legal_field_values('bug_severity'); } -our $_open_states; -sub _open_states { - $_open_states ||= Bugzilla::Status->match({ is_open => 1, isactive => 1 }); - return wantarray ? @$_open_states : $_open_states; -} - -our $_quoted_open_states; -sub _quoted_open_states { - my $dbh = Bugzilla->dbh; - $_quoted_open_states ||= [ map { $dbh->quote($_->name) } _open_states() ]; - return wantarray ? @$_quoted_open_states : $_quoted_open_states; -} - -sub _active_product_counts { - my ($vars) = @_; - my $dbh = Bugzilla->dbh; - my $user = Bugzilla->user; - - my @enterable_products = @{$user->get_enterable_products()}; - $vars->{'products'} - = $dbh->selectall_arrayref("SELECT products.name AS product, count(*) AS count - FROM bugs,products - WHERE bugs.product_id=products.id - AND products.isactive = 1 - AND bugs.bug_status IN (" . join(',', _quoted_open_states()) . ") - AND products.id IN (" . join(',', map { $_->id } @enterable_products) . ") - GROUP BY products.name ORDER BY count DESC", { Slice => {} }); - - $vars->{'products_buffer'} = "&" . join('&', map { "bug_status=" . $_->name } _open_states()); -} - sub _standard_saved_queries { my ($vars) = @_; my $dbh = Bugzilla->dbh; @@ -306,7 +276,7 @@ sub _flags_requested { AND ccmap.bug_id = bugs.bug_id "; # Limit query to pending requests and open bugs only - $query .= " WHERE bugs.bug_status IN (" . join(',', _quoted_open_states()) . ") + $query .= " WHERE bugs.bug_status IN (" . join(',', quoted_open_states()) . ") AND flags.status = '?' "; # Weed out bug the user does not have access to diff --git a/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl b/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl index 0fb526dd7..1dbc749b7 100644 --- a/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl +++ b/extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl @@ -195,47 +195,6 @@ }); --> - -
-
- Products with Open [% terms.Bugs %] -
-
- - - - - - - - - [% FOREACH product = products %] - - - - - [% END %] - -
CountProduct
[% product.count FILTER html %] - [% product.product FILTER html %]
-
-
- -
-- cgit v1.2.3-24-g4f1b