]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bugzilla source.
authorterry%netscape.com <>
Wed, 26 Aug 1998 13:14:15 +0000 (13:14 +0000)
committerterry%netscape.com <>
Wed, 26 Aug 1998 13:14:15 +0000 (13:14 +0000)
31 files changed:
1x1.gif [new file with mode: 0644]
CGI.tcl [new file with mode: 0755]
ant.jpg [new file with mode: 0644]
bug_form.tcl [new file with mode: 0755]
bug_status.html [new file with mode: 0755]
buglist.cgi [new file with mode: 0755]
changepassword.cgi [new file with mode: 0755]
colchange.cgi [new file with mode: 0755]
doclosebug.cgi [new file with mode: 0755]
edit_desc.cgi [new file with mode: 0755]
enter_bug.cgi [new file with mode: 0755]
globals.tcl [new file with mode: 0644]
help.html [new file with mode: 0644]
how_to_mail.html [new file with mode: 0644]
index.html [new file with mode: 0644]
long_list.cgi [new file with mode: 0755]
makeactivitytable.sh [new file with mode: 0755]
makebugtable.sh [new file with mode: 0755]
makecctable.sh [new file with mode: 0755]
makecomponenttable.sh [new file with mode: 0755]
makeprofilestable.sh [new file with mode: 0755]
makeversiontable.sh [new file with mode: 0755]
new_comment.cgi [new file with mode: 0755]
newquip.html [new file with mode: 0644]
post_bug.cgi [new file with mode: 0755]
process_bug.cgi [new file with mode: 0755]
processmail [new file with mode: 0755]
query.cgi [new file with mode: 0755]
relogin.cgi [new file with mode: 0755]
show_activity.cgi [new file with mode: 0755]
show_bug.cgi [new file with mode: 0755]

