summaryrefslogtreecommitdiffstats
path: root/editproducts.cgi
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-03-17 23:47:05 +0100
committerlpsolit%gmail.com <>2005-03-17 23:47:05 +0100
commit4374ee31d841496880373f04e04c96d2f16132ab (patch)
tree3cf6b578c93b084d42e76e6e5b3a3021bdbaf71f /editproducts.cgi
parente4710b7e0d4a5613488561fcbac0eafe59de2312 (diff)
downloadbugzilla-4374ee31d841496880373f04e04c96d2f16132ab.tar.gz
bugzilla-4374ee31d841496880373f04e04c96d2f16132ab.tar.xz
Bug 282384: Templatize the 'select classification' bit of editproducts - Patch by GavinS <bugzilla@chimpychompy.org> r=LpSolit, a=justdave
Diffstat (limited to 'editproducts.cgi')
-rwxr-xr-xeditproducts.cgi44
1 files changed, 19 insertions, 25 deletions
diff --git a/editproducts.cgi b/editproducts.cgi
index 823ec92c2..0d70fc191 100755
--- a/editproducts.cgi
+++ b/editproducts.cgi
@@ -290,39 +290,33 @@ if (Param('useclassification') && (defined $classification)) {
}
#
-# product = '' -> Show nice list of products
+# product = '' -> Show nice list of classifications (if
+# classifications enabled)
#
if (Param('useclassification')) {
unless ($classification) {
- PutHeader("Select classification");
- SendSQL("SELECT classifications.name, classifications.description,
- COUNT(classification_id) AS total
+ my $dbh = Bugzilla->dbh;
+
+ my $query =
+ "SELECT classifications.name, classifications.description,
+ COUNT(classification_id) AS product_count
FROM classifications
LEFT JOIN products
- ON classifications.id = products.classification_id " .
- $dbh->sql_group_by('classifications.id',
- 'classifications.name,
- classifications.description') . "
- ORDER BY name");
- print "<TABLE BORDER=1 CELLPADDING=4 CELLSPACING=0><TR BGCOLOR=\"#6666FF\">\n";
- print " <TH ALIGN=\"left\">Edit products of ...</TH>\n";
- print " <TH ALIGN=\"left\">Description</TH>\n";
- print " <TH ALIGN=\"left\">Total</TH>\n";
- print "</TR>";
- while ( MoreSQLData() ) {
- my ($classification, $description, $count) = FetchSQLData();
- $description ||= "<FONT COLOR=\"red\">missing</FONT>";
- print "<TR>\n";
- print " <TD VALIGN=\"top\"><A HREF=\"editproducts.cgi?classification=",url_quote($classification),"\"><B>$classification</B></A></TD>\n";
- print " <TD VALIGN=\"top\">$description</TD>\n";
- $count ||= "none";
- print " <TD VALIGN=\"top\">$count</TD>\n";
- }
- print "</TR></TABLE>\n";
+ ON classifications.id = products.classification_id " .
+ $dbh->sql_group_by('classifications.id',
+ 'classifications.name,
+ classifications.description') . "
+ ORDER BY name";
+
+ $vars->{'classifications'} = $dbh->selectall_arrayref($query,
+ {'Slice' => {}});
+
+ $template->process("admin/products/list-classifications.html.tmpl",
+ $vars)
+ || ThrowTemplateError($template->error());
- PutTrailer();
exit;
}
}