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

@ -335,40 +335,30 @@ $template->process("$format->{'template'}", $vars)
exit;
sub get_names {
sub get_names
{
my ($names, $isnumeric, $field) = @_;
# These are all the fields we want to preserve the order of in reports.
my %fields;
my @select_fields = Bugzilla->get_fields({ is_select => 1 });
foreach my $field (@select_fields) {
my @names = map($_->name, @{$field->legal_values});
unshift @names, ' ' if $field->name eq 'resolution';
$fields{$field->name} = \@names;
my $f = Bugzilla->get_field($field);
if ($f && $f->is_select)
{
my $values = [ map { $_->name } @{ $f->legal_values } ];
unshift @$values, ' ' if $field eq 'resolution';
my %dup;
@$values = grep { exists($names->{$_}) && !($dup{$_}++) } @$values;
return $values;
}
my $field_list = $fields{$field};
my @sorted;
if ($field_list) {
my @unsorted = keys %{$names};
# 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) {
elsif ($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 [ sort numerically keys %$names ];
}
else
{
# ...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"
value="[% default.content.0 FILTER html %]">
<script type="text/javascript"> <!--
document.forms['queryform'].content.focus();
document.forms[queryform].content.focus();
// -->
</script>
</td>

View File

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

View File

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