2001-11-19 01:23:31 +03:00
|
|
|
#!/usr/bonsaitools/bin/perl -wT
|
1998-09-16 01:49:26 +04:00
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
1998-08-26 10:14:20 +04:00
|
|
|
#
|
1999-11-02 02:33:56 +03:00
|
|
|
# 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.
|
|
|
|
#
|
1998-08-26 10:14:20 +04:00
|
|
|
# The Original Code is the Bugzilla Bug Tracking System.
|
1999-11-02 02:33:56 +03:00
|
|
|
#
|
1998-08-26 10:14:20 +04:00
|
|
|
# The Initial Developer of the Original Code is Netscape Communications
|
1999-11-02 02:33:56 +03:00
|
|
|
# Corporation. Portions created by Netscape are
|
|
|
|
# Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
# Rights Reserved.
|
|
|
|
#
|
1998-08-26 10:14:20 +04:00
|
|
|
# Contributor(s): Terry Weissman <terry@mozilla.org>
|
1999-03-20 00:40:14 +03:00
|
|
|
# David Gardiner <david.gardiner@unisa.edu.au>
|
2000-11-20 22:42:36 +03:00
|
|
|
# Matthias Radestock <matthias@sorted.org>
|
2001-11-19 01:23:31 +03:00
|
|
|
# Gervase Markham <gerv@gerv.net>
|
1998-08-26 10:14:20 +04:00
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
use diagnostics;
|
|
|
|
use strict;
|
2001-11-19 01:23:31 +03:00
|
|
|
use lib ".";
|
1998-08-26 10:14:20 +04:00
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
require "CGI.pl";
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# Prevents &make_options in CGI.pl from throwing an error if we give it
|
|
|
|
# an invalid list of selections (from a remembered query containing values
|
|
|
|
# that no longer exist). We don't want to die in the query page even if
|
|
|
|
# strict value checks are turned on.
|
|
|
|
$::CheckOptionValues = 0;
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2000-01-12 00:32:43 +03:00
|
|
|
use vars
|
2001-11-19 01:23:31 +03:00
|
|
|
@::CheckOptionValues,
|
|
|
|
@::legal_resolution,
|
|
|
|
@::legal_bug_status,
|
|
|
|
@::legal_components,
|
|
|
|
@::legal_keywords,
|
|
|
|
@::legal_opsys,
|
|
|
|
@::legal_platform,
|
|
|
|
@::legal_priority,
|
|
|
|
@::legal_product,
|
|
|
|
@::legal_severity,
|
|
|
|
@::legal_target_milestone,
|
|
|
|
@::legal_versions,
|
|
|
|
@::log_columns,
|
|
|
|
%::versions,
|
|
|
|
%::components,
|
|
|
|
%::FORM;
|
|
|
|
|
|
|
|
# Use the template toolkit (http://www.template-toolkit.org/) to generate
|
|
|
|
# the user interface (HTML pages and mail messages) using templates in the
|
|
|
|
# "template/" subdirectory.
|
|
|
|
use Template;
|
|
|
|
|
|
|
|
# Create the global template object that processes templates and specify
|
|
|
|
# configuration parameters that apply to all templates processed in this script.
|
|
|
|
my $template = Template->new(
|
|
|
|
{
|
|
|
|
# Colon-separated list of directories containing templates.
|
|
|
|
INCLUDE_PATH => "template/custom:template/default",
|
|
|
|
# Allow templates to be specified with relative paths.
|
|
|
|
RELATIVE => 1,
|
|
|
|
PRE_CHOMP => 1,
|
|
|
|
FILTERS =>
|
|
|
|
{
|
|
|
|
# Returns the text with backslashes, single/double quotes,
|
|
|
|
# and newlines/carriage returns escaped for use in JS strings.
|
|
|
|
'js' => sub
|
|
|
|
{
|
|
|
|
my ($var) = @_;
|
|
|
|
$var =~ s/([\\\'\"])/\\$1/g;
|
|
|
|
$var =~ s/\n/\\n/g;
|
|
|
|
$var =~ s/\r/\\r/g;
|
|
|
|
return $var;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
# Define the global variables and functions that will be passed to the UI
|
|
|
|
# template. Individual functions add their own values to this hash before
|
|
|
|
# sending them to the templates they process.
|
|
|
|
my $vars =
|
|
|
|
{
|
|
|
|
# Function for retrieving global parameters.
|
|
|
|
'Param' => \&Param,
|
|
|
|
|
|
|
|
# Function for processing global parameters that contain references
|
|
|
|
# to other global parameters.
|
|
|
|
'PerformSubsts' => \&PerformSubsts,
|
|
|
|
|
|
|
|
# Function to search an array for a value
|
|
|
|
'lsearch' => \&lsearch,
|
|
|
|
};
|
1998-09-16 01:49:26 +04:00
|
|
|
|
|
|
|
if (defined $::FORM{"GoAheadAndLogIn"}) {
|
1998-08-26 10:14:20 +04:00
|
|
|
# We got here from a login page, probably from relogin.cgi. We better
|
|
|
|
# make sure the password is legit.
|
1998-09-16 01:49:26 +04:00
|
|
|
confirm_login();
|
2000-01-23 23:31:50 +03:00
|
|
|
} else {
|
|
|
|
quietly_check_login();
|
|
|
|
}
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# Backwards compatibility hack -- if there are any of the old QUERY_*
|
2000-01-23 23:31:50 +03:00
|
|
|
# cookies around, and we are logged in, then move them into the database
|
2001-11-19 01:23:31 +03:00
|
|
|
# and nuke the cookie. This is required for Bugzilla 2.8 and earlier.
|
|
|
|
if ($::userid) {
|
2000-01-23 23:31:50 +03:00
|
|
|
my @oldquerycookies;
|
|
|
|
foreach my $i (keys %::COOKIE) {
|
|
|
|
if ($i =~ /^QUERY_(.*)$/) {
|
|
|
|
push(@oldquerycookies, [$1, $i, $::COOKIE{$i}]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (defined $::COOKIE{'DEFAULTQUERY'}) {
|
|
|
|
push(@oldquerycookies, [$::defaultqueryname, 'DEFAULTQUERY',
|
|
|
|
$::COOKIE{'DEFAULTQUERY'}]);
|
|
|
|
}
|
|
|
|
if (@oldquerycookies) {
|
|
|
|
foreach my $ref (@oldquerycookies) {
|
|
|
|
my ($name, $cookiename, $value) = (@$ref);
|
|
|
|
if ($value) {
|
|
|
|
my $qname = SqlQuote($name);
|
|
|
|
SendSQL("SELECT query FROM namedqueries " .
|
2001-11-19 01:23:31 +03:00
|
|
|
"WHERE userid = $::userid AND name = $qname");
|
2000-01-23 23:31:50 +03:00
|
|
|
my $query = FetchOneColumn();
|
|
|
|
if (!$query) {
|
|
|
|
SendSQL("REPLACE INTO namedqueries " .
|
|
|
|
"(userid, name, query) VALUES " .
|
2001-11-19 01:23:31 +03:00
|
|
|
"($::userid, $qname, " . SqlQuote($value) . ")");
|
2000-01-23 23:31:50 +03:00
|
|
|
}
|
|
|
|
}
|
2001-11-19 01:23:31 +03:00
|
|
|
print "Set-Cookie: $cookiename= ; path=" . Param("cookiepath") .
|
|
|
|
"; expires=Sun, 30-Jun-1980 00:00:00 GMT\n";
|
2000-01-23 23:31:50 +03:00
|
|
|
}
|
|
|
|
}
|
2000-01-23 20:14:09 +03:00
|
|
|
}
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2000-01-23 23:31:50 +03:00
|
|
|
if ($::FORM{'nukedefaultquery'}) {
|
2001-11-19 01:23:31 +03:00
|
|
|
if ($::userid) {
|
2000-01-23 23:31:50 +03:00
|
|
|
SendSQL("DELETE FROM namedqueries " .
|
2001-11-19 01:23:31 +03:00
|
|
|
"WHERE userid = $::userid AND name = '$::defaultqueryname'");
|
2000-01-23 23:31:50 +03:00
|
|
|
}
|
|
|
|
$::buffer = "";
|
1998-08-26 10:14:20 +04:00
|
|
|
}
|
|
|
|
|
2000-01-23 23:31:50 +03:00
|
|
|
my $userdefaultquery;
|
2001-11-19 01:23:31 +03:00
|
|
|
if ($::userid) {
|
2000-01-23 23:31:50 +03:00
|
|
|
SendSQL("SELECT query FROM namedqueries " .
|
2001-11-19 01:23:31 +03:00
|
|
|
"WHERE userid = $::userid AND name = '$::defaultqueryname'");
|
2000-01-23 23:31:50 +03:00
|
|
|
$userdefaultquery = FetchOneColumn();
|
1998-08-26 10:14:20 +04:00
|
|
|
}
|
|
|
|
|
2000-01-23 23:31:50 +03:00
|
|
|
my %default;
|
1998-09-16 01:49:26 +04:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# We pass the defaults as a hash of references to arrays. For those
|
|
|
|
# Items which are single-valued, the template should only reference [0]
|
|
|
|
# and ignore any multiple values.
|
|
|
|
sub PrefillForm {
|
2000-01-23 23:31:50 +03:00
|
|
|
my ($buf) = (@_);
|
|
|
|
my $foundone = 0;
|
2001-11-19 01:23:31 +03:00
|
|
|
|
|
|
|
# Nothing must be undef, otherwise the template complains.
|
2000-01-23 23:31:50 +03:00
|
|
|
foreach my $name ("bug_status", "resolution", "assigned_to",
|
|
|
|
"rep_platform", "priority", "bug_severity",
|
|
|
|
"product", "reporter", "op_sys",
|
|
|
|
"component", "version", "chfield", "chfieldfrom",
|
2001-04-10 07:49:01 +04:00
|
|
|
"chfieldto", "chfieldvalue", "target_milestone",
|
2001-11-19 01:23:31 +03:00
|
|
|
"email", "emailtype", "emailreporter",
|
|
|
|
"emailassigned_to", "emailcc", "emailqa_contact",
|
|
|
|
"emaillongdesc",
|
2000-01-23 23:31:50 +03:00
|
|
|
"changedin", "votes", "short_desc", "short_desc_type",
|
|
|
|
"long_desc", "long_desc_type", "bug_file_loc",
|
|
|
|
"bug_file_loc_type", "status_whiteboard",
|
2000-01-27 00:48:36 +03:00
|
|
|
"status_whiteboard_type", "bug_id",
|
|
|
|
"bugidtype", "keywords", "keywords_type") {
|
2001-11-19 01:23:31 +03:00
|
|
|
# This is a bit of a hack. The default, empty list has
|
|
|
|
# three entries to accommodate the needs of the email fields -
|
|
|
|
# we use each position to denote the relevant field. Array
|
|
|
|
# position 0 is unused for email fields because the form
|
|
|
|
# parameters historically started at 1.
|
|
|
|
$default{$name} = ["", "", ""];
|
1998-09-16 01:49:26 +04:00
|
|
|
}
|
2001-11-19 01:23:31 +03:00
|
|
|
|
|
|
|
|
|
|
|
# Iterate over the URL parameters
|
2000-01-23 23:31:50 +03:00
|
|
|
foreach my $item (split(/\&/, $buf)) {
|
|
|
|
my @el = split(/=/, $item);
|
|
|
|
my $name = $el[0];
|
|
|
|
my $value;
|
|
|
|
if ($#el > 0) {
|
|
|
|
$value = url_decode($el[1]);
|
1998-08-26 10:14:20 +04:00
|
|
|
} else {
|
2000-01-23 23:31:50 +03:00
|
|
|
$value = "";
|
|
|
|
}
|
2001-11-19 01:23:31 +03:00
|
|
|
|
|
|
|
# If the name ends in a number (which it does for the fields which
|
|
|
|
# are part of the email searching), we use the array
|
|
|
|
# positions to show the defaults for that number field.
|
|
|
|
if ($name =~ m/^(.+)(\d)$/ && defined($default{$1})) {
|
2000-01-23 23:31:50 +03:00
|
|
|
$foundone = 1;
|
2001-11-19 01:23:31 +03:00
|
|
|
$default{$1}->[$2] = $value;
|
1998-08-26 10:14:20 +04:00
|
|
|
}
|
2001-11-19 01:23:31 +03:00
|
|
|
# If there's no default yet, we replace the blank string.
|
|
|
|
elsif (defined($default{$name}) && $default{$name}->[0] eq "") {
|
|
|
|
$foundone = 1;
|
|
|
|
$default{$name} = [$value];
|
|
|
|
}
|
|
|
|
# If there's already a default, we push on the new value.
|
|
|
|
elsif (defined($default{$name})) {
|
|
|
|
push (@{$default{$name}}, $value);
|
|
|
|
}
|
|
|
|
}
|
2000-01-23 23:31:50 +03:00
|
|
|
return $foundone;
|
1998-08-26 10:14:20 +04:00
|
|
|
}
|
1998-09-16 01:49:26 +04:00
|
|
|
|
1999-03-24 01:32:21 +03:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
if (!PrefillForm($::buffer)) {
|
2000-01-23 23:31:50 +03:00
|
|
|
# Ah-hah, there was no form stuff specified. Do it again with the
|
|
|
|
# default query.
|
|
|
|
if ($userdefaultquery) {
|
2001-11-19 01:23:31 +03:00
|
|
|
PrefillForm($userdefaultquery);
|
2000-01-23 23:31:50 +03:00
|
|
|
} else {
|
2001-11-19 01:23:31 +03:00
|
|
|
PrefillForm(Param("defaultquery"));
|
2000-01-23 23:31:50 +03:00
|
|
|
}
|
|
|
|
}
|
1999-03-24 01:32:21 +03:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
if ($default{'chfieldto'}->[0] eq "") {
|
|
|
|
$default{'chfieldto'} = ["Now"];
|
1998-08-26 10:14:20 +04:00
|
|
|
}
|
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
GetVersionTable();
|
1999-01-19 03:07:46 +03:00
|
|
|
|
2000-07-18 19:28:19 +04:00
|
|
|
# if using usebuggroups, then we don't want people to see products they don't
|
2001-11-19 01:23:31 +03:00
|
|
|
# have access to. Remove them from the list.
|
2000-07-18 19:28:19 +04:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
my @products = ();
|
2000-11-20 22:42:36 +03:00
|
|
|
my %component_set;
|
|
|
|
my %version_set;
|
|
|
|
my %milestone_set;
|
2000-07-18 19:28:19 +04:00
|
|
|
foreach my $p (@::legal_product) {
|
2000-11-20 22:42:36 +03:00
|
|
|
# If we're using bug groups to restrict entry on products, and
|
|
|
|
# this product has a bug group, and the user is not in that
|
|
|
|
# group, we don't want to include that product in this list.
|
2001-11-19 01:23:31 +03:00
|
|
|
next if (Param("usebuggroups") && GroupExists($p) && !UserInGroup($p));
|
|
|
|
|
|
|
|
# We build up boolean hashes in the "-set" hashes for each of these things
|
|
|
|
# before making a list because there may be duplicates names across products.
|
|
|
|
push @products, $p;
|
|
|
|
if ($::components{$p}) {
|
|
|
|
foreach my $c (@{$::components{$p}}) {
|
|
|
|
$component_set{$c} = 1;
|
2001-08-31 02:56:53 +04:00
|
|
|
}
|
|
|
|
}
|
2001-11-19 01:23:31 +03:00
|
|
|
foreach my $v (@{$::versions{$p}}) {
|
|
|
|
$version_set{$v} = 1;
|
1999-03-20 00:40:14 +03:00
|
|
|
}
|
2001-11-19 01:23:31 +03:00
|
|
|
foreach my $m (@{$::target_milestone{$p}}) {
|
|
|
|
$milestone_set{$m} = 1;
|
1999-03-20 00:40:14 +03:00
|
|
|
}
|
2001-08-31 02:56:53 +04:00
|
|
|
}
|
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# @products is now all the products we are ever concerned with, as a list
|
|
|
|
# %x_set is now a unique "list" of the relevant components/versions/tms
|
|
|
|
@products = sort { lc($a) cmp lc($b) } @products;
|
2000-03-21 19:47:06 +03:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# Create the component, version and milestone lists.
|
|
|
|
my @components = ();
|
|
|
|
my @versions = ();
|
|
|
|
my @milestones = ();
|
|
|
|
foreach my $c (@::legal_components) {
|
|
|
|
if ($component_set{$c}) {
|
|
|
|
push @components, $c;
|
2000-03-21 19:47:06 +03:00
|
|
|
}
|
1999-03-20 00:40:14 +03:00
|
|
|
}
|
2001-11-19 01:23:31 +03:00
|
|
|
foreach my $v (@::legal_versions) {
|
|
|
|
if ($version_set{$v}) {
|
|
|
|
push @versions, $v;
|
1999-03-20 00:40:14 +03:00
|
|
|
}
|
2001-08-31 02:56:53 +04:00
|
|
|
}
|
2001-11-19 01:23:31 +03:00
|
|
|
foreach my $m (@::legal_target_milestone) {
|
|
|
|
if ($milestone_set{$m}) {
|
|
|
|
push @milestones, $m;
|
2001-08-31 02:56:53 +04:00
|
|
|
}
|
2001-03-01 02:00:28 +03:00
|
|
|
}
|
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# Sort the component list...
|
|
|
|
my $comps = \%::components;
|
|
|
|
foreach my $p (@products) {
|
|
|
|
my @tmp = sort { lc($a) cmp lc($b) } @{$comps->{$p}};
|
|
|
|
$comps->{$p} = \@tmp;
|
|
|
|
}
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# and the version list...
|
|
|
|
my $vers = \%::versions;
|
|
|
|
foreach my $p (@products) {
|
|
|
|
my @tmp = sort { lc($a) cmp lc($b) } @{$vers->{$p}};
|
|
|
|
$vers->{$p} = \@tmp;
|
|
|
|
}
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# and the milestone list.
|
|
|
|
my $mstones;
|
|
|
|
if (Param('usetargetmilestone')) {
|
|
|
|
$mstones = \%::target_milestone;
|
|
|
|
foreach my $p (@products) {
|
|
|
|
my @tmp = sort { lc($a) cmp lc($b) } @{$mstones->{$p}};
|
|
|
|
$mstones->{$p} = \@tmp;
|
|
|
|
}
|
1999-01-28 00:17:10 +03:00
|
|
|
}
|
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# "foo" or "foos" is a list of all the possible (or legal) products,
|
|
|
|
# components, versions or target milestones.
|
|
|
|
# "foobyproduct" is a hash, keyed by product, of sorted lists
|
|
|
|
# of the same data.
|
1999-05-25 01:16:18 +04:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
$vars->{'product'} = \@products;
|
1999-05-25 01:16:18 +04:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# We use 'component_' because 'component' is a Template Toolkit reserved word.
|
|
|
|
$vars->{'componentsbyproduct'} = $comps;
|
|
|
|
$vars->{'component_'} = \@components;
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
$vars->{'versionsbyproduct'} = $vers;
|
|
|
|
$vars->{'version'} = \@versions;
|
1999-01-28 00:17:10 +03:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
if (Param('usetargetmilestone')) {
|
|
|
|
$vars->{'milestonesbyproduct'} = $mstones;
|
|
|
|
$vars->{'target_milestone'} = \@milestones;
|
2000-01-07 00:16:15 +03:00
|
|
|
}
|
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
$vars->{'have_keywords'} = scalar(%::legal_keywords);
|
2000-01-28 04:01:40 +03:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
push @::legal_resolution, "---"; # Oy, what a hack.
|
|
|
|
shift @::legal_resolution;
|
|
|
|
# Another hack - this array contains "" for some reason. See bug 106589.
|
|
|
|
$vars->{'resolution'} = \@::legal_resolution;
|
|
|
|
|
|
|
|
$vars->{'chfield'} = ["[Bug creation]", @::log_columns];
|
|
|
|
$vars->{'bug_status'} = \@::legal_bug_status;
|
|
|
|
$vars->{'rep_platform'} = \@::legal_platform;
|
|
|
|
$vars->{'op_sys'} = \@::legal_opsys;
|
|
|
|
$vars->{'priority'} = \@::legal_priority;
|
|
|
|
$vars->{'bug_severity'} = \@::legal_severity;
|
|
|
|
$vars->{'userid'} = $::userid;
|
|
|
|
|
|
|
|
# Boolean charts
|
2000-01-28 04:01:40 +03:00
|
|
|
my @fields;
|
2001-11-19 01:23:31 +03:00
|
|
|
push(@fields, { name => "noop", description => "---" });
|
2000-01-28 10:15:44 +03:00
|
|
|
ConnectToDatabase();
|
2000-01-28 04:01:40 +03:00
|
|
|
SendSQL("SELECT name, description FROM fielddefs ORDER BY sortkey");
|
|
|
|
while (MoreSQLData()) {
|
2001-11-19 01:23:31 +03:00
|
|
|
my ($name, $description) = FetchSQLData();
|
|
|
|
push(@fields, { name => $name, description => $description });
|
2000-01-28 04:01:40 +03:00
|
|
|
}
|
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
$vars->{'fields'} = \@fields;
|
2000-01-31 21:19:44 +03:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# Creating new charts - if the cmd-add value is there, we define the field
|
|
|
|
# value so the code sees it and creates the chart. It will attempt to select
|
|
|
|
# "xyzzy" as the default, and fail. This is the correct behaviour.
|
2000-01-28 04:01:40 +03:00
|
|
|
foreach my $cmd (grep(/^cmd-/, keys(%::FORM))) {
|
|
|
|
if ($cmd =~ /^cmd-add(\d+)-(\d+)-(\d+)$/) {
|
2001-10-13 05:36:17 +04:00
|
|
|
$::FORM{"field$1-$2-$3"} = "xyzzy";
|
2000-01-28 04:01:40 +03:00
|
|
|
}
|
|
|
|
}
|
2001-10-13 05:36:17 +04:00
|
|
|
|
2000-01-28 04:01:40 +03:00
|
|
|
if (!exists $::FORM{'field0-0-0'}) {
|
|
|
|
$::FORM{'field0-0-0'} = "xyzzy";
|
|
|
|
}
|
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# Create data structure of boolean chart info. It's an array of arrays of
|
|
|
|
# arrays - with the inner arrays having three members - field, type and
|
|
|
|
# value.
|
|
|
|
my @charts;
|
|
|
|
for (my $chart = 0; $::FORM{"field$chart-0-0"}; $chart++) {
|
2000-01-28 04:01:40 +03:00
|
|
|
my @rows;
|
2001-11-19 01:23:31 +03:00
|
|
|
for (my $row = 0; $::FORM{"field$chart-$row-0"}; $row++) {
|
2001-10-13 05:36:17 +04:00
|
|
|
my @cols;
|
2001-11-19 01:23:31 +03:00
|
|
|
for (my $col = 0; $::FORM{"field$chart-$row-$col"}; $col++) {
|
|
|
|
push(@cols, { field => $::FORM{"field$chart-$row-$col"},
|
|
|
|
type => $::FORM{"type$chart-$row-$col"},
|
|
|
|
value => $::FORM{"value$chart-$row-$col"} });
|
2001-10-13 05:36:17 +04:00
|
|
|
}
|
2001-11-19 01:23:31 +03:00
|
|
|
push(@rows, \@cols);
|
2000-01-28 04:01:40 +03:00
|
|
|
}
|
2001-11-19 01:23:31 +03:00
|
|
|
push(@charts, \@rows);
|
2000-01-28 04:01:40 +03:00
|
|
|
}
|
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
$default{'charts'} = \@charts;
|
2000-01-28 04:01:40 +03:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# Named queries
|
|
|
|
if ($::userid) {
|
2000-01-23 23:31:50 +03:00
|
|
|
my @namedqueries;
|
2001-11-19 01:23:31 +03:00
|
|
|
SendSQL("SELECT name FROM namedqueries " .
|
|
|
|
"WHERE userid = $::userid AND name != '$::defaultqueryname' " .
|
|
|
|
"ORDER BY name");
|
|
|
|
while (MoreSQLData()) {
|
|
|
|
push(@namedqueries, FetchOneColumn());
|
2000-01-23 23:31:50 +03:00
|
|
|
}
|
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
$vars->{'namedqueries'} = \@namedqueries;
|
2000-01-23 23:31:50 +03:00
|
|
|
}
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# Sort order
|
|
|
|
my $deforder;
|
|
|
|
my @orders = ('Bug Number', 'Importance', 'Assignee', 'Last Changed');
|
2000-01-22 22:08:57 +03:00
|
|
|
|
|
|
|
if ($::COOKIE{'LASTORDER'}) {
|
|
|
|
$deforder = "Reuse same sort as last time";
|
|
|
|
unshift(@orders, $deforder);
|
|
|
|
}
|
2000-01-23 20:14:09 +03:00
|
|
|
|
2000-09-14 02:04:30 +04:00
|
|
|
if ($::FORM{'order'}) { $deforder = $::FORM{'order'} }
|
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
$vars->{'userdefaultquery'} = $userdefaultquery;
|
|
|
|
$vars->{'orders'} = \@orders;
|
|
|
|
$default{'querytype'} = $deforder || 'Importance';
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# Add in the defaults.
|
|
|
|
$vars->{'default'} = \%default;
|
2000-01-15 01:35:49 +03:00
|
|
|
|
2001-11-19 01:23:31 +03:00
|
|
|
# Generate and return the UI (HTML page) from the appropriate template.
|
|
|
|
print "Content-type: text/html\n\n";
|
|
|
|
$template->process("query/query.atml", $vars)
|
|
|
|
|| DisplayError("Template process failed: " . $template->error())
|
|
|
|
&& exit;
|