diff options
-rw-r--r-- | extensions/MyDashboard/Extension.pm | 38 | ||||
-rw-r--r-- | extensions/MyDashboard/template/en/default/pages/mydashboard.html.tmpl | 41 |
2 files changed, 4 insertions, 75 deletions
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 @@ }); --> </script> - - <div id="activeproducts"> - <div class="query_heading"> - Products with Open [% terms.Bugs %] - </div> - <div id="activeproducts_table_container"> - <table id="activeproducts_table" cellspacing="0" cellpadding="4" width="100%"> - <thead> - <tr bgcolor="#dedede"> - <th>Count</th> - <th>Product</th> - </tr> - </thead> - <tbody> - [% FOREACH product = products %] - <tr class="bz_bugitem [%+ loop.count() % 2 == 0 ? "bz_row_odd" : "bz_row_even" %]"> - <td align="right">[% product.count FILTER html %]</td> - <td><a href="buglist.cgi?product=[% product.product FILTER uri %][% products_buffer FILTER none %]"> - [% product.product FILTER html %]</a></td> - </tr> - [% END %] - </tbody> - </table> - </div> - </div> - <script> - <!-- - var product_column_defs = [ - { key:"count", label:"Count", sortable:true }, - { key:"product", label:"Product", sortable:true } - ]; - var product_fields = [ - { key:"count", parser:"number" }, - { key:"product" } - ]; - addStatListener("activeproducts_table_container", "activeproducts_table", product_column_defs, product_fields, { - paginator: new YAHOO.widget.Paginator({ rowsPerPage: 25, alwaysVisible: false }) - }); - --> - </script> - </div> <div style="clear:both;"></div> </div> |