Bug 69481 - Debug reports

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1066 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2010-11-15 17:06:04 +00:00
parent f43b836b5b
commit ed2236cd44
6 changed files with 35 additions and 45 deletions

View File

@ -38,7 +38,7 @@ my $buffer = $cgi->query_string();
# Go straight back to query.cgi if we are adding a boolean chart. # Go straight back to query.cgi if we are adding a boolean chart.
if (grep(/^cmd-/, $cgi->param())) { if (grep(/^cmd-/, $cgi->param())) {
my $params = $cgi->canonicalise_query("format", "ctype"); my $params = $cgi->canonicalise_query("format", "ctype");
my $location = "query.cgi?format=" . $cgi->param('query_format') . my $location = "query.cgi?format=" . $cgi->param('query_format') .
($params ? "&$params" : ""); ($params ? "&$params" : "");
print $cgi->redirect($location); print $cgi->redirect($location);
@ -118,7 +118,7 @@ if (defined($height)) {
$height <= 2000 || ThrowUserError("chart_too_large"); $height <= 2000 || ThrowUserError("chart_too_large");
} }
# These shenanigans are necessary to make sure that both vertical and # These shenanigans are necessary to make sure that both vertical and
# horizontal 1D tables convert to the correct dimension when you ask to # horizontal 1D tables convert to the correct dimension when you ask to
# display them as some sort of chart. # display them as some sort of chart.
if (defined $cgi->param('format') && $cgi->param('format') eq "table") { if (defined $cgi->param('format') && $cgi->param('format') eq "table") {
@ -174,7 +174,7 @@ $::SIG{PIPE} = 'DEFAULT';
my $results = $dbh->selectall_arrayref($query, {Slice=>{}}); my $results = $dbh->selectall_arrayref($query, {Slice=>{}});
# We have a hash of hashes for the data itself, and a hash to hold the # We have a hash of hashes for the data itself, and a hash to hold the
# row/col/table names. # row/col/table names.
my %data; my %data;
my %names; my %names;
@ -217,7 +217,7 @@ foreach my $tbl (@tbl_names) {
if ($tbl ne "-total-") { if ($tbl ne "-total-") {
# This is a bit sneaky. We spend every loop except the last # This is a bit sneaky. We spend every loop except the last
# building up the -total- data, and then last time round, # building up the -total- data, and then last time round,
# we process it as another tbl, and push() the total values # we process it as another tbl, and push() the total values
# into the image_data array. # into the image_data array.
$data{"-total-"}{$col}{$row} += $data{$tbl}{$col}{$row}; $data{"-total-"}{$col}{$row} += $data{$tbl}{$col}{$row};
} }
@ -225,7 +225,7 @@ foreach my $tbl (@tbl_names) {
push(@tbl_data, \@col_data); push(@tbl_data, \@col_data);
} }
unshift(@image_data, \@tbl_data); unshift(@image_data, \@tbl_data);
} }
@ -269,13 +269,13 @@ if ($action eq "wrap") {
$vars->{'format'} = $formatparam; $vars->{'format'} = $formatparam;
$formatparam = ''; $formatparam = '';
# We need to keep track of the defined restrictions on each of the # We need to keep track of the defined restrictions on each of the
# axes, because buglistbase, below, throws them away. Without this, we # axes, because buglistbase, below, throws them away. Without this, we
# get buglistlinks wrong if there is a restriction on an axis field. # get buglistlinks wrong if there is a restriction on an axis field.
$vars->{'col_vals'} = join("&", $buffer =~ /[&?]($field->{y}=[^&]+)/g); $vars->{'col_vals'} = join("&", $buffer =~ /[&?]($field->{y}=[^&]+)/g);
$vars->{'row_vals'} = join("&", $buffer =~ /[&?]($field->{x}=[^&]+)/g); $vars->{'row_vals'} = join("&", $buffer =~ /[&?]($field->{x}=[^&]+)/g);
$vars->{'tbl_vals'} = join("&", $buffer =~ /[&?]($field->{z}=[^&]+)/g); $vars->{'tbl_vals'} = join("&", $buffer =~ /[&?]($field->{z}=[^&]+)/g);
# We need a number of different variants of the base URL for different # We need a number of different variants of the base URL for different
# URLs in the HTML. # URLs in the HTML.
$vars->{buglistbase} = $cgi->canonicalise_query( $vars->{buglistbase} = $cgi->canonicalise_query(
@ -335,40 +335,30 @@ $template->process("$format->{'template'}", $vars)
exit; exit;
sub get_names
sub get_names { {
my ($names, $isnumeric, $field) = @_; my ($names, $isnumeric, $field) = @_;
# These are all the fields we want to preserve the order of in reports. # These are all the fields we want to preserve the order of in reports.
my %fields; my $f = Bugzilla->get_field($field);
my @select_fields = Bugzilla->get_fields({ is_select => 1 }); if ($f && $f->is_select)
foreach my $field (@select_fields) { {
my @names = map($_->name, @{$field->legal_values}); my $values = [ map { $_->name } @{ $f->legal_values } ];
unshift @names, ' ' if $field->name eq 'resolution'; unshift @$values, ' ' if $field eq 'resolution';
$fields{$field->name} = \@names; my %dup;
} @$values = grep { exists($names->{$_}) && !($dup{$_}++) } @$values;
my $field_list = $fields{$field}; return $values;
my @sorted; }
elsif ($isnumeric)
if ($field_list) { {
my @unsorted = keys %{$names}; # It's not a field we are preserving the order of, so sort it
# Extract the used fields from the field_list, in the order they
# appear in the field_list. This lets us keep e.g. severities in
# the normal order.
#
# This is O(n^2) but it shouldn't matter for short lists.
@sorted = map {lsearch(\@unsorted, $_) == -1 ? () : $_} @{$field_list};
}
elsif ($isnumeric) {
# It's not a field we are preserving the order of, so sort it
# numerically... # numerically...
sub numerically { $a <=> $b } sub numerically { $a <=> $b }
@sorted = sort numerically keys(%{$names}); return [ sort numerically keys %$names ];
} else { }
# ...or alphabetically, as appropriate. else
@sorted = sort(keys(%{$names})); {
# ...or alphabetically, as appropriate.
return [ sort keys %$names ];
} }
return \@sorted;
} }

View File

@ -72,7 +72,7 @@ qfVisibility = [% json(Bugzilla.full_json_query_visibility) %];
<input name="content" size="40" id="content" <input name="content" size="40" id="content"
value="[% default.content.0 FILTER html %]"> value="[% default.content.0 FILTER html %]">
<script type="text/javascript"> <!-- <script type="text/javascript"> <!--
document.forms['queryform'].content.focus(); document.forms[queryform].content.focus();
// --> // -->
</script> </script>
</td> </td>

View File

@ -33,7 +33,7 @@ var queryform = "reportform"
title = "Generate Graphical Report" title = "Generate Graphical Report"
onload = "chartTypeChanged()" onload = "chartTypeChanged()"
javascript = js_data javascript = js_data
javascript_urls = [ "js/productform.js" ] javascript_urls = [ "js/productform.js" "js/util.js" ]
doc_section = "reporting.html#reports" doc_section = "reporting.html#reports"
%] %]

View File

@ -32,7 +32,7 @@ var queryform = "reportform"
[% PROCESS global/header.html.tmpl [% PROCESS global/header.html.tmpl
title = "Generate Tabular Report" title = "Generate Tabular Report"
javascript = js_data javascript = js_data
javascript_urls = [ "js/productform.js" ] javascript_urls = [ "js/productform.js" "js/util.js" ]
doc_section = "reporting.html#reports" doc_section = "reporting.html#reports"
%] %]

View File

@ -100,7 +100,7 @@ for "crash secure SSL flash".
<input name="content" size="40" id="content" <input name="content" size="40" id="content"
value="[% default.content.0 FILTER html %]"> value="[% default.content.0 FILTER html %]">
<script type="text/javascript"> <!-- <script type="text/javascript"> <!--
document.forms['queryform'].content.focus(); document.forms['queryform'].content.focus();
// --> // -->
</script> </script>
</td> </td>
@ -108,7 +108,7 @@ for "crash secure SSL flash".
<tr> <tr>
<td></td> <td></td>
<td> <td>
[% IF Param('specific_search_allow_empty_words') %] [% IF Param('specific_search_allow_empty_words') %]
<input type="submit" id="search" value="Search"> <input type="submit" id="search" value="Search">
[% ELSE %] [% ELSE %]

View File

@ -14,12 +14,12 @@
# University Foundation. Portions created by the Initial Developer are # University Foundation. Portions created by the Initial Developer are
# Copyright (C) 2008 the Initial Developer. All Rights Reserved. # Copyright (C) 2008 the Initial Developer. All Rights Reserved.
# #
# Contributor(s): # Contributor(s):
# Max Kanat-Alexander <mkanat@bugzilla.org> # Max Kanat-Alexander <mkanat@bugzilla.org>
#%] #%]
[% PROCESS "global/field-descs.none.tmpl" %] [% PROCESS "global/field-descs.none.tmpl" %]
<select name="[% name FILTER html %]"> <select name="[% name FILTER html %]">
[% FOREACH type = types %] [% FOREACH type = types %]
<option value="[% type FILTER html %]" <option value="[% type FILTER html %]"