]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 340439: Include classifications in config.cgi
authorFrank Becker <Frank@Frank-Becker.de>
Thu, 12 Apr 2012 22:55:00 +0000 (00:55 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Thu, 12 Apr 2012 22:55:00 +0000 (00:55 +0200)
r/a=LpSolit

config.cgi
template/en/default/config.rdf.tmpl

index 51b33ed7e456b72dab1b9ae464318377061288ba..891a2f8a36a5359f805e70eda6bbc7dd6021e232 100755 (executable)
@@ -69,6 +69,18 @@ if ($cgi->param('product')) {
 # We set the 2nd argument to 1 to also preload flag types.
 Bugzilla::Product::preload($vars->{'products'}, 1);
 
+if (Bugzilla->params->{'useclassification'}) {
+    my $class = {};
+    # Get all classifications with at least one selectable product.
+    foreach my $product (@{$vars->{'products'}}) {
+        $class->{$product->classification_id} ||= $product->classification;
+    }
+    my @classifications = sort {$a->sortkey <=> $b->sortkey
+        || lc($a->name) cmp lc($b->name)} (values %$class);
+    $vars->{'class_names'} = $class;
+    $vars->{'classifications'} = \@classifications;
+}
+
 # Allow consumers to specify whether or not they want flag data.
 if (defined $cgi->param('flags')) {
     $vars->{'show_flags'} = $cgi->param('flags');
index 4fb51d10984d844382e14be672e5e280526b407b..c6ecac7ce8e1cc5f586b2baca59a9214da53eb7a 100644 (file)
 
 [% END %]
 
+[% IF Param('useclassification') %]
+  <bz:classifications>
+    <Seq>
+      [% FOREACH classification = classifications %]
+      <li>
+        <bz:classification rdf:about="[% escaped_urlbase %]classification.cgi?name=
+          [% classification.name FILTER uri %]">
+          <bz:name>[% classification.name FILTER html %]</bz:name>
+          <bz:description>[% classification.description FILTER html %]</bz:description>
+          <bz:sortkey>[% classification.sortkey FILTER html %]</bz:sortkey>
+        </bz:classification>
+      </li>
+      [% END %]
+    </Seq>
+  </bz:classifications>
+[% END %]
+
   <bz:products>
     <Seq>
       [% FOREACH product = products %]
           <bz:product rdf:about="[% escaped_urlbase %]product.cgi?name=[% product.name FILTER uri %]">
             <bz:name>[% product.name FILTER html %]</bz:name>
             <bz:allows_unconfirmed>[% product.allows_unconfirmed FILTER html %]</bz:allows_unconfirmed>
-
+            [% IF Param('useclassification') %]
+              <bz:classification>[% class_names.${product.classification_id}.name FILTER html %]</bz:classification>
+            [% END %]
             <bz:components>
               <Seq>
                 [% FOREACH component = product.components %]