#!/usr/bonsaitools/bin/perl -w # -*- 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 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): Rick Dean # Terry Weissman # David Gardiner # use strict; require "CGI.pl"; $::CheckOptionValues = 0; # It's OK if we have some bogus things in the # pop-up lists here, from a remembered query # that is no longer quite valid. We don't # want to crap out in the query page. # Shut up misguided -w warnings about "used only once": use vars @::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; if (defined($::FORM{'csv'})) { print("Content-Type: text/csv\n\n"); } else { print "Content-type: text/html\n\n"; }; if (defined $::FORM{"GoAheadAndLogIn"}) { # We got here from a login page, probably from relogin.cgi. We better # make sure the password is legit. confirm_login(); } else { quietly_check_login(); } my $userid = 0; if (defined $::COOKIE{"Bugzilla_login"}) { $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"}); } use vars %::default; # would use "our" but want perl 5.004 compliance my %type; sub ProcessFormStuff { my ($buf) = (@_); my $foundone = 0; foreach my $name ("bug_status", "resolution", "assigned_to", "rep_platform", "priority", "bug_severity", "product", "op_sys", "component", "version", "assigned_to","reporter","qa_contact","cc","comment_add", "changedin", "votes", "short_desc", "long_desc", "long_desc_type", "bug_file_loc", "status_whiteboard", "status_whiteboard_type", "bug_id", "target_milestone", "retroactive","num_intervals", "metric_census", "metric_open", "metric_resolved","metric_fixed","metric_verified", "metric_closed", "metric_openings", "metric_resolves", "metric_fixes", "metric_nonfixes", "metric_verifies", "metric_closingss", "bugidtype", "keywords", "keywords_type") { $::default{$name} = ""; $type{$name} = 0; } foreach my $item (split(/\&/, $buf)) { my @el = split(/=/, $item); my $name = $el[0]; my $value; if ($#el > 0) { $value = url_decode($el[1]); } else { $value = ""; } if (defined $::default{$name}) { $foundone = 1; if ($::default{$name} ne "") { $::default{$name} .= "|$value"; $type{$name} = 1; } else { $::default{$name} = $value; } } } return $foundone; } if($::buffer eq "") { $::buffer = "bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED"; $::buffer = "nothing"; } if (!ProcessFormStuff($::buffer)) { # ProcessFormStuff(Param("defaultquery")); } my $hasmetric = grep { /^metric_/ && $::default{$_} } keys %::default; # if a metric is selected $::default{"metric_open"} = 1 if ! $hasmetric; $::default{"num_intervals"} ||= "10"; $::default{'retroactive'} = 1 if ! defined $::FORM{'vertical'}; GetVersionTable(); # javascript my $jscript = << 'ENDSCRIPT'; }; # Muck the "legal product" list so that the default one is always first (and # is therefore visibly selected. # Commented out, until we actually have enough products for this to matter. # set w [lsearch $legal_product $::default{"product"}] # if {$w >= 0} { # set legal_product [concat $::default{"product"} [lreplace $legal_product $w $w]] # } if (!defined($::FORM{'csv'})) { PutHeader("Table of Bug Counts", "Table of Bug Counts", "Build a trendy table of bug counts. Everyone does it! Start by picking the axes...", q{onLoad="selectProduct(document.forms[0]);"}, 0, $jscript); }; push @::legal_resolution, "---"; # Oy, what a hack. my @logfields = ("[Bug creation]", @::log_columns); @::axis_types = ("severity", "priority", "nothing", "who", "assigned_to", "reporter", "status", "resolution", "component", "product", "version", "platform", "os"); push(@::axis_types,"qa_contact") if (Param("useqacontact")); push(@::axis_types,"target_milestone") if (Param("usetargetmilestone")); @::time_types = ("4hours", "12hours", "daily", "3days", "weekly", "2weeks", "month"); sub use_if_listed { my($desired, $default, @list) = @_; return $default if ! defined($desired); for my $elem (@list) { return $desired if $elem eq $desired; } return $default; } # figure out what our axes are $::vertical = $::FORM{'vertical'}; $::vertical = use_if_listed($::vertical, "priority", @::axis_types); $::horizontal = $::FORM{'horizontal'}; $::horizontal = use_if_listed($::horizontal, "weekly", @::time_types); do "print_trend_table.pl" || print "

Error in print_trend_table.pl

$@