diff --git a/1x1.gif b/1x1.gif
new file mode 100644 (file)
index 0000000..b07a89a
Binary files /dev/null and b/1x1.gif differ
diff --git a/CGI.tcl b/CGI.tcl
new file mode 100755 (executable)
index 0000000..fc711c7
--- /dev/null
+++ b/CGI.tcl
@@ -0,0 +1,320 @@
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+source "globals.tcl"
+
+proc url_decode {buf} {
+  regsub -all {\\(.)} $buf {\1} buf ; regsub -all {\\} $buf {\\\\} buf ;
+  regsub -all { }  $buf {\ } buf ; regsub -all {\+} $buf {\ } buf ;
+  regsub -all {\$} $buf {\$} buf ; regsub -all \n   $buf {\n} buf ;
+  regsub -all {;}  $buf {\;} buf ; regsub -all {\[} $buf {\[} buf ;
+  regsub -all \" $buf \\\" buf ; regsub  ^\{ $buf \\\{ buf ;
+  regsub -all -nocase {%([a-fA-F0-9][a-fA-F0-9])} $buf {[format %c 0x\1]} buf
+  eval return \"$buf\"
+}
+
+proc url_quote {var} {
+  regsub -all { } "$var" {%20} var
+  regsub -all {=} "$var" {%3d} var
+  regsub -all "\n" "$var" {%0a} var
+  return $var
+}
+
+proc lookup { a key } {
+  global $a
+  set ref [format %s(%s) $a $key]
+  if { [ info exists $ref] } {
+    eval return \$$ref
+  } else {
+    return ""
+  }
+}
+
+proc ProcessFormFields {buffer} {
+    global FORM MFORM
+    catch {unset FORM}
+    catch {unset MFORM}
+    set remaining $buffer
+    while {![cequal $remaining ""]} {
+        if {![regexp {^([^&]*)&(.*)$} $remaining foo item remaining]} {
+            set item $remaining
+            set remaining ""
+        }
+        if {![regexp {^([^=]*)=(.*)$} $item foo name value]} {
+            set name $item
+            set value ""
+        }
+        set value [url_decode $value]
+        if {![cequal $value ""]} {
+            append FORM($name) $value
+            lappend MFORM($name) $value
+        } else {
+            set isnull($name) 1
+        }
+    }
+    if {[info exists isnull]} {
+        foreach name [array names isnull] {
+            if {![info exists FORM($name)]} {
+                set FORM($name) ""
+                set MFORM($name) ""
+            }
+        }
+    }
+}
+
+proc FormData { field } {
+  global FORM
+  return $FORM($field)
+}
+    
+if { [info exists env(REQUEST_METHOD) ] } {
+  if { $env(REQUEST_METHOD) == "GET" } { 
+    set buffer [lookup env QUERY_STRING]
+  } else { set buffer [ read stdin $env(CONTENT_LENGTH) ] }
+  ProcessFormFields $buffer
+}
+
+proc html_quote { var } {
+  regsub -all {&} "$var" {\&amp;} var
+  regsub -all {<} "$var" {\&lt;} var
+  regsub -all {>} "$var" {\&gt;} var
+  return $var
+}
+proc value_quote { var } {
+  regsub -all {&} "$var" {\&amp;} var
+  regsub -all {"} "$var" {\&quot;} var
+  regsub -all {<} "$var" {\&lt;} var
+  regsub -all {>} "$var" {\&gt;} var
+  return $var
+}
+
+proc value_unquote { var } {
+    regsub -all {&quot;} $var "\"" var
+    regsub -all {&lt;} $var "<" var
+    regsub -all {&gt;} $var ">" var
+    regsub -all {&amp;} $var {\&} var
+    return $var
+}
+    
+foreach pair [ split [lookup env HTTP_COOKIE] ";" ] {
+  set pair [string trim $pair]
+  set eq [string first = $pair ]
+  if {$eq == -1} {
+    set COOKIE($pair) ""
+  } else {
+    set COOKIE([string range $pair 0 [expr $eq - 1]]) [string range $pair [expr $eq + 1] end]
+  }
+}
+
+proc navigation_header {} {
+  global COOKIE FORM next_bug
+  set buglist [lookup COOKIE BUGLIST]
+  if { $buglist != "" } {
+    set bugs [split $buglist :]
+    set cur [ lsearch -exact $bugs $FORM(id) ]
+    puts "<B>Bug List:</B> ([expr $cur + 1] of [llength $bugs])"
+    puts "<A HREF=\"show_bug.cgi?id=[lindex $bugs 0]\">First</A>"
+    puts "<A HREF=\"show_bug.cgi?id=[lindex $bugs [expr [ llength $bugs ] - 1]]\">Last</A>"
+    if { $cur > 0 } {
+      puts "<A HREF=\"show_bug.cgi?id=[lindex $bugs [expr $cur - 1]]\">Prev</A>"
+    } else {
+      puts "<I><FONT COLOR=\#777777>Prev</FONT></I>"
+    }
+    if { $cur < [expr [ llength $bugs ] - 1] } {
+      set next_bug [lindex $bugs [expr $cur + 1]]
+      puts "<A HREF=\"show_bug.cgi?id=$next_bug\">Next</A>"
+    } else {
+      puts "<I><FONT COLOR=\#777777>Next</FONT></I>"
+    }
+  }
+  puts "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=\"query.cgi\">Query page</A>"
+}
+
+proc make_options { src default {isregexp 0} } {
+    set last "" ; set popup "" ; set found 0
+    foreach item $src {
+        if {$item == "-blank-" || $item != $last} {
+            if { $item == "-blank-" } { set item "" }
+            set last $item
+            if {$isregexp ? [regexp $default $item] : [cequal $default $item]} {
+                append popup "<OPTION SELECTED VALUE=\"$item\">$item"
+                set found 1
+            } else {
+                append popup "<OPTION VALUE=\"$item\">$item"
+            }
+        }
+    }
+    if {!$found && $default != ""} {
+        append popup "<OPTION SELECTED>$default"
+    }
+    return $popup
+}
+
+
+
+proc PasswordForLogin {login} {
+    SendSQL "select password from profiles where login_name = '[SqlQuote $login]'"
+    return [FetchSQLData]
+}
+    
+
+
+proc confirm_login {{nexturl ""}} {
+#    puts "Content-type: text/plain\n"
+    global FORM COOKIE argv0
+    ConnectToDatabase
+    if { [info exists FORM(Bugzilla_login)] && 
+         [info exists FORM(Bugzilla_password)] } {
+        if {![regexp {^[^@, ]*@[^@, ]*\.[^@, ]*$} $FORM(Bugzilla_login)]} {
+            puts "Content-type: text/html\n"
+            puts "<H1>Invalid e-mail address entered.</H1>"
+            puts "The e-mail address you entered"
+            puts "(<b>$FORM(Bugzilla_login)</b>) didn't match our minimal"
+            puts "syntax checking for a legal email address.  A legal address"
+            puts "must contain exactly one '@', and at least one '.' after"
+            puts "the @, and may not contain any commas or spaces."
+            puts "<p>Please click <b>back</b> and try again."
+            exit
+        }
+        set realpwd [PasswordForLogin $FORM(Bugzilla_login)]
+        if {[info exists FORM(PleaseMailAPassword)]} {
+            if {[cequal $realpwd ""]} {
+                set realpwd [InsertNewUser $FORM(Bugzilla_login)]
+            }
+            set template "From: bugzilla-daemon
+To: %s
+Subject: Your bugzilla password.
+
+To use the wonders of bugzilla, you can use the following:
+
+E-mail address: %s
+      Password: %s
+"
+            set msg [format $template $FORM(Bugzilla_login) \
+                         $FORM(Bugzilla_login) $realpwd]
+            
+            exec /usr/lib/sendmail -t << $msg
+            puts "Content-type: text/html\n"
+            puts "<H1>Password has been emailed.</H1>"
+            puts "The password for the e-mail address"
+            puts "$FORM(Bugzilla_login) has been e-mailed to that address."
+            puts "<p>When the e-mail arrives, you can click <b>Back</b>"
+            puts "and enter your password in the form there."
+            exit
+        }
+                
+        if {[cequal $realpwd ""] || ![cequal $realpwd $FORM(Bugzilla_password)]} {
+            puts "Content-type: text/html\n"
+            puts "<H1>Login failed.</H1>"
+            puts "The username or password you entered is not valid.  Please"
+            puts "click <b>back</b> and try again."
+            exit
+        }
+        set COOKIE(Bugzilla_login) $FORM(Bugzilla_login)
+        set COOKIE(Bugzilla_password) $FORM(Bugzilla_password)
+        puts "Set-Cookie: Bugzilla_login=$COOKIE(Bugzilla_login) ; path=/; expires=Sun, 30-Jun-2029 00:00:00 GMT"
+        puts "Set-Cookie: Bugzilla_password=$COOKIE(Bugzilla_password) ; path=/; expires=Sun, 30-Jun-2029 00:00:00 GMT"
+    }
+
+
+    set realpwd {}
+
+    if { [info exists COOKIE(Bugzilla_login)] && [info exists COOKIE(Bugzilla_password)] } {
+        set realpwd [PasswordForLogin $COOKIE(Bugzilla_login)]
+    }
+
+    if {[cequal $realpwd ""] || ![cequal $realpwd $COOKIE(Bugzilla_password)]} {
+        puts "Content-type: text/html\n"
+        puts "<H1>Please log in.</H1>"
+        puts "I need a legitimate e-mail address and password to continue."
+        if {[cequal $nexturl ""]} {
+            regexp {[^/]*$} $argv0 nexturl
+        }
+        set method POST
+        if {[info exists env(REQUEST_METHOD)]} {
+            set method $env(REQUEST_METHOD)
+        }
+        puts "
+<FORM action=$nexturl method=$method>
+<table>
+<tr>
+<td align=right><b>E-mail address:</b></td>
+<td><input size=35 name=Bugzilla_login></td>
+</tr>
+<tr>
+<td align=right><b>Password:</b></td>
+<td><input type=password size=35 name=Bugzilla_password></td>
+</tr>
+</table>
+"
+        foreach i [array names FORM] {
+            if {[regexp {^Bugzilla_} $i]} {
+                continue
+            }
+            puts "<input type=hidden name=$i value=\"[value_quote $FORM($i)]\">"
+        }
+        puts "
+<input type=submit value=Login name=GoAheadAndLogIn><hr>
+If you don't have a password, or have forgotten it, then please fill in the
+e-mail address above and click
+ here:<input type=submit value=\"E-mail me a password\"
+name=PleaseMailAPassword>
+</form>"
+        
+        exit
+    }
+}
+
+
+proc CopyOut {filename} {
+    if {[file exists $filename]} {
+        set fid [open $filename "r"]
+        while {[gets $fid line] > 0} {
+            puts $line
+        }
+        close $fid
+    }
+}
+
+proc PutHeader {title h1 {h2 ""}} {
+    puts "<HTML><HEAD><TITLE>$title</TITLE></HEAD>";
+    puts "<BODY   BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\"";
+    puts "LINK=\"#0000EE\" VLINK=\"#551A8B\" ALINK=\"#FF0000\">";
+
+    CopyOut "banner.html"
+
+    puts "<TABLE BORDER=0 CELLPADDING=12 CELLSPACING=0 WIDTH=\"100%\">";
+    puts " <TR>\n";
+    puts "  <TD>\n";
+    puts "   <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=2>\n";
+    puts "    <TR><TD VALIGN=TOP ALIGN=CENTER NOWRAP>\n";
+    puts "     <FONT SIZE=\"+3\"><B><NOBR>$h1</NOBR></B></FONT>\n";
+    puts "    </TD></TR><TR><TD VALIGN=TOP ALIGN=CENTER>\n";
+    puts "     <B>$h2</B>\n";
+    puts "    </TD></TR>\n";
+    puts "   </TABLE>\n";
+    puts "  </TD>\n";
+    puts "  <TD>\n";
+
+    CopyOut "blurb.html"
+
+    puts "</TD></TR></TABLE>\n";
+
+}
diff --git a/ant.jpg b/ant.jpg
new file mode 100644 (file)
index 0000000..440e836
Binary files /dev/null and b/ant.jpg differ
diff --git a/bug_form.tcl b/bug_form.tcl
new file mode 100755 (executable)
index 0000000..9e433b7
--- /dev/null
@@ -0,0 +1,216 @@
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+set 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,
+        date_format(creation_ts,'Y-m-d')
+from bugs
+where bug_id = $FORM(id)";
+
+SendSQL $query
+set ret [FetchSQLData]
+if {$ret != ""} {
+  set count 0
+  foreach field { bug_id product version rep_platform op_sys bug_status 
+                  resolution priority bug_severity component
+                  assigned_to reporter bug_file_loc short_desc 
+                  creation_ts} {
+    if { [regexp {^\{(.*)\}$} [lindex $ret $count] junk bug($field)] == 0 } {
+      set bug($field) [lindex $ret $count]
+    }
+    incr count
+  }
+  set error "none"
+} else {
+    puts "<TITLE>Bug Splat Error</TITLE>"
+    puts "<H1>Query Error</H1>Somehow something went wrong.  Possibly if you"
+    puts "mail this page to $maintainer, he will be able to fix things.<HR>"
+    puts "Bug $FORM(id) not found<H2>Query Text</H2><PRE>$query<PRE>"
+    exit 0
+}
+
+set bug(assigned_to) [DBID_to_name $bug(assigned_to)]
+set bug(reporter) [DBID_to_name $bug(reporter)]
+set bug(long_desc) [GetLongDescription $FORM(id)]
+
+
+GetVersionTable
+
+#
+# These should be read from the database ...
+#
+set resolution_popup [make_options $legal_resolution_no_dup $bug(resolution)]
+set platform_popup [make_options $legal_platform $bug(rep_platform)]
+set priority_popup [make_options $legal_priority $bug(priority)]
+set sev_popup [make_options $legal_severity $bug(bug_severity)]
+
+
+set component_popup [make_options $components($bug(product)) $bug(component)]
+
+set cc_element "<INPUT NAME=cc SIZE=30 VALUE=\"[ShowCcList $FORM(id)]\">"
+
+
+if {$bug(bug_file_loc) != "none" && $bug(bug_file_loc) != "NULL" && $bug(bug_file_loc) != ""} {
+  set URL "<B><A HREF=\"$bug(bug_file_loc)\">URL:</A></B>"
+} else {
+  set URL "<B>URL:</B>"
+}
+
+puts "
+<HEAD><TITLE>Bug $FORM(id) -- [html_quote $bug(short_desc)]</TITLE></HEAD><BODY>
+<FORM NAME=changeform METHOD=POST ACTION=\"process_bug.cgi\">
+<INPUT TYPE=HIDDEN NAME=\"id\" VALUE=$FORM(id)>
+<INPUT TYPE=HIDDEN NAME=\"was_assigned_to\" VALUE=\"$bug(assigned_to)\">
+  <TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0><TR>
+    <TD ALIGN=RIGHT><B>Bug#:</B></TD><TD>$bug(bug_id)</TD>
+    <TD ALIGN=RIGHT><B><A HREF=\"bug_status.html#rep_platform\">Platform:</A></B></TD>
+    <TD><SELECT NAME=rep_platform>$platform_popup</SELECT></TD>
+    <TD ALIGN=RIGHT><B>Version:</B></TD>
+    <TD><SELECT NAME=version>[make_options $versions($bug(product)) $bug(version)]</SELECT></TD>
+  </TR><TR>
+    <TD ALIGN=RIGHT><B>Product:</B></TD>
+    <TD><SELECT NAME=product>[make_options $legal_product $bug(product)]</SELECT></TD>
+    <TD ALIGN=RIGHT><B>OS:</B></TD><TD>$bug(op_sys)</TD>
+    <TD ALIGN=RIGHT><B>Reporter:</B></TD><TD>$bug(reporter)</TD>
+  </TR><TR>
+    <TD ALIGN=RIGHT><B><A HREF=\"bug_status.html\">Status:</A></B></TD>
+      <TD>$bug(bug_status)</TD>
+    <TD ALIGN=RIGHT><B><A HREF=\"bug_status.html#priority\">Priority:</A></B></TD>
+      <TD><SELECT NAME=priority>$priority_popup</SELECT></TD>
+    <TD ALIGN=RIGHT><B>Cc:</B></TD>
+      <TD> $cc_element </TD>
+  </TR><TR>
+    <TD ALIGN=RIGHT><B><A HREF=\"bug_status.html\">Resolution:</A></B></TD>
+      <TD>$bug(resolution)</TD>
+    <TD ALIGN=RIGHT><B><A HREF=\"bug_status.html#severity\">Severity:</A></B></TD>
+      <TD><SELECT NAME=bug_severity>$sev_popup</SELECT></TD>
+    <TD ALIGN=RIGHT><B>Component:</B></TD>
+      <TD><SELECT NAME=component>$component_popup</SELECT></TD>
+  </TR><TR>
+    <TD ALIGN=RIGHT><B><A HREF=\"bug_status.html#assigned_to\">Assigned&nbsp;To:
+        </A></B></TD>
+      <TD>$bug(assigned_to)</TD>
+  </TR><TR>
+    <TD ALIGN=\"RIGHT\">$URL
+    <TD COLSPAN=6>
+      <INPUT NAME=bug_file_loc VALUE=\"$bug(bug_file_loc)\" SIZE=60></TD>
+  </TR><TR>
+    <TD ALIGN=\"RIGHT\"><B>Summary:</B>
+    <TD COLSPAN=6>
+      <INPUT NAME=short_desc VALUE=\"[value_quote $bug(short_desc)]\" SIZE=60></TD>
+  </TR>
+</TABLE>
+<br>
+<B>Additional Comments:</B>
+<BR>
+<TEXTAREA WRAP=HARD NAME=comment ROWS=5 COLS=80></TEXTAREA><BR>
+<br>
+<INPUT TYPE=radio NAME=knob VALUE=none CHECKED>
+        Leave as <b>$bug(bug_status) $bug(resolution)</b><br>"
+
+# knum is which knob number we're generating, in javascript terms.
+
+set knum 1
+
+if {[cequal $bug(bug_status) NEW] || [cequal $bug(bug_status) ASSIGNED] || \
+        [cequal $bug(bug_status) REOPENED]} {
+    if {![cequal $bug(bug_status) ASSIGNED]} {
+        puts "<INPUT TYPE=radio NAME=knob VALUE=accept>
+            Accept bug (change status to <b>ASSIGNED</b>)<br>"
+        incr knum
+    }
+    if {[clength $bug(resolution)] > 0} {
+        puts "<INPUT TYPE=radio NAME=knob VALUE=clearresolution>"
+        puts "Clear the resolution (remove the current resolution of"
+        puts "<b>$bug(resolution)</b>)<br>"
+        incr knum
+    }
+    puts "<INPUT TYPE=radio NAME=knob VALUE=resolve>
+        Resolve bug, changing <A HREF=\"bug_status.html\">resolution</A> to
+        <SELECT NAME=resolution
+          ONCHANGE=\"document.changeform.knob\[$knum\].checked=true\">
+          $resolution_popup</SELECT><br>"
+    incr knum
+    puts "<INPUT TYPE=radio NAME=knob VALUE=duplicate>
+        Resolve bug, mark it as duplicate of bug # 
+        <INPUT NAME=dup_id SIZE=6 ONCHANGE=\"document.changeform.knob\[$knum\].checked=true\"><br>"
+    incr knum
+    set assign_element "<INPUT NAME=assigned_to SIZE=32 ONCHANGE=\"document.changeform.knob\[$knum\].checked=true\" VALUE=$bug(assigned_to)>"
+
+    puts "<INPUT TYPE=radio NAME=knob VALUE=reassign> 
+          <A HREF=\"bug_status.html#assigned_to\">Reassign</A> bug to
+          $assign_element
+        <br>"
+    incr knum
+    puts "<INPUT TYPE=radio NAME=knob VALUE=reassignbycomponent>
+          Reassign bug to owner of selected component<br>"
+    incr knum
+} else {
+    puts "<INPUT TYPE=radio NAME=knob VALUE=reopen> Reopen bug<br>"
+    incr knum
+    if {[cequal $bug(bug_status) RESOLVED]} {
+        puts "<INPUT TYPE=radio NAME=knob VALUE=verify>
+        Mark bug as <b>VERIFIED</b><br>"
+        incr knum
+    }
+    if {![cequal $bug(bug_status) CLOSED]} {
+        puts "<INPUT TYPE=radio NAME=knob VALUE=close>
+        Mark bug as <b>CLOSED</b><br>"
+        incr knum
+    }
+}
+puts "
+<INPUT TYPE=\"submit\" VALUE=\"Commit\">
+<INPUT TYPE=\"reset\" VALUE=\"Reset\">
+<INPUT TYPE=hidden name=form_name VALUE=process_bug>
+<BR>
+<FONT size=\"+1\"><B>
+ <A HREF=\"show_activity.cgi?id=$FORM(id)\">View Bug Activity</A>
+ <A HREF=\"long_list.cgi?buglist=$FORM(id)\">Format For Printing</A>
+ <A HREF=\"edit_desc.cgi?id=$FORM(id)\">Edit Long Description</A>
+</B></FONT><BR>
+</FORM>
+<table><tr><td align=left><B>Description:</B></td><td width=100%>&nbsp;</td>
+<td align=right>Opened:&nbsp;$bug(creation_ts)</td></tr></table>
+<HR>
+<PRE>
+[html_quote $bug(long_desc)]
+</PRE>
+<HR>"
+
+navigation_header
+
+puts "</BODY>"
+flush stdout
diff --git a/bug_status.html b/bug_status.html
new file mode 100755 (executable)
index 0000000..fff5585
--- /dev/null
@@ -0,0 +1,194 @@
+<HTML>
+
+<!--
+     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 <terry@mozilla.org>
+-->
+
+<TITLE>A Bug's Life Cycle</TITLE>
+
+<h1 ALIGN=CENTER>A Bug's Life Cycle</h1>
+
+The <B>status</B> and <B>resolution</B> field define and track the
+life cycle of a bug.
+
+<p>
+<TABLE BORDER=1 CELLPADDING=4>
+
+<TR ALIGN=CENTER VALIGN=TOP>
+<TD WIDTH=50%><H1>STATUS</H1> <TD><H1>RESOLUTION</H1>
+
+<TR VALIGN=TOP>
+<TD>The <B>status</B> field indicates the general health of a bug. Only
+certain status transitions are allowed.
+<TD>The <b>resolution</b> field indicates what happened to this bug.
+
+<TR VALIGN=TOP><TD>
+<DL><DT><B>NEW</B> 
+<DD> This bug has recently been added to the assignee's list of bugs
+     and must be processed. Bugs in this state may be accepted, and
+     become <B>ASSIGNED</B>, passed on to someone else, and remain
+     <B>NEW</B>, or resolved and marked <B>RESOLVED</B>.
+<DT><B>ASSIGNED</B> 
+<DD> This bug is not yet resolved, but is assigned to the proper
+     person. From here bugs can be given to another person and become
+     <B>NEW</B>, or resolved and become <B>RESOLVED</B>.
+<DT><B>REOPENED</B>
+<DD>This bug was once resolved, but the resolution was deemed
+     incorrect.  For example, a <B>WORKSFORME</B> bug is
+     <B>REOPENED</B> when more information shows up and the bug is now
+     reproducible.  From here bugs are either marked <B>ASSIGNED</B>
+     or <B>RESOLVED</B>.
+</DL>
+<TD>
+<DL>
+<DD> No resolution yet. All bugs which are <B>NEW</B> or
+     <B>ASSIGNED</B> have the resolution set to blank. All other bugs
+     will be marked with one of the following resolutions.
+</DL>
+
+<TR VALIGN=TOP><TD>
+<DL>
+<DT><B>RESOLVED</B> 
+<DD> A resolution has been taken, and it is awaiting verification by
+     QA. From here bugs are either re-opened and become
+     <B>REOPENED</B>, are marked <B>VERIFIED</B>, or are closed for good
+     and marked <B>CLOSED</B>.
+<DT><B>VERIFIED</B>
+<DD> QA has looked at the bug and the resolution and agrees that the
+     appropriate resolution has been taken.  Bugs remain in this state
+     until the product they were reported against actually ship, at
+     which point the become <B>CLOSED</B>.
+<DT><B>CLOSED</B> 
+<DD> The bug is considered dead, the resolution is correct. Any zombie
+     bugs who choose to walk the earth again must do so by becoming
+     <B>REOPENED</B>.
+</DL>
+
+<TD>
+<DL>
+<DT><B>FIXED</B>
+<DD> A fix for this bug is checked into the tree and tested.
+<DT><B>INVALID</B>
+<DD> The problem described is not a bug 
+<DT><B>WONTFIX</B>
+<DD> The problem described is a bug which will never be fixed.
+<DT><B>LATER</B>
+<DD> The problem described is a bug which will not be fixed in this
+     version of the product.
+<DT><B>REMIND</B>
+<DD> The problem described is a bug which will probably not be fixed in this
+     version of the product, but might still be.
+<DT><B>DUPLICATE</B>
+<DD> The problem is a duplicate of an existing bug. Marking a bug
+     duplicate requires the bug# of the duplicating bug and will at
+     least put that bug number in the description field.
+<DT><B>WORKSFORME</B>
+<DD> All attempts at reproducing this bug were futile, reading the
+     code produces no clues as to why this behavior would occur. If
+     more information appears later, please re-assign the bug, for
+     now, file it.
+</DL>
+</TABLE>
+
+<H1>Other Fields</H1>
+
+<table border=1 cellpadding=4><tr><td>
+<a name="severity"><h2>Severity</h2></a>
+
+This field describes the impact of a bug.
+
+<p>
+<p>
+<table>
+<tr><th>Critical</th><td>crashes, loss of data, severe memory leak 
+<tr><th>Major</th><td>major loss of function 
+<tr><th>Minor</th><td>minor loss of function, or other problem where easy workaround is present 
+<tr><th>Trivial</th><td>cosmetic problem like misspelt words or misaligned text 
+<tr><th>Enhancement</th><td>Request for enhancement
+</table> 
+
+</td><td>
+
+<a name="priority"><h2>Priority</h2></a>
+
+This field describes the importance and order in which a bug should be
+fixed.  The available priorities are:
+
+<p>
+<p>
+
+<table>
+<tr><th>P1</th><td>Most important
+<tr><th>P2</th><td>
+<tr><th>P3</th><td>
+<tr><th>P4</th><td>
+<tr><th>P5</th><td>Least important
+</table>
+</tr></table>
+
+
+<a name="area"><h2>Area</h2></a>
+This is the general area which is covered by the bug report.  This allows
+bugs to migrate over to testing, but not show up on the "daily bug list".
+Most bugs should have area set to <B>CODE</B>.  Legal values include:
+<UL>
+<LI> CODE
+<LI> JAVA
+<LI> TEST
+<LI> UI
+<LI> BUILD
+<LI> PERF
+<LI> i18n <i>(internationalization)</i>
+<LI> l10n <i>(localization)</i>
+</UL>
+<a name="rep_platform"><h2>Platform</h2></a>
+This is the platform against which the bug was reported.  Legal
+platforms include:
+
+<UL>
+<LI> All (happens on all platform; cross-platform bug)
+<LI> Macintosh
+<LI> PC
+<LI> X-Windows
+</UL>
+
+<b>Note:</b> Selecting the option "All" does not select bugs assigned against all platforms.  It
+merely selects bugs that <b>occur</b> on all platforms.
+
+<a name="assigned_to"><h2>Assigned To</h2></a>
+
+This is the person in charge of resolving the bug.  Every time this
+field changes, the status changes to <B>NEW</B> to make it easy to see
+which new bugs have appeared on a person's list.
+
+<p><A HREF="http://www.mozilla.org/owners.html">List of module owners.</a>
+<p>
+
+
+The default status for queries is set to NEW, ASSIGNED and REOPENED. When
+searching for bugs that have been resolved or verified, remember to set the
+status field appropriately. 
+
+<hr>
+<address><a href="http://home.netscape.com/people/terry/">Terry Weissman &lt;terry@netscape.com&gt;</a></address>
+<!-- hhmts start -->
+Last modified: Tue Aug 25 23:11:26 1998
+<!-- hhmts end -->
+</body> </html>
diff --git a/buglist.cgi b/buglist.cgi
new file mode 100755 (executable)
index 0000000..3ac68c4
--- /dev/null
@@ -0,0 +1,623 @@
+#! /usr/bonsaitools/bin/mysqltcl
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+puts "Content-type: multipart/x-mixed-replace;boundary=ThisRandomString"
+puts ""
+puts "--ThisRandomString"
+
+proc InitMessage {str} {
+    global initstr
+    append initstr "$str\n"
+    puts "Content-type: text/plain"
+    puts ""
+    puts $initstr
+    puts ""
+    puts "--ThisRandomString"
+    flush stdout
+}
+
+
+# The below "if catch" stuff, if uncommented, will trap any error, and
+# mail the error messages to terry.  What a hideous, horrible
+# debugging hack.
+
+# if {[catch {
+
+
+source "CGI.tcl"
+
+ConnectToDatabase
+
+if {![info exists FORM(cmdtype)]} {
+    # This can happen if there's an old bookmark to a query...
+    set FORM(cmdtype) doit
+}
+
+switch $FORM(cmdtype) {
+    runnamed {
+        set buffer $COOKIE(QUERY_$FORM(namedcmd))
+        ProcessFormFields $buffer
+    }
+    editnamed {
+        puts "Content-type: text/html
+Refresh: 0; URL=query.cgi?$COOKIE(QUERY_$FORM(namedcmd))
+
+<TITLE>What a hack.</TITLE>
+Loading your query named <B>$FORM(namedcmd)</B>..."
+        exit
+    }
+    forgetnamed {
+        puts "Set-Cookie: QUERY_$FORM(namedcmd)= ; path=/ ; expires=Sun, 30-Jun-99 00:00:00 GMT
+Content-type: text/html
+
+<HTML>
+<TITLE>Forget what?</TITLE>
+OK, the <B>$FORM(namedcmd)</B> query is gone.
+<P>
+<A HREF=query.cgi>Go back to the query page.</A>"
+    exit
+    }
+    asnamed {
+        if {[regexp {^[a-zA-Z0-9_ ]+$} $FORM(newqueryname)]} {
+    puts "Set-Cookie: QUERY_$FORM(newqueryname)=$buffer ; path=/ ; expires=Sun, 30-Jun-99 00:00:00 GMT
+Content-type: text/html
+
+<HTML>
+<TITLE>OK, done.</TITLE>
+OK, you now have a new query named <B>$FORM(newqueryname)</B>.
+
+<P>
+
+<A HREF=query.cgi>Go back to the query page.</A>"
+        } else {
+            puts "Content-type: text/html
+
+<HTML>
+<TITLE>Picky, picky.</TITLE>
+Query names can only have letters, digits, spaces, or underbars.  You entered 
+\"<B>$FORM(newqueryname)</B>\", which doesn't cut it.
+<P>
+Click the <B>Back</B> button and type in a valid name for this query."
+        }
+        exit
+    }
+    asdefault {
+        puts "Set-Cookie: DEFAULTQUERY=$buffer ; path=/ ; expires=Sun, 30-Jun-99 00:00:00 GMT
+Content-type: text/html
+
+<HTML>
+<TITLE>OK, default is set.</TITLE>
+OK, you now have a new default query.
+
+<P>
+
+<A HREF=query.cgi>Go back to the query page, using the new default.</A>"
+        exit
+    }
+}
+
+proc qadd { item } {
+  global query
+  append query "$item"
+}
+
+
+proc DefCol {name k t {s ""} {q 0}} {
+    global key title sortkey needquote
+    set key($name) $k
+    set title($name) $t
+    if {![cequal $s ""]} {
+        set sortkey($name) $s
+    }
+    set needquote($name) $q
+}
+
+DefCol resolved_ts "bugs.resolved_ts" DateResolved bugs.resolved_ts
+DefCol verified_ts "bugs.verified_ts" DateVerified bugs.verified_ts
+DefCol opendate "date_format(bugs.creation_ts,'Y-m-d')" Opened bugs.creation_ts
+DefCol changeddate "date_format(bugs.delta_ts,'Y-m-d')" Changed bugs.delta_ts
+DefCol severity "substring(bugs.bug_severity, 1, 3)" Sev bugs.bug_severity
+DefCol priority "substring(bugs.priority, 1, 3)" Pri bugs.priority
+DefCol platform "substring(bugs.rep_platform, 1, 3)" Plt bugs.rep_platform
+DefCol owner "assign.login_name" Owner assign.login_name
+DefCol reporter "report.login_name" Reporter report.login_name
+DefCol status "substring(bugs.bug_status,1,4)" State bugs.bug_status
+DefCol resolution "substring(bugs.resolution,1,4)" Res bugs.resolution
+DefCol summary "substring(bugs.short_desc, 1, 60)" Summary {} 1
+DefCol summaryfull "bugs.short_desc" Summary {} 1
+DefCol component "substring(bugs.component, 1, 8)" Comp bugs.component
+DefCol product "substring(bugs.product, 1, 8)" Product bugs.product
+DefCol version "substring(bugs.version, 1, 5)" Vers bugs.version
+DefCol os "substring(bugs.op_sys, 1, 4)" OS bugs.op_sys
+DefCol status_summary "bugs.status_summary" Status_Summary {} 1
+
+if {[info exists COOKIE(COLUMNLIST)]} {
+    set collist $COOKIE(COLUMNLIST)
+} else {
+    set collist $default_column_list
+}
+
+set dotweak [info exists FORM(tweak)]
+
+if {$dotweak} {
+    confirm_login
+}
+
+
+puts "Content-type: text/plain\n"
+
+set query "
+select
+        bugs.bug_id"
+
+
+foreach c $collist {
+    append query ",
+\t$key($c)"
+}
+
+
+if {$dotweak} {
+    append query ",
+bugs.product,
+bugs.bug_status"
+}
+
+append query "
+from   bugs,
+       profiles assign,
+       profiles report,
+       versions projector
+where  bugs.assigned_to = assign.userid 
+and    bugs.reporter = report.userid
+and    bugs.product = projector.program
+and    bugs.version = projector.value
+"
+
+if {[info exists FORM(sql)]} {
+  append query "and (\n[join [url_decode $FORM(sql)] { }]\n)"
+} else {
+
+
+  set legal_fields { bug_id product version rep_platform op_sys bug_status
+                     resolution priority bug_severity assigned_to reporter
+                     bug_file_loc short_desc component
+                     status_summary resolved_ts verified_ts}
+
+  foreach field [array names FORM] {
+    if { [ lsearch $legal_fields $field ] != -1 && ![cequal $FORM($field) ""]} {
+      qadd "\tand (\n"
+      set or ""
+      if { $field == "assigned_to" || $field == "reporter" || $field == "qa_assigned_to"} {
+        foreach p [split $FORM($field) ","] {
+          qadd "\t\t${or}bugs.$field = [DBname_to_id $p]\n"
+          set or "or "
+        }
+      } elseif { $field == "resolved_ts"} {
+                        if {! [cequal $FORM(resolved_ts_2) ""]} { 
+                                qadd "\t\tbugs.resolved_ts between \n\t\t\tTO_DATE('$FORM($field)','DD-MON-YY') and\n \t\t\tTO_DATE('$FORM(resolved_ts_2)', 'DD-MON-YY')\n"
+                        } else {
+                                qadd "\t\tTO_CHAR (bugs.resolved_ts,'DD-MON-YY') = '[string toupper $FORM($field)]'\n"
+                                }
+      } elseif { $field == "verified_ts"} {
+                        if {! [cequal $FORM(verified_ts_2) ""]} {
+                                qadd "\t\tbugs.verified_ts between \n\t\t\tTO_DATE('$FORM($field)','DD-MON-YY') and\n \t\t\tTO_DATE('$FORM(verified_ts_2)', 'DD-MON-YY')\n"
+                        } else {
+                                qadd "\t\tTO_CHAR (bugs.verified_ts,'DD-MON-YY') = '[string toupper $FORM($field)]'\n"
+                                }
+      } else {
+        foreach v $MFORM($field) {
+          if {[cequal $v "(empty)"]} {
+              qadd "\t\t${or}bugs.$field is null\n"
+          } else {
+              qadd "\t\t${or}bugs.$field = '$v'\n"
+          }
+          set or "or "
+        }
+      }
+      qadd "\t)\n"
+    }
+  }
+
+  if {[lookup FORM changedin] != ""} {
+    qadd "and to_days(now()) - to_days(bugs.delta_ts) <= $FORM(changedin) "
+  }
+}
+
+if {[info exists FORM(order)]} {
+    qadd "order by "
+    switch -glob $FORM(order) {
+        *.* {}
+        *Number* {
+            set FORM(order) bugs.bug_id
+        }
+        *Import* {
+            set FORM(order) bugs.priority
+        }
+        *Assign* {
+            set FORM(order) "assign.login_name, bugs.bug_status, priorities.rank, bugs.bug_id"
+        }
+        default {
+            set FORM(order) "bugs.bug_status, priorities.rank, assign.login_name, bugs.bug_id"
+        }
+    }
+    if {[cequal [cindex $FORM(order) 0] "\{"]} {
+        # I don't know why this happens, but...
+        set FORM(order) [lindex $FORM(order) 0]
+    }
+    qadd $FORM(order)
+}
+
+puts "Please stand by ..."
+if {[info exists FORM(debug)]} {
+    puts $query
+}
+flush stdout
+set child 0
+if {[info exists FORM(keepalive)]} {
+  set child [fork]
+  if {$child == 0} {
+    while 1 {
+      puts "Still waiting ..."
+      flush stdout
+      sleep 10
+    }
+    puts "Child process died, what's up?"
+    flush stdout
+    exit 0
+  }
+}
+SendSQL $query
+
+set count 0
+set bugl ""
+proc pnl { str } {
+  global bugl
+  append bugl "$str"
+}
+
+regsub -all {[&?]order=[^&]*} $buffer {} fields
+regsub -all {[&?]cmdtype=[^&]*} $fields {} fields
+
+
+if {[info exists FORM(order)]} {
+    regsub -all { } ", $FORM(order)" "%20" oldorder
+} else {
+    set oldorder ""
+}
+
+if {$dotweak} {
+    pnl "<FORM NAME=changeform METHOD=POST ACTION=\"process_bug.cgi\">"
+}
+
+set tablestart "<TABLE CELLSPACING=0 CELLPADDING=2>
+<TR ALIGN=LEFT><TH>
+<A HREF=\"buglist.cgi?[set fields]&order=bugs.bug_id\">ID</A>"
+
+
+foreach c $collist {
+    if {$needquote($c)} {
+        append tablestart "<TH WIDTH=100% valigh=left>"
+    } else {
+        append tablestart "<TH valign=left>"
+    }
+    if {[info exists sortkey($c)]} {
+        append tablestart "<A HREF=\"buglist.cgi?[set fields]&order=$sortkey($c)$oldorder\">$title($c)</A>"
+    } else {
+        append tablestart $title($c)
+    }
+}
+
+append tablestart "\n"
+
+set dotweak [info exists FORM(tweak)]
+
+set p_true 1
+
+while { $p_true } {
+    set result [FetchSQLData]
+    set p_true [MoreSQLData]
+    if { $result != "" } { 
+        set bug_id [lvarpop result]
+        if {![info exists seen($bug_id)]} {
+            set seen($bug_id) 1
+            incr count
+            if {($count % 200) == 0} {
+                # Too big tables take too much browser memory...
+                pnl "</TABLE>$tablestart"
+            }
+            if {[info exists buglist]} {
+                append buglist ":$bug_id"
+            } else {
+                set buglist $bug_id
+            }
+            pnl "<TR VALIGN=TOP ALIGN=LEFT><TD>"
+            if {$dotweak} {
+                pnl "<input type=checkbox name=id_$bug_id>"
+            }
+            pnl "<A HREF=\"show_bug.cgi?id=$bug_id\">"
+            pnl "$bug_id</A> "
+            foreach c $collist {
+                set value [lvarpop result]
+                set nowrap {} 
+
+                #-- This cursor is used to pick the login_name to be
+                #   displayed on the query list as the field value may or
+                #   maynot have vales associated to it
+
+                if { $c == "qa_assigned_to"} {
+                     set dml_cur [ oraopen $lhandle ]
+
+                     orasql $dml_cur "select login_name 
+                                      from   profiles 
+                                      where  userid = $value"
+
+                     set cur_resultset [orafetch $dml_cur]
+
+                     if {$cur_resultset != ""} { 
+                         set  value $cur_resultset 
+                         set nowrap {nowrap}
+                     } else {
+                         set  value ""
+                     }
+
+                     oraclose $dml_cur
+
+                } 
+
+                if {$needquote($c)} {
+                    set value [html_quote $value]
+                } else {
+                    set value "<nobr>$value</nobr>"
+                }
+                pnl "<td $nowrap>$value"
+            }
+            if {$dotweak} {
+                set value [lvarpop result]
+                set prodarray($value) 1
+                set value [lvarpop result]
+                set statusarray($value) 1
+            }
+            pnl "\n"
+        }
+    }
+}
+if {$child != 0} {
+  kill $child
+}
+puts ""
+puts "--ThisRandomString"
+
+set toolong 0
+puts "Content-type: text/html"
+if { [info exists buglist] } {
+    if {[clength $buglist] < 4000} {
+        puts "Set-Cookie: BUGLIST=$buglist\n"
+    } else {
+        puts "Set-Cookie: BUGLIST=\n"
+        set toolong 1
+    }
+} else {
+  puts ""
+}
+set env(TZ) PST8PDT
+
+PutHeader "Bug List" "Bug List"
+
+puts -nonewline "
+<CENTER><H1>M<font -= 2>OZILLA</font> B<font -= 2>UGS</font></H1>
+<B>[fmtclock [getclock ]]</B>"
+if {[info exists FORM(debug)]} { puts "<PRE>$query</PRE>" }
+
+if {$toolong} {
+    puts "<h2>This list is too long for bugzilla's little mind; the"
+    puts "Next/Prev/First/Last buttons won't appear.</h2>"
+}
+
+set cdata [ split [read_file -nonewline "comments"] "\n" ]
+random seed
+puts {<HR><I><A HREF="newquip.html">}
+puts [lindex $cdata [random [llength $cdata]]]</I></A></CENTER>
+puts "<HR SIZE=10>$tablestart"
+puts $bugl
+puts "</TABLE>"
+
+switch $count {
+    0 {
+        puts "Zarro Boogs found."
+    }
+    1 {
+        puts "One bug found."
+    }
+    default {
+        puts "$count bugs found."
+    }
+}
+
+if {$dotweak} {
+    GetVersionTable
+    puts "
+<SCRIPT>
+numelements = document.changeform.elements.length;
+function SetCheckboxes(value) {
+    for (var i=0 ; i<numelements ; i++) {
+        item = document.changeform.elements\[i\];
+        item.checked = value;
+    }
+}
+document.write(\" <input type=button value=\\\"Uncheck All\\\" onclick=\\\"SetCheckboxes(false);\\\"> <input type=button value=\\\"Check All\\\" onclick=\\\"SetCheckboxes(true);\\\">\");
+</SCRIPT>"
+    set resolution_popup [make_options $legal_resolution_no_dup FIXED]
+    GetVersionTable
+    set prod_list [array names prodarray]
+    set list $prod_list
+    set legal_target_versions $versions([lvarpop list])
+    foreach p $list {
+        set legal_target_versions [intersect $legal_target_versions \
+                                       $versions($p)]
+    }
+    set version_popup [make_options \
+                              [concat "-blank-" $legal_target_versions] \
+                              $dontchange]
+    set platform_popup [make_options $legal_platform $dontchange]
+    set priority_popup [make_options $legal_priority $dontchange]
+    set sev_popup [make_options $legal_severity $dontchange]
+    if {[llength $prod_list] == 1} {
+        set prod_list [lindex $prod_list 0 ]
+        set legal_component [linsert $components($prod_list) 0 { }]
+    } else {
+        set legal_component { }
+    }
+
+    set component_popup [make_options $legal_component $dontchange]
+
+    set product_popup [make_options $legal_product $dontchange]
+
+
+    puts "
+<hr>
+<TABLE>
+<TR>
+    <TD ALIGN=RIGHT><B>Product:</B></TD>
+    <TD><SELECT NAME=product>$product_popup</SELECT></TD>
+    <TD ALIGN=RIGHT><B>Version:</B></TD>
+    <TD><SELECT NAME=version>$version_popup</SELECT></TD>
+<TR>
+    <TD ALIGN=RIGHT><B><A HREF=\"bug_status.html#rep_platform\">Platform:</A></B></TD>
+    <TD><SELECT NAME=rep_platform>$platform_popup</SELECT></TD>
+    <TD ALIGN=RIGHT><B><A HREF=\"bug_status.html#priority\">Priority:</A></B></TD>
+    <TD><SELECT NAME=priority>$priority_popup</SELECT></TD>
+</TR>
+<TR>
+    <TD ALIGN=RIGHT><B>Component:</B></TD>
+    <TD><SELECT NAME=component>$component_popup</SELECT></TD>
+    <TD ALIGN=RIGHT><B><A HREF=\"bug_status.html#severity\">Severity:</A></B></TD>
+    <TD><SELECT NAME=bug_severity>$sev_popup</SELECT></TD>
+</TR>
+</TABLE>
+
+<INPUT NAME=multiupdate value=Y TYPE=hidden>
+
+<B>Additional Comments:</B>
+<BR>
+<TEXTAREA WRAP=HARD NAME=comment ROWS=5 COLS=80></TEXTAREA><BR>"
+
+    # knum is which knob number we're generating, in javascript terms.
+
+    set knum 0
+    puts "
+<INPUT TYPE=radio NAME=knob VALUE=none CHECKED>
+        Do nothing else<br>"
+    incr knum
+    puts "
+<INPUT TYPE=radio NAME=knob VALUE=accept>
+        Accept bugs (change status to <b>ASSIGNED</b>)<br>"
+    incr knum
+    if {![info exists statusarray(CLOSED)] && \
+            ![info exists statusarray(VERIFIED)] && \
+            ![info exists statusarray(RESOLVED)]} {
+        puts "
+<INPUT TYPE=radio NAME=knob VALUE=clearresolution>
+        Clear the resolution<br>"
+        incr knum
+        puts "
+<INPUT TYPE=radio NAME=knob VALUE=resolve>
+        Resolve bugs, changing <A HREF=\"bug_status.html\">resolution</A> to
+        <SELECT NAME=resolution
+          ONCHANGE=\"document.changeform.knob\[$knum\].checked=true\">
+          $resolution_popup</SELECT><br>"
+        incr knum
+    }
+    if {![info exists statusarray(NEW)] && \
+            ![info exists statusarray(ASSIGNED)] && \
+            ![info exists statusarray(REOPENED)]} {
+        puts "
+<INPUT TYPE=radio NAME=knob VALUE=reopen> Reopen bugs<br>"
+        incr knum
+    }
+    if {[llength [array names statusarray]] == 1} {
+        if {[info exists statusarray(RESOLVED)]} {
+            puts "
+<INPUT TYPE=radio NAME=knob VALUE=verify>
+        Mark bugs as <b>VERIFIED</b><br>"
+            incr knum
+        }
+        if {[info exists statusarray(VERIFIED)]} {
+            puts "
+<INPUT TYPE=radio NAME=knob VALUE=close>
+        Mark bugs as <b>CLOSED</b><br>"
+            incr knum
+        }
+    }
+    puts "
+<INPUT TYPE=radio NAME=knob VALUE=reassign> 
+        <A HREF=\"bug_status.html#assigned_to\">Reassign</A> bugs to
+        <INPUT NAME=assigned_to SIZE=32
+          ONCHANGE=\"document.changeform.knob\[$knum\].checked=true\"
+          VALUE=\"$COOKIE(Bugzilla_login)\"><br>"
+    incr knum
+    puts "<INPUT TYPE=radio NAME=knob VALUE=reassignbycomponent>
+          Reassign bugs to owner of selected component<br>"
+    incr knum
+
+    puts "
+<p>
+<font size=-1>
+To make changes to a bunch of bugs at once:
+<ol>
+<li> Put check boxes next to the bugs you want to change.
+<li> Adjust above form elements.  (It's <b>always</b> a good idea to add some
+     comment explaining what you're doing.)
+<li> Click the below \"Commit\" button.
+</ol></font>
+<INPUT TYPE=SUBMIT VALUE=Commit>
+</FORM><hr>"
+}
+
+
+if {$count > 0} {
+  puts "<FORM METHOD=POST ACTION=\"long_list.cgi\">
+<INPUT TYPE=HIDDEN NAME=buglist VALUE=$buglist>
+<INPUT TYPE=SUBMIT VALUE=\"Long Format\">
+<A HREF=\"query.cgi\">Query Page</A>
+<A HREF=\"colchange.cgi?$buffer\">Change columns</A>
+</FORM>"
+    if {!$dotweak && $count > 1} {
+        puts "<A HREF=\"buglist.cgi?[set fields]&tweak=1\">Make changes to several of these bugs at once.</A>"
+    }
+}
+puts "--ThisRandomString--"
+flush stdout
+
+#
+# Below is second part of hideous "if catch" stuff from above. 
+#
+#
+# 
+# }]} {
+#     exec /usr/lib/sendmail -t << "To: terry
+# 
+# 
+# $query
+# 
+# $errorInfo
+# "
+# }
diff --git a/changepassword.cgi b/changepassword.cgi
new file mode 100755 (executable)
index 0000000..2e0a4f0
--- /dev/null
@@ -0,0 +1,74 @@
+#! /usr/bonsaitools/bin/mysqltcl
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+source "CGI.tcl"
+
+confirm_login
+
+if {![info exists FORM(pwd1)]} {
+    puts "Content-type: text/html
+
+<H1>Change your password</H1>
+<form method=post>
+<table>
+<tr>
+<td align=right>Please enter the new password for <b>$COOKIE(Bugzilla_login)</b>:</td>
+<td><input type=password name=pwd1></td>
+</tr>
+<tr>
+<td align=right>Re-enter your new password:</td>
+<td><input type=password name=pwd2></td>
+</table>
+<input type=submit value=Submit>"
+    exit
+}
+
+if {![cequal $FORM(pwd1) $FORM(pwd2)]} {
+    puts "Content-type: text/html
+
+<H1>Try again.</H1>
+The two passwords you entered did not match.  Please click <b>Back</b> and try again."
+    exit
+}
+
+
+set pwd $FORM(pwd1)
+
+
+if {![regexp {^[a-zA-Z0-9-_]*$} $pwd] || [clength $pwd] < 3 || [clength $pwd] > 15} {
+    puts "Content-type: text/html
+
+<H1>Sorry; we're picky.</H1>
+Please choose a password that is between 3 and 15 characters long, and that
+contains only numbers, letters, hyphens, or underlines.
+<p>
+Please click <b>Back</b> and try again."
+    exit
+}
+
+
+puts "Content-type: text/html\n"
+
+SendSQL "update profiles set password='$pwd' where login_name='[SqlQuote $COOKIE(Bugzilla_login)]'"
+
+puts "<H1>OK, done.</H1>
+Your new password has been set.
+<p>
+<a href=query.cgi>Back to query page.</a>"
diff --git a/colchange.cgi b/colchange.cgi
new file mode 100755 (executable)
index 0000000..3adc475
--- /dev/null
@@ -0,0 +1,88 @@
+#! /usr/bonsaitools/bin/mysqltcl
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+source "CGI.tcl"
+
+puts "Content-type: text/html"
+
+# The master list not only says what fields are possible, but what order
+# they get displayed in.
+
+set masterlist {opendate changeddate severity priority platform owner reporter status
+    resolution component product version project os summary summaryfull status_summary resolved_ts verified_ts}
+
+
+if {[info exists FORM(rememberedquery)]} {
+    if {[info exists FORM(resetit)]} {
+        set collist $default_column_list
+    } else {
+        set collist {}
+        foreach i $masterlist {
+            if {[info exists FORM(column_$i)]} {
+                lappend collist $i
+            }
+        }
+    }
+    puts "Set-Cookie: COLUMNLIST=$collist ; path=/ ; expires=Sun, 30-Jun-99 00:00:00 GMT"
+    puts "Refresh: 0; URL=buglist.cgi?$FORM(rememberedquery)"
+    puts ""
+    puts "<TITLE>What a hack.</TITLE>"
+    puts "Resubmitting your query with new columns..."
+    exit
+}
+
+if {[info exists COOKIE(COLUMNLIST)]} {
+    set collist $COOKIE(COLUMNLIST)
+} else {
+    set collist $default_column_list
+}
+
+foreach i $masterlist {
+    set desc($i) $i
+}
+
+set desc(summary) "Summary (first 60 characters)"
+set desc(summaryfull) "Full Summary"
+
+
+puts ""
+puts "Check which columns you wish to appear on the list, and then click on"
+puts "submit."
+puts "<p>"
+puts "<FORM ACTION=colchange.cgi>"
+puts "<INPUT TYPE=HIDDEN NAME=rememberedquery VALUE=$buffer>"
+
+foreach i $masterlist {
+    if {[lsearch $collist $i] >= 0} {
+        set c CHECKED
+    } else {
+        set c ""
+    }
+    puts "<INPUT TYPE=checkbox NAME=column_$i $c>$desc($i)<br>"
+}
+puts "<P>"
+puts "<INPUT TYPE=\"submit\" VALUE=\"Submit\">"
+puts "</FORM>"
+puts "<FORM ACTION=colchange.cgi>"
+puts "<INPUT TYPE=HIDDEN NAME=rememberedquery VALUE=$buffer>"
+puts "<INPUT TYPE=HIDDEN NAME=resetit VALUE=1>"
+puts "<INPUT TYPE=\"submit\" VALUE=\"Reset to Bugzilla default\">"
+puts "</FORM>"
diff --git a/doclosebug.cgi b/doclosebug.cgi
new file mode 100755 (executable)
index 0000000..cfb3539
--- /dev/null
@@ -0,0 +1,53 @@
+#! /usr/bonsaitools/bin/mysqltcl
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+source "CGI.tcl"
+puts "Content-type: text/plain\n"
+
+set query "update bugs\nset 
+bug_status=RESOLVED,
+bug_resolution=FIXED
+where bug_id = $FORM(id)"
+
+set newcomment "Fixed by changes in $FORM(directory):"
+foreach i $FORM(fileversions) {
+    lassign $i file version
+    append newcomment "\n  $file ($version)"
+}
+
+puts "Query is $query"
+puts "Comment is $newcomment"
+
+exit
+
+ConnectToDatabase
+
+SendSQL $query
+
+while {[MoreSQLData]} {
+  FetchSQLData
+  set result [MoreSQLData]
+}
+
+AppendComment $FORM(id) $FORM(who) $newcomment
+
+
+exec ./processmail $FORM(id) < /dev/null > /dev/null 2> /dev/null &
diff --git a/edit_desc.cgi b/edit_desc.cgi
new file mode 100755 (executable)
index 0000000..7f386b8
--- /dev/null
@@ -0,0 +1,112 @@
+#! /usr/bonsaitools/bin/mysqltcl
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+source "CGI.tcl"
+confirm_login
+
+puts "Content-type: text/html\n"
+ConnectToDatabase
+if {[info exists FORM(commit)]} {
+  puts "<TITLE>Changing Long Description for bug [FormData id]</TITLE>"
+  set tmpfile [TmpName ldesc.[pid]]
+  SendSQL "select rowid from bugs where bug_id = [FormData id]"
+  set r [FetchSQLData]
+  set lfile [open $tmpfile w]
+  puts -nonewline $lfile [FormData long_desc]
+  close $lfile
+  orawritelong $oc [lindex $r 0] bugs long_desc $tmpfile
+  unlink $tmpfile
+  oracommit $oc
+  puts "<H1>Long Description Changed</H1>"
+  puts "<UL><LI>"
+  puts "<A HREF=\"show_bug.cgi?id=[FormData id]\">Show Bug #[FormData id]</A>"
+  puts "<LI><A HREF=\"query.cgi\">Query Page</A>"
+  exec ./processmail [FormData id] < /dev/null > /dev/null 2> /dev/null &
+  exit 0
+}
+
+
+puts "<TITLE>Editing Long Description for bug [FormData id]</TITLE>"
+
+puts "<H2>Be Careful</H2>"
+puts "Many people think that the ability to edit the full long description
+is a bad thing and that developers should not be allowed to do this,
+because information can get lost.  Please do not use this feature casually.
+<P><HR>"
+
+set generic_query {
+select
+  bugs.bug_id,
+  bugs.product,
+  bugs.version,
+  bugs.rep_platform,
+  bugs.op_sys,
+  bugs.bug_status,
+  bugs.bug_severity,
+  bugs.priority,
+  bugs.resolution,
+  assign.login_name,
+  report.login_name,
+  bugs.bug_file_loc,
+  bugs.short_desc
+from bugs,profiles assign,profiles report,priorities
+where assign.userid = bugs.assigned_to and report.userid = bugs.reporter and
+}
+
+
+SendSQL "$generic_query bugs.bug_id = [FormData id]"
+set result [ FetchSQLData ]
+puts "<TABLE WIDTH=100%>"
+puts "<TD COLSPAN=4><TR><DIV ALIGN=CENTER><B><FONT =\"+3\">[html_quote [lindex $result 13]]</B></FONT></DIV>"
+puts "<TR><TD><B>Bug#:</B> [lindex $result 0]"
+puts "<TD><B>Product:</B> [lindex $result 1]"
+puts "<TD><B>Version:</B> [lindex $result 2]"
+puts "<TD><B>Platform:</B> [lindex $result 3]"
+puts "<TR><TD><B>OS/Version:</B> [lindex $result 4]"
+puts "<TD><B>Status:</B> [lindex $result 5]"
+puts "<TD><B>Severity:</B> [lindex $result 6]"
+puts "<TD><B>Priority:</B> [lindex $result 7]"
+puts "</TD><TD><B>Resolution:</B> [lindex $result 8]</TD>"
+puts "<TD><B>Assigned To:</B> [lindex $result 9]"
+puts "<TD><B>Reported By:</B> [lindex $result 10]"
+puts "<TR><TD COLSPAN=6><B>URL:</B> [html_quote [lindex $result 11]]"
+puts "<TR><TD><B>Description:</B>\n</TABLE>"
+
+set ldesc [GetLongDescription [FormData id]]
+set lines [llength [split $ldesc "\n"]]
+incr lines 10
+if {$lines > 100} {
+  set lines 100
+}
+if {[regexp {Macintosh} $env(HTTP_USER_AGENT)]} {
+  set cols 160
+} else {
+  set cols 80
+}
+
+puts "<FORM METHOD=POST ACTION=\"edit_desc.cgi\">
+<INPUT TYPE=HIDDEN NAME=\"id\" VALUE=$FORM(id)>
+<INPUT TYPE=HIDDEN NAME=\"commit\" VALUE=yes>
+<TEXTAREA NAME=long_desc WRAP=HARD COLS=$cols ROWS=$lines>
+[html_quote $ldesc]
+</TEXTAREA>
+<INPUT TYPE=SUBMIT VALUE=\"Change Description\">
+</FORM>"
diff --git a/enter_bug.cgi b/enter_bug.cgi
new file mode 100755 (executable)
index 0000000..f6fdb7d
--- /dev/null
@@ -0,0 +1,227 @@
+#! /usr/bonsaitools/bin/mysqltcl
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+
+source CGI.tcl
+confirm_login
+
+puts "Content-type: text/html\n"
+
+
+
+proc pickplatform {} {
+    global env FORM
+    if {[formvalue rep_platform] != ""} {
+        return [formvalue rep_platform]
+    }
+    switch -regexp $env(HTTP_USER_AGENT) {
+        {Mozilla.*\(X11} {return "X-Windows"}
+        {Mozilla.*\(Windows} {return "PC"}
+        {Mozilla.*\(Macintosh} {return "Macintosh"}
+        {Mozilla.*\(Win} {return "PC"}
+        default {return "PC"}
+    }
+}
+
+proc pickproduct {} {
+    global FORM env COOKIE product versions
+    set product missingProductSoPickDefault
+    
+    set product [formvalue product]
+    if {$product == ""} {
+        if {[info exists COOKIE(PRODUCT)]} {
+            set product $COOKIE(PRODUCT)
+        } else {
+            switch -regexp $env(HTTP_USER_AGENT) {
+                {2.0Gold}       {set product "Hearst"}
+                {4\.0.*; *Nav} { set product "Ratbert"}
+                {4\.0}  {set product "Communicator"}
+                {3\.0}  {set product "Akbar"}
+                {2\.0}  {set product "Cheddar"}
+            }
+        }
+    }
+    if {![info exists versions($product)]} { set product "Communicator" }
+    return $product
+}
+
+proc pickversion {} {
+    global env versions product FORM
+    
+    set version [formvalue version]
+    if {$version == ""} {
+        regexp {Mozilla[ /]([^ ]*) } $env(HTTP_USER_AGENT) foo version
+        switch -regexp $env(HTTP_USER_AGENT) {
+            {4\.09} { set version "4.5" }
+        }
+    }
+    
+    if {[lsearch -exact $versions($product) $version] >= 0} {
+        return $version
+    } else {
+        if {[info exists COOKIE(VERSION-$product)]} {
+            if {[lsearch -exact $versions($product) $COOKIE(VERSION-$Product)] >= 0} {
+                return $COOKIE(VERSION-$Product)
+            }
+        }
+    }
+    return [lindex $versions($product) 0]
+}
+
+
+proc pickcomponent {} {
+    global components product FORM
+    set result [formvalue component]
+    if {![cequal $result ""] && \
+            [lsearch -exact $components($product) $result] < 0} {
+        set result ""
+    }
+    return $result
+}
+
+
+proc pickos {} {
+    global env FORM
+    if {[formvalue op_sys] != ""} {
+        return [formvalue op_sys]
+    }
+    switch -regexp $env(HTTP_USER_AGENT) {
+        {Mozilla.*\(.*;.*; IRIX.*\)}    {return "IRIX"}
+        {Mozilla.*\(.*;.*; 32bit.*\)}   {return "Windows 95"}
+        {Mozilla.*\(.*;.*; 16bit.*\)}   {return "Windows 3.1"}
+        {Mozilla.*\(.*;.*; 68K.*\)}     {return "System 7.5"}
+        {Mozilla.*\(.*;.*; PPC.*\)}     {return "System 7.5"}
+        {Mozilla.*\(.*;.*; OSF.*\)}     {return "OSF/1"}
+        {Mozilla.*\(.*;.*; Linux.*\)}   {return "Linux"}
+        {Mozilla.*\(.*;.*; SunOS 5.*\)} {return "Solaris"}
+        {Mozilla.*\(.*;.*; SunOS.*\)}   {return "SunOS"}
+        {Mozilla.*\(.*;.*; SunOS.*\)}   {return "SunOS"}
+        {Mozilla.*\(Win16.*\)}          {return "Windows 3.1"}
+        {Mozilla.*\(Win95.*\)}          {return "Windows 95"}
+        {Mozilla.*\(WinNT.*\)}          {return "Windows NT"}
+        default {return "other"}
+    }
+}
+
+proc formvalue {name {default ""}} {
+    global FORM
+    if {[info exists FORM($name)]} {
+        return [FormData $name]
+    }
+    return $default
+}
+
+GetVersionTable
+pickproduct
+
+set assign_element [GeneratePersonInput assigned_to 1 [formvalue assigned_to]]
+set cc_element [GeneratePeopleInput cc [formvalue cc ""]]
+
+
+set priority_popup [make_popup priority $legal_priority [formvalue priority "P2"] 0]
+set sev_popup [make_popup bug_severity $legal_severity [formvalue bug_severity "normal"] 0]
+set platform_popup [make_popup rep_platform $legal_platform [pickplatform] 0]
+set opsys_popup [make_popup op_sys $legal_opsys [pickos] 0]
+
+set component_popup [make_popup component $components($product) \
+                         [formvalue component] 1]
+
+PutHeader "Enter Bug" "Enter Bug"
+
+puts "
+<FORM NAME=enterForm METHOD=POST ACTION=\"post_bug.cgi\">
+<INPUT TYPE=HIDDEN NAME=bug_status VALUE=NEW>
+<INPUT TYPE=HIDDEN NAME=reporter VALUE=$COOKIE(Bugzilla_login)>
+  <TABLE CELLSPACING=2 CELLPADDING=0 BORDER=0>
+  <TR>
+    <td ALIGN=right valign=top><B>Product:</B></td>
+    <td>[Product_element $product]</td>
+    <td ALIGN=right valign=top><B>Version:</B></td>
+    <td>[Version_element [pickversion] $product]</td>
+    <td align=right valign=top><b>Component:</b></td>
+    <td>$component_popup</td>
+  </TR>
+  <tr><td>&nbsp<td> <td> <td> <td> <td> </tr>
+  <TR>
+    <td align=right><b><B><A HREF=\"bug_status.html#rep_platform\">Platform:</A></B></td>
+    <TD>$platform_popup</TD>
+    <TD ALIGN=RIGHT><B>OS:</B></TD>
+    <TD>$opsys_popup</TD>
+    <td align=right valign=top></td>
+    <td rowspan=3></td>
+    <td></td>
+  </TR>
+  <TR>
+    <TD ALIGN=RIGHT><B><A HREF=\"bug_status.html#priority\">Priority</A>:</B></TD>
+    <TD>$priority_popup</TD>
+    <TD ALIGN=RIGHT><B><A HREF=\"bug_status.html#severity\">Severity</A>:</B></TD>
+    <TD>$sev_popup</TD>
+    <td></td>
+    <td></td>
+  </TR>
+  <tr><td>&nbsp<td> <td> <td> <td> <td> </tr>
+  <tr>
+    <TD ALIGN=RIGHT><B><A HREF=\"bug_status.html#assigned_to\">Assigned To:
+        </A></B></TD>
+    <TD colspan=5>$assign_element
+    (Leave blank to assign to default owner for component)</td>
+  </tr>
+  <tr>
+    <TD ALIGN=RIGHT ><B>Cc:</B></TD>
+    <TD colspan=5>$cc_element</TD>
+  </tr>
+  <tr><td>&nbsp<td> <td> <td> <td> <td> </tr>
+  <TR>
+    <TD ALIGN=RIGHT><B>URL:</B>
+    <TD COLSPAN=5>
+      <INPUT NAME=bug_file_loc SIZE=60 value=\"[value_quote [formvalue bug_file_loc]]\"></TD>
+  </TR>
+  <TR>
+    <TD ALIGN=RIGHT><B>Summary:</B>
+    <TD COLSPAN=5>
+      <INPUT NAME=short_desc SIZE=60 value=\"[value_quote [formvalue short_desc]]\"></TD>
+  </TR>
+  <tr><td>&nbsp<td> <td> <td> <td> <td> </tr>
+  <tr>
+    <td aligh=right valign=top><B>Description:</b>
+    <td colspan=5><TEXTAREA WRAP=HARD NAME=comment ROWS=10 COLS=80>[value_quote [formvalue comment]]</TEXTAREA><BR></td>
+  </tr>
+  <tr>
+    <td></td>
+    <td colspan=5>
+       <INPUT TYPE=\"submit\" VALUE=\"    Commit    \">
+       &nbsp;&nbsp;&nbsp;&nbsp;
+       <INPUT TYPE=\"reset\" VALUE=\"Reset\">
+       &nbsp;&nbsp;&nbsp;&nbsp;
+       <INPUT TYPE=\"submit\" NAME=maketemplate VALUE=\"Remember values as bookmarkable template\">
+    </td>
+  </tr>
+  </TABLE>
+  <INPUT TYPE=hidden name=form_name VALUE=enter_bug>
+</FORM>
+
+Some fields initialized from your user-agent, <b>$env(HTTP_USER_AGENT)</b>.
+If you think it got it wrong, please tell $maintainer what it should have been.
+
+</BODY></HTML>"
+
+flush stdout
diff --git a/globals.tcl b/globals.tcl
new file mode 100644 (file)
index 0000000..b30137c
--- /dev/null
@@ -0,0 +1,435 @@
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+# Contains some global variables and routines used throughout bugzilla.
+
+set maintainer "<a href=mailto:terry@netscape.com>terry@netscape.com</a>"
+
+if { ! [info exists oradbname] } {
+  set oradbname "SCOPPROD"
+}
+
+set dontchange "--do_not_change--"
+set chooseone "--Choose_one:--"
+
+set tmp_dir ""
+proc TmpName { tail } {
+  global tmp_dir
+  if { $tmp_dir == "" } {
+    set tmp_dir "/var/tmp/bugzilla"
+    if {! [file isdirectory $tmp_dir]} {
+      mkdir $tmp_dir
+    }
+  }
+  return "$tmp_dir/$tail"
+}
+
+proc ConnectToDatabase {} {
+    global mysqlhandle
+    if {![info exists mysqlhandle]} {
+        set mysqlhandle [mysqlconnect]
+        mysqluse $mysqlhandle "bugs"
+    }
+}
+
+# Useful for my stand-alone debugging
+proc DebugConnect {} {
+    global COOKIE
+    set COOKIE(Bugzilla_login) terry
+    set COOKIE(Bugzilla_password) terry
+    ConnectToDatabase
+}
+
+
+proc SendSQL { str } {
+    global mysqlhandle
+    mysqlsel $mysqlhandle $str
+    return 0
+}
+
+proc MoreSQLData {} {
+    global mysqlhandle
+    set result [mysqlresult $mysqlhandle "rows?"]
+    return [expr ![cequal $result ""] && $result > 0]
+}
+
+proc FetchSQLData {} {
+    global mysqlhandle
+    return [mysqlnext $mysqlhandle]
+}
+
+proc Disconnect {} {
+    global mysqlhandle
+    mysqlclose $mysqlhandle
+    unset mysqlhandle
+}
+
+
+set legal_opsys { "Windows 3.1" "Windows 95" "Windows NT" "System 7" "System 7.5"
+               "7.1.6" "AIX" "BSDI" "HP-UX" "IRIX" "Linux" "OSF/1" "Solaris" "SunOS"
+               "other" }
+
+
+set default_column_list {severity priority platform owner status resolution summary}
+
+set env(TZ) PST8PDT
+
+proc AppendComment {bugid who comment} {
+    regsub -all "\r\n" $comment "\n" comment
+    if {[cequal $comment "\n"] || [clength $comment] == 0} {
+        return
+    }
+    SendSQL "select long_desc from bugs where bug_id = $bugid"
+    set desc [lindex [FetchSQLData] 0]
+    append desc "\n\n------- Additional Comments From $who  [fmtclock [getclock] "%D %H:%M"] -------\n"
+    append desc $comment
+    SendSQL "update bugs set long_desc='[SqlQuote $desc]' where bug_id=$bugid"
+}
+
+proc SortIgnoringCase {a b} {
+    return [string compare [string tolower $a] [string tolower $b]]
+}
+
+
+proc make_popup { name src default listtype {onchange {}}} {
+    set last ""
+    set popup "<SELECT NAME=$name"
+    if {$listtype > 0} {
+        append popup " SIZE=5"
+        if {$listtype == 2} {
+            append popup " MULTIPLE"
+        }
+    }
+    if {$onchange != ""} {
+        append popup " onchange=$onchange"
+    }
+    append popup ">"
+    append popup [make_options $src $default [expr {$listtype == 2 && $default != ""}]]
+    append popup "</SELECT>"
+    return $popup
+}
+
+proc Product_element { prod {onchange {}} } {
+    global versions
+    return [make_popup product [lsort [array names versions]] $prod 1 \
+                $onchange]
+}
+
+proc Component_element { comp prod {onchange {}} } {
+    global components
+    if {![info exists components($prod)]} {
+        set componentlist {}
+    } else {
+        set componentlist $components($prod)
+    }
+        
+    if {![cequal $comp ""] && [lsearch $componentlist $comp] >= 0} {
+        set defcomponent $comp
+    } else {
+        set defcomponent [lindex $componentlist 0]
+    }
+    return [make_popup component $componentlist $defcomponent 1 ""]
+}
+
+proc Version_element { vers prod {onchange {}} } {
+  global versions
+  if {![info exists versions($prod)]} {
+    set versionlist {}
+  } else {
+    set versionlist $versions($prod)
+  }
+
+  set defversion [lindex $versionlist 0]
+
+  if {[lsearch $versionlist $vers] >= 0} {
+    set defversion $vers
+  }
+  return [make_popup version $versionlist $defversion 1 $onchange]
+}
+
+proc GenerateVersionTable {} {
+    ConnectToDatabase
+    SendSQL "select value, program from versions order by value"
+    while { [ MoreSQLData ] } {
+        set line [FetchSQLData]
+        if {$line != ""} {
+            set v [lindex $line 0]
+            set p1 [lindex $line 1]
+            lappend versions($p1) $v
+            set varray($v) 1
+            set parray($p1) 1
+        }
+    }
+
+    SendSQL "select value, program from components"
+    while { [ MoreSQLData ] } {
+        set line [FetchSQLData]
+        if {$line != ""} {
+            lassign $line c p
+            lappend components($p) $c
+            set carray($c) 1
+            set parray($p) 1
+        }
+    }
+
+    LearnAboutColumns bugs cols
+    set log_columns $cols(-list-)
+    foreach i {bug_id creation_ts delta_ts long_desc} {
+        set w [lsearch $log_columns $i]
+        if {$w >= 0} {
+            set log_columns [lreplace $log_columns $w $w]
+        }
+    }
+    set legal_priority [SplitEnumType $cols(priority,type)]
+    set legal_severity [SplitEnumType $cols(bug_severity,type)]
+    set legal_platform [SplitEnumType $cols(rep_platform,type)]
+    set legal_bug_status [SplitEnumType $cols(bug_status,type)]
+    set legal_resolution [SplitEnumType $cols(resolution,type)]
+    set legal_resolution_no_dup $legal_resolution
+    set w [lsearch $legal_resolution_no_dup "DUPLICATE"]
+    if {$w >= 0} {
+        set legal_resolution_no_dup [lreplace $legal_resolution_no_dup $w $w]
+    }
+
+    set list [lsort -command SortIgnoringCase [array names versions]]
+    
+    set tmpname "versioncache.[id process]"
+
+    set fid [open $tmpname "w"]
+    puts $fid [list set log_columns $log_columns]
+    foreach i $list {
+        puts $fid [list set versions($i) $versions($i)]
+        if {![info exists components($i)]} {
+            set components($i) {}
+        }
+    }
+
+    puts $fid [list set legal_versions [lsort -command SortIgnoringCase \
+                                            [array names varray]]]
+    foreach i [lsort -command SortIgnoringCase [array names components]] {
+        puts $fid [list set components($i) $components($i)]
+    }
+    puts $fid [list set legal_components [lsort -command SortIgnoringCase \
+                                              [array names carray]]]
+    puts $fid [list set legal_product $list]
+    puts $fid [list set legal_priority $legal_priority]
+    puts $fid [list set legal_severity $legal_severity]
+    puts $fid [list set legal_platform $legal_platform]
+    puts $fid [list set legal_bug_status $legal_bug_status]
+    puts $fid [list set legal_resolution $legal_resolution]
+    puts $fid [list set legal_resolution_no_dup $legal_resolution_no_dup]
+    close $fid
+    frename $tmpname "versioncache"
+    catch {chmod 0666 "versioncache"}
+}
+
+# This proc must be called before using legal_product or the versions array.
+
+proc GetVersionTable {} {
+    global versions
+    set mtime 0
+    catch {set mtime [file mtime versioncache]}
+    if {[getclock] - $mtime > 3600} {
+        GenerateVersionTable
+    }
+    uplevel #0 {source versioncache}
+    if {![info exists versions]} {
+        GenerateVersionTable
+        uplevel #0 {source versioncache}
+        if {![info exists versions]} {
+            error "Can't generate version info; tell terry."
+        }
+    }
+}
+
+
+
+proc GeneratePersonInput { field required def_value {extraJavaScript {}} } {
+    if {![cequal $extraJavaScript ""]} {
+        set $extraJavaScript "onChange=\" $extraJavaScript \""
+    }
+    return "<INPUT NAME=\"$field\" SIZE=32 $extraJavaScript VALUE=\"$def_value\">"
+}
+
+proc GeneratePeopleInput { field def_value } {
+  return "<INPUT NAME=\"$field\" SIZE=45 VALUE=\"$def_value\">"
+}
+
+
+
+set cachedNameArray() ""
+
+proc InsertNewUser {username} {
+    random seed
+    set pwd ""
+    loop i 0 8 {
+        append pwd [cindex "abcdefghijklmnopqrstuvwxyz" [random 26]]
+    }
+    SendSQL "insert into profiles (login_name, password) values ('[SqlQuote $username]', '$pwd')"
+    return $pwd
+}
+
+
+proc DBID_to_name { id } {
+    global cachedNameArray
+
+    if {![info exists cachedNameArray($id)]} {
+
+        SendSQL "select login_name from profiles where userid = $id"
+        set r [FetchSQLData]
+        if {$r == ""} { set r "__UNKNOWN__" }
+        set cachedNameArray($id) $r
+    }
+    return $cachedNameArray($id)
+}
+
+proc DBname_to_id { name } {
+    SendSQL "select userid from profiles where login_name = '[SqlQuote $name]'"
+    set r [FetchSQLData]
+    if {[cequal $r ""]} {
+        return 0
+    }
+    return $r
+}
+
+proc DBNameToIdAndCheck {name {forceok 0}} {
+    set result [DBname_to_id $name]
+    if {$result > 0} {
+        return $result
+    }
+    if {$forceok} {
+        InsertNewUser $name
+        set result [DBname_to_id $name]
+        if {$result > 0} {
+            return $result
+        }
+        puts "Yikes; couldn't create user $name.  Please report problem to"
+        puts "$maintainer."
+    } else {
+        puts "The name <TT>$name</TT> is not a valid username.  Please hit the"
+        puts "<B>Back</B> button and try again."
+    }
+    exit 0
+}
+
+proc GetLongDescription { id } {
+    SendSQL "select long_desc from bugs where bug_id = $id"
+    return [lindex [FetchSQLData] 0]
+}
+
+proc ShowCcList {num} {
+    set cclist ""
+    set comma ""
+    SendSQL "select who from cc where bug_id = $num"
+    set ccids ""
+    while {[MoreSQLData]} {
+        lappend ccids [lindex [FetchSQLData] 0]
+    }
+    set result ""
+    foreach i $ccids {
+        lappend result [DBID_to_name $i]
+    }
+
+    return [join $result ","]
+}
+
+proc make_options_new { src default {isregexp 0} } {
+    set last "" ; set popup "" ; set found 0
+    foreach item $src {
+        if { $item == "-blank-" } { set item "" } {
+            if {$isregexp ? [regexp $default $item] : [cequal $default $item]} {
+                append popup "<OPTION SELECTED VALUE=\"$item\">$item"
+                set found 1
+            } else {
+                append popup "<OPTION VALUE=\"$item\">$item"
+            }
+        }
+    }
+    if {!$found && $default != ""} {
+        append popup "<OPTION SELECTED>$default"
+    }
+    return $popup
+}
+
+
+proc Shell {} {
+    ConnectToDatabase
+    while (1) {
+        puts -nonewline "> "
+        if {[gets stdin line] < 0} {
+            break
+        }
+        if {[catch {SendSQL $line} errorinfo]} {
+            puts "Error -- $errorinfo"
+        } else {
+            while {[MoreSQLData]} {
+                puts [FetchSQLData]
+            }
+        }
+    }
+}
+
+
+
+
+# Fills in the given array with info about the columns.  The array gets
+# the following entries:
+#   -list-  the list of column names
+#   <name>,type  the type for the given name
+
+proc LearnAboutColumns {table arrayname} {
+    upvar $arrayname a
+    catch (unset a)
+    SendSQL "show columns from $table"
+    set list {}
+    while {[MoreSQLData]} {
+        lassign [FetchSQLData] name type
+        set a($name,type) $type
+        lappend list $name
+    }
+    set a(-list-) $list
+}
+
+# If the above returned a enum type, take that type and parse it into the
+# list of values.  Assumes that enums don't ever contain an apostrophe!
+
+proc SplitEnumType {str} {
+    set result {}
+    if {[regexp {^enum\((.*)\)$} $str junk guts]} {
+        append guts ","
+        while {[regexp {^'([^']*)',(.*)$} $guts junk first guts]} {
+            lappend result $first
+        }
+    }
+    return $result
+}
+
+
+proc SqlQuote {str} {
+    regsub -all "'" $str "''" str
+    # 
+    # This next line is quoting hell.  One level of quoting comes from
+    # the TCL interpreter, and another level comes from TCL's regular
+    # expression parser.  It really works out to "change every
+    # backslash to two backslashes".
+    regsub -all "\\\\" $str "\\\\\\\\" str
+
+    return $str
+}
diff --git a/help.html b/help.html
new file mode 100644 (file)
index 0000000..0d7244d
--- /dev/null
+++ b/help.html
@@ -0,0 +1,55 @@
+<HTML>
+<!--
+     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 <terry@mozilla.org>
+-->
+
+<TITLE>Clue</TITLE>
+<H1>A Clue</H1>
+This form will allow you to call up a subset of the bug list.
+You should be able to add the URL of the resulting list to
+your bookmark file in order to preserve queries.
+<p>
+The way the query works, if you have nothing checked in a box,
+then all values for that field are legal, for example if you checked nothing
+in any of the boxes, you would get the entire bug list.
+<p>
+The default value of this form should correspond roughly to a "personal"
+bug list.
+<HR>
+<H2>Running queries not supported by the pretty boxes</H2>
+There is a hacky way to do some searches that aren't supported by the
+form.  The buglist script will build queries based on the URL, so
+you can add other criteria.
+<P>
+For example, if you wanted to see all bugs reported against the X platform
+and assigned to jwz, you could ask for all bugs assign to jwz, then
+edit the URL in the "Location" box, adding the clause "&rep_platform=X-Windows"
+to the URL.
+<P>
+Here is a list of some of the field names you could use for additional
+unsupported searches ...
+
+<PRE>
+version
+rep_platform
+op_sys
+reporter area
+bug_file_loc
+short_desc
+</PRE>
diff --git a/how_to_mail.html b/how_to_mail.html
new file mode 100644 (file)
index 0000000..6b43bca
--- /dev/null
@@ -0,0 +1,80 @@
+<HTML>
+
+<!--
+     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 <terry@mozilla.org>
+-->
+
+
+<TITLE>How to Mail to bugzilla</TITLE>
+
+<H1>THIS DOESN'T WORK RIGHT NOW.  Coming someday.</H1>
+
+Mailing to "bugzilla" will be piped through a script which examines
+your message, stripping out control lines, and passing the rest of the
+message in as the description of a new bug.  The control lines look like: <P>
+
+<PRE>
+@FIELD-LABEL VALUE
+        LABEL           Legal Values
+        Priority        critical major normal minor trivial
+        Type            BUG RFE
+        Product         Cheddar
+        Platform        PC X-Windows Macintosh All
+        Area            CODE JAVA TEST BUILD UI PERF
+        Version version 2.0b1 2.0b2 2.0b2 2.0b4 2.1a0 2.1a1 2.1b0 2.1b1 2.1b2
+        OS              Windows 3.1 Windows 95 Windows NT System 7 System 7.5
+                        AIX BSDI HP-UX IRIX Linux OSF/1 Solaris SunOS other
+        Summary         -anything-
+        URL             -anything-
+        Assign          someone in eng
+
+
+and
+
+@description
+        This tells the bug parse to stop looking for control lines,
+        allowing the bug description to contain lines which start with @
+</PRE>
+
+There are default values for all these fields.  If you don't specify a
+Summary, the subject of the mail message is used. <P>
+
+If you specify an illegal value, the default value is used, the
+bug is assigned to you, and the answerback message will describe
+the error. <P>
+
+After the bug is posted, you will get mail verifying the posting
+and informing you of the bug number if you wish to fix any
+mistakes made by the auto-processor. <P>
+
+EXAMPLE: <P>
+
+
+<PRE>
+    % Mail bugzilla
+    Subject: WinFE crashes with GPF when I pour beer on my keyboard
+    @priority critical
+    @platform PC
+    @assign troy
+
+    After the beer bash I emptied the rest of the keg onto my keyboard
+    and my sharp build of Navigator got a GPF.
+    .
+
+</PRE>
diff --git a/index.html b/index.html
new file mode 100644 (file)
index 0000000..68155a0
--- /dev/null
@@ -0,0 +1,76 @@
+<HTML>
+<!--
+     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 <terry@mozilla.org>
+-->
+<HEAD><TITLE>Bugzilla Main Page</TITLE></HEAD>
+<BODY   BGCOLOR="#FFFFFF" TEXT="#000000"
+LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
+<TABLE BGCOLOR="#000000" WIDTH="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0>
+<TR><TD><A HREF="http://www.mozilla.org/"><IMG
+ SRC="http://www.mozilla.org/images/mozilla-banner.gif" ALT=""
+ BORDER=0 WIDTH=600 HEIGHT=58></A></TD></TR></TABLE>
+<TABLE BORDER=0 CELLPADDING=12 CELLSPACING=0 WIDTH="100%">
+ <TR>
+
+  <TD>
+
+   <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=2>
+
+    <TR><TD VALIGN=TOP ALIGN=CENTER NOWRAP>
+
+     <FONT SIZE="+3"><B><NOBR>Main Page</NOBR></B></FONT>
+
+    </TD></TR><TR><TD VALIGN=TOP ALIGN=CENTER>
+
+     <B></B>
+
+    </TD></TR>
+
+   </TABLE>
+
+  </TD>
+
+  <TD>
+
+   This is <B>Bugzilla</B>: the Mozilla bug system.  For more 
+   information about what Bugzilla is and what it can do, see 
+   <A HREF="http://www.mozilla.org/">mozilla.org</A>'s
+   <A HREF="http://www.mozilla.org/bugs/"><B>bug pages</B></A>.
+</TD></TR></TABLE>
+
+
+<body>
+
+<img align=right width=329 height=220 src=ant.jpg>
+
+
+This is where we put in lots of nifty words explaining all about
+bugzilla.
+
+<p>
+
+But it all boils down to a choice of:
+<br>
+<a href="query.cgi">Go to the query page to start.</a><br>
+<a href="enter_bug.cgi">Enter a new bug</a>
+<FORM METHOD=GET ACTION=show_bug.cgi><INPUT TYPE=SUBMIT VALUE="Find"> bug
+# <INPUT NAME=id SIZE=6></FORM></TD>
+
+</BODY>
+</HTML>
diff --git a/long_list.cgi b/long_list.cgi
new file mode 100755 (executable)
index 0000000..3d575cf
--- /dev/null
@@ -0,0 +1,78 @@
+#! /usr/bonsaitools/bin/mysqltcl
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+
+source "CGI.tcl"
+puts "Content-type: text/html\n"
+puts "<TITLE>Full Text Bug Listing</TITLE>"
+
+set generic_query {
+select
+  bugs.bug_id,
+  bugs.product,
+  bugs.version,
+  bugs.rep_platform,
+  bugs.op_sys,
+  bugs.bug_status,
+  bugs.bug_severity,
+  bugs.priority,
+  bugs.resolution,
+  assign.login_name,
+  report.login_name,
+  bugs.component,
+  bugs.target_fix_version,
+  bugs.bug_file_loc,
+  bugs.short_desc
+from bugs,profiles assign,profiles report
+where assign.userid = bugs.assigned_to and report.userid = bugs.reporter and
+}
+
+ConnectToDatabase
+
+foreach bug [split $FORM(buglist) :] {
+  SendSQL "$generic_query bugs.bug_id = $bug\n"
+
+  if { [ MoreSQLData ] } {
+    set result [ FetchSQLData ]
+    puts "<IMG SRC=\"1x1.gif\" WIDTH=1 HEIGHT=80 ALIGN=LEFT>"
+    puts "<TABLE WIDTH=100%>"
+    puts "<TD COLSPAN=4><TR><DIV ALIGN=CENTER><B><FONT =\"+3\">[html_quote [lindex $result 15]]</B></FONT></DIV>"
+    puts "<TR><TD><B>Bug#:</B> <A HREF=\"show_bug.cgi?id=[lindex $result 0]\">[lindex $result 0]</A>"
+    puts "<TD><B>Product:</B> [lindex $result 1]"
+    puts "<TD><B>Version:</B> [lindex $result 2]"
+    puts "<TD><B>Platform:</B> [lindex $result 3]"
+    puts "<TR><TD><B>OS/Version:</B> [lindex $result 4]"
+    puts "<TD><B>Status:</B> [lindex $result 5]"
+    puts "<TD><B>Severity:</B> [lindex $result 6]"
+    puts "<TD><B>Priority:</B> [lindex $result 7]"
+    puts "<TR><TD><B>Resolution:</B> [lindex $result 8]</TD>"
+    puts "<TD><B>Assigned To:</B> [lindex $result 9]"
+    puts "<TD><B>Reported By:</B> [lindex $result 10]"
+    puts "<TR><TD><B>Component:</B> [lindex $result 11]"
+    puts "<TD><B>Target Fix Version:</B> [lindex $result 12]"
+    puts "<TR><TD COLSPAN=6><B>URL:</B> [html_quote [lindex $result 13]]"
+    puts "<TR><TD COLSPAN=6><B>Summary&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</B> [html_quote [lindex $result 14]]"
+    puts "<TR><TD><B>Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</B>\n</TABLE>"
+    puts "<PRE>[html_quote [GetLongDescription $bug]]</PRE>"
+    puts "<HR>"
+  }
+}
+puts "<h6>Mozilla Communications Corporation, Company Confidential, read and eat.</h6>"
diff --git a/makeactivitytable.sh b/makeactivitytable.sh
new file mode 100755 (executable)
index 0000000..047d81e
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# 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 <terry@mozilla.org>
+
+mysql > /dev/null 2>/dev/null << OK_ALL_DONE
+
+use bugs;
+
+drop table bugs_activity
+OK_ALL_DONE
+
+mysql << OK_ALL_DONE
+use bugs;
+create table bugs_activity (
+        bug_id mediumint not null,
+        who mediumint not null,
+        when datetime not null,
+        field varchar(64) not null,
+        oldvalue tinytext,
+        newvalue tinytext,
+
+        index (bug_id),
+        index (when)
+);
+
+
+
+show columns from bugs_activity;
+show index from bugs_activity;
+
+OK_ALL_DONE
diff --git a/makebugtable.sh b/makebugtable.sh
new file mode 100755 (executable)
index 0000000..ff0cc78
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# 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 <terry@mozilla.org>
+
+mysql > /dev/null 2>/dev/null << OK_ALL_DONE
+
+use bugs;
+
+drop table bugs;
+OK_ALL_DONE
+
+mysql << OK_ALL_DONE
+use bugs;
+create table bugs (
+bug_id mediumint not null auto_increment primary key,
+assigned_to mediumint not null, # This is a comment.
+bug_file_loc text,
+bug_severity enum("critical", "major", "normal", "minor", "trivial", "enhancement") not null,
+bug_status enum("NEW", "ASSIGNED", "REOPENED", "RESOLVED", "VERIFIED", "CLOSED") not null,
+creation_ts datetime,
+delta_ts timestamp,
+short_desc mediumtext,
+long_desc mediumtext,
+op_sys tinytext,
+priority enum("P1", "P2", "P3", "P4", "P5") not null,
+product varchar(16) not null,
+rep_platform enum("All", "DEC", "HP", "Macintosh", "PC", "SGI", "Sun", "X-Windows", "Other"),
+reporter mediumint not null,
+version varchar(16) not null,
+area enum("BUILD", "CODE", "CONTENT", "DOC", "PERFORMANCE", "TEST", "UI", "i18n", "l10n") not null,
+component varchar(50) not null,
+resolution enum("", "FIXED", "INVALID", "WONTFIX", "LATER", "REMIND", "DUPLICATE", "WORKSFORME") not null,
+
+
+index (assigned_to),
+index (delta_ts),
+index (bug_severity),
+index (bug_status),
+index (priority),
+index (product),
+index (reporter),
+index (version),
+index (area),
+index (component),
+index (resolution)
+
+);
+
+show columns from bugs;
+show index from bugs;
+
+
+OK_ALL_DONE
diff --git a/makecctable.sh b/makecctable.sh
new file mode 100755 (executable)
index 0000000..44c50ca
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# 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 <terry@mozilla.org>
+
+mysql > /dev/null 2>/dev/null << OK_ALL_DONE
+
+use bugs;
+
+drop table cc
+OK_ALL_DONE
+
+mysql << OK_ALL_DONE
+use bugs;
+create table cc (
+        bug_id mediumint not null,
+        who mediumint not null
+);
+
+
+
+show columns from cc;
+show index from cc;
+
+OK_ALL_DONE
diff --git a/makecomponenttable.sh b/makecomponenttable.sh
new file mode 100755 (executable)
index 0000000..2d0e360
--- /dev/null
@@ -0,0 +1,102 @@
+#!/bin/sh
+#
+# 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 <terry@mozilla.org>
+
+mysql > /dev/null 2>/dev/null << OK_ALL_DONE
+
+use bugs;
+
+drop table components
+OK_ALL_DONE
+
+mysql << OK_ALL_DONE
+use bugs;
+create table components (
+value tinytext,
+program tinytext,
+initialowner tinytext           # Should arguably be a mediumint!
+);
+
+
+
+
+insert into components (value, program, initialowner) values ("Macintosh FE", "Communicator", "sdagley@netscape.com");
+insert into components (value, program, initialowner) values ("Windows FE", "Communicator", "blythe@netscape.com");
+insert into components (value, program, initialowner) values ("XFE", "Communicator", "ramiro@netscape.com");
+insert into components (value, program, initialowner) values ("StubFE", "Communicator", "toshok@netscape.com");
+insert into components (value, program, initialowner) values ("Aurora/RDF FE", "Communicator", "don@netscape.com");
+insert into components (value, program, initialowner) values ("Aurora/RDF BE", "Communicator", "guha@netscape.com");
+insert into components (value, program, initialowner) values ("Berkeley DB", "Communicator", "montulli@netscape.com");
+insert into components (value, program, initialowner) values ("Browser Hooks", "Communicator", "ebina@netscape.com");
+insert into components (value, program, initialowner) values ("Build Config", "Communicator", "briano@netscape.com");
+insert into components (value, program, initialowner) values ("Composer", "Communicator", "brade@netscape.com");
+insert into components (value, program, initialowner) values ("Compositor Library", "Communicator", "vidur@netscape.com");
+insert into components (value, program, initialowner) values ("Dialup", "Communicator", "selmer@netscape.com");
+insert into components (value, program, initialowner) values ("FontLib", "Communicator", "dp@netscape.com");
+insert into components (value, program, initialowner) values ("HTML Dialogs", "Communicator", "nisheeth@netscape.com");
+insert into components (value, program, initialowner) values ("HTML to Text/PostScript Translation", "Communicator", "brendan@netscape.com");
+insert into components (value, program, initialowner) values ("ImageLib", "Communicator", "pnunn@netscape.com");
+insert into components (value, program, initialowner) values ("JPEG Image Handling", "Communicator", "tgl@sss.pgh.pa.us");
+insert into components (value, program, initialowner) values ("PNG Image Handling", "Communicator", "png@wco.com");
+insert into components (value, program, initialowner) values ("Image Conversion Library", "Communicator", "mjudge@netscape.com");
+insert into components (value, program, initialowner) values ("I18N Library", "Communicator", "bobj@netscape.com");
+insert into components (value, program, initialowner) values ("Java Stubs", "Communicator", "warren@netscape.com");
+insert into components (value, program, initialowner) values ("JavaScript", "Communicator", "mccabe@netscape.com");
+insert into components (value, program, initialowner) values ("JavaScript Debugger", "Communicator", "jband@netscape.com");
+insert into components (value, program, initialowner) values ("JavaScript/Java Reflection", "Communicator", "fur@netscape.com");
+insert into components (value, program, initialowner) values ("Layout", "Communicator", "djw@netscape.com");
+insert into components (value, program, initialowner) values ("LibMocha", "Communicator", "chouck@netscape.com");
+insert into components (value, program, initialowner) values ("MIMELib", "Communicator", "terry@netscape.com");
+insert into components (value, program, initialowner) values ("NetLib", "Communicator", "gagan@netscape.com");
+insert into components (value, program, initialowner) values ("NSPR", "Communicator", "wtc@netscape.com");
+insert into components (value, program, initialowner) values ("Password Cache", "Communicator", "montulli@netscape.com");
+insert into components (value, program, initialowner) values ("PICS", "Communicator", "montulli@netscape.com");
+insert into components (value, program, initialowner) values ("Plugins", "Communicator", "byrd@netscape.com");
+insert into components (value, program, initialowner) values ("Preferences", "Communicator", "aoki@netscape.com");
+insert into components (value, program, initialowner) values ("Progress Window", "Communicator", "atotic@netscape.com");
+insert into components (value, program, initialowner) values ("Registry", "Communicator", "dveditz@netscape.com");
+insert into components (value, program, initialowner) values ("Scheduler", "Communicator", "aoki@netscape.com");
+insert into components (value, program, initialowner) values ("Security Stubs", "Communicator", "jsw@netscape.com");
+insert into components (value, program, initialowner) values ("SmartUpdate", "Communicator", "dveditz@netscape.com");
+insert into components (value, program, initialowner) values ("XML", "Communicator", "guha@netscape.com");
+insert into components (value, program, initialowner) values ("XP-COM", "Communicator", "scullin@netscape.com");
+insert into components (value, program, initialowner) values ("XP File Handling", "Communicator", "atotic@netscape.com");
+insert into components (value, program, initialowner) values ("XP Miscellany", "Communicator", "brendan@netscape.com");
+insert into components (value, program, initialowner) values ("XP Utilities", "Communicator", "toshok@netscape.com");
+insert into components (value, program, initialowner) values ("Zlib", "Communicator", "pnunn@netscape.com");
+
+
+
+insert into components (value, program, initialowner) values ("Platform: Lesstif on Linux", "Communicator", "ramiro@netscape.com");
+insert into components (value, program, initialowner) values ("Platform: OS/2", "Communicator", "law@netscape.com");
+insert into components (value, program, initialowner) values ("Platform: MacOS/PPC", "Communicator", "sdagley@netscape.com");
+insert into components (value, program, initialowner) values ("Platform: Rhapsody", "Communicator", "mcafee@netscape.com");
+insert into components (value, program, initialowner) values ("Platform: MFC/Win32 on Windows", "Communicator", "blythe@netscape.com");
+
+
+insert into components (value, program, initialowner) values ("UI", "Bugzilla", "terry@netscape.com");
+insert into components (value, program, initialowner) values ("Database", "Bugzilla", "terry@netscape.com");
+
+
+select * from components;
+
+show columns from components;
+show index from components;
+
+OK_ALL_DONE
diff --git a/makeprofilestable.sh b/makeprofilestable.sh
new file mode 100755 (executable)
index 0000000..2780d61
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# 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 <terry@mozilla.org>
+
+mysql > /dev/null 2>/dev/null << OK_ALL_DONE
+
+use bugs;
+
+drop table profiles
+OK_ALL_DONE
+
+mysql << OK_ALL_DONE
+use bugs;
+create table profiles (
+userid mediumint not null auto_increment primary key,
+login_name varchar(255) not null,
+password varchar(16),
+realname varchar(255),
+index(login_name)
+);
+
+
+show columns from profiles;
+show index from profiles;
+
+OK_ALL_DONE
diff --git a/makeversiontable.sh b/makeversiontable.sh
new file mode 100755 (executable)
index 0000000..111b6d1
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/sh
+#
+# 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 <terry@mozilla.org>
+
+mysql > /dev/null 2>/dev/null << OK_ALL_DONE
+
+use bugs;
+
+drop table versions
+OK_ALL_DONE
+
+mysql << OK_ALL_DONE
+use bugs;
+create table versions (
+value tinytext,
+program tinytext
+);
+
+
+
+insert into versions (value, program) values ("other", "Communicator");
+insert into versions (value, program) values ("1998-03-31", "Communicator");
+insert into versions (value, program) values ("1998-04-08", "Communicator");
+insert into versions (value, program) values ("1998-04-29", "Communicator");
+insert into versions (value, program) values ("1998-06-03", "Communicator");
+insert into versions (value, program) values ("1998-07-28", "Communicator");
+insert into versions (value, program) values ("1.0", "Bugzilla");
+insert into versions (value, program) values ("other", "Bugzilla");
+
+select * from versions;
+
+show columns from versions;
+show index from versions;
+
+OK_ALL_DONE
diff --git a/new_comment.cgi b/new_comment.cgi
new file mode 100755 (executable)
index 0000000..b57caff
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bonsaitools/bin/perl
+# -*- 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 <terry@mozilla.org>
+
+if ($ENV{'REQUEST_METHOD'} eq "GET") { $buffer = $ENV{'QUERY_STRING'}; }
+else { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); }
+# Split the name-value pairs
+@pairs = split(/&/, $buffer);
+foreach $pair (@pairs)
+{
+    ($name, $value) = split(/=/, $pair);
+
+    $value =~ tr/+/ /;
+    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
+    $FORM{$name} = $value;
+}
+open(COMMENTS, ">>comments");
+$c=$FORM{"comment"};
+print COMMENTS $FORM{"comment"} . "\n";
+close(COMMENTS);
+print "Content-type: text/html\n\n";
+print "<TITLE>The Word Of Confirmation</TITLE>";
+print "<H1>Done</H1>";
+print $c;
diff --git a/newquip.html b/newquip.html
new file mode 100644 (file)
index 0000000..dbb2fb1
--- /dev/null
@@ -0,0 +1,34 @@
+<HTML>
+
+<!--
+     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 <terry@mozilla.org>
+-->
+
+<TITLE>I'm So Pretty and Witty And Wise</TITLE>
+<H2>Add your own clever headline.</h2>
+The buglist picks a random quip for the headline, and 
+you can extend the quip list.  Type in something clever or
+funny or boring and bonk on the button.
+<HR>
+<FORM METHOD=POST ACTION="new_comment.cgi">
+<INPUT SIZE=80 NAME="comment"><BR>
+<INPUT TYPE="submit" VALUE="Add This Quip"></FORM>
+</HR>
+For the impatient, you can
+<A HREF="comments">view the whole quip list</A>.
diff --git a/post_bug.cgi b/post_bug.cgi
new file mode 100755 (executable)
index 0000000..94878d3
--- /dev/null
@@ -0,0 +1,137 @@
+#! /usr/bonsaitools/bin/mysqltcl
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+
+source "CGI.tcl"
+confirm_login
+
+puts "Set-Cookie: PLATFORM=$FORM(product) ; path=/ ; expires=Sun, 30-Jun-99 00:00:00 GMT"
+puts "Set-Cookie: VERSION-$FORM(product)=$FORM(version) ; path=/ ; expires=Sun, 30-Jun-99 00:00:00 GMT"
+puts "Content-type: text/html\n"
+
+if {[info exists FORM(maketemplate)]} {
+    puts "<TITLE>Bookmarks are your friend.</TITLE>"
+    puts "<H1>Template constructed.</H1>"
+    
+    set url "enter_bug.cgi?$buffer"
+
+    puts "If you put a bookmark <a href=\"$url\">to this link</a>, it will"
+    puts "bring up the submit-a-new-bug page with the fields initialized"
+    puts "as you've requested."
+    exit
+}
+
+PutHeader "Posting Bug -- Please wait" "Posting Bug" "One moment please..."
+
+flush stdout
+umask 0
+ConnectToDatabase
+
+if {![info exists FORM(component)] || [cequal $FORM(component) ""]} {
+    puts "You must choose a component that corresponds to this bug.  If"
+    puts "necessary, just guess.  But please hit the <B>Back</B> button and"
+    puts "choose a component."
+    exit 0
+}
+    
+
+set forceAssignedOK 0
+if {[cequal "" $FORM(assigned_to)]} {
+    SendSQL "select initialowner from components
+where program='[SqlQuote $FORM(product)]'
+and value='[SqlQuote $FORM(component)]'"
+    set FORM(assigned_to) [lindex [FetchSQLData] 0]
+    set forceAssignedOK 1
+}
+
+set FORM(assigned_to) [DBNameToIdAndCheck $FORM(assigned_to) $forceAssignedOK]
+set FORM(reporter) [DBNameToIdAndCheck $FORM(reporter)]
+
+
+set bug_fields { reporter product version rep_platform bug_severity \
+                     priority op_sys assigned_to bug_status bug_file_loc \
+                     short_desc component }
+set query "insert into bugs (\n"
+
+foreach field $bug_fields {
+  append query "$field,\n"
+}
+
+append query "creation_ts, long_desc )\nvalues (\n"
+
+
+foreach field $bug_fields {
+    if {$field == "qa_assigned_to"} {
+
+        set valin [DBname_to_id $FORM($field)]
+        if {$valin == "__UNKNOWN__"} {
+            append query "null,\n"
+        } else {
+            append query "$valin,\n"
+        }
+
+    } else {
+        regsub -all "'" [FormData $field] "''" value
+        append query "'$value',\n"
+    }
+}
+
+append query "now(), "
+append query "'[SqlQuote [FormData comment]]' )\n"
+
+
+set ccids(zz) 1
+unset ccids(zz)
+
+
+if {[info exists FORM(cc)]} {
+    foreach person [split $FORM(cc) " ,"] {
+        if {![cequal $person ""]} {
+            set ccids([DBNameToIdAndCheck $person]) 1
+        }
+    }
+}
+
+
+# puts "<PRE>$query</PRE>"
+
+SendSQL $query
+while {[MoreSQLData]} { set ret [FetchSQLData] }
+
+SendSQL "select LAST_INSERT_ID()"
+set id [FetchSQLData]
+
+foreach person [array names ccids] {
+    SendSQL "insert into cc (bug_id, who) values ($id, $person)"
+    while { [ MoreSQLData ] } { FetchSQLData }
+}
+
+# Now make sure changes are written before we run processmail...
+Disconnect
+
+puts "<H2>Changes Submitted</H2>"
+puts "<A HREF=\"show_bug.cgi?id=$id\">Show BUG# $id</A>"
+puts "<BR><A HREF=\"query.cgi\">Back To Query Page</A>"
+
+flush stdout
+
+exec ./processmail $id < /dev/null > /dev/null 2> /dev/null &
+exit
diff --git a/process_bug.cgi b/process_bug.cgi
new file mode 100755 (executable)
index 0000000..27b54de
--- /dev/null
@@ -0,0 +1,309 @@
+#! /usr/bonsaitools/bin/mysqltcl
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+source "CGI.tcl"
+
+confirm_login
+
+puts "Content-type: text/html\n"
+
+GetVersionTable
+
+if {![cequal $FORM(product) $dontchange]} {
+    set prod [FormData product]
+    set vok [expr [lsearch -exact $versions($prod) \
+                       [FormData version]] >= 0]
+    set cok [expr [lsearch -exact $components($prod) \
+                       [FormData component]] >= 0]
+    if {!$vok || !$cok} {
+        puts "<H1>Changing product means changing version and component.</H1>"
+        puts "You have chosen a new product, and now the version and/or"
+        puts "component fields are not correct.  Please set them now.<p>"
+        puts "<form>"
+        puts "<table>"
+        puts "<tr>"
+        puts "<td align=right><b>Product:</b></td>"
+        puts "<td>$prod</td>"
+        puts "</tr><tr>"
+        puts "<td align=right><b>Version:</b></td>"
+        puts "<td>[Version_element [FormData version] $prod]</td>"
+        puts "</tr><tr>"
+        puts "<td align=right><b>Component:</b></td>"
+        puts "<td>[Component_element [FormData component] $prod]</td>"
+        puts "</tr>"
+        puts "</table>"
+        foreach i [array names FORM] {
+            if {[lsearch -exact {version component} $i] < 0} {
+                puts "<input type=hidden name=$i value=\"[value_quote $FORM($i)]\">"
+            }
+        }
+        puts "<input type=submit value=Commit>"
+        puts "</form>"
+        puts "</hr>"
+        puts "<a href=query.cgi>Cancel all this and go back to the query page.</a>"
+        exit
+    }
+}
+
+
+if {[info exists FORM(id)]} {
+    set idlist $FORM(id)
+} else {
+    set idlist {}
+    foreach i [array names FORM] {
+        if {[string match "id_*" $i]} {
+            lappend idlist [crange $i 3 end]
+        }
+    }
+}
+
+if {![info exists FORM(who)]} {
+    set FORM(who) $COOKIE(Bugzilla_login)
+}
+
+puts "<TITLE>Update Bug $idlist</TITLE>"
+if {[info exists FORM(id)]} {
+    navigation_header
+}
+puts "<HR>"
+set query "update bugs\nset"
+set comma ""
+umask 0
+
+proc DoComma {} {
+    global query comma
+    append query "$comma\n    "
+    set comma ","
+}
+
+proc ChangeStatus {str} {
+    global dontchange query
+    if {![cequal $str $dontchange]} {
+        DoComma
+        append query "bug_status = '$str'"
+    }
+}
+
+proc ChangeResolution {str} {
+    global dontchange query
+    if {![cequal $str $dontchange]} {
+        DoComma
+        append query "resolution = '$str'"
+    }
+}
+
+
+
+
+foreach field {rep_platform priority bug_severity url summary \
+                   component bug_file_loc short_desc \
+                   status_summary product version component} {
+    if {[info exists FORM($field)]} {
+        if {![cequal $FORM($field) $dontchange]} {
+            DoComma
+            regsub -all "'" [FormData $field] "''" value
+            append query "$field = '$value'"
+        }
+    }
+}
+
+
+
+ConnectToDatabase
+
+switch -exact $FORM(knob) {
+    none {}
+    accept {
+        ChangeStatus ASSIGNED
+    }
+    clearresolution {
+        ChangeResolution {}
+    }
+    resolve {
+        ChangeStatus RESOLVED
+        ChangeResolution $FORM(resolution)
+    }
+    reassign {
+        ChangeStatus NEW
+        DoComma
+        set newid [DBNameToIdAndCheck $FORM(assigned_to)]
+        append query "assigned_to = $newid"
+    }
+    reassignbycomponent {
+        if {[cequal $FORM(component) $dontchange]} {
+            puts "You must specify a component whose owner should get assigned"
+            puts "these bugs."
+            exit 0
+        }
+        ChangeStatus NEW
+        DoComma
+        SendSQL "select initialowner from components
+where program='[SqlQuote $FORM(product)]'
+and value='[SqlQuote $FORM(component)]'"
+        set newname [lindex [FetchSQLData] 0]
+        set newid [DBNameToIdAndCheck $newname 1]
+        append query "assigned_to = $newid"
+    }   
+    reopen {
+        ChangeStatus REOPENED
+    }
+    verify {
+        ChangeStatus VERIFIED
+    }
+    close {
+        ChangeStatus CLOSED
+    }
+    duplicate {
+        ChangeStatus RESOLVED
+        ChangeResolution DUPLICATE
+        set num $FORM(dup_id)
+        if {[catch {incr num}]} {
+            puts "You must specify a bug number of which this bug is a"
+            puts "duplicate.  The bug has not been changed."
+            exit
+        }
+        if {$FORM(dup_id) == $FORM(id)} {
+            puts "Nice try.  But it doesn't really make sense to mark a bug as"
+            puts "a duplicate of itself, does it?"
+            exit
+        }
+        AppendComment $FORM(dup_id) $FORM(who) "*** Bug $FORM(id) has been marked as a duplicate of this bug. ***"
+        append FORM(comment) "\n\n*** This bug has been marked as a duplicate of $FORM(dup_id) ***"
+        exec ./processmail $FORM(dup_id) < /dev/null > /dev/null 2> /dev/null &
+    }
+    default {
+        puts "Unknown action $FORM(knob)!"
+        exit
+    }
+}
+
+
+if {[lempty $idlist]} {
+    puts "You apparently didn't choose any bugs to modify."
+    puts "<p>Click <b>Back</b> and try again."
+    exit
+}
+
+if {[cequal $comma ""]} {
+    set comment {}
+    if {[info exists FORM(comment)]} {
+        set comment $FORM(comment)
+    }
+    if {[cequal $comment ""]} {
+        puts "Um, you apparently did not change anything on the selected bugs."
+        puts "<p>Click <b>Back</b> and try again."
+        exit
+    }
+}
+
+set basequery $query
+
+proc SnapShotBug {id} {
+    global log_columns
+    SendSQL "select [join $log_columns ","] from bugs where bug_id = $id"
+    return [FetchSQLData]
+}
+
+
+foreach id $idlist {
+    SendSQL "lock tables bugs write, bugs_activity write, cc write, profiles write"
+    set oldvalues [SnapShotBug $id]
+
+    set query "$basequery\nwhere bug_id = $id"
+    
+# puts "<PRE>$query</PRE>"
+
+    if {![cequal $comma ""]} {
+        if { [SendSQL $query] != 0 } {
+          puts "<H1>Error -- Changes not applied</H1>"
+          puts "OK, the database rejected the changes for some reason"
+          puts "which bugzilla can't deal with.  The error string returned"
+          puts "was:<PRE>$oramsg(errortxt)</PRE>"
+          puts "Here is the query which caused the error:"
+          puts "<PRE>$query</PRE>"
+        }
+        while {[MoreSQLData]} {
+            FetchSQLData
+        }
+    }
+    
+    if {[info exists FORM(comment)]} {
+        AppendComment $id $FORM(who) [FormData comment]
+    }
+    
+    if {[info exists FORM(cc)] && [ShowCcList $id] != [lookup FORM cc]} {
+        set ccids(zz) 1
+        unset ccids(zz)
+        foreach person [split $FORM(cc) " ,"] {
+            if {![cequal $person ""]} {
+                set id [DBNameToIdAndCheck $person]
+                set ccids($id) 1
+            }
+        }
+        
+        SendSQL "delete from cc where bug_id = $id"
+        while {[MoreSQLData]} { FetchSQLData }
+        foreach ccid [array names ccids] {
+            SendSQL "insert into cc (bug_id, who) values ($id, $ccid)"
+            while { [ MoreSQLData ] } { FetchSQLData }
+        }
+    }
+
+#    oracommit $lhandle
+
+    set newvalues [SnapShotBug $id]
+    foreach col $log_columns {
+        set old [lvarpop oldvalues]
+        set new [lvarpop newvalues]
+        if {![cequal $old $new]} {
+            if {![info exists whoid]} {
+                set whoid [DBNameToIdAndCheck $FORM(who)]
+                SendSQL "select delta_ts from bugs where bug_id = $id"
+                set timestamp [lindex [FetchSQLData] 0]
+            }
+            if {[cequal $col assigned_to]} {
+                set old [DBID_to_name $old]
+                set new [DBID_to_name $new]
+            }
+            set q "insert into bugs_activity (bug_id,who,when,field,oldvalue,newvalue) values ($id,$whoid,$timestamp,'[SqlQuote $col]','[SqlQuote $old]','[SqlQuote $new]')"
+            # puts "<pre>$q</pre>"
+            SendSQL $q
+        }
+    }
+    
+    puts "<TABLE BORDER=1><TD><H1>Changes Submitted</H1>"
+    puts "<TD><A HREF=\"show_bug.cgi?id=$id\">Back To BUG# $id</A></TABLE>"
+    flush stdout
+
+    SendSQL "unlock tables"
+
+    exec ./processmail $id < /dev/null > /dev/null 2> /dev/null &
+}
+
+if {[info exists next_bug]} {
+    set FORM(id) $next_bug
+    puts "<HR>"
+
+    navigation_header
+    source "bug_form.tcl"
+} else {
+  puts "<BR><A HREF=\"query.cgi\">Back To Query Page</A>"
+}
diff --git a/processmail b/processmail
new file mode 100755 (executable)
index 0000000..7992b01
--- /dev/null
@@ -0,0 +1,238 @@
+#! /usr/bonsaitools/bin/mysqltcl
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+
+# To recreate the shadow database, nuke all the entires and then run
+# processmail regenerate <last>, where <last> is the biggest bug number
+# currently used.
+
+
+source "globals.tcl"
+
+umask 0
+
+proc Different {file1 file2} {
+    if {[file size $file1] != [file size $file2]} {
+        return 1
+    }
+    set f1 [open $file1 "r"]
+    set f2 [open $file2 "r"]
+    set d1 [read $f1]
+    set d2 [read $f2]
+    close $f1
+    close $f2
+    return [expr ![cequal $d1 $d2]]
+}
+
+
+proc DescCC {cclist} {
+    if {[lempty $cclist]} return ""
+    return "Cc: [join $cclist ", "]\n"
+}
+
+proc DescFixVersion {v} {
+    if {[cequal $v ""]} return ""
+    return "Fix-Version: $v\n"
+}
+
+
+proc GetBugText {id} {
+    global bug
+    catch {unset bug}
+set query "
+select
+        bug_id,
+        product,
+        version,
+        rep_platform,
+        op_sys,
+        bug_status,
+        resolution,
+        priority,
+        bug_severity,
+        area,
+        assigned_to,
+        reporter,
+        bug_file_loc,
+        target_fix_version,
+        short_desc,
+        component
+from bugs
+where bug_id = $id";
+
+    SendSQL $query
+
+    set ret [FetchSQLData]
+    
+    if {$ret == ""} {
+        return ""
+    }
+    set count 0
+    foreach field { bug_id product version rep_platform op_sys bug_status
+                  resolution priority bug_severity area assigned_to
+                  reporter bug_file_loc target_fix_version short_desc
+                  component } {
+      set bug($field) [lindex $ret $count]
+      incr count
+    }
+
+    set bug(assigned_to) [DBID_to_name $bug(assigned_to)]
+    set bug(reporter) [DBID_to_name $bug(reporter)]
+
+    set bug(long_desc) [GetLongDescription $id]
+
+    set bug(cclist) [split [ShowCcList $id] ","]
+
+
+    return "Bug\#: $id
+Product: $bug(product)
+Version: $bug(version)
+Platform: $bug(rep_platform)
+OS/Version: $bug(op_sys)
+Status: $bug(bug_status)   
+Resolution: $bug(resolution)
+Severity: $bug(bug_severity)
+Priority: $bug(priority)
+Component: $bug(component)
+Area: $bug(area)
+AssignedTo: $bug(assigned_to)                            
+ReportedBy: $bug(reporter)               
+URL: $bug(bug_file_loc)
+[DescCC $bug(cclist)][DescFixVersion $bug(target_fix_version)]Summary: $bug(short_desc)
+
+$bug(long_desc)"
+
+}
+
+
+
+proc fixaddresses {list} {
+    global nomail
+    set result {}
+    foreach i [lrmdups $list] {
+        if {![info exists nomail($i)]} {
+            lappend result $i
+        }
+    }
+    return [join $result ", "]
+}
+
+
+proc Log {str} {
+    set lockfid [open "maillock" "w"]
+    flock -write $lockfid
+    set fid [open "maillog" "a"]
+    puts $fid "[fmtclock [getclock] "%D %H:%M"] $str"
+    close $fid
+    close $lockfid
+}
+    
+
+set COOKIE(Bugzilla_login) terry
+set COOKIE(Bugzilla_password) terry
+
+ConnectToDatabase
+
+
+
+set template "From: bugzilla-daemon
+To: terry@netscape.com
+X-Real-To: %s
+X-Real-Cc: %s
+Subject: \[Bug %s\] %s - %s
+
+http://bugzilla.mozilla.org/bugzilla/show_bug.cgi?id=%s
+
+%s"
+
+
+set lockfid [open "maillock" "r"]
+flock -read $lockfid
+
+# foreach i [split [read_file -nonewline "okmail"] "\n"] {
+#     set okmail($i) 1
+# }
+
+foreach i [split [read_file -nonewline "nomail"] "\n"] {
+    if {[info exists okmail($i)]} {
+        unset okmail($i)
+    }
+    set nomail($i) 1
+}
+
+
+close $lockfid
+
+
+set regenerate 0
+if {[cequal [lindex $argv 0] "regenerate"]} {
+    set regenerate 1
+    set last [lindex $argv 1]
+    set argv ""
+    loop i 1 [expr $last + 1] {
+        lappend argv $i
+    }
+}
+
+foreach i $argv {
+    if {[lempty $i]} continue
+    set old shadow/$i
+    set new shadow/$i.tmp.[id process]
+    set diffs shadow/$i.diffs.[id process]
+    set verb "Changed"
+    if {![file exists $old]} {
+        close [open $old "w"]
+        set verb "New"
+    }
+    set text [GetBugText $i]
+    if {$text == ""} {
+        if {$regenerate} {
+            continue
+        }
+        error "Couldn't find bug $i."
+    }
+    set fid [open $new "w"]
+    puts $fid $text
+    close $fid
+    if {[Different $old $new]} {
+        catch {exec diff -c $old $new > $diffs}
+        set tolist [fixaddresses [list $bug(assigned_to) $bug(reporter)]]
+        set cclist [fixaddresses $bug(cclist)]
+        set logstr "Bug $i changed"
+        if {![lempty $tolist] || ![lempty $cclist]} {
+            set msg [format $template $tolist $cclist $i $verb \
+                         $bug(short_desc) $i [read_file $diffs]]
+            if {!$regenerate || ![cequal $verb "New"]} {
+                exec /usr/lib/sendmail -t << $msg
+                set logstr "$logstr; mail sent to $tolist $cclist"
+            }
+        }
+        unlink $diffs
+        Log $logstr
+    }
+    frename $new $old
+    catch {chmod 0666 $old}
+    if {$regenerate} {
+        puts -nonewline "$i "
+    }
+}
+
+exit
diff --git a/query.cgi b/query.cgi
new file mode 100755 (executable)
index 0000000..432620b
--- /dev/null
+++ b/query.cgi
@@ -0,0 +1,242 @@
+#! /usr/bonsaitools/bin/mysqltcl
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+source "CGI.tcl"
+
+if {[catch {
+
+
+
+if {[info exists FORM(GoAheadAndLogIn)]} {
+    # We got here from a login page, probably from relogin.cgi.  We better
+    # make sure the password is legit.
+    confirm_login
+}
+
+
+if {![info exists COOKIE(DEFAULTQUERY)]} {
+    set COOKIE(DEFAULTQUERY) "bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&product=Communicator&order=%22Importance%22"
+}
+
+if {![info exists buffer] || $buffer == ""} {
+    set buffer $COOKIE(DEFAULTQUERY)
+}
+
+foreach name {bug_status resolution assigned_to rep_platform priority \
+                  bug_severity product reporter op_sys component  \
+                  version} {
+    set default($name) ""
+    set type($name) 0
+}
+
+foreach item [split $buffer "&"] {
+    set el [ split $item = ]
+    set value [url_decode [lindex $el 1]]
+    set name [lindex $el 0]
+    if {[info exists default($name)]} {
+        if {$default($name) != ""} {
+            append default($name) "|$value"
+            set type($name) 1
+        } else {
+            set default($name) $value
+        }
+    }
+}
+
+foreach i [lsort [array names COOKIE]] {
+    switch -glob $i {
+        QUERY_* {
+            if {$COOKIE($i) != ""} {
+                set name [crange $i 6 end]
+                append namelist "<OPTION>$name"
+            }
+        }
+    }
+}
+        
+puts "Set-Cookie: BUGLIST=
+Content-type: text/html\n"
+
+GetVersionTable
+set who [GeneratePeopleInput assigned_to $default(assigned_to)]
+set reporter [GeneratePeopleInput reporter $default(reporter)]
+set qa_assigned_to_who [GeneratePeopleInput qa_assigned_to ""]
+
+
+# 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]]
+# }
+
+PutHeader "Bugzilla Query Page" "Query Page"
+
+puts "
+<FORM NAME=queryForm METHOD=GET ACTION=\"buglist.cgi\">
+
+<table>
+<tr>
+<th align=left><A HREF=\"bug_status.html\">Status</a>:</th>
+<th align=left><A HREF=\"bug_status.html\">Resolution</a>:</th>
+<th align=left><A HREF=\"bug_status.html#rep_platform\">Platform</a>:</th>
+<th align=left><A HREF=\"bug_status.html#priority\">Priority</a>:</th>
+<th align=left><A HREF=\"bug_status.html#severity\">Severity</a>:</th>
+</tr>
+<tr>
+<td align=left valign=top>
+<SELECT NAME=\"bug_status\" MULTIPLE SIZE=7>
+[make_options $legal_bug_status $default(bug_status) $type(bug_status)]
+</SELECT>
+</td>
+<td align=left valign=top>
+<SELECT NAME=\"resolution\" MULTIPLE SIZE=7>
+[make_options $legal_resolution $default(resolution) $type(resolution)]
+</SELECT>
+</td>
+<td align=left valign=top>
+<SELECT NAME=\"rep_platform\" MULTIPLE SIZE=7>
+[make_options $legal_platform $default(rep_platform) $type(rep_platform)]
+</SELECT>
+</td>
+<td align=left valign=top>
+<SELECT NAME=\"priority\" MULTIPLE SIZE=7>
+[make_options $legal_priority $default(priority) $type(priority) ]
+</SELECT>
+</td>
+<td align=left valign=top>
+<SELECT NAME=\"bug_severity\" MULTIPLE SIZE=7>
+[make_options $legal_severity $default(bug_severity) $type(bug_severity)]
+</SELECT>
+</tr>
+</table>
+
+<p>
+<TABLE>
+<TR><TD ALIGN=RIGHT><B><A HREF=\"bug_status.html#assigned_to\">Assigned To:</a></B><TD>$who
+
+<p>
+<TR><TD ALIGN=RIGHT><B>Reporter:</B><TD>$reporter
+</TABLE>
+<NOBR>Changed in the last <INPUT NAME=changedin SIZE=2> days.</NOBR>
+
+
+<P>
+
+<table>
+<tr>
+<TH ALIGN=LEFT>Program:</th>
+<TH ALIGN=LEFT>Version:</th>
+<TH ALIGN=LEFT>Component:</th>
+</tr>
+<tr>
+
+<td align=left valign=top>
+<SELECT NAME=\"product\" MULTIPLE SIZE=5>
+[make_options $legal_product $default(product) $type(product)]
+</SELECT>
+</td>
+
+<td align=left valign=top>
+<SELECT NAME=\"version\" MULTIPLE SIZE=5>
+[make_options $legal_versions $default(version) $type(version)]
+</SELECT>
+</td>
+
+<td align=left valign=top>
+<SELECT NAME=\"component\" MULTIPLE SIZE=5>
+[make_options $legal_components $default(component) $type(component)]
+</SELECT>
+</td>
+
+</tr>
+</table>
+
+<table border=0><tr><td align=right>
+<b><A HREF=\"bug_status.html#resolved_ts\">Date Resolved</a>:</b> </td>
+<td align=left><INPUT NAME=resolved_ts SIZE=9> (to <INPUT NAME=resolved_ts_2 SIZE=9>, optional)</td>
+</tr>
+<tr>
+<td align=right><b><A HREF=\"bug_status.html#resolved_ts\">Date Verified</a>:</b> </td>
+<td align=left><INPUT NAME=verified_ts SIZE=9> (to <INPUT NAME=verified_ts_2 SIZE=9>, optional)
+<font size=-1>&nbsp;&nbsp;date format: 24-FEB-98</font>
+</td>
+</tr>
+</table>
+
+<p>
+
+
+
+<BR>
+<INPUT TYPE=radio NAME=cmdtype VALUE=doit CHECKED> Run this query
+<BR>"
+
+if {[info exists namelist]} {
+    puts "
+<table cellspacing=0 cellpadding=0><tr>
+<td><INPUT TYPE=radio NAME=cmdtype VALUE=editnamed> Load the remembered query:</td>
+<td rowspan=3><select name=namedcmd>$namelist</select>
+</tr><tr>
+<td><INPUT TYPE=radio NAME=cmdtype VALUE=runnamed> Run the remembered query:</td>
+</tr><tr>
+<td><INPUT TYPE=radio NAME=cmdtype VALUE=forgetnamed> Forget the remembered query:</td>
+</tr></table>"
+}
+
+puts "
+<INPUT TYPE=radio NAME=cmdtype VALUE=asdefault> Remember this as the default query
+<BR>
+<INPUT TYPE=radio NAME=cmdtype VALUE=asnamed> Remember this query, and name it:
+<INPUT TYPE=text NAME=newqueryname>
+<BR>
+
+<NOBR><B>Sort By:</B>
+<SELECT NAME=\"order\">
+  <OPTION>Bug Number
+  <OPTION SELECTED>\"Importance\"
+  <OPTION>Assignee
+</SELECT></NOBR>
+<INPUT TYPE=\"submit\" VALUE=\"Submit\">
+<INPUT TYPE=\"reset\" VALUE=\"Reset back to the default query\">
+<INPUT TYPE=hidden name=form_name VALUE=query>
+<BR>Give me a <A HREF=\"help.html\">clue</A> about how to use this form.
+</CENTER>
+</FORM>
+
+"
+
+
+if {[info exists COOKIE(Bugzilla_login)]} {
+    puts "
+<a href=relogin.cgi>Log in as someone besides <b>$COOKIE(Bugzilla_login)</b></a><br>
+<a href=changepassword.cgi>Change my password.</a><br>"
+}
+
+puts "<a href=\"enter_bug.cgi\">Create a new bug.</a><br>"
+
+}]} {
+    puts "\n\nQuery Page Error\n$errorInfo"
+    # exec /usr/lib/sendmail -t << "To: terry\n\n$errorInfo\n"
+}
diff --git a/relogin.cgi b/relogin.cgi
new file mode 100755 (executable)
index 0000000..e569496
--- /dev/null
@@ -0,0 +1,52 @@
+#! /usr/bonsaitools/bin/mysqltcl
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+source CGI.tcl
+
+
+
+
+
+puts "Set-Cookie: Bugzilla_login= ; path=/; expires=Sun, 30-Jun-80 00:00:00 GMT
+Set-Cookie: Bugzilla_password= ; path=/; expires=Sun, 30-Jun-80 00:00:00 GMT
+Content-type: text/html
+
+<H1>Your login has been forgotten.</H1>
+The cookie that was remembering your login is now gone.  The next time you
+do an action that requires a login, you will be prompted for it.
+<p>
+<a href=query.cgi>Back to the query page.</a>
+"
+
+exit
+
+# The below was a different way, that prompted you for a login right then.
+
+catch {unset COOKIE(Bugzilla_login)}
+catch {unset COOKIE(Bugzilla_password)}
+confirm_login
+
+puts "Content-type: text/html\n"
+puts "<H1>OK, logged in.</H1>"
+puts "You are now logged in as <b>$COOKIE(Bugzilla_login)</b>."
+puts "<p>"
+puts "<a href=query.cgi>Back to the query page.</a>"
+
diff --git a/show_activity.cgi b/show_activity.cgi
new file mode 100755 (executable)
index 0000000..835b740
--- /dev/null
@@ -0,0 +1,58 @@
+#! /usr/bonsaitools/bin/mysqltcl
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+source "CGI.tcl"
+puts "Content-type: text/html\n"
+
+puts "<HTML>
+<H1>Changes made to bug $FORM(id)</H1>
+"
+set query "
+        select bugs_activity.field, bugs_activity.when,
+                bugs_activity.oldvalue, bugs_activity.newvalue,
+                profiles.login_name
+        from bugs_activity,profiles
+        where bugs_activity.bug_id = $FORM(id)
+        and profiles.userid = bugs_activity.who
+        order by bugs_activity.when"
+
+ConnectToDatabase
+SendSQL $query
+
+puts "<table border cellpadding=4>"
+puts "<tr>"
+puts "    <th>Who</th><th>What</th><th>Old value</th><th>New value</th><th>When</th>"
+puts "</tr>"
+
+while { [MoreSQLData] } {
+    set value [FetchSQLData]
+    lassign $value field when old new who
+
+    puts "<tr>"
+    puts "<td>$who</td>"
+    puts "<td>$field</td>"
+    puts "<td>[value_quote $old]</td>"
+    puts "<td>[value_quote $new]</td>"
+    puts "<td>$when</td>"
+    puts "</tr>"
+}
+puts "</table>"
+puts "<hr><a href=show_bug.cgi?id=$FORM(id)>Back to bug $FORM(id)</a>"
diff --git a/show_bug.cgi b/show_bug.cgi
new file mode 100755 (executable)
index 0000000..5228ed3
--- /dev/null
@@ -0,0 +1,44 @@
+#! /usr/bonsaitools/bin/mysqltcl
+# -*- Mode: tcl; 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 <terry@mozilla.org>
+
+source "CGI.tcl"
+puts "Content-type: text/html"
+puts ""
+
+
+if {[lookup FORM id] == ""} {
+  puts "<H2>Search By Bug Number</H2>"
+  puts "<FORM METHOD=GET ACTION=\"show_bug.cgi\">"
+  puts "You may find a single bug by entering its bug id here: "
+  puts "<INPUT NAME=id>"
+  puts "<INPUT TYPE=\"submit\" VALUE=\"Show Me This Bug\">"
+  puts "</FORM>"
+  exit 0
+}
+ConnectToDatabase
+
+GetVersionTable
+
+PutHeader "Bugzilla bug $FORM(id)" "Bugzilla Bug" $FORM(id)
+navigation_header
+
+puts "<HR>"
+source "bug_form.tcl"