]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 327077: Implement a way to get all the components with a given default assignee...
authorlpsolit%gmail.com <>
Sun, 13 May 2007 23:58:26 +0000 (23:58 +0000)
committerlpsolit%gmail.com <>
Sun, 13 May 2007 23:58:26 +0000 (23:58 +0000)
Bugzilla/User.pm
skins/standard/editusers.css
template/en/default/admin/users/confirm-delete.html.tmpl
template/en/default/admin/users/edit.html.tmpl
template/en/default/filterexceptions.pl

index 6d0922abf728667144ecccc955a07fca0b855aa9..a14549f8479112b3bca5509213d40adc851c6baa 100644 (file)
@@ -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'};
 }
 
index 55eb5c307f26d7f676be191046a7e9ce90036d1b..770d602c836ecb0020c38c31ad38a128f13936dd 100644 (file)
@@ -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;
index 0fd4aafa70b6699657ed9537551f3aa4e91c30d2..5b28aad75ee2327b712c6dcf01f4825ee42f099c 100644 (file)
   listselectionvalues = listselectionvalues
 %]
 
-[% responsibilityterms = {
-  'default_assignee'   => 'Default Assignee',
-  'default_qa_contact' => 'Default QA Contact'
-  }
-%]
-
 <table class="main">
   <tr>
     <th>Login name:</th>
     <tr>
       <th>Product responsibilities:</th>
       <td>
-        <ul>
-          [% 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>
+        [% PROCESS admin/users/responsibilities.html.tmpl otheruser = otheruser %]
       </td>
     </tr>
   [% END %]
index 5712b6f57f55cf80edbcac788a05e2b82563a416..ab7369a23670e9602dbe2fbb5cc36371e1ffbab5 100644 (file)
@@ -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
       </td>
     </tr>
   [% 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>
 
 <p>
index f605ca82e638b4ed0a44821c527d43227258dd09..cc2e060ee62da268ac8066c624b97fad9b34e18d 100644 (file)
 ],
 
 'admin/users/confirm-delete.html.tmpl' => [
-  'andstring',
-  'responsibilityterms.$responsibility',
   'reporter',
   'assignee_or_qa',
   'cc',