Commit afa01192 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 327077: Implement a way to get all the components with a given default…

Bug 327077: Implement a way to get all the components with a given default assignee (owner) and/or default QA contact - Patch by Fré©ric Buclin <LpSolit@gmail.com> r=bkor a=LpSolit
parent 6976f410
...@@ -917,14 +917,33 @@ sub product_responsibilities { ...@@ -917,14 +917,33 @@ sub product_responsibilities {
return $self->{'product_resp'} if defined $self->{'product_resp'}; return $self->{'product_resp'} if defined $self->{'product_resp'};
return [] unless $self->id; return [] unless $self->id;
my $comp_ids = $dbh->selectcol_arrayref('SELECT id FROM components my $list = $dbh->selectall_arrayref('SELECT product_id, id
WHERE initialowner = ? FROM components
OR initialqacontact = ?', WHERE initialowner = ?
undef, ($self->id, $self->id)); 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. # We cannot |use| it, because Component.pm already |use|s User.pm.
require Bugzilla::Component; 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'}; return $self->{'product_resp'};
} }
......
...@@ -51,6 +51,20 @@ table.groups td.checkbox { ...@@ -51,6 +51,20 @@ table.groups td.checkbox {
white-space: nowrap; 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 { .missing {
color: red; color: red;
border-color: inherit; border-color: inherit;
......
...@@ -55,12 +55,6 @@ ...@@ -55,12 +55,6 @@
listselectionvalues = listselectionvalues listselectionvalues = listselectionvalues
%] %]
[% responsibilityterms = {
'default_assignee' => 'Default Assignee',
'default_qa_contact' => 'Default QA Contact'
}
%]
<table class="main"> <table class="main">
<tr> <tr>
<th>Login name:</th> <th>Login name:</th>
...@@ -88,30 +82,7 @@ ...@@ -88,30 +82,7 @@
<tr> <tr>
<th>Product responsibilities:</th> <th>Product responsibilities:</th>
<td> <td>
<ul> [% PROCESS admin/users/responsibilities.html.tmpl otheruser = otheruser %]
[% FOREACH component = otheruser.product_responsibilities %]
<li>
[% andstring = '' %]
[% FOREACH responsibility = ['default_assignee', 'default_qa_contact'] %]
[% IF component.${responsibility}.id == otheruser.id %]
[% andstring %] [% responsibilityterms.$responsibility %]
[% andstring = ' and ' %]
[% END %]
[% END %]
for
[% IF user.in_group("editcomponents", component.product_id) %]
<a href="editcomponents.cgi?action=edit&amp;product=
[% component.product.name FILTER url_quote %]&amp;component=
[% component.name FILTER url_quote %]">
[% END %]
[%+ component.product.name FILTER html %]:
[% component.name FILTER html %]
[% IF user.in_group("editcomponents", component.product_id) %]
</a>
[% END %]
</li>
[% END %]
</ul>
</td> </td>
</tr> </tr>
[% END %] [% END %]
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
[% PROCESS global/header.html.tmpl [% PROCESS global/header.html.tmpl
title = title title = title
message = message message = message
style_urls = ['skins/standard/editusers.css'] style_urls = ['skins/standard/admin.css', 'skins/standard/editusers.css']
%] %]
[% PROCESS admin/users/listselectvars.html.tmpl [% PROCESS admin/users/listselectvars.html.tmpl
...@@ -96,6 +96,17 @@ ...@@ -96,6 +96,17 @@
</td> </td>
</tr> </tr>
[% END %] [% END %]
<tr>
<th>Product responsibilities:</th>
<td>
[% IF otheruser.product_responsibilities.size %]
[% PROCESS admin/users/responsibilities.html.tmpl otheruser = otheruser %]
[% ELSE %]
<em>none</em>
[% END %]
</td>
</tr>
</table> </table>
<p> <p>
......
...@@ -518,8 +518,6 @@ ...@@ -518,8 +518,6 @@
], ],
'admin/users/confirm-delete.html.tmpl' => [ 'admin/users/confirm-delete.html.tmpl' => [
'andstring',
'responsibilityterms.$responsibility',
'reporter', 'reporter',
'assignee_or_qa', 'assignee_or_qa',
'cc', 'cc',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment