# -*- Mode: perl; indent-tabs-mode: nil -*- # # The contents of this file are subject to the Mozilla Public License # Version 1.0 (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; my %knownattachments; # This routine quoteUrls contains inspirations from the HTML::FromText CPAN # module by Gareth Rees . It has been heavily hacked, # all that is really recognizable from the original is bits of the regular # expressions. sub quoteUrls { my $text = shift; # Take a copy; don't modify in-place. return $text unless $text; my $base = Param('urlbase'); my $protocol = join '|', qw(afs cid ftp gopher http https mid news nntp prospero telnet wais); my %options = ( metachars => 1, @_ ); my $count = 0; # Now, quote any "#" characters so they won't confuse stuff later $text =~ s/#/%#/g; # Next, find anything that looks like a URL or an email address and # pull them out the the text, replacing them with a "#### # marker, and writing them into an array. All this confusion is # necessary so that we don't match on something we've already replaced, # which can happen if you do multiple s///g operations. my @things; while ($text =~ s%((mailto:)?([\w\.\-\+\=]+\@\w+(?:\.\w+)+)\b| (\b((?:$protocol):\S+[\w/])))%"##$count##"%exo) { my $item = $&; $item = value_quote($item); if ($item !~ m/^$protocol:/o && $item !~ /^mailto:/) { # We must have grabbed this one because it looks like an email # address. $item = qq{$item}; } else { $item = qq{$item}; } $things[$count++] = $item; } while ($text =~ s/\bbug(\s|%\#)*(\d+)/"##$count##"/ei) { my $item = $&; my $num = $2; $item = value_quote($item); # Not really necessary, since we know # there's no special chars in it. $item = qq{$item}; $things[$count++] = $item; } while ($text =~ s/\*\*\* This bug has been marked as a duplicate of (\d+) \*\*\*/"##$count##"/ei) { my $item = $&; my $num = $1; $item =~ s@\d+@$num@; $things[$count++] = $item; } while ($text =~ s/Created an attachment \(id=(\d+)\)/"##$count##"/e) { my $item = $&; my $num = $1; if (exists $knownattachments{$num}) { $item = qq{$item}; } $things[$count++] = $item; } $text = value_quote($text); # Stuff everything back from the array. for (my $i=0 ; $i<$count ; $i++) { $text =~ s/##$i##/$things[$i]/e; } # And undo the quoting of "#" characters. $text =~ s/%#/#/g; return $text; } quietly_check_login(); my $query = " select 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'), groupset from bugs where bug_id = $::FORM{'id'} and bugs.groupset & $::usergroupset = bugs.groupset"; 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") { $bug{$field} = shift @row; if (!defined $bug{$field}) { $bug{$field} = ""; } $count++; } } else { my $maintainer = Param("maintainer"); print "Bug Splat Error\n"; print "

Query Error

Somehow something went wrong. Possibly if\n"; print "you mail this page to $maintainer, he will be able to fix\n"; print "things.
\n"; print "Bug $::FORM{'id'} not found

Query Text

$query
\n";
    exit 0
}

$bug{'assigned_to'} = DBID_to_name($bug{'assigned_to'});
$bug{'reporter'} = DBID_to_name($bug{'reporter'});
$bug{'long_desc'} = GetLongDescription($::FORM{'id'});


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 $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 "
Bug $::FORM{'id'} -- " . html_quote($bug{'short_desc'}) .
    "
"; 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'} = " "; } push(@::legal_target_milestone, " "); print " "; } print " "; if (Param("useqacontact")) { my $name = $bug{'qa_contact'} > 0 ? DBID_to_name($bug{'qa_contact'}) : ""; print " "; if (Param("usestatuswhiteboard")) { print " \n"; SendSQL("select attach_id, creation_ts, description from attachments where bug_id = $::FORM{'id'}"); while (MoreSQLData()) { my ($id, $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=$id"; $desc = value_quote($desc); print qq{}; $knownattachments{$id} = 1; } print "\n"; 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: "; } print "
Attachments:$date$desc
Create a new attachment (proposed patch, testcase, etc.)

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'}; if ($status eq "NEW" || $status eq "ASSIGNED" || $status eq "REOPENED") { if ($status ne "ASSIGNED") { print ""; print "Accept bug (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++; my $assign_element = ""; print " Reassign bug to $assign_element
\n"; $knum++; print " Reassign bug to owner of selected component
\n"; $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 quoteUrls($bug{'long_desc'}, email=>1, urls=>1);
print "

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