\n"; exit if defined($::FORM{'csv'}); print qq{

}; my $script_name = $0; $script_name =~ s/.*\///; # delete anything before the slash $script_name .= "/bugs_". time2str("%Y%b%d",time) . "_$::vertical.csv"; print "
Vertical Axis: Horizontal Axis: Metrics:
@{[make_selection_widget(\"vertical\",\@::axis_types,$::vertical,1 , 0)]} @{[make_selection_widget(\"horizontal\",\@::time_types,$::horizontal,1 , 0)]}
intervals
(census at instant)
Count all (matching)
Count open
Count resolved
Count resolved, fixed
Count verified
Count closed
(transitions during interval)
Count openings
Count resolves
Count resolves, fixes
Count resolves, non-fixes
Count verifies
Count closings
Use final values retroactively (except status & resolution)
download as Comma Separated Variables (CSV)
"; print " (HINT: After updating to a table you like, consider bookmarking the page.)

And further constrain your data set with ... "; print qq{ }; print "
Status: Resolution: Platform: OpSys: Priority: Severity:
@{[make_selection_widget(\"bug_status\",\@::legal_bug_status,$::default{'bug_status'}, $type{'bug_status'}, 1)]} @{[make_selection_widget(\"resolution\",\@::legal_resolution,$::default{'resolution'}, $type{'resolution'}, 1)]} @{[make_selection_widget(\"rep_platform\",\@::legal_platform,$::default{'rep_platform'}, $type{'rep_platform'}, 1)]} @{[make_selection_widget(\"op_sys\",\@::legal_opsys,$::default{'op_sys'}, $type{'op_sys'}, 1)]} @{[make_selection_widget(\"priority\",\@::legal_priority,$::default{'priority'}, $type{'priority'}, 1)]} @{[make_selection_widget(\"bug_severity\",\@::legal_severity,$::default{'bug_severity'}, $type{'bug_severity'}, 1)]}

\n"; my $def_assigned_to = value_quote($::default{"assigned_to"}); my $def_reporter = value_quote($::default{"reporter"}); my $def_qa_contact = value_quote($::default{"qa_contact"}); my $def_cc = value_quote($::default{"cc"}); my $def_comment_add = value_quote($::default{"comment_add"}); print qq{ Email: }; print"

Assigned To:
Reported By:
QA Contact:
CC: (only one)
Added Comment By: (only one)
"; if (Param("usetargetmilestone")) { print ""; } print " "; if (Param("usetargetmilestone")) { print " "; } sub StringSearch { my ($desc, $name) = (@_); my $type = $name . "_type"; my $def = value_quote($::default{$name}); print qq{ "; } print "
Program: Version: Component:Target Milestone:
$desc:
"; my $def_short_desc = value_quote($::default{"short_desc"}); my $def_bug_file_loc = value_quote($::default{"bug_file_loc"}); print qq{
Summary: (any word)
URL: (any word)
}; #StringSearch("Summary", "short_desc"); #StringSearch("A description entry", "long_desc"); #StringSearch("URL", "bug_file_loc"); if (Param("usestatuswhiteboard")) { StringSearch("Status whiteboard", "status_whiteboard"); } if (@::legal_keywords) { my $def = value_quote($::default{'keywords'}); print qq{ Keywords: }; my $type = $::default{"keywords_type"}; if ($type eq "or") { # Backward compatability hack. $type = "anywords"; } print BuildPulldown("keywords_type", [["anywords", "Any of the listed keywords set"], ["allwords", "All of the listed keywords set"], ["nowords", "None of the listed keywords set"]], $type); print qq{}; } print "

"; my @fields; push(@fields, ["noop", "---"]); ConnectToDatabase(); SendSQL("SELECT name, description FROM fielddefs ORDER BY sortkey"); while (MoreSQLData()) { my ($name, $description) = (FetchSQLData()); push(@fields, [$name, $description]); } my @types = ( ["noop", "---"], ["equals", "equal to"], ["notequals", "not equal to"], ["casesubstring", "contains (case-sensitive) substring"], ["substring", "contains (case-insensitive) substring"], ["notsubstring", "does not contain (case-insensitive) substring"], ["regexp", "contains regexp"], ["notregexp", "does not contain regexp"], ["lessthan", "less than"], ["greaterthan", "greater than"], ["anywords", "any words"], ["allwords", "all words"], ["nowords", "none of the words"], ["changedbefore", "changed before"], ["changedafter", "changed after"], ["changedto", "changed to"], ["changedby", "changed by"], ); print qq{ \n}; foreach my $cmd (grep(/^cmd-/, keys(%::FORM))) { if ($cmd =~ /^cmd-add(\d+)-(\d+)-(\d+)$/) { $::FORM{"field$1-$2-$3"} = "xyzzy"; } } # foreach my $i (sort(keys(%::FORM))) { # print "$i : " . value_quote($::FORM{$i}) . "
\n"; # } print " \n"; print "

"; if (UserInGroup("tweakparams")) { print "Edit Bugzilla operating parameters
\n"; } if (UserInGroup("editcomponents")) { print "Edit Bugzilla products and components
\n"; } if (UserInGroup("editkeywords")) { print "Edit Bugzilla keywords
\n"; } if ($userid) { print "Log in as someone besides $::COOKIE{'Bugzilla_login'}
\n"; } print "Change your password or preferences.
\n"; print "Create a new bug.
\n"; print "Open a new Bugzilla account
\n"; print "Bug reports
\n"; PutFooter();