From 4374ee31d841496880373f04e04c96d2f16132ab Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 17 Mar 2005 22:47:05 +0000 Subject: Bug 282384: Templatize the 'select classification' bit of editproducts - Patch by GavinS r=LpSolit, a=justdave --- editproducts.cgi | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) (limited to 'editproducts.cgi') 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 "\n"; - print " \n"; - print " \n"; - print " \n"; - print ""; - while ( MoreSQLData() ) { - my ($classification, $description, $count) = FetchSQLData(); - $description ||= "missing"; - print "\n"; - print " \n"; - print " \n"; - $count ||= "none"; - print " \n"; - } - print "
Edit products of ...DescriptionTotal
$classification$description$count
\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; } } -- cgit v1.2.3-24-g4f1b