From 89185e6c2b0f62c8cbb5ea77ff46f8b8f4c3db17 Mon Sep 17 00:00:00 2001 From: "ghendricks%novell.com" Date: Wed, 6 Dec 2006 22:29:50 +0000 Subject: [PATCH] Added a top bugs report to plans --- .../en/default/testopia/plan/choose.html.tmpl | 3 ++ .../en/default/testopia/plan/show.html.tmpl | 1 + .../testopia/reports/bug-count.html.tmpl | 40 +++++++++++++++++++ webtools/testopia/tr_plan_reports.cgi | 36 +++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 webtools/testopia/template/en/default/testopia/reports/bug-count.html.tmpl diff --git a/webtools/testopia/template/en/default/testopia/plan/choose.html.tmpl b/webtools/testopia/template/en/default/testopia/plan/choose.html.tmpl index 31f7fba3930..33f56097d47 100644 --- a/webtools/testopia/template/en/default/testopia/plan/choose.html.tmpl +++ b/webtools/testopia/template/en/default/testopia/plan/choose.html.tmpl @@ -34,6 +34,9 @@ [% IF form_action == 'tr_new_run.cgi' %] [% END %] + [% IF type %] + + [% END %]

diff --git a/webtools/testopia/template/en/default/testopia/plan/show.html.tmpl b/webtools/testopia/template/en/default/testopia/plan/show.html.tmpl index 55799fc1ceb..f9d96b62a24 100644 --- a/webtools/testopia/template/en/default/testopia/plan/show.html.tmpl +++ b/webtools/testopia/template/en/default/testopia/plan/show.html.tmpl @@ -257,6 +257,7 @@ Build Coverage
General Reports
[% IF plan.bugs %] +Top Bugs
Bugs Found in this Plan
[% END %] [%##### Edit Plan #####%] diff --git a/webtools/testopia/template/en/default/testopia/reports/bug-count.html.tmpl b/webtools/testopia/template/en/default/testopia/reports/bug-count.html.tmpl new file mode 100644 index 00000000000..50622519059 --- /dev/null +++ b/webtools/testopia/template/en/default/testopia/reports/bug-count.html.tmpl @@ -0,0 +1,40 @@ +[%# 1.0@bugzilla.org %] +[%# The contents of this file are subject to the Mozilla Public + # License Version 1.1 (the "License"); you may not use this file + # except in compliance with the License. You may obtain a copy of + # the License at http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS + # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + # implied. See the License for the specific language governing + # rights and limitations under the License. + # + # The Original Code is the Bugzilla Testopia System. + # + # The Initial Developer of the Original Code is Greg Hendricks. + # Portions created by Greg Hendricks are Copyright (C) 2001 + # Novell. All Rights Reserved. + # + # Contributor(s): Greg Hendricks + #%] + +[%# INTERFACE: + # ... + #%] + +[% PROCESS global/header.html.tmpl %] + + + + + + +[% FOREACH row = bug_table %] + + + + +[% END %] +
Test CasesBug
[% row.casecount FILTER html %][% row.bug_id FILTER bug_link(row.bug_id) %]
+ +[% PROCESS global/footer.html.tmpl %] \ No newline at end of file diff --git a/webtools/testopia/tr_plan_reports.cgi b/webtools/testopia/tr_plan_reports.cgi index 9d65e0cc17b..61f04ce857c 100755 --- a/webtools/testopia/tr_plan_reports.cgi +++ b/webtools/testopia/tr_plan_reports.cgi @@ -29,6 +29,8 @@ use Bugzilla::Util; use Bugzilla::Testopia::Util; use Bugzilla::Testopia::Report; +require "globals.pl"; + use vars qw($template $vars); my $template = Bugzilla->template; my $cgi = Bugzilla->cgi; @@ -42,6 +44,8 @@ if ($type eq 'build_coverage'){ unless ($plan_id){ $vars->{'form_action'} = 'tr_plan_reports.cgi'; + $vars->{'type'} = 'build_coverage'; + print $cgi->header; $template->process("testopia/plan/choose.html.tmpl", $vars) || ThrowTemplateError($template->error()); exit; @@ -51,6 +55,7 @@ if ($type eq 'build_coverage'){ my $action = $cgi->param('action') || ''; my $plan = Bugzilla::Testopia::TestPlan->new($plan_id); + ThrowUserError("testopia-permission-denied", {'object' => 'plan'}) unless $plan->canview; my $report = {}; my %buildseen; foreach my $case (@{$plan->test_cases}){ @@ -86,6 +91,37 @@ if ($type eq 'build_coverage'){ || ThrowTemplateError($template->error()); } +elsif ($type eq 'bugcounts'){ + my $plan_id = trim(Bugzilla->cgi->param('plan_id') || ''); + + unless ($plan_id){ + $vars->{'form_action'} = 'tr_plan_reports.cgi'; + $vars->{'type'} = 'bugcounts'; + print $cgi->header; + $template->process("testopia/plan/choose.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + exit; + } + validate_test_id($plan_id, 'plan'); + my $plan = Bugzilla::Testopia::TestPlan->new($plan_id); + ThrowUserError("testopia-permission-denied", {'object' => 'plan'}) unless $plan->canview; + + my $dbh = Bugzilla->dbh; + my $ref = $dbh->selectall_arrayref( + "SELECT COUNT(bug_id) AS casecount, bug_id FROM test_case_bugs + INNER JOIN test_cases ON test_cases.case_id = test_case_bugs.case_id + INNER JOIN test_case_plans ON test_case_plans.case_id = test_cases.case_id + INNER JOIN test_plans ON test_case_plans.plan_id = test_plans.plan_id + WHERE test_plans.plan_id = ? + GROUP BY test_cases.case_id", {'Slice'=>{}}, $plan->id); + + $vars->{'bug_table'} = $ref; + $vars->{'plan'} = $plan; + + print $cgi->header; + $template->process("testopia/reports/bug-count.html.tmpl", $vars) + || ThrowTemplateError($template->error()); +} else{ $cgi->param('current_tab', 'plan'); $cgi->param('viewall', 1);