#!/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): Terry Weissman use diagnostics; use strict; require "CGI.pl"; # Shut up misguided -w warnings about "used only once": use vars @::legal_platform, @::legal_severity, @::legal_opsys, @::legal_priority; if (!defined $::FORM{'product'}) { GetVersionTable(); my @prodlist = keys %::versions; if ($#prodlist != 0) { print "Content-type: text/html\n\n"; PutHeader("Enter Bug"); print "

First, you must pick a product on which to enter\n"; print "a bug.

\n"; print ""; foreach my $p (sort (@prodlist)) { if (defined $::proddesc{$p} && $::proddesc{$p} eq '0') { # Special hack. If we stuffed a "0" into proddesc, that means # that disallownew was set for this bug, and so we don't want # to allow people to specify that product here. next; } print "\n"; if (defined $::proddesc{$p}) { print "\n"; } print ""; } print "
$p:$::proddesc{$p}
\n"; exit; } $::FORM{'product'} = $prodlist[0]; } my $product = $::FORM{'product'}; confirm_login(); print "Content-type: text/html\n\n"; sub formvalue { my ($name, $default) = (@_); if (exists $::FORM{$name}) { return $::FORM{$name}; } if (defined $default) { return $default; } return ""; } sub pickplatform { my $value = formvalue("rep_platform"); if ($value ne "") { return $value; } if ( Param('usebrowserinfo') ) { for ($ENV{'HTTP_USER_AGENT'}) { /Mozilla.*\(Windows/ && do {return "PC";}; /Mozilla.*\(Macintosh/ && do {return "Macintosh";}; /Mozilla.*\(Win/ && do {return "PC";}; /Mozilla.*Linux.*86/ && do {return "PC";}; /Mozilla.*Linux.*alpha/ && do {return "DEC";}; /Mozilla.*OSF/ && do {return "DEC";}; /Mozilla.*HP-UX/ && do {return "HP";}; /Mozilla.*IRIX/ && do {return "SGI";}; /Mozilla.*(SunOS|Solaris)/ && do {return "Sun";}; } } # default return "Other"; } sub pickversion { my $version = formvalue('version'); if ( Param('usebrowserinfo') ) { if ($version eq "") { if ($ENV{'HTTP_USER_AGENT'} =~ m@Mozilla[ /]([^ ]*)@) { $version = $1; } } } if (lsearch($::versions{$product}, $version) >= 0) { return $version; } else { if (defined $::COOKIE{"VERSION-$product"}) { if (lsearch($::versions{$product}, $::COOKIE{"VERSION-$product"}) >= 0) { return $::COOKIE{"VERSION-$product"}; } } } return $::versions{$product}->[0]; } sub pickcomponent { my $result =formvalue('component'); if ($result ne "" && lsearch($::components{$product}, $result) < 0) { $result = ""; } return $result; } sub pickos { if (formvalue('op_sys') ne "") { return formvalue('op_sys'); } if ( Param('usebrowserinfo') ) { for ($ENV{'HTTP_USER_AGENT'}) { /Mozilla.*\(.*;.*; IRIX.*\)/ && do {return "IRIX";}; /Mozilla.*\(.*;.*; 32bit.*\)/ && do {return "Windows 95";}; /Mozilla.*\(.*;.*; 16bit.*\)/ && do {return "Windows 3.1";}; /Mozilla.*\(.*;.*; 68K.*\)/ && do {return "Mac System 8.5";}; /Mozilla.*\(.*;.*; PPC.*\)/ && do {return "Mac System 8.5";}; /Mozilla.*\(.*;.*; OSF.*\)/ && do {return "OSF/1";}; /Mozilla.*\(.*;.*; Linux.*\)/ && do {return "Linux";}; /Mozilla.*\(.*;.*; SunOS 5.*\)/ && do {return "Solaris";}; /Mozilla.*\(.*;.*; SunOS.*\)/ && do {return "SunOS";}; /Mozilla.*\(.*;.*; SunOS.*\)/ && do {return "SunOS";}; /Mozilla.*\(.*;.*; BSD\/OS.*\)/ && do {return "BSDI";}; /Mozilla.*\(Win16.*\)/ && do {return "Windows 3.1";}; /Mozilla.*\(Win95.*\)/ && do {return "Windows 95";}; /Mozilla.*\(Win98.*\)/ && do {return "Windows 98";}; /Mozilla.*\(WinNT.*\)/ && do {return "Windows NT";}; } } # default return "other"; } GetVersionTable(); my $assign_element = GeneratePersonInput('assigned_to', 1, formvalue('assigned_to')); my $cc_element = GeneratePeopleInput('cc', formvalue('cc')); my $priority = Param('defaultpriority'); my $priority_popup = make_popup('priority', \@::legal_priority, formvalue('priority', $priority), 0); my $sev_popup = make_popup('bug_severity', \@::legal_severity, formvalue('bug_severity', 'normal'), 0); my $platform_popup = make_popup('rep_platform', \@::legal_platform, pickplatform(), 0); my $opsys_popup = make_popup('op_sys', \@::legal_opsys, pickos(), 0); my $component_popup = make_popup('component', $::components{$product}, formvalue('component'), 1); PutHeader ("Enter Bug"); print "
"; if (Param("entryheaderhtml")){ print " "; } print " "; if (Param('letsubmitterchoosepriority')) { print " "; } else { print ''; } print " "; if ( Param('usebrowserinfo') ) { print " "; } print "
" . Param("entryheaderhtml") . "\n" . "

Reporter: $::COOKIE{'Bugzilla_login'} Product: $product
Version: " . Version_element(pickversion(), $product) . " Component: $component_popup
 
Platform: $platform_popup OS: $opsys_popup
Priority: $priority_popupSeverity: $sev_popup
 
Assigned To: $assign_element (Leave blank to assign to default component owner)
Cc: $cc_element
 
URL:
Summary:
Description:
         

Some fields initialized from your user-agent, $ENV{'HTTP_USER_AGENT'}. If you think it got it wrong, please tell " . Param('maintainer') . " what it should have been.
\n"; print "\n";