From afa011924df93865e9d392843a26ed337e7f6cf8 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sun, 13 May 2007 23:58:26 +0000 Subject: Bug 327077: Implement a way to get all the components with a given default assignee (owner) and/or default QA contact - Patch by Frédéric Buclin r=bkor a=LpSolit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/User.pm | 29 ++++++++++++++++---- skins/standard/editusers.css | 14 ++++++++++ .../default/admin/users/confirm-delete.html.tmpl | 31 +--------------------- template/en/default/admin/users/edit.html.tmpl | 13 ++++++++- template/en/default/filterexceptions.pl | 2 -- 5 files changed, 51 insertions(+), 38 deletions(-) diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 6d0922abf..a14549f84 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -917,14 +917,33 @@ sub product_responsibilities { return $self->{'product_resp'} if defined $self->{'product_resp'}; return [] unless $self->id; - my $comp_ids = $dbh->selectcol_arrayref('SELECT id FROM components - WHERE initialowner = ? - OR initialqacontact = ?', - undef, ($self->id, $self->id)); + my $list = $dbh->selectall_arrayref('SELECT product_id, id + FROM components + WHERE initialowner = ? + OR initialqacontact = ?', + {Slice => {}}, ($self->id, $self->id)); + + unless ($list) { + $self->{'product_resp'} = []; + return $self->{'product_resp'}; + } + my @prod_ids = map {$_->{'product_id'}} @$list; + my $products = Bugzilla::Product->new_from_list(\@prod_ids); # We cannot |use| it, because Component.pm already |use|s User.pm. require Bugzilla::Component; - $self->{'product_resp'} = Bugzilla::Component->new_from_list($comp_ids); + my @comp_ids = map {$_->{'id'}} @$list; + my $components = Bugzilla::Component->new_from_list(\@comp_ids); + + my @prod_list; + # @$products is already sorted alphabetically. + foreach my $prod (@$products) { + # We use @components instead of $prod->components because we only want + # components where the user is either the default assignee or QA contact. + push(@prod_list, {product => $prod, + components => [grep {$_->product_id == $prod->id} @$components]}); + } + $self->{'product_resp'} = \@prod_list; return $self->{'product_resp'}; } diff --git a/skins/standard/editusers.css b/skins/standard/editusers.css index 55eb5c307..770d602c8 100644 --- a/skins/standard/editusers.css +++ b/skins/standard/editusers.css @@ -51,6 +51,20 @@ table.groups td.checkbox { white-space: nowrap; } +table#user_responsibilities th { + text-align: center; + padding: 0 1em 1em; +} + +table#user_responsibilities th.product { + text-align: left; + padding: 1em 0 0; +} + +table#user_responsibilities td.center { + text-align: center; +} + .missing { color: red; border-color: inherit; diff --git a/template/en/default/admin/users/confirm-delete.html.tmpl b/template/en/default/admin/users/confirm-delete.html.tmpl index 0fd4aafa7..5b28aad75 100644 --- a/template/en/default/admin/users/confirm-delete.html.tmpl +++ b/template/en/default/admin/users/confirm-delete.html.tmpl @@ -55,12 +55,6 @@ listselectionvalues = listselectionvalues %] -[% responsibilityterms = { - 'default_assignee' => 'Default Assignee', - 'default_qa_contact' => 'Default QA Contact' - } -%] - @@ -88,30 +82,7 @@ [% END %] diff --git a/template/en/default/admin/users/edit.html.tmpl b/template/en/default/admin/users/edit.html.tmpl index 5712b6f57..ab7369a23 100644 --- a/template/en/default/admin/users/edit.html.tmpl +++ b/template/en/default/admin/users/edit.html.tmpl @@ -30,7 +30,7 @@ [% PROCESS global/header.html.tmpl title = title message = message - style_urls = ['skins/standard/editusers.css'] + style_urls = ['skins/standard/admin.css', 'skins/standard/editusers.css'] %] [% PROCESS admin/users/listselectvars.html.tmpl @@ -96,6 +96,17 @@ [% END %] + + + + +
Login name:
Product responsibilities: - + [% PROCESS admin/users/responsibilities.html.tmpl otheruser = otheruser %]
Product responsibilities: + [% IF otheruser.product_responsibilities.size %] + [% PROCESS admin/users/responsibilities.html.tmpl otheruser = otheruser %] + [% ELSE %] + none + [% END %] +

diff --git a/template/en/default/filterexceptions.pl b/template/en/default/filterexceptions.pl index f605ca82e..cc2e060ee 100644 --- a/template/en/default/filterexceptions.pl +++ b/template/en/default/filterexceptions.pl @@ -518,8 +518,6 @@ ], 'admin/users/confirm-delete.html.tmpl' => [ - 'andstring', - 'responsibilityterms.$responsibility', 'reporter', 'assignee_or_qa', 'cc', -- cgit v1.2.3-24-g4f1b