# -*- 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): Terry Weissman use diagnostics; use strict; use RelationSet; # Shut up misguided -w warnings about "used only once". For some reason, # "use vars" chokes on me when I try it here. sub bug_form_pl_sillyness { my $zz; $zz = %::FORM; $zz = %::components; $zz = %::prodmaxvotes; $zz = %::versions; $zz = @::legal_keywords; $zz = @::legal_opsys; $zz = @::legal_platform; $zz = @::legal_product; $zz = @::legal_priority; $zz = @::legal_resolution_no_dup; $zz = @::legal_severity; $zz = %::target_milestone; } my $loginok = quietly_check_login(); my $id = $::FORM{'id'}; my $query = " select bugs.bug_id, product, version, rep_platform, op_sys, bug_status, resolution, priority, bug_severity, component, assigned_to, reporter, bug_file_loc, short_desc, target_milestone, qa_contact, status_whiteboard, date_format(creation_ts,'%Y-%m-%d %H:%i'), groupset, delta_ts, sum(votes.count) from bugs left join votes using(bug_id) where bugs.bug_id = $id and bugs.groupset & $::usergroupset = bugs.groupset group by bugs.bug_id"; SendSQL($query); my %bug; my @row; if (@row = FetchSQLData()) { my $count = 0; foreach my $field ("bug_id", "product", "version", "rep_platform", "op_sys", "bug_status", "resolution", "priority", "bug_severity", "component", "assigned_to", "reporter", "bug_file_loc", "short_desc", "target_milestone", "qa_contact", "status_whiteboard", "creation_ts", "groupset", "delta_ts", "votes") { $bug{$field} = shift @row; if (!defined $bug{$field}) { $bug{$field} = ""; } $count++; } } else { SendSQL("select groupset from bugs where bug_id = $id"); if (@row = FetchSQLData()) { print "

Permission denied.

\n"; if ($loginok) { print "Sorry; you do not have the permissions necessary to see\n"; print "bug $id.\n"; } else { print "Sorry; bug $id can only be viewed when logged\n"; print "into an account with the appropriate permissions. To\n"; print "see this bug, you must first\n"; print ""; print "log in."; } } else { print "

Bug not found

\n"; print "There does not seem to be a bug numbered $id.\n"; } PutFooter(); exit; } my $assignedtoid = $bug{'assigned_to'}; my $reporterid = $bug{'reporter'}; my $qacontactid = $bug{'qa_contact'}; $bug{'assigned_to'} = DBID_to_real_or_loginname($bug{'assigned_to'}); $bug{'reporter'} = DBID_to_real_or_loginname($bug{'reporter'}); print qq{
\n}; # foreach my $i (sort(keys(%bug))) { # my $q = value_quote($bug{$i}); # print qq{\n}; # } $bug{'long_desc'} = GetLongDescriptionAsHTML($id); my $longdesclength = length($bug{'long_desc'}); GetVersionTable(); # # These should be read from the database ... # my $resolution_popup = make_options(\@::legal_resolution_no_dup, $bug{'resolution'}); my $platform_popup = make_options(\@::legal_platform, $bug{'rep_platform'}); my $priority_popup = make_options(\@::legal_priority, $bug{'priority'}); my $sev_popup = make_options(\@::legal_severity, $bug{'bug_severity'}); my $component_popup = make_options($::components{$bug{'product'}}, $bug{'component'}); my $ccSet = new RelationSet; $ccSet->mergeFromDB("select who from cc where bug_id=$id"); my $cc_element = ''; my $URL = $bug{'bug_file_loc'}; if (defined $URL && $URL ne "none" && $URL ne "NULL" && $URL ne "") { $URL = "URL:"; } else { $URL = "URL:"; } print " "; if (Param("usetargetmilestone")) { my $url = ""; if (defined $::milestoneurl{$bug{'product'}}) { $url = $::milestoneurl{$bug{'product'}}; } if ($url eq "") { $url = "notargetmilestone.html"; } if ($bug{'target_milestone'} eq "") { $bug{'target_milestone'} = " "; } print " "; } print " "; if (Param("useqacontact")) { my $name = $bug{'qa_contact'} > 0 ? DBID_to_name($bug{'qa_contact'}) : ""; print " "; if (Param("usestatuswhiteboard")) { print " }; } print "\n"; SendSQL("select attach_id, creation_ts, description from attachments where bug_id = $id"); while (MoreSQLData()) { my ($attachid, $date, $desc) = (FetchSQLData()); if ($date =~ /^(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/) { $date = "$3/$4/$2 $5:$6"; } my $link = "showattachment.cgi?attach_id=$attachid"; $desc = value_quote($desc); print qq{}; } print "
Bug#:$bug{'bug_id'} Platform: Version:
Product: OS: Reporter:$bug{'reporter'}
Status: $bug{'bug_status'} Priority: Cc: $cc_element
Resolution: $bug{'resolution'} Severity: Component:
Assigned To: $bug{'assigned_to'}Target Milestone:
QA Contact: "; } print "
$URL
Summary:
Status Whiteboard: "; } if (@::legal_keywords) { SendSQL("SELECT keyworddefs.name FROM keyworddefs, keywords WHERE keywords.bug_id = $id AND keyworddefs.id = keywords.keywordid ORDER BY keyworddefs.name"); my @list; while (MoreSQLData()) { push(@list, FetchOneColumn()); } my $value = value_quote(join(', ', @list)); print qq{
Keywords:
Attachments:$date$desc
Create a new attachment (proposed patch, testcase, etc.)
\n"; sub EmitDependList { my ($desc, $myfield, $targetfield) = (@_); print "$desc:"; my @list; SendSQL("select dependencies.$targetfield, bugs.bug_status from dependencies, bugs where dependencies.$myfield = $id and bugs.bug_id = dependencies.$targetfield order by dependencies.$targetfield"); while (MoreSQLData()) { my ($i, $stat) = (FetchSQLData()); push(@list, $i); my $opened = ($stat eq "NEW" || $stat eq "ASSIGNED" || $stat eq "REOPENED"); if (!$opened) { print ""; } print qq{$i}; if (!$opened) { print ""; } print " "; } print "\n"; } if (Param("usedependencies")) { print "\n"; EmitDependList("Bug $id depends on", "blocked", "dependson"); print qq{ "; EmitDependList("Bug $id blocks", "dependson", "blocked"); print "
Show dependency tree }; if (Param("webdotbase") ne "") { print qq{
Show dependency graph }; } print "
\n"; } if ($::prodmaxvotes{$bug{'product'}}) { print qq{
Votes for bug $id: $bug{'votes'}    Vote for this bug
}; } print "
Additional Comments:

