summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterry%netscape.com <>1998-09-01 13:21:44 +0200
committerterry%netscape.com <>1998-09-01 13:21:44 +0200
commit7fa78eee115a50354911bc11bc8047c2e4b7d4ca (patch)
tree6df662bacb2b57f96b2804289bbaa1a0154dff40
parentfa3443b1e248960d9182d03f412fbcb229c9ae3d (diff)
downloadbugzilla-7fa78eee115a50354911bc11bc8047c2e4b7d4ca.tar.gz
bugzilla-7fa78eee115a50354911bc11bc8047c2e4b7d4ca.tar.xz
Allow editing of parameters via a web page.
-rwxr-xr-xCGI.tcl2
-rw-r--r--README29
-rw-r--r--defparams.tcl139
-rwxr-xr-xdoeditparams.cgi62
-rwxr-xr-xeditparams.cgi71
-rw-r--r--globals.tcl19
-rwxr-xr-xquery.cgi5
7 files changed, 325 insertions, 2 deletions
diff --git a/CGI.tcl b/CGI.tcl
index e3c459a11..c368ed8a4 100755
--- a/CGI.tcl
+++ b/CGI.tcl
@@ -208,7 +208,7 @@ E-mail address: %s
Password: %s
To change your password, go to:
-http://cvs-mirror.mozilla.org/webtools/bugzilla/changepassword.cgi
+[Param urlbase]changepassword.cgi
(Your bugzilla and CVS password, if any, are not currently synchronized.
Top hackers are working around the clock to fix this, as you read this.)
diff --git a/README b/README
index e884deab8..8ad6413b2 100644
--- a/README
+++ b/README
@@ -104,6 +104,35 @@ You should be run all six scripts named make*.sh. This creates the
databases and populates them a teeny bit.
+4. Setting the parameters
+
+At this point, you ought to be able to go and browse some pages. But you'd
+like to customize some things.
+
+Create yourself an account. (Try to enter a new bug, and it will
+prompt you for your login. Give it your email address, and have it
+mail you your password.) Go visit the query page; that ought to force
+the creation of the "params" file in your installation dir. Edit the
+params file, and change the line that says "set param(maintainer)" to
+have your email address as the maintainer. Go visit the query page
+again; there should now be a link at the bottom that invites you to
+edit the parameters. (If you have cookies turned off, you'll have to
+go to editparams.cgi manually.)
+
+Tweak the parameters to taste. Be careful.
+
+
+5. Set up the whining cron job.
+
+It's a good idea to set up a daily cronjob that does
+
+ cd <your-installation-dir> ; ./whineatnews.tcl
+
+This causes email that gets sent to anyone who has a NEW bug that
+hasn't been touched for several days. For more info, see the
+whinedays and whinemail parameters.
+
+
*******************************************************
APPENDIXES
diff --git a/defparams.tcl b/defparams.tcl
new file mode 100644
index 000000000..07046bc82
--- /dev/null
+++ b/defparams.tcl
@@ -0,0 +1,139 @@
+#! /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>
+
+
+# This file defines all the parameters that we have a GUI to edit within
+# Bugzilla.
+
+
+
+proc WriteParams {} {
+ global param param_list param_default
+ set tmpname "params.[id process]"
+ set fid [open $tmpname "w"]
+ foreach i $param_list {
+ if {![info exists param($i)]} {
+ set param($i) $param_default($i)
+ }
+ puts $fid [list set param($i) $param($i)]
+ }
+ close $fid
+ frename $tmpname "params"
+ catch {chmod 0666 "params"}
+}
+
+
+proc DefParam {id desc type default {checker {}}} {
+ global param_list param_desc param_type param_default param_checker
+ lappend param_list $id
+ set param_desc($id) $desc
+ set param_type($id) $type
+ set param_default($id) $default
+ set param_checker($id) $checker
+}
+
+
+proc check_numeric {value} {
+ if {[catch {incr value}]} {
+ return "must be a numeric value"
+ }
+ return ""
+}
+
+
+
+set param_list {}
+
+
+
+# OK, here are the definitions themselves.
+#
+# The type of parameters (the third parameter to DefParam) can be one
+# of the following:
+#
+# t -- A short text entry field (suitable for a single line)
+# l -- A long text field (suitable for many lines)
+
+# This very first one is silly. At some point, "superuserness" should be an
+# attribute of the person's profile entry, and not a single name like this.
+#
+# When first installing bugzilla, you need to either change this line to be
+# you, or (better) edit the initial "params" file and change the entry for
+# param(maintainer).
+
+DefParam maintainer {The email address of the person who maintains this installation of Bugzilla.} t terry@mozilla.org
+
+DefParam urlbase {The URL that is the common initial leading part of all Bugzilla URLs.} t {http://cvs-mirror.mozilla.org/webtools/bugzilla/} check_urlbase
+
+proc check_urlbase {url} {
+ if {![regexp {^http.*/$} $url]} {
+ return "must be a legal URL, that starts with http and ends with a slash."
+ }
+ return ""
+}
+
+
+DefParam whinedays {The number of days that we'll let a bug sit untouched in a NEW state before our cronjob will whine at the owner.} t 7 check_numeric
+
+
+DefParam whinemail {The email that gets sent to anyone who has a NEW bug that hasn't been touched for more than <b>whinedays</b>. Within this text, %email% gets replaced by the offender's email address. %<i>anythingelse</i>% gets replaced by the definition of that parameter (as defined on this page).<p> It is a good idea to make sure this message has a valid From: address, so that if the mail bounces, a real person can know that there are bugs assigned to an invalid address.} l {From: %maintainer%
+To: %email%
+Subject: Your Bugzilla buglist needs attention.
+
+[This e-mail has been automatically generated.]
+
+You have one or more bugs assigned to you in the Bugzilla
+bugsystem (%urlbase%) that require
+attention.
+
+All of these bugs are in the NEW state, and have not been touched
+in %whinedays% days or more. You need to take a look at them, and
+decide on an initial action.
+
+Generally, this means one of three things:
+
+(1) You decide this bug is really quick to deal with (like, it's INVALID),
+ and so you get rid of it immediately.
+(2) You decide the bug doesn't belong to you, and you reassign it to someone
+ else. (Hint: if you don't know who to reassign it to, make sure that
+ the Component field seems reasonable, and then use the "Reassign bug to
+ owner of selected component" option.)
+(3) You decide the bug belongs to you, but you can't solve it this moment.
+ Just use the "Accept bug" command.
+
+To get a list of all NEW bugs, you can use this URL (bookmark it if you like!):
+
+ %urlbase%buglist.cgi?bug_status=NEW&assigned_to=%email%
+
+Or, you can use the general query page, at
+%urlbase%query.cgi.
+
+Appended below are the individual URLs to get to all of your NEW bugs that
+haven't been touched for a week or more.
+
+You will get this message once a day until you've dealt with these bugs!
+
+}
+
+
+DefParam defaultquery {This is the default query that initially comes up when you submit a bug. It's in URL parameter format, which makes it hard to read. Sorry!} t "bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&product=Mozilla&order=%22Importance%22"
+
+
diff --git a/doeditparams.cgi b/doeditparams.cgi
new file mode 100755
index 000000000..b214ff750
--- /dev/null
+++ b/doeditparams.cgi
@@ -0,0 +1,62 @@
+#! /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"
+source "defparams.tcl"
+
+confirm_login
+
+puts "Content-type: text/html\n"
+
+if {![cequal [Param "maintainer"] $COOKIE(Bugzilla_login)]} {
+ puts "<H1>Sorry, you aren't the maintainer of this system.</H1>"
+ puts "And so, you aren't allowed to edit the parameters of it."
+ exit
+}
+
+
+PutHeader "Saving new parameters" "Saving new parameters"
+
+foreach i $param_list {
+ if {[info exists FORM(reset-$i)]} {
+ set FORM($i) $param_default($i)
+ }
+ if {![cequal $FORM($i) [Param $i]]} {
+ if {![cequal $param_checker($i) ""]} {
+ set ok [$param_checker($i) $FORM($i)]
+ if {![cequal $ok ""]} {
+ puts "New value for $i is invalid: $ok<p>"
+ puts "Please hit <b>Back</b> and try again."
+ exit
+ }
+ }
+ puts "Changed $i.<br>"
+ set param($i) $FORM($i)
+ }
+}
+
+
+WriteParams
+
+puts "OK, done.<p>"
+puts "<a href=editparams.cgi>Edit the params some more.</a><p>"
+puts "<a href=query.cgi>Go back to the query page.</a>"
+
diff --git a/editparams.cgi b/editparams.cgi
new file mode 100755
index 000000000..a0a400419
--- /dev/null
+++ b/editparams.cgi
@@ -0,0 +1,71 @@
+#! /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"
+source "defparams.tcl"
+
+confirm_login
+
+puts "Content-type: text/html\n"
+
+if {![cequal [Param "maintainer"] $COOKIE(Bugzilla_login)]} {
+ puts "<H1>Sorry, you aren't the maintainer of this system.</H1>"
+ puts "And so, you aren't allowed to edit the parameters of it."
+ exit
+}
+
+
+PutHeader "Edit parameters" "Edit parameters"
+
+puts "This lets you edit the basic operating parameters of bugzilla. Be careful!"
+puts "<p>"
+puts "Any item you check Reset on will get reset to its default value."
+
+puts "<form method=get action=doeditparams.cgi><table>"
+
+set rowbreak "<tr><td colspan=2><hr></td></tr>"
+puts $rowbreak
+
+foreach i $param_list {
+ puts "<tr><th align=right valign=top>$i:</th><td>$param_desc($i)</td></tr>"
+ puts "<tr><td valign=top><input type=checkbox name=reset-$i>Reset</td><td>"
+ set value [Param $i]
+ switch $param_type($i) {
+ t {
+ puts "<input size=80 name=$i value=\"[value_quote $value]\">"
+ }
+ l {
+ puts "<textarea wrap=hard name=$i rows=10 cols=80>[value_quote $value]</textarea>"
+ }
+ }
+ puts "</td></tr>"
+ puts $rowbreak
+}
+
+puts "</table>"
+
+puts "<input type=reset value=\"Reset form\"><br>"
+puts "<input type=submit value=\"Submit changes\">"
+
+puts "</form>"
+
+puts "<p><a href=query.cgi>Skip all this, and go back to the query page</a>"
diff --git a/globals.tcl b/globals.tcl
index 275a6a301..b8997102c 100644
--- a/globals.tcl
+++ b/globals.tcl
@@ -437,3 +437,22 @@ proc SqlQuote {str} {
return $str
}
+
+
+proc Param {value} {
+ global param
+ if {[info exists param($value)]} {
+ return $param($value)
+ }
+ # Um, maybe we haven't sourced in the params at all yet.
+ catch {uplevel \#0 source "params"}
+ if {[info exists param($value)]} {
+ return $param($value)
+ }
+ # Well, that didn't help. Maybe it's a new param, and the user
+ # hasn't defined anything for it. Try and load a default value
+ # for it.
+ uplevel #0 source "defparams.tcl"
+ WriteParams
+ return $param($value)
+}
diff --git a/query.cgi b/query.cgi
index d285cf66c..992a232ac 100755
--- a/query.cgi
+++ b/query.cgi
@@ -33,7 +33,7 @@ if {[info exists FORM(GoAheadAndLogIn)]} {
if {![info exists COOKIE(DEFAULTQUERY)]} {
- set COOKIE(DEFAULTQUERY) "bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&product=Mozilla&order=%22Importance%22"
+ set COOKIE(DEFAULTQUERY) [Param defaultquery]
}
if {![info exists buffer] || $buffer == ""} {
@@ -231,6 +231,9 @@ puts "
if {[info exists COOKIE(Bugzilla_login)]} {
+ if {[cequal $COOKIE(Bugzilla_login) [Param maintainer]]} {
+ puts "<a href=editparams.cgi>Edit Bugzilla operating parameters</a><br>"
+ }
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>"