зеркало из https://github.com/mozilla/gecko-dev.git
Emulating Bugzilla's reporting for test cases, plans and runs.
This commit is contained in:
Родитель
f47f8c1e15
Коммит
775488c755
|
@ -0,0 +1,351 @@
|
|||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# 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) 2006
|
||||
# Greg Hendricks. All Rights Reserved.
|
||||
#
|
||||
# Large portions lifted from bugzilla's report.cgi written by
|
||||
# Gervase Markham <gerv@gerv.net>
|
||||
#
|
||||
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Bugzilla::Testopia::Report - Generates report data.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Reports
|
||||
|
||||
=over
|
||||
|
||||
=back
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
|
||||
=cut
|
||||
|
||||
package Bugzilla::Testopia::Report;
|
||||
|
||||
use strict;
|
||||
|
||||
use Bugzilla;
|
||||
use Bugzilla::Util;
|
||||
use Bugzilla::Error;
|
||||
use Bugzilla::Testopia::Util;
|
||||
use Bugzilla::Testopia::Search;
|
||||
|
||||
|
||||
###############################
|
||||
#### Initialization ####
|
||||
###############################
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=head2 new
|
||||
|
||||
Instantiates a new report object
|
||||
|
||||
=cut
|
||||
|
||||
sub new {
|
||||
my $invocant = shift;
|
||||
my $class = ref($invocant) || $invocant;
|
||||
|
||||
my $self = {};
|
||||
bless($self, $class);
|
||||
|
||||
$self->init(@_);
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
=head2 init
|
||||
|
||||
Private constructor for this class
|
||||
|
||||
=cut
|
||||
|
||||
sub init {
|
||||
my $self = shift;
|
||||
my ($type, $url, $cgi) = @_;
|
||||
$self->{'type'} = $type || ThrowCodeError('bad_arg',
|
||||
{argument => 'type',
|
||||
function => 'Testopia::Table::_init'});
|
||||
$self->{'url_loc'} = $url;
|
||||
$self->{'cgi'} = $cgi;
|
||||
my $debug = $cgi->param('debug') if $cgi;
|
||||
|
||||
my $col_field = $cgi->param('x_axis_field') || '';
|
||||
my $row_field = $cgi->param('y_axis_field') || '';
|
||||
my $tbl_field = $cgi->param('z_axis_field') || '';
|
||||
|
||||
if (!($col_field || $row_field || $tbl_field)) {
|
||||
ThrowUserError("no_axes_defined");
|
||||
}
|
||||
|
||||
my $width = $cgi->param('width');
|
||||
my $height = $cgi->param('height');
|
||||
|
||||
if (defined($width)) {
|
||||
(detaint_natural($width) && $width > 0)
|
||||
|| ThrowCodeError("invalid_dimensions");
|
||||
$width <= 2000 || ThrowUserError("chart_too_large");
|
||||
}
|
||||
|
||||
if (defined($height)) {
|
||||
(detaint_natural($height) && $height > 0)
|
||||
|| ThrowCodeError("invalid_dimensions");
|
||||
$height <= 2000 || ThrowUserError("chart_too_large");
|
||||
}
|
||||
|
||||
# These shenanigans are necessary to make sure that both vertical and
|
||||
# horizontal 1D tables convert to the correct dimension when you ask to
|
||||
# display them as some sort of chart.
|
||||
if (defined $cgi->param('format') && $cgi->param('format') eq "table") {
|
||||
if ($col_field && !$row_field) {
|
||||
# 1D *tables* should be displayed vertically (with a row_field only)
|
||||
$row_field = $col_field;
|
||||
$col_field = '';
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($row_field && !$col_field) {
|
||||
# 1D *charts* should be displayed horizontally (with an col_field only)
|
||||
$col_field = $row_field;
|
||||
$row_field = '';
|
||||
}
|
||||
}
|
||||
|
||||
my %columns;
|
||||
if ($type eq 'case'){
|
||||
$columns{'case_status'} = "map_case_status.name";
|
||||
$columns{'priority'} = "map_priority.value";
|
||||
$columns{'product'} = "map_case_product.name";
|
||||
$columns{'component'} = "map_case_components.name";
|
||||
$columns{'category'} = "map_categories.name";
|
||||
$columns{'isautomated'} = "test_cases.isautomated";
|
||||
$columns{'tags'} = "map_case_tags.name";
|
||||
$columns{'requirement'} = "test_cases.requirement";
|
||||
$columns{'author'} = "map_case_author.login_name";
|
||||
$columns{'default_tester'} = "map_default_tester.login_name";
|
||||
}
|
||||
elsif ($type eq 'run'){
|
||||
$columns{'run_status'} = "test_runs.close_date";
|
||||
$columns{'product'} = "map_run_product.name";
|
||||
$columns{'build'} = "map_run_build.name";
|
||||
$columns{'milestone'} = "map_run_milestone.value";
|
||||
$columns{'environment'} = "map_run_environment.name";
|
||||
$columns{'tags'} = "map_run_tags.name";
|
||||
$columns{'manager'} = "map_run_manager.login_name";
|
||||
$columns{'default_product_version'} = "test_runs.product_version";
|
||||
}
|
||||
elsif ($type eq 'plan'){
|
||||
$columns{'plan_type'} = "map_plan_type.name";
|
||||
$columns{'product'} = "map_plan_product.name";
|
||||
$columns{'archived'} = "test_plans.isactive";
|
||||
$columns{'tags'} = "map_plan_tags.name";
|
||||
$columns{'author'} = "map_plan_author.login_name";
|
||||
$columns{'default_product_version'} = "test_plans.default_product_version";
|
||||
}
|
||||
# One which means "nothing". Any number would do, really. It just gets SELECTed
|
||||
# so that we always select 3 items in the query.
|
||||
$columns{''} = "42217354";
|
||||
|
||||
# Validate the values in the axis fields or throw an error.
|
||||
!$row_field
|
||||
|| ($columns{$row_field} && trick_taint($row_field))
|
||||
|| ThrowCodeError("report_axis_invalid", {fld => "x", val => $row_field});
|
||||
!$col_field
|
||||
|| ($columns{$col_field} && trick_taint($col_field))
|
||||
|| ThrowCodeError("report_axis_invalid", {fld => "y", val => $col_field});
|
||||
!$tbl_field
|
||||
|| ($columns{$tbl_field} && trick_taint($tbl_field))
|
||||
|| ThrowCodeError("report_axis_invalid", {fld => "z", val => $tbl_field});
|
||||
|
||||
my @axis_fields = ($row_field, $col_field, $tbl_field);
|
||||
my @selectnames = map($columns{$_}, @axis_fields);
|
||||
$self->{'axis_fields'} = \@axis_fields;
|
||||
$self->{'selectnames'} = \@selectnames;
|
||||
$cgi->param('viewall', 1);
|
||||
|
||||
my $dbh = Bugzilla->switch_to_shadow_db;
|
||||
my $search = Bugzilla::Testopia::Search->new($cgi, \@selectnames);
|
||||
my $results = $dbh->selectall_arrayref($search->query);
|
||||
Bugzilla->switch_to_main_db;
|
||||
|
||||
# We have a hash of hashes for the data itself, and a hash to hold the
|
||||
# row/col/table names.
|
||||
my %data;
|
||||
my %names;
|
||||
|
||||
# Read the bug data and count the bugs for each possible value of row, column
|
||||
# and table.
|
||||
#
|
||||
# We detect a numerical field, and sort appropriately, if all the values are
|
||||
# numeric.
|
||||
my $col_isnumeric = 1;
|
||||
my $row_isnumeric = 1;
|
||||
my $tbl_isnumeric = 1;
|
||||
|
||||
foreach my $result (@$results) {
|
||||
my ($row, $col, $tbl) = @$result;
|
||||
|
||||
# handle empty dimension member names
|
||||
$row = ' ' if ($row eq '');
|
||||
$col = ' ' if ($col eq '');
|
||||
$tbl = ' ' if ($tbl eq '');
|
||||
|
||||
$row = "" if ($row eq $columns{''});
|
||||
$col = "" if ($col eq $columns{''});
|
||||
$tbl = "" if ($tbl eq $columns{''});
|
||||
|
||||
# account for the fact that names may start with '_' or '.'. Change this
|
||||
# so the template doesn't hide hash elements with those keys
|
||||
$row =~ s/^([._])/ $1/;
|
||||
$col =~ s/^([._])/ $1/;
|
||||
$tbl =~ s/^([._])/ $1/;
|
||||
|
||||
$data{$tbl}{$col}{$row}++;
|
||||
$names{"col"}{$col}++;
|
||||
$names{"row"}{$row}++;
|
||||
$names{"tbl"}{$tbl}++;
|
||||
|
||||
$col_isnumeric &&= ($col =~ /^-?\d+(\.\d+)?$/o);
|
||||
$row_isnumeric &&= ($row =~ /^-?\d+(\.\d+)?$/o);
|
||||
$tbl_isnumeric &&= ($tbl =~ /^-?\d+(\.\d+)?$/o);
|
||||
}
|
||||
|
||||
my @col_names = @{get_names($names{"col"}, $col_isnumeric, $col_field)};
|
||||
my @row_names = @{get_names($names{"row"}, $row_isnumeric, $row_field)};
|
||||
my @tbl_names = @{get_names($names{"tbl"}, $tbl_isnumeric, $tbl_field)};
|
||||
|
||||
# The GD::Graph package requires a particular format of data, so once we've
|
||||
# gathered everything into the hashes and made sure we know the size of the
|
||||
# data, we reformat it into an array of arrays of arrays of data.
|
||||
push(@tbl_names, "-total-") if (scalar(@tbl_names) > 1);
|
||||
|
||||
my @image_data;
|
||||
foreach my $tbl (@tbl_names) {
|
||||
my @tbl_data;
|
||||
push(@tbl_data, \@col_names);
|
||||
foreach my $row (@row_names) {
|
||||
my @col_data;
|
||||
foreach my $col (@col_names) {
|
||||
$data{$tbl}{$col}{$row} = $data{$tbl}{$col}{$row} || 0;
|
||||
push(@col_data, $data{$tbl}{$col}{$row});
|
||||
if ($tbl ne "-total-") {
|
||||
# This is a bit sneaky. We spend every loop except the last
|
||||
# building up the -total- data, and then last time round,
|
||||
# we process it as another tbl, and push() the total values
|
||||
# into the image_data array.
|
||||
$data{"-total-"}{$col}{$row} += $data{$tbl}{$col}{$row};
|
||||
}
|
||||
}
|
||||
|
||||
push(@tbl_data, \@col_data);
|
||||
}
|
||||
|
||||
unshift(@image_data, \@tbl_data);
|
||||
}
|
||||
$self->{'col_field'} = $col_field;
|
||||
$self->{'row_field'} = $row_field;
|
||||
$self->{'tbl_field'} = $tbl_field;
|
||||
|
||||
my @time = localtime(time());
|
||||
my $date = sprintf "%04d-%02d-%02d", 1900+$time[5],$time[4]+1,$time[3];
|
||||
$self->{'date'} = $date;
|
||||
$self->{'format'} = $cgi->param('format');
|
||||
|
||||
$self->{'col_names'} = \@col_names;
|
||||
$self->{'row_names'} = \@row_names;
|
||||
$self->{'tbl_names'} = \@tbl_names;
|
||||
|
||||
# Below a certain width, we don't see any bars, so there needs to be a minimum.
|
||||
if ($width && $cgi->param('format') eq "bar") {
|
||||
my $min_width = (scalar(@col_names) || 1) * 20;
|
||||
|
||||
if (!$cgi->param('cumulate')) {
|
||||
$min_width *= (scalar(@row_names) || 1);
|
||||
}
|
||||
|
||||
$self->{'min_width'} = $min_width;
|
||||
}
|
||||
|
||||
$self->{'width'} = $width if $width;
|
||||
$self->{'height'} = $height if $height;
|
||||
|
||||
$self->{'query'} = $search->query;
|
||||
$self->{'debug'} = $cgi->param('debug');
|
||||
|
||||
$self->{'data'} = \%data;
|
||||
$self->{'image_data'} = \@image_data;
|
||||
$self->{'report_loc'} = "tr_" . $type . "_reports.cgi";
|
||||
if ($cgi->param('debug')) {
|
||||
print $cgi->header;
|
||||
require Data::Dumper;
|
||||
print "<pre>data hash:\n";
|
||||
print Data::Dumper::Dumper(%data) . "\n\n";
|
||||
print "data array:\n";
|
||||
print Data::Dumper::Dumper(@image_data) . "\n\n</pre>";
|
||||
}
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub get_names {
|
||||
my ($names, $isnumeric, $field) = @_;
|
||||
|
||||
my @sorted;
|
||||
|
||||
if ($isnumeric) {
|
||||
# It's not a field we are preserving the order of, so sort it
|
||||
# numerically...
|
||||
sub numerically { $a <=> $b }
|
||||
@sorted = sort numerically keys(%{$names});
|
||||
} else {
|
||||
# ...or alphabetically, as appropriate.
|
||||
@sorted = sort(keys(%{$names}));
|
||||
}
|
||||
|
||||
return \@sorted;
|
||||
}
|
||||
sub listbase{
|
||||
my $self = shift;
|
||||
my $cgi = $self->{'cgi'};
|
||||
$self->{'listbase'} = $cgi->canonicalise_query(
|
||||
"x_axis_field", "y_axis_field", "z_axis_field",
|
||||
"ctype", "format", "query_format", "report_action", @{$self->{'axis_fields'}});
|
||||
return $self->{'listbase'};
|
||||
}
|
||||
|
||||
sub imagebase {
|
||||
my $self = shift;
|
||||
my $cgi = $self->{'cgi'};
|
||||
$self->{'imagebase'} = $cgi->canonicalise_query(
|
||||
$self->{'tbl_field'}, "report_action", "ctype", "format", "width", "height");
|
||||
return $self->{'imagebase'};
|
||||
}
|
||||
|
||||
sub switchbase {
|
||||
my $self = shift;
|
||||
my $cgi = $self->{'cgi'};
|
||||
$self->{'switchbase'} = $cgi->canonicalise_query(
|
||||
"query_format", "report_action", "ctype", "format", "width", "height");
|
||||
return $self->{'switchbase'};
|
||||
}
|
||||
|
||||
1;
|
|
@ -75,15 +75,16 @@ sub new {
|
|||
sub init {
|
||||
my $self = shift;
|
||||
my $cgi = shift;
|
||||
my $fields = shift;
|
||||
my $user = $self->{'user'} || Bugzilla->user;
|
||||
$self->{'cgi'} = $cgi;
|
||||
$self->{'fields'} = $fields if $fields;
|
||||
my $debug = $cgi->param('debug') || 0;
|
||||
my $dbh = Bugzilla->dbh;
|
||||
|
||||
if ($debug){
|
||||
print $cgi->header if $debug;
|
||||
if ($debug && !$cgi->{'final_separator'}){
|
||||
use Data::Dumper;
|
||||
print Dumper($cgi);
|
||||
print "<br><br>";
|
||||
}
|
||||
my $page = $cgi->param('page') || 0;
|
||||
detaint_natural($page) if $page;
|
||||
|
@ -137,7 +138,103 @@ sub init {
|
|||
my $obj = trim($cgi->param('current_tab')) || ThrowUserError('testopia-missing-parameter', {'param' => 'current_tab'});
|
||||
ThrowUserError('unknown-tab') if $obj !~ '^(case|plan|run|case_run|environment)$';
|
||||
trick_taint($obj);
|
||||
|
||||
# If what we intend to do is generate a report, we need some tables
|
||||
# to map names to ids
|
||||
if ($fields){
|
||||
## Cases ##
|
||||
if (grep(/map_categories/, @$fields)) {
|
||||
push @supptables, "INNER JOIN test_case_categories AS map_categories " .
|
||||
"ON test_cases.category_id = map_categories.category_id";
|
||||
}
|
||||
if (grep(/map_priority/, @$fields)) {
|
||||
push @supptables, "INNER JOIN priority AS map_priority " .
|
||||
"ON test_cases.priority_id = map_priority.id";
|
||||
}
|
||||
if (grep(/map_case_status/, @$fields)) {
|
||||
push @supptables, "INNER JOIN test_case_status AS map_case_status " .
|
||||
"ON test_cases.case_status_id = map_case_status.case_status_id";
|
||||
}
|
||||
if (grep(/map_case_components/, @$fields)) {
|
||||
push @supptables, "INNER JOIN test_case_components AS tccomps " .
|
||||
"ON test_cases.case_id = tccomps.case_id";
|
||||
push @supptables, "INNER JOIN components AS map_case_components " .
|
||||
"ON tccomps.component_id = map_case_components.id";
|
||||
}
|
||||
if (grep(/map_case_product/, @$fields)) {
|
||||
push(@supptables, "INNER JOIN test_case_plans AS map_case_plans " .
|
||||
"ON test_cases.case_id = map_case_plans.case_id");
|
||||
push(@supptables, "INNER JOIN test_plans AS map_product_plans " .
|
||||
"ON map_case_plans.plan_id = map_product_plans.plan_id");
|
||||
push(@supptables, "INNER JOIN products AS map_case_product " .
|
||||
"ON map_product_plans.product_id = map_case_product.id");
|
||||
}
|
||||
if (grep(/map_case_tags/, @$fields)) {
|
||||
push @supptables, "INNER JOIN test_case_tags AS tctags " .
|
||||
"ON test_cases.case_id = tctags.case_id";
|
||||
push @supptables, "INNER JOIN test_tags AS map_case_tags " .
|
||||
"ON tctags.tag_id = map_case_tags.tag_id";
|
||||
}
|
||||
if (grep(/map_case_author/, @$fields)) {
|
||||
push @supptables, "INNER JOIN profiles AS map_case_author " .
|
||||
"ON test_cases.author_id = profiles.userid";
|
||||
}
|
||||
if (grep(/map_default_tester/, @$fields)) {
|
||||
push @supptables, "INNER JOIN profiles AS map_default_tester " .
|
||||
"ON test_cases.default_tester_id = map_default_tester.userid";
|
||||
}
|
||||
## Runs ##
|
||||
|
||||
if (grep(/map_run_product/, @$fields)) {
|
||||
push @supptables, "INNER JOIN test_plans " .
|
||||
"ON test_runs.plan_id = test_plans.plan_id";
|
||||
push @supptables, "INNER JOIN products AS map_run_product " .
|
||||
"ON test_plans.product_id = map_run_product.id";
|
||||
}
|
||||
if (grep(/map_run_build/, @$fields)) {
|
||||
push @supptables, "INNER JOIN test_builds AS map_run_build " .
|
||||
"ON test_runs.build_id = map_run_build.build_id";
|
||||
}
|
||||
if (grep(/map_run_milestone/, @$fields)) {
|
||||
push @supptables, "INNER JOIN test_builds AS map_run_milestone " .
|
||||
"ON test_runs.build_id = map_run_build.build_id";
|
||||
}
|
||||
if (grep(/map_run_environment/, @$fields)) {
|
||||
push @supptables, "INNER JOIN test_environments AS map_run_environment " .
|
||||
"ON test_runs.environment_id = map_run_environment.environment_id";
|
||||
}
|
||||
if (grep(/map_run_tags/, @$fields)) {
|
||||
push @supptables, "INNER JOIN test_run_tags " .
|
||||
"ON test_runs.run_id = test_run_tags.run_id";
|
||||
push @supptables, "INNER JOIN test_tags AS map_run_tags " .
|
||||
"ON test_run_tags.tag_id = map_run_tags.tag_id";
|
||||
}
|
||||
if (grep(/map_run_manager/, @$fields)) {
|
||||
push @supptables, "INNER JOIN profiles AS map_run_manager " .
|
||||
"ON test_runs.manager_id = map_run_manager.userid";
|
||||
}
|
||||
|
||||
## Plans ##
|
||||
if (grep(/map_plan_type/, @$fields)) {
|
||||
push @supptables, "INNER JOIN test_plan_types AS map_plan_type " .
|
||||
"ON test_plans.type_id = map_plan_type.type_id";
|
||||
}
|
||||
if (grep(/map_plan_product/, @$fields)) {
|
||||
push @supptables, "INNER JOIN products AS map_plan_product " .
|
||||
"ON test_plans.product_id = map_plan_product.id";
|
||||
}
|
||||
if (grep(/map_plan_tags/, @$fields)) {
|
||||
push @supptables, "INNER JOIN test_plan_tags " .
|
||||
"ON test_plans.plan_id = test_plan_tags.plan_id";
|
||||
push @supptables, "INNER JOIN test_tags AS map_plan_tags " .
|
||||
"ON test_plan_tags.tag_id = map_plan_tags.tag_id";
|
||||
}
|
||||
if (grep(/map_plan_author/, @$fields)) {
|
||||
push @supptables, "INNER JOIN profiles AS map_plan_author " .
|
||||
"ON test_plans.author_id = map_plan_author.userid";
|
||||
}
|
||||
}
|
||||
|
||||
# Set up tables for field sort order
|
||||
my $order = $cgi->param('order') || '';
|
||||
if ($order eq 'author') {
|
||||
|
@ -262,19 +359,43 @@ sub init {
|
|||
"ON test_plans.plan_id = plan_texts.plan_id");
|
||||
$f = "plan_texts.plan_text";
|
||||
},
|
||||
"^prod_name," => sub {
|
||||
push(@supptables,
|
||||
"INNER JOIN products ".
|
||||
"ON test_". $obj ."s.product_id = products.id");
|
||||
$f = 'products.name';
|
||||
},
|
||||
"^case_status," => sub {
|
||||
push(@supptables,
|
||||
"INNER JOIN test_case_status AS case_status " .
|
||||
"ON test_cases.case_status_id = case_status.case_status_id");
|
||||
$f = 'case_status.name';
|
||||
},
|
||||
"^priority," => sub {
|
||||
push(@supptables,
|
||||
"INNER JOIN priority ".
|
||||
"ON test_". $obj ."s.priority_id = priority.id");
|
||||
$f = 'priority.value';
|
||||
},
|
||||
"^environment," => sub {
|
||||
if ($obj eq 'case_run'){
|
||||
$f = "environment_id";
|
||||
}
|
||||
else{
|
||||
push(@supptables,
|
||||
"LEFT JOIN test_environments AS env " .
|
||||
"ON test_runs.environment_id = env.environment_id");
|
||||
$f = "env.xml";
|
||||
}
|
||||
push(@supptables,
|
||||
"INNER JOIN test_environments ".
|
||||
"ON test_". $obj ."s.environment_id = test_environments.environment_id");
|
||||
$f = 'test_environments.name';
|
||||
},
|
||||
"^plan_type," => sub {
|
||||
push(@supptables,
|
||||
"INNER JOIN test_plan_types ".
|
||||
"ON test_plans.type_id = test_plan_types.type_id");
|
||||
$f = 'test_plan_types.name';
|
||||
},
|
||||
"^case_run_status," => sub {
|
||||
push(@supptables,
|
||||
"INNER JOIN test_case_run_status AS tcrs ".
|
||||
"ON test_case_runs.case_run_status_id = tcrs.case_run_status_id");
|
||||
$f = 'tcrs.name';
|
||||
},
|
||||
"^env_products," => sub {
|
||||
print STDERR "THIS IS HERE";
|
||||
push(@supptables,
|
||||
"INNER JOIN products as env_products
|
||||
ON test_environments.product_id = env_products.id");
|
||||
|
@ -448,7 +569,13 @@ sub init {
|
|||
push(@supptables,
|
||||
"INNER JOIN products " .
|
||||
"ON test_plans.product_id = products.id");
|
||||
$f = "test_plans.product_id";
|
||||
if ($cgi->param('product_id')){
|
||||
$f = "test_plans.product_id";
|
||||
}
|
||||
else {
|
||||
$f = "products.name";
|
||||
}
|
||||
|
||||
},
|
||||
"^run_prod," => sub {
|
||||
push(@supptables,
|
||||
|
@ -457,7 +584,12 @@ sub init {
|
|||
push(@supptables,
|
||||
"INNER JOIN products " .
|
||||
"ON test_plans.product_id = products.id");
|
||||
$f = "test_plans.product_id";
|
||||
if ($cgi->param('product_id')){
|
||||
$f = "test_plans.product_id";
|
||||
}
|
||||
else {
|
||||
$f = "products.name";
|
||||
}
|
||||
},
|
||||
"^(author|manager|default_tester)," => sub {
|
||||
push(@supptables,
|
||||
|
@ -633,19 +765,25 @@ sub init {
|
|||
}
|
||||
push(@specialchart, ["bug", $type, join(',', $cgi->param('bug_id'))]);
|
||||
}
|
||||
if ($cgi->param("product_id")){
|
||||
if ($cgi->param("product_id") || $cgi->param("product")){
|
||||
my $attribute = $cgi->param("product_id") ? "product_id" : "product";
|
||||
my $type = "anyexact";
|
||||
if ($cgi->param('prodidtype') && $cgi->param('prodidtype') eq 'exclude') {
|
||||
$type = "nowords";
|
||||
}
|
||||
if ($obj eq 'run'){
|
||||
push(@specialchart, ["run_prod", $type, join(',', $cgi->param('product_id'))]);
|
||||
push(@specialchart, ["run_prod", $type, join(',', $cgi->param($attribute))]);
|
||||
}
|
||||
elsif ($obj eq 'case'){
|
||||
push(@specialchart, ["case_prod", $type, join(',', $cgi->param('product_id'))]);
|
||||
push(@specialchart, ["case_prod", $type, join(',', $cgi->param($attribute))]);
|
||||
}
|
||||
else{
|
||||
push(@specialchart, ["product_id", $type, join(',', $cgi->param('product_id'))]);
|
||||
if ($cgi->param("product")){
|
||||
push(@specialchart, ["prod_name", $type, join(',', $cgi->param($attribute))]);
|
||||
}
|
||||
else{
|
||||
push(@specialchart, ["product_id", $type, join(',', $cgi->param($attribute))]);
|
||||
}
|
||||
}
|
||||
}
|
||||
# Check the Multi select fields and add them to the chart
|
||||
|
@ -653,7 +791,9 @@ sub init {
|
|||
"component", "isautomated", "case_run_status_id",
|
||||
"default_product_version", "type_id",
|
||||
"build", "environment_id", "milestone", "env_products",
|
||||
"env_categories", "env_elements", "env_properties", "env_expressions");
|
||||
"env_categories", "env_elements", "env_properties",
|
||||
"env_expressions", "case_status", "priority", "environment",
|
||||
"plan_type", "case_run_status");
|
||||
|
||||
foreach my $field ($cgi->param()) {
|
||||
if (lsearch(\@legal_fields, $field) != -1) {
|
||||
|
@ -890,7 +1030,11 @@ sub init {
|
|||
push(@supptables, $specialorderjoin{$splitfield[0]});
|
||||
}
|
||||
}
|
||||
|
||||
if ($debug){
|
||||
print "<pre>";
|
||||
print join("\n", @supptables);
|
||||
print "</pre>";
|
||||
}
|
||||
my %suppseen = ("test_". $obj ."s" => 1);
|
||||
my $suppstring = "test_". $obj ."s";
|
||||
my @supplist = (" ");
|
||||
|
@ -919,9 +1063,14 @@ sub init {
|
|||
# Make sure we create a legal SQL query.
|
||||
@andlist = ("1 = 1") if !@andlist;
|
||||
|
||||
my $query = "SELECT test_". $obj ."s.". $obj. "_id" .
|
||||
" FROM $suppstring";
|
||||
|
||||
my $query;
|
||||
if ($self->{'fields'}){
|
||||
$query = "SELECT ". join(",", @{$self->{'fields'}});
|
||||
}
|
||||
else {
|
||||
$query = "SELECT test_". $obj ."s.". $obj. "_id";
|
||||
}
|
||||
$query .= " FROM $suppstring";
|
||||
$query .= " WHERE " . join(' AND ', (@wherepart, @andlist));
|
||||
|
||||
|
||||
|
@ -950,7 +1099,6 @@ sub init {
|
|||
}
|
||||
if ($debug) {
|
||||
print "<p><code>" . value_quote($query) . "</code></p>\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$self->{'sql'} = $query;
|
||||
|
|
|
@ -121,6 +121,27 @@ $self->{'display_columns'} = \@columns;
|
|||
return $self->{'display_columns'};
|
||||
}
|
||||
|
||||
sub report_columns {
|
||||
my $self = shift;
|
||||
my %columns;
|
||||
# Changes here need to match Report.pm
|
||||
$columns{'Status'} = "case_status";
|
||||
$columns{'Priority'} = "priority";
|
||||
$columns{'Product'} = "product_id";
|
||||
$columns{'Component'} = "component";
|
||||
$columns{'Category'} = "category";
|
||||
$columns{'Automated'} = "isautomated";
|
||||
$columns{'Tags'} = "tags";
|
||||
$columns{'Requirement'} = "requirement";
|
||||
$columns{'Author'} = "author";
|
||||
$columns{'Default tester'} = "default_tester";
|
||||
$columns{'<none>'} = '';
|
||||
my @result;
|
||||
push @result, {'name' => $_, 'id' => $columns{$_}} foreach (keys %columns);
|
||||
return \@result;
|
||||
|
||||
}
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=cut
|
||||
|
|
|
@ -87,6 +87,22 @@ use constant DB_COLUMNS => qw(
|
|||
|
||||
our $columns = join(", ", DB_COLUMNS);
|
||||
|
||||
sub report_columns {
|
||||
my $self = shift;
|
||||
my %columns;
|
||||
# Changes here need to match Report.pm
|
||||
$columns{'Type'} = "plan_type";
|
||||
$columns{'Version'} = "default_product_version";
|
||||
$columns{'Product'} = "product";
|
||||
$columns{'Archived'} = "archived";
|
||||
$columns{'Tags'} = "tags";
|
||||
$columns{'Author'} = "author";
|
||||
$columns{'<none>'} = '';
|
||||
my @result;
|
||||
push @result, {'name' => $_, 'id' => $columns{$_}} foreach (keys %columns);
|
||||
return \@result;
|
||||
|
||||
}
|
||||
|
||||
###############################
|
||||
#### Methods ####
|
||||
|
|
|
@ -88,6 +88,24 @@ use constant DB_COLUMNS => qw(
|
|||
|
||||
our $columns = join(", ", DB_COLUMNS);
|
||||
|
||||
sub report_columns {
|
||||
my $self = shift;
|
||||
my %columns;
|
||||
# Changes here need to match Report.pm
|
||||
$columns{'Status'} = "run_status";
|
||||
$columns{'Version'} = "default_product_version";
|
||||
$columns{'Product'} = "product";
|
||||
$columns{'Build'} = "build";
|
||||
$columns{'Milestone'} = "milestone";
|
||||
$columns{'Environment'} = "environment";
|
||||
$columns{'Tags'} = "tags";
|
||||
$columns{'Manager'} = "manager";
|
||||
$columns{'<none>'} = '';
|
||||
my @result;
|
||||
push @result, {'name' => $_, 'id' => $columns{$_}} foreach (keys %columns);
|
||||
return \@result;
|
||||
|
||||
}
|
||||
|
||||
###############################
|
||||
#### Methods ####
|
||||
|
|
|
@ -1,5 +1,23 @@
|
|||
[%# 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
|
||||
# Greg Hendricks. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
|
||||
#%]
|
||||
|
||||
[% IF plan_id %]
|
||||
[% plan_id = plan_id %]
|
||||
[% ELSIF plan %]
|
||||
|
@ -17,6 +35,7 @@
|
|||
</div>
|
||||
<div class="links">
|
||||
<a href="tr_query.cgi">Search</a> |
|
||||
<a href="tr_query.cgi?report=1">Reports</a> |
|
||||
<a href="tr_new_plan.cgi">New Plan</a> |
|
||||
<a href="tr_new_case.cgi?plan_id=[% plan_id FILTER none %]">New Case</a> |
|
||||
<a href="tr_new_run.cgi?plan_id=[% plan_id FILTER none %]&case_status_id=2">New Run</a> |
|
||||
|
|
|
@ -231,6 +231,7 @@
|
|||
<br><br>
|
||||
<h3>Reports</h3>
|
||||
<img src="tr_case_reports.cgi?case_id=[% case.id FILTER none %]&type=status-breakdown">
|
||||
<a href="tr_query.cgi?current_tab=case&report=1">General Reports</a>
|
||||
[%##### Attachments #####%]
|
||||
<br><br>
|
||||
<h3>Attachments</h3>
|
||||
|
|
|
@ -254,7 +254,8 @@
|
|||
[%### Reports ###%]
|
||||
<br><br>
|
||||
<h3>Reports</h3>
|
||||
<a href="tr_plan_reports.cgi?plan_id=[% plan.id FILTER none %]">Build Coverage</a>
|
||||
<a href="tr_plan_reports.cgi?plan_id=[% plan.id FILTER none %]&type=build_coverage">Build Coverage</a>
|
||||
<a href="tr_query.cgi?current_tab=plan&report=1">General Reports</a>
|
||||
[%##### Edit Plan #####%]
|
||||
<br><br>
|
||||
[% IF plan.canedit %]
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
[%# 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 Bug Tracking System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Gervase Markham <gerv@gerv.net>
|
||||
#%]
|
||||
|
||||
[% PROCESS global/variables.none.tmpl %]
|
||||
|
||||
[% y_label = report.type %]
|
||||
|
||||
[% PROCESS "global/field-descs.none.tmpl" %]
|
||||
|
||||
[% col_field_disp = field_descs.$col_field || col_field %]
|
||||
|
||||
|
||||
[% FILTER null;
|
||||
USE graph = GD.Graph.bars(report.width, report.height);
|
||||
|
||||
graph.set(x_label => col_field_disp,
|
||||
y_label => y_label,
|
||||
y_tick_number => 8,
|
||||
y_number_format => "%d",
|
||||
x_label_position => 0.5,
|
||||
x_labels_vertical => x_labels_vertical,
|
||||
bar_spacing => 8,
|
||||
shadow_depth => 4,
|
||||
shadowclr => 'dred',
|
||||
show_values => 1,
|
||||
legend_placement => "RT");
|
||||
|
||||
graph.set(cumulate => "true",
|
||||
show_values => 0) IF cumulate;
|
||||
|
||||
# Workaround for the fact that set_legend won't take report.row_names directly,
|
||||
# because report.row_names is an array reference rather than an array.
|
||||
graph.set_legend(report.row_names.0, report.row_names.1, report.row_names.2, report.row_names.3,
|
||||
report.row_names.4, report.row_names.5, report.row_names.6, report.row_names.7,
|
||||
report.row_names.8, report.row_names.9, report.row_names.10, report.row_names.11,
|
||||
report.row_names.12, report.row_names.13, report.row_names.14, report.row_names.15);
|
||||
|
||||
graph.plot(data.0).png | stdout(1);
|
||||
END;
|
||||
-%]
|
|
@ -0,0 +1,52 @@
|
|||
[%# 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 Bug Tracking System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Gervase Markham <gerv@gerv.net>
|
||||
#%]
|
||||
|
||||
[% IF cumulate %]
|
||||
[% USE graph = GD.Graph.area(report.width, report.height) %]
|
||||
[% graph.set(cumulate => "true") %]
|
||||
[% ELSE %]
|
||||
[% USE graph = GD.Graph.lines(report.width, report.height) %]
|
||||
[% END %]
|
||||
|
||||
[% FILTER null;
|
||||
graph.set(x_label => report.col_field,
|
||||
y_label => report.type,
|
||||
y_tick_number => 8,
|
||||
x_label_position => 0.5,
|
||||
x_labels_vertical => x_labels_vertical,
|
||||
legend_placement => "RT",
|
||||
line_width => 2,
|
||||
dclrs => ["lred", "lgreen", "lblue", "lyellow",
|
||||
"lpurple", "lorange", "black", "green",
|
||||
"blue", "dpink", "lbrown", "gray",
|
||||
"red", "dpurple", "gold", "marine"]);
|
||||
|
||||
# Workaround for the fact that set_legend won't take report.row_names directly,
|
||||
# because report.row_names is an array reference rather than an array.
|
||||
graph.set_legend(report.row_names.0, report.row_names.1, report.row_names.2, report.row_names.3,
|
||||
report.row_names.4, report.row_names.5, report.row_names.6, report.row_names.7,
|
||||
report.row_names.8, report.row_names.9, report.row_names.10, report.row_names.11,
|
||||
report.row_names.12, report.row_names.13, report.row_names.14, report.row_names.15);
|
||||
|
||||
graph.plot(data.0).png | stdout(1);
|
||||
END;
|
||||
-%]
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
[%# 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 Bug Tracking System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Gervase Markham <gerv@gerv.net>
|
||||
# <rdean@cambianetworks.com>
|
||||
#%]
|
||||
|
||||
[%# INTERFACE:
|
||||
# report.listbase: The base query for this table, in URL form
|
||||
# report.col_field: string. Name of the field being plotted as columns.
|
||||
# report.row_field: string. Name of the field being plotted as rows.
|
||||
# report.tbl_field: string. Name of the field being plotted as tables.
|
||||
# report.col_names: array. List of values for the field being plotted as columns.
|
||||
# report.row_names: array. List of values for the field being plotted as rows.
|
||||
# report.data: <depends on format>. Data to plot. Only data.$tbl is accessed.
|
||||
# tbl: Name of a hash in data which is the table to be plotted.
|
||||
#%]
|
||||
|
||||
[% PROCESS "global/field-descs.none.tmpl" %]
|
||||
|
||||
[% col_field_disp = field_descs.$col_field || report.col_field %]
|
||||
[% row_field_disp = field_descs.$row_field || report.row_field %]
|
||||
|
||||
[% IF tbl == "-total-" %]
|
||||
[% urlbase = BLOCK %]buglist.cgi?[% report.listbase %]
|
||||
[% "&$tbl_vals" IF tbl_vals %][% END %]
|
||||
[% ELSE %]
|
||||
[% urlbase = BLOCK %][% report.url_loc FILTER url_quote %]?[% report.listbase %]&
|
||||
[% report.tbl_field FILTER url_quote %]=[% tbl FILTER url_quote %][% END %]
|
||||
[% END %]
|
||||
|
||||
<table>
|
||||
[% IF report.tbl_field %]
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td align="center">
|
||||
<h3>[% tbl_disp FILTER html %]</h3>
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td align="center">
|
||||
<strong>[% col_field_disp FILTER html %]</strong>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<strong>[% row_field_disp FILTER html %]</strong>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
|
||||
[% classes = [ [ "t1", "t2" ] , [ "t3", "t4" ] ] %]
|
||||
[% col_idx = 0 %]
|
||||
[% row_idx = 0 %]
|
||||
[% grand_total = 0 %]
|
||||
|
||||
<table border="1">
|
||||
[% IF report.col_field %]
|
||||
<tr>
|
||||
<td class="[% classes.$row_idx.$col_idx %]">
|
||||
</td>
|
||||
[% FOREACH col = report.col_names %]
|
||||
[% col_totals.$col = 0 %]
|
||||
[% NEXT IF col == "" %]
|
||||
|
||||
[% col_idx = 1 - col_idx %]
|
||||
<td class="[% classes.$row_idx.$col_idx %]">
|
||||
[% col FILTER html FILTER replace('^ $',' ') %]
|
||||
</td>
|
||||
[% END %]
|
||||
<td class="ttotal">
|
||||
Total
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
|
||||
[% FOREACH row = report.row_names %]
|
||||
[% row_total = 0 %]
|
||||
|
||||
[% row_idx = 1 - row_idx %]
|
||||
<tr>
|
||||
<td class="[% classes.$row_idx.$col_idx %]" align="right">
|
||||
[% row FILTER html FILTER replace('^ $',' ') %]
|
||||
</td>
|
||||
[% FOREACH col = report.col_names %]
|
||||
[% row_total = row_total + report.data.$tbl.$col.$row %]
|
||||
[% NEXT IF col == "" %]
|
||||
[% col_totals.$col = col_totals.$col + report.data.$tbl.$col.$row %]
|
||||
|
||||
[% col_idx = 1 - col_idx %]
|
||||
<td class="[% classes.$row_idx.$col_idx %]" align="center">
|
||||
[% IF report.data.$tbl.$col.$row AND report.data.$tbl.$col.$row > 0 %]
|
||||
<a href="[% urlbase %]&
|
||||
[% report.row_field FILTER url_quote %]=[% row FILTER url_quote %]&
|
||||
[% report.col_field FILTER url_quote %]=[% col FILTER url_quote %]">
|
||||
[% report.data.$tbl.$col.$row %]</a>
|
||||
[% ELSE %]
|
||||
.
|
||||
[% END %]
|
||||
</td>
|
||||
[% END %]
|
||||
<td class="ttotal" align="right">
|
||||
<a href="[% urlbase %]&
|
||||
[% report.row_field FILTER url_quote %]=[% row FILTER url_quote %]
|
||||
[% "&$col_vals" IF col_vals %]">
|
||||
[% row_total %]</a>
|
||||
[% grand_total = grand_total + row_total %]
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
|
||||
<tr>
|
||||
[% row_idx = 1 - row_idx %]
|
||||
<td class="ttotal">
|
||||
Total
|
||||
</td>
|
||||
[% FOREACH col = report.col_names %]
|
||||
[% NEXT IF col == "" %]
|
||||
|
||||
<td class="ttotal" align="center">
|
||||
<a href="[% urlbase %]&
|
||||
[% report.col_field FILTER url_quote %]=[% col FILTER url_quote %]
|
||||
[% "&$row_vals" IF row_vals %]">
|
||||
[% col_totals.$col %]</a>
|
||||
<strong>
|
||||
</td>
|
||||
[% END %]
|
||||
<td class="ttotal" align="right">
|
||||
<strong>
|
||||
<a href="[% urlbase %]
|
||||
[% "&$row_vals" IF row_vals %]
|
||||
[% "&$col_vals" IF col_vals %]">[% grand_total %]</a>
|
||||
</strong>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
|
@ -0,0 +1,90 @@
|
|||
[%# 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 Bug Tracking System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Gervase Markham <gerv@gerv.net>
|
||||
#%]
|
||||
[%# INTERFACE:
|
||||
# See report-table.html.tmpl.
|
||||
#%]
|
||||
[% PROCESS global/variables.none.tmpl %]
|
||||
|
||||
[% colsepchar = user.settings.csv_colsepchar.value %]
|
||||
[% num_bugs = BLOCK %]Number of [% terms.bugs %][% END %]
|
||||
[% tbl_field_disp = field_descs.$tbl_field || report.tbl_field %]
|
||||
[% col_field_disp = field_descs.$col_field || report.col_field %]
|
||||
[% row_field_disp = field_descs.$row_field || report.row_field %]
|
||||
[% grand_total = 0 %]
|
||||
|
||||
[% IF report.tbl_field %]
|
||||
[% tbl_field_disp FILTER csv %]: [% tbl FILTER csv %]
|
||||
[% END %]
|
||||
[% IF report.row_field %]
|
||||
[% row_field_disp FILTER csv %]
|
||||
[% END %]
|
||||
[% " / " IF report.col_field AND report.row_field %]
|
||||
[% col_field_disp FILTER csv %]
|
||||
[% IF report.col_field -%]
|
||||
[% FOREACH col = report.col_names -%]
|
||||
[% col_totals.$col = 0 %]
|
||||
[% colsepchar %]
|
||||
[% IF report.col_field == 'bug_status' %]
|
||||
[% status_descs.$col FILTER csv -%]
|
||||
[% ELSIF col_field == 'resolution' %]
|
||||
[% resolution_descs.$col FILTER csv -%]
|
||||
[% ELSE %]
|
||||
[% col FILTER csv -%]
|
||||
[% END %]
|
||||
[% END -%]
|
||||
[% colsepchar %]
|
||||
[% 'Total' FILTER csv%]
|
||||
[% ELSE -%]
|
||||
[% colsepchar %][% num_bugs FILTER csv %]
|
||||
[% END %]
|
||||
|
||||
[% FOREACH row = report.row_names %]
|
||||
[% row_total = 0 %]
|
||||
[% IF report.row_field == 'bug_status' %]
|
||||
[% status_descs.$row FILTER csv -%]
|
||||
[% ELSIF report.row_field == 'resolution' %]
|
||||
[% resolution_descs.$row FILTER csv -%]
|
||||
[% ELSE %]
|
||||
[% row FILTER csv -%]
|
||||
[% END %]
|
||||
[% FOREACH col = report.col_names %]
|
||||
[% row_total = row_total + data.$tbl.$col.$row %]
|
||||
[% colsepchar %]
|
||||
[% IF report.data.$tbl AND report.data.$tbl.$col AND report.data.$tbl.$col.$row %]
|
||||
[% col_totals.$col = col_totals.$col + report.data.$tbl.$col.$row %]
|
||||
[% report.data.$tbl.$col.$row %]
|
||||
[% ELSE %]
|
||||
[% -%]0
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% colsepchar %]
|
||||
[% row_total %]
|
||||
[% "\n" %]
|
||||
[% grand_total = grand_total + row_total %]
|
||||
[% END %]
|
||||
[% 'Total' FILTER csv %]
|
||||
[% FOREACH col = col_names %]
|
||||
[% NEXT IF col == "" %]
|
||||
[% colsepchar %]
|
||||
[% col_totals.$col %]
|
||||
[% END %]
|
||||
[% colsepchar %]
|
||||
[% grand_total %]
|
|
@ -0,0 +1,177 @@
|
|||
[%# 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 Bug Tracking System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Gervase Markham <gerv@gerv.net>
|
||||
#%]
|
||||
|
||||
[%# INTERFACE:
|
||||
# report.col_field: string. Name of the field being plotted as columns.
|
||||
# report.row_field: string. Name of the field being plotted as rows.
|
||||
# report.tbl_field: string. Name of the field being plotted as tables.
|
||||
# report.tbl_names: array. List of values for the field being plotted as tables.
|
||||
# time: integer. Seconds since the epoch.
|
||||
# report.data: <depends on format>. Data to plot.
|
||||
# report.format: string. Format of the individual reports.
|
||||
# report.width: integer. For image charts, height of the image.
|
||||
# report.height: integer. For image charts, width of the image.
|
||||
# switchbase: string. Base URL for format switching.
|
||||
# cumulate: boolean. For bar/line charts, whether to cumulate data sets.
|
||||
#%]
|
||||
|
||||
[% DEFAULT width = 600
|
||||
height = 350
|
||||
%]
|
||||
|
||||
[% IF report.min_width AND report.width < report.min_width %]
|
||||
[% width = report.min_width %]
|
||||
[% END %]
|
||||
|
||||
[%# We ignore report.row_field for pie charts %]
|
||||
[% IF report.format == "pie" %]
|
||||
[% report.row_field = "" %]
|
||||
[% END %]
|
||||
|
||||
[% PROCESS "global/field-descs.none.tmpl" %]
|
||||
|
||||
[% tbl_field_disp = field_descs.$report.tbl_field || report.tbl_field %]
|
||||
[% col_field_disp = field_descs.$report.col_field || report.col_field %]
|
||||
[% row_field_disp = field_descs.$report.row_field || report.row_field %]
|
||||
|
||||
[% title = BLOCK %]
|
||||
Report:
|
||||
[% IF report.tbl_field %]
|
||||
[% tbl_field_disp FILTER html %]
|
||||
[% END %]
|
||||
[% " / " IF report.tbl_field AND (report.col_field OR report.row_field) %]
|
||||
[% IF report.row_field %]
|
||||
[% row_field_disp FILTER html %]
|
||||
[% END %]
|
||||
[% " / " IF report.col_field AND report.row_field %]
|
||||
[% col_field_disp FILTER html %]
|
||||
[% END %]
|
||||
|
||||
[% PROCESS global/header.html.tmpl
|
||||
style = "
|
||||
.t1 { background-color: #ffffff } /* white */
|
||||
.t2 { background-color: #dfefff } /* light blue */
|
||||
.t3 { background-color: #dddddd } /* grey */
|
||||
.t4 { background-color: #c3d3ed } /* darker blue */
|
||||
.ttotal { background-color: #cfffdf } /* light green */
|
||||
"
|
||||
h3 = time2str("%Y-%m-%d %H:%M:%S", time)
|
||||
%]
|
||||
|
||||
[% IF debug %]
|
||||
<p>[% query FILTER html %]</p>
|
||||
[% END %]
|
||||
|
||||
<div align="center">
|
||||
|
||||
[% FOREACH tbl = report.tbl_names %]
|
||||
[% IF tbl == "-total-" %]
|
||||
[% tbl_disp = "Total" %]
|
||||
[% ELSE %]
|
||||
[% tbl_disp = tbl %]
|
||||
[% END %]
|
||||
|
||||
[% IF report.format == "table" %]
|
||||
[% PROCESS "testopia/reports/report-table.html.tmpl" %]
|
||||
[% ELSE %]
|
||||
[% IF tbl %]
|
||||
<h2>[% tbl_disp FILTER html %]</h2>
|
||||
[% END %]
|
||||
|
||||
[% imageurl = BLOCK %][% report.report_loc %]?[% report.imagebase %]&format=
|
||||
[% report.format FILTER url_quote %]&ctype=png&report_action=plot&
|
||||
[% IF report.tbl_field %]
|
||||
[% IF tbl != "-total-" %]
|
||||
[% report.tbl_field FILTER url_quote %]=[% tbl FILTER url_quote %]&
|
||||
[% ELSE %]
|
||||
[% FOREACH tblname = report.tbl_names %]
|
||||
[% IF tblname != "-total-" %]
|
||||
[% report.tbl_field FILTER url_quote %]=[% tblname FILTER url_quote %]&
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% END %]width=[% width %]&height=[% height %]
|
||||
[% END %]
|
||||
|
||||
<img alt="Graphical report results" src="[% imageurl %]"
|
||||
width="[% width %]" height="[% height %]">
|
||||
[% END %]
|
||||
<br>
|
||||
[% END %]
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
[% formats = [ { name => "pie", description => "Pie" },
|
||||
{ name => "bar", description => "Bar" },
|
||||
{ name => "line", description => "Line" },
|
||||
{ name => "table", description => "Table" } ] %]
|
||||
|
||||
[% formaturl = "$report.report_loc?$report.switchbase&width=$width&height=$height" _
|
||||
"&report_action=data" %]
|
||||
[% FOREACH other_format = formats %]
|
||||
[% NEXT IF other_format.name == "pie" AND report.row_field AND report.col_field %]
|
||||
[% UNLESS other_format.name == format %]
|
||||
<a href="[% formaturl %]&format=[% other_format.name %]">
|
||||
[% END %]
|
||||
[% other_format.description FILTER html %]
|
||||
[% "</a>" UNLESS other_format.name == format %] |
|
||||
[% END %]
|
||||
<a href="[% formaturl %]&ctype=csv&format=table">CSV</a>
|
||||
</td>
|
||||
|
||||
[% IF format != "table" %]
|
||||
<td>
|
||||
|
||||
</td>
|
||||
|
||||
[% sizeurl = BLOCK %]report.cgi?
|
||||
[% report.switchbase %]&report_action=data&format=
|
||||
[% format FILTER html %][% END %]
|
||||
<td align="center">
|
||||
<a href="[% sizeurl %]&width=[% width %]&height=
|
||||
[% height + 100 %]">Taller</a><br>
|
||||
<a href="[% sizeurl %]&width=[% width - 100 %]&height=
|
||||
[% height %]">Thinner</a> *
|
||||
<a href="[% sizeurl %]&width=[% width + 100 %]&height=
|
||||
[% height %]">Fatter</a> <br>
|
||||
<a href="[% sizeurl %]&width=[% width %]&height=
|
||||
[% height - 100 %]">Shorter</a><br>
|
||||
</td>
|
||||
[% END %]
|
||||
<tr>
|
||||
</table>
|
||||
<!--
|
||||
<p>
|
||||
[% IF format == "table" %]
|
||||
<a href="query.cgi?[% report.switchbase %]&format=report-table">Edit
|
||||
this report</a>
|
||||
[% ELSE %]
|
||||
<a href="query.cgi?[% report.switchbase %]&chart_format=
|
||||
[% format %]&format=report-graph&cumulate=[% cumulate %]">
|
||||
Edit this report
|
||||
</a>
|
||||
[% END %]
|
||||
</p>
|
||||
-->
|
||||
</div>
|
||||
|
||||
[% PROCESS global/footer.html.tmpl %]
|
|
@ -185,6 +185,10 @@
|
|||
<input type="submit" name="action" value="Clone Run With These Cases" />
|
||||
<a href="tr_list_caseruns.cgi?[% table.get_query_part FILTER none %]">Update Multiple</a>
|
||||
<a href="tr_list_cases.cgi?run_id=[% run.id FILTER none %]">List Cases</a>
|
||||
[%##### Reports #####%]
|
||||
<br><br>
|
||||
<h3>Reports</h3>
|
||||
<a href="tr_query.cgi?current_tab=run&report=1">General Reports</a>
|
||||
<br><br>
|
||||
[%##### Categories and Tags #####%]
|
||||
<h3>CC, Coverage, Tags</h3>
|
||||
|
|
|
@ -134,7 +134,7 @@
|
|||
</td>
|
||||
[% ELSE %]
|
||||
<td align="center" bgcolor="#BBBBEE" class="unselected_tab">
|
||||
<a href="tr_query.cgi?current_tab=[% tab.name %]" >
|
||||
<a href="tr_query.cgi?current_tab=[% tab.name %][% '&report=1' IF report %]" >
|
||||
[% tab.description %]
|
||||
</a>
|
||||
</td>
|
||||
|
|
|
@ -17,8 +17,61 @@
|
|||
#
|
||||
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
|
||||
#%]
|
||||
|
||||
<form action="tr_list_cases.cgi" method="GET">
|
||||
|
||||
|
||||
[% IF report %]
|
||||
<form action="tr_case_reports.cgi" method="GET">
|
||||
<p>
|
||||
Choose one or more fields as your axes, and then refine your set of
|
||||
cases using the rest of the form.
|
||||
</p>
|
||||
|
||||
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td align="center">
|
||||
<b>Horizontal Axis:</b>
|
||||
[% PROCESS select sel = { name => 'x_axis_field',
|
||||
list => case.report_columns } %]
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="middle" align="center">
|
||||
<b>Vertical Axis:</b><br>
|
||||
[% PROCESS select sel = { name => 'y_axis_field',
|
||||
list => case.report_columns } %]
|
||||
|
||||
</td>
|
||||
<td width="150" height="150">
|
||||
<table border="1" width="100%" height="100%">
|
||||
<tr>
|
||||
<td align="center" valign="middle">
|
||||
<b>Multiple Tables:</b><br>
|
||||
[% PROCESS select sel = { name => 'z_axis_field',
|
||||
list => case.report_columns } %]
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr>
|
||||
|
||||
<br>
|
||||
<input type="submit" value="Submit">
|
||||
<input type="hidden" name="format" value="table">
|
||||
<input type="hidden" name="report_action" value="data">
|
||||
<input type="hidden" name="report" value="1" />
|
||||
<hr>
|
||||
[% ELSE %]
|
||||
<form action="tr_list_cases.cgi" method="GET">
|
||||
[% END %]
|
||||
<input type="hidden" name="current_tab" value="[% current_tab FILTER none %]" />
|
||||
<fieldset>
|
||||
<legend><strong>Product</strong></legend>
|
||||
|
|
|
@ -18,7 +18,59 @@
|
|||
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
|
||||
#%]
|
||||
|
||||
<form action="tr_list_plans.cgi" method="GET">
|
||||
[% IF report %]
|
||||
<form action="tr_plan_reports.cgi" method="GET">
|
||||
<p>
|
||||
Choose one or more fields as your axes, and then refine your set of
|
||||
plans using the rest of the form.
|
||||
</p>
|
||||
|
||||
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td align="center">
|
||||
<b>Horizontal Axis:</b>
|
||||
[% PROCESS select sel = { name => 'x_axis_field',
|
||||
list => plan.report_columns } %]
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="middle" align="center">
|
||||
<b>Vertical Axis:</b><br>
|
||||
[% PROCESS select sel = { name => 'y_axis_field',
|
||||
list => plan.report_columns } %]
|
||||
|
||||
</td>
|
||||
<td width="150" height="150">
|
||||
<table border="1" width="100%" height="100%">
|
||||
<tr>
|
||||
<td align="center" valign="middle">
|
||||
<b>Multiple Tables:</b><br>
|
||||
[% PROCESS select sel = { name => 'z_axis_field',
|
||||
list => plan.report_columns } %]
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr>
|
||||
|
||||
<br>
|
||||
<input type="submit" value="Submit">
|
||||
<input type="hidden" name="format" value="table">
|
||||
<input type="hidden" name="report_action" value="data">
|
||||
<input type="hidden" name="report" value="1" />
|
||||
<hr>
|
||||
[% ELSE %]
|
||||
<form action="tr_list_plans.cgi" method="GET">
|
||||
[% END %]
|
||||
<input type="hidden" name="current_tab" value="[% current_tab FILTER none %]" />
|
||||
<fieldset>
|
||||
<legend><strong>Product</strong></legend>
|
||||
|
|
|
@ -9,16 +9,69 @@
|
|||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is the Bugzilla Test Runner System.
|
||||
# The Original Code is the Bugzilla Testopia System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Maciej Maczynski.
|
||||
# Portions created by Maciej Maczynski are Copyright (C) 2001
|
||||
# Maciej Maczynski. All Rights Reserved.
|
||||
# The Initial Developer of the Original Code is Greg Hendricks.
|
||||
# Portions created by Greg Hendricks are Copyright (C) 2001
|
||||
# Greg Hendricks. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
|
||||
#%]
|
||||
|
||||
<form action="tr_list_runs.cgi" method="GET">
|
||||
[% IF report %]
|
||||
<form action="tr_run_reports.cgi" method="GET">
|
||||
<p>
|
||||
Choose one or more fields as your axes, and then refine your set of
|
||||
runs using the rest of the form.
|
||||
</p>
|
||||
|
||||
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td align="center">
|
||||
<b>Horizontal Axis:</b>
|
||||
[% PROCESS select sel = { name => 'x_axis_field',
|
||||
list => run.report_columns } %]
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="middle" align="center">
|
||||
<b>Vertical Axis:</b><br>
|
||||
[% PROCESS select sel = { name => 'y_axis_field',
|
||||
list => run.report_columns } %]
|
||||
|
||||
</td>
|
||||
<td width="150" height="150">
|
||||
<table border="1" width="100%" height="100%">
|
||||
<tr>
|
||||
<td align="center" valign="middle">
|
||||
<b>Multiple Tables:</b><br>
|
||||
[% PROCESS select sel = { name => 'z_axis_field',
|
||||
list => run.report_columns } %]
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr>
|
||||
|
||||
<br>
|
||||
<input type="submit" value="Submit">
|
||||
<input type="hidden" name="format" value="table">
|
||||
<input type="hidden" name="report_action" value="data">
|
||||
<input type="hidden" name="report" value="1" />
|
||||
<hr>
|
||||
[% ELSE %]
|
||||
<form action="tr_list_runs.cgi" method="GET">
|
||||
[% END %]
|
||||
|
||||
<input type="hidden" name="current_tab" value="[% current_tab FILTER none %]" />
|
||||
<fieldset>
|
||||
<legend><strong>Product</strong></legend>
|
||||
|
|
|
@ -30,30 +30,29 @@ use Bugzilla::Error;
|
|||
use Bugzilla::Util;
|
||||
use Bugzilla::Testopia::Util;
|
||||
use Bugzilla::Testopia::Constants;
|
||||
use Bugzilla::Testopia::Report;
|
||||
|
||||
use vars qw($template $vars);
|
||||
my $template = Bugzilla->template;
|
||||
my $cgi = Bugzilla->cgi;
|
||||
|
||||
Bugzilla->login();
|
||||
print $cgi->header();
|
||||
|
||||
my $case_id = trim(Bugzilla->cgi->param('case_id') || '');
|
||||
|
||||
unless ($case_id){
|
||||
$vars->{'form_action'} = 'tr_case_reports.cgi';
|
||||
$template->process("testopia/case/choose.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
}
|
||||
validate_test_id($case_id, 'case');
|
||||
push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
|
||||
|
||||
my $case = Bugzilla::Testopia::TestCase->new($case_id);
|
||||
|
||||
my $type = $cgi->param('type') || '';
|
||||
|
||||
if ($type eq 'status-breakdown'){
|
||||
my $case_id = trim(Bugzilla->cgi->param('case_id') || '');
|
||||
|
||||
unless ($case_id){
|
||||
$vars->{'form_action'} = 'tr_case_reports.cgi';
|
||||
$template->process("testopia/case/choose.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
}
|
||||
validate_test_id($case_id, 'case');
|
||||
push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
|
||||
|
||||
my $case = Bugzilla::Testopia::TestCase->new($case_id);
|
||||
|
||||
my @data;
|
||||
my $caserun = Bugzilla::Testopia::TestCaseRun->new({});
|
||||
|
@ -72,7 +71,51 @@ if ($type eq 'status-breakdown'){
|
|||
$vars->{'data'} = \@data;
|
||||
$vars->{'chart_title'} = 'Historic Status Breakdown';
|
||||
$vars->{'colors'} = (['#858aef', '#56e871', '#ed3f58', '#b8eae1', '#f1d9ab', '#e17a56']);
|
||||
|
||||
print $cgi->header;
|
||||
$template->process("testopia/reports/pie.png.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
}
|
||||
else{
|
||||
$cgi->param('current_tab', 'case');
|
||||
$cgi->param('viewall', 1);
|
||||
my $report = Bugzilla::Testopia::Report->new('case', 'tr_list_cases.cgi', $cgi);
|
||||
$vars->{'report'} = $report;
|
||||
|
||||
### From Bugzilla report.cgi by Gervase Markham
|
||||
my $formatparam = $cgi->param('format');
|
||||
my $report_action = $cgi->param('report_action');
|
||||
if ($report_action eq "data") {
|
||||
# So which template are we using? If action is "wrap", we will be using
|
||||
# no format (it gets passed through to be the format of the actual data),
|
||||
# and either report.csv.tmpl (CSV), or report.html.tmpl (everything else).
|
||||
# report.html.tmpl produces an HTML framework for either tables of HTML
|
||||
# data, or images generated by calling report.cgi again with action as
|
||||
# "plot".
|
||||
$formatparam =~ s/[^a-zA-Z\-]//g;
|
||||
trick_taint($formatparam);
|
||||
$vars->{'format'} = $formatparam;
|
||||
$formatparam = '';
|
||||
}
|
||||
elsif ($report_action eq "plot") {
|
||||
# If action is "plot", we will be using a format as normal (pie, bar etc.)
|
||||
# and a ctype as normal (currently only png.)
|
||||
$vars->{'cumulate'} = $cgi->param('cumulate') ? 1 : 0;
|
||||
$vars->{'x_labels_vertical'} = $cgi->param('x_labels_vertical') ? 1 : 0;
|
||||
$vars->{'data'} = $report->{'image_data'};
|
||||
}
|
||||
else {
|
||||
ThrowCodeError("unknown_action", {action => $cgi->param('report_action')});
|
||||
}
|
||||
|
||||
my $format = $template->get_format("testopia/reports/report", $formatparam,
|
||||
scalar($cgi->param('ctype')));
|
||||
|
||||
my $filename = "report-" . $report->{'date'} . ".$format->{extension}";
|
||||
print $cgi->header(-type => $format->{'ctype'},
|
||||
-content_disposition => "inline; filename=$filename");
|
||||
|
||||
$template->process("$format->{'template'}", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ elsif ($action eq 'do_delete'){
|
|||
$cgi->param('current_tab', 'case_run');
|
||||
my $search = Bugzilla::Testopia::Search->new($cgi);
|
||||
my $table = Bugzilla::Testopia::Table->new('case_run', 'tr_list_caseruns.cgi', $cgi, undef, $search->query);
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit}) if $table->list_count > $query_limit;
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit}) if $table->view_count > $query_limit;
|
||||
|
||||
if ($table->list_count > 0){
|
||||
my $prod_id = $table->list->[0]->run->plan->product_id;
|
||||
|
|
|
@ -157,7 +157,7 @@ if ($action eq 'Commit'){
|
|||
$case->link_plan($planid);
|
||||
}
|
||||
}
|
||||
if ($serverpush) {
|
||||
if ($serverpush && !$cgi->param('debug')) {
|
||||
print $cgi->multipart_end;
|
||||
print $cgi->multipart_start;
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ if ($action eq 'Commit'){
|
|||
$cgi->param('current_tab', 'case');
|
||||
my $search = Bugzilla::Testopia::Search->new($cgi);
|
||||
my $table = Bugzilla::Testopia::Table->new('case', 'tr_list_cases.cgi', $cgi, undef, $search->query);
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit}) if $table->list_count > $query_limit;
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit}) if $table->view_count > $query_limit;
|
||||
|
||||
# Check that all of the test cases returned only belong to one product.
|
||||
if ($table->list_count > 0){
|
||||
|
@ -253,7 +253,7 @@ $vars->{'status_list'} = $status_list;
|
|||
$vars->{'priority_list'} = $priority_list;
|
||||
$vars->{'dotweak'} = UserInGroup('edittestcases');
|
||||
$vars->{'table'} = $table;
|
||||
if ($serverpush) {
|
||||
if ($serverpush && !$cgi->param('debug')) {
|
||||
print $cgi->multipart_end;
|
||||
print $cgi->multipart_start;
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ if ($action eq 'Commit'){
|
|||
}
|
||||
}
|
||||
}
|
||||
if ($serverpush) {
|
||||
if ($serverpush && !$cgi->param('debug')) {
|
||||
print $cgi->multipart_end;
|
||||
print $cgi->multipart_start;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ else {
|
|||
$cgi->param('current_tab', 'plan');
|
||||
my $search = Bugzilla::Testopia::Search->new($cgi);
|
||||
my $table = Bugzilla::Testopia::Table->new('plan', 'tr_list_plans.cgi', $cgi, undef, $search->query);
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit}) if $table->list_count > $query_limit;
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit}) if $table->view_count > $query_limit;
|
||||
|
||||
my $p = Bugzilla::Testopia::TestPlan->new({'plan_id' => 0 });
|
||||
my $product_list = $p->get_available_products;
|
||||
|
@ -147,7 +147,7 @@ else {
|
|||
$vars->{'fullwidth'} = 1; #novellonly
|
||||
$vars->{'dotweak'} = UserInGroup('managetestplans');
|
||||
$vars->{'table'} = $table;
|
||||
if ($serverpush) {
|
||||
if ($serverpush && !$cgi->param('debug')) {
|
||||
print $cgi->multipart_end;
|
||||
print $cgi->multipart_start;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ if ($action eq 'Commit'){
|
|||
}
|
||||
}
|
||||
}
|
||||
if ($serverpush) {
|
||||
if ($serverpush && !$cgi->param('debug')) {
|
||||
print $cgi->multipart_end;
|
||||
print $cgi->multipart_start;
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ else {
|
|||
$cgi->param('current_tab', 'run');
|
||||
my $search = Bugzilla::Testopia::Search->new($cgi);
|
||||
my $table = Bugzilla::Testopia::Table->new('run', 'tr_list_runs.cgi', $cgi, undef, $search->query);
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit}) if $table->list_count > $query_limit;
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit}) if $table->view_count > $query_limit;
|
||||
|
||||
if ($table->list_count > 0){
|
||||
my $plan_id = $table->list->[0]->plan->product_id;
|
||||
|
@ -169,7 +169,7 @@ else {
|
|||
$vars->{'fullwidth'} = 1; #novellonly
|
||||
$vars->{'dotweak'} = UserInGroup('runtests');
|
||||
$vars->{'table'} = $table;
|
||||
if ($serverpush) {
|
||||
if ($serverpush && !$cgi->param('debug')) {
|
||||
print $cgi->multipart_end;
|
||||
print $cgi->multipart_start;
|
||||
}
|
||||
|
|
|
@ -11,15 +11,13 @@
|
|||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is the Bugzilla Test Runner System.
|
||||
# The Original Code is the Bugzilla Testopia System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Maciej Maczynski.
|
||||
# Portions created by Maciej Maczynski are Copyright (C) 2001
|
||||
# Maciej Maczynski. All Rights Reserved.
|
||||
# The Initial Developer of the Original Code is Greg Hendricks.
|
||||
# Portions created by Greg Hendricks are Copyright (C) 2001
|
||||
# Greg Hendricks. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Maciej Maczynski <macmac@xdsnet.pl>
|
||||
# Ed Fuentetaja <efuentetaja@acm.org>
|
||||
# Greg Hendricks <ghendricks@novell.com>
|
||||
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
|
||||
|
||||
use strict;
|
||||
use lib ".";
|
||||
|
@ -29,38 +27,88 @@ use Bugzilla::Constants;
|
|||
use Bugzilla::Error;
|
||||
use Bugzilla::Util;
|
||||
use Bugzilla::Testopia::Util;
|
||||
use Bugzilla::Testopia::Report;
|
||||
|
||||
use vars qw($template $vars);
|
||||
my $template = Bugzilla->template;
|
||||
my $cgi = Bugzilla->cgi;
|
||||
|
||||
Bugzilla->login();
|
||||
print $cgi->header();
|
||||
|
||||
my $plan_id = trim(Bugzilla->cgi->param('plan_id') || '');
|
||||
my $type = $cgi->param('type') || '';
|
||||
|
||||
unless ($plan_id){
|
||||
$vars->{'form_action'} = 'tr_plan_reports.cgi';
|
||||
$template->process("testopia/plan/choose.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
}
|
||||
validate_test_id($plan_id, 'plan');
|
||||
push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
|
||||
|
||||
my $action = $cgi->param('action') || '';
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
my $report = {};
|
||||
my %buildseen;
|
||||
foreach my $case (@{$plan->test_cases}){
|
||||
foreach my $cr (@{$case->caseruns}){
|
||||
$buildseen{$cr->build->id} = $cr->build->name;
|
||||
$report->{$case->id}->{$cr->build->id} = $cr;
|
||||
if ($type eq 'build_coverage'){
|
||||
my $plan_id = trim(Bugzilla->cgi->param('plan_id') || '');
|
||||
|
||||
unless ($plan_id){
|
||||
$vars->{'form_action'} = 'tr_plan_reports.cgi';
|
||||
$template->process("testopia/plan/choose.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
}
|
||||
validate_test_id($plan_id, 'plan');
|
||||
push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
|
||||
|
||||
my $action = $cgi->param('action') || '';
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
my $report = {};
|
||||
my %buildseen;
|
||||
foreach my $case (@{$plan->test_cases}){
|
||||
foreach my $cr (@{$case->caseruns}){
|
||||
$buildseen{$cr->build->id} = $cr->build->name;
|
||||
$report->{$case->id}->{$cr->build->id} = $cr;
|
||||
}
|
||||
}
|
||||
$report->{'builds'} = \%buildseen;
|
||||
$vars->{'report'} = $report;
|
||||
$vars->{'plan'} = $plan;
|
||||
|
||||
print $cgi->header();
|
||||
$template->process("testopia/reports/build-coverage.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|
||||
}
|
||||
$report->{'builds'} = \%buildseen;
|
||||
$vars->{'report'} = $report;
|
||||
$vars->{'plan'} = $plan;
|
||||
$template->process("testopia/reports/build-coverage.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
else{
|
||||
$cgi->param('current_tab', 'plan');
|
||||
$cgi->param('viewall', 1);
|
||||
my $report = Bugzilla::Testopia::Report->new('plan', 'tr_list_plans.cgi', $cgi);
|
||||
$vars->{'report'} = $report;
|
||||
|
||||
### From Bugzilla report.cgi by Gervase Markham
|
||||
my $formatparam = $cgi->param('format');
|
||||
my $report_action = $cgi->param('report_action');
|
||||
if ($report_action eq "data") {
|
||||
# So which template are we using? If action is "wrap", we will be using
|
||||
# no format (it gets passed through to be the format of the actual data),
|
||||
# and either report.csv.tmpl (CSV), or report.html.tmpl (everything else).
|
||||
# report.html.tmpl produces an HTML framework for either tables of HTML
|
||||
# data, or images generated by calling report.cgi again with action as
|
||||
# "plot".
|
||||
$formatparam =~ s/[^a-zA-Z\-]//g;
|
||||
trick_taint($formatparam);
|
||||
$vars->{'format'} = $formatparam;
|
||||
$formatparam = '';
|
||||
}
|
||||
elsif ($report_action eq "plot") {
|
||||
# If action is "plot", we will be using a format as normal (pie, bar etc.)
|
||||
# and a ctype as normal (currently only png.)
|
||||
$vars->{'cumulate'} = $cgi->param('cumulate') ? 1 : 0;
|
||||
$vars->{'x_labels_vertical'} = $cgi->param('x_labels_vertical') ? 1 : 0;
|
||||
$vars->{'data'} = $report->{'image_data'};
|
||||
}
|
||||
else {
|
||||
ThrowCodeError("unknown_action", {action => $cgi->param('report_action')});
|
||||
}
|
||||
|
||||
my $format = $template->get_format("testopia/reports/report", $formatparam,
|
||||
scalar($cgi->param('ctype')));
|
||||
|
||||
my $filename = "report-" . $report->{'date'} . ".$format->{extension}";
|
||||
print $cgi->header(-type => $format->{'ctype'},
|
||||
-content_disposition => "inline; filename=$filename");
|
||||
|
||||
$template->process("$format->{'template'}", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ else{
|
|||
$vars->{'case'} = $case;
|
||||
$vars->{'title'} = "Search For Test Cases";
|
||||
}
|
||||
|
||||
$vars->{'report'} = $cgi->param('report');
|
||||
$vars->{'current_tab'} = $tab;
|
||||
$template->process("testopia/search/advanced.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
#!/usr/bin/perl -wT
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# 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
|
||||
# Greg Hendricks. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
|
||||
|
||||
use strict;
|
||||
use lib ".";
|
||||
|
||||
use Bugzilla;
|
||||
use Bugzilla::Constants;
|
||||
use Bugzilla::Error;
|
||||
use Bugzilla::Util;
|
||||
use Bugzilla::Testopia::Util;
|
||||
use Bugzilla::Testopia::Constants;
|
||||
use Bugzilla::Testopia::Report;
|
||||
|
||||
use vars qw($template $vars);
|
||||
my $template = Bugzilla->template;
|
||||
my $cgi = Bugzilla->cgi;
|
||||
|
||||
Bugzilla->login();
|
||||
|
||||
my $type = $cgi->param('type') || '';
|
||||
|
||||
$cgi->param('current_tab', 'run');
|
||||
$cgi->param('viewall', 1);
|
||||
my $report = Bugzilla::Testopia::Report->new('run', 'tr_list_runs.cgi', $cgi);
|
||||
$vars->{'report'} = $report;
|
||||
|
||||
### From Bugzilla report.cgi by Gervase Markham
|
||||
my $formatparam = $cgi->param('format');
|
||||
my $report_action = $cgi->param('report_action');
|
||||
if ($report_action eq "data") {
|
||||
# So which template are we using? If action is "wrap", we will be using
|
||||
# no format (it gets passed through to be the format of the actual data),
|
||||
# and either report.csv.tmpl (CSV), or report.html.tmpl (everything else).
|
||||
# report.html.tmpl produces an HTML framework for either tables of HTML
|
||||
# data, or images generated by calling report.cgi again with action as
|
||||
# "plot".
|
||||
$formatparam =~ s/[^a-zA-Z\-]//g;
|
||||
trick_taint($formatparam);
|
||||
$vars->{'format'} = $formatparam;
|
||||
$formatparam = '';
|
||||
}
|
||||
elsif ($report_action eq "plot") {
|
||||
# If action is "plot", we will be using a format as normal (pie, bar etc.)
|
||||
# and a ctype as normal (currently only png.)
|
||||
$vars->{'cumulate'} = $cgi->param('cumulate') ? 1 : 0;
|
||||
$vars->{'x_labels_vertical'} = $cgi->param('x_labels_vertical') ? 1 : 0;
|
||||
$vars->{'data'} = $report->{'image_data'};
|
||||
}
|
||||
else {
|
||||
ThrowCodeError("unknown_action", {action => $cgi->param('report_action')});
|
||||
}
|
||||
|
||||
my $format = $template->get_format("testopia/reports/report", $formatparam,
|
||||
scalar($cgi->param('ctype')));
|
||||
|
||||
my $filename = "report-" . $report->{'date'} . ".$format->{extension}";
|
||||
print $cgi->header(-type => $format->{'ctype'},
|
||||
-content_disposition => "inline; filename=$filename");
|
||||
|
||||
$template->process("$format->{'template'}", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|
||||
exit;
|
||||
|
Загрузка…
Ссылка в новой задаче