"; if ($::usergroupset ne '0') { SendSQL("select bit, description, (bit & $bug{'groupset'} != 0) from groups where bit & $::usergroupset != 0 and isbuggroup != 0 order by bit"); while (MoreSQLData()) { my ($bit, $description, $ison) = (FetchSQLData()); my $check0 = !$ison ? " SELECTED" : ""; my $check1 = $ison ? " SELECTED" : ""; print "
\n"; } } print "
Leave as $bug{'bug_status'} $bug{'resolution'}
"; # knum is which knob number we're generating, in javascript terms. my $knum = 1; my $status = $bug{'bug_status'}; # In the below, if the person hasn't logged in ($::userid == 0), then # we treat them as if they can do anything. That's because we don't # know why they haven't logged in; it may just be because they don't # use cookies. Display everything as if they have all the permissions # in the world; their permissions will get checked when they log in # and actually try to make the change. my $canedit = UserInGroup("editbugs") || ($::userid == 0); my $canconfirm; if ($status eq $::unconfirmedstate) { $canconfirm = UserInGroup("canconfirm") || ($::userid == 0); if ($canedit || $canconfirm) { print ""; print "Confirm bug (change status to NEW)
"; $knum++; } } if ($canedit || $::userid == $assignedtoid || $::userid == $reporterid || $::userid == $qacontactid) { if (IsOpenedState($status)) { if ($status ne "ASSIGNED") { print ""; my $extra = ""; if ($status eq $::unconfirmedstate && ($canconfirm || $canedit)) { $extra = "confirm bug, "; } print "Accept bug (${extra}change status to ASSIGNED)
"; $knum++; } if ($bug{'resolution'} ne "") { print "\n"; print "Clear the resolution (remove the current resolution of\n"; print "$bug{'resolution'})
\n"; $knum++; } print " Resolve bug, changing resolution to
\n"; $knum++; print " Resolve bug, mark it as duplicate of bug #
\n"; $knum++; if ( $bug{'assigned_to'} =~ /(.*)\((.*)\)/ ) { $bug{'assigned_to'} = $1; chop($bug{'assigned_to'}); } my $assign_element = ""; print " Reassign bug to $assign_element
\n"; if ($status eq $::unconfirmedstate && ($canconfirm || $canedit)) { print "     and confirm bug (change status to NEW)
"; } $knum++; print " Reassign bug to owner of selected component
\n"; if ($status eq $::unconfirmedstate && ($canconfirm || $canedit)) { print "     and confirm bug (change status to NEW)
"; } $knum++; } else { print " Reopen bug
\n"; $knum++; if ($status eq "RESOLVED") { print " Mark bug as VERIFIED
\n"; $knum++; } if ($status ne "CLOSED") { print " Mark bug as CLOSED
\n"; $knum++; } } } print "
View Bug Activity Format For Printing
Description: Opened: $bug{'creation_ts'}

"; print $bug{'long_desc'}; print "
\n"; # To add back option of editing the long description, insert after the above # long_list.cgi line: # Edit Long Description navigation_header(); PutFooter(); 1;