2004-05-23 11:22:32 +04:00
|
|
|
#!/usr/bin/perl -wT
|
1998-09-16 01:49:26 +04:00
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
1998-09-01 08:21:45 +04:00
|
|
|
#
|
1999-11-02 02:33:56 +03:00
|
|
|
# The contents of this file are subject to the Mozilla Public
|
|
|
|
# License Version 1.1 (the "License"); you may not use this file
|
|
|
|
# except in compliance with the License. You may obtain a copy of
|
|
|
|
# the License at http://www.mozilla.org/MPL/
|
|
|
|
#
|
|
|
|
# Software distributed under the License is distributed on an "AS
|
|
|
|
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
# implied. See the License for the specific language governing
|
|
|
|
# rights and limitations under the License.
|
|
|
|
#
|
1998-09-01 08:21:45 +04:00
|
|
|
# The Original Code is the Bugzilla Bug Tracking System.
|
1999-11-02 02:33:56 +03:00
|
|
|
#
|
1998-09-01 08:21:45 +04:00
|
|
|
# The Initial Developer of the Original Code is Netscape Communications
|
1999-11-02 02:33:56 +03:00
|
|
|
# Corporation. Portions created by Netscape are
|
|
|
|
# Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
# Rights Reserved.
|
|
|
|
#
|
1998-09-01 08:21:45 +04:00
|
|
|
# Contributor(s): Terry Weissman <terry@mozilla.org>
|
2002-08-11 18:12:33 +04:00
|
|
|
# J. Paul Reed <preed@sigkill.com>
|
1998-09-01 08:21:45 +04:00
|
|
|
|
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
use strict;
|
2002-04-29 23:32:29 +04:00
|
|
|
use lib ".";
|
1998-09-01 08:21:45 +04:00
|
|
|
|
2004-03-27 06:51:44 +03:00
|
|
|
use Bugzilla::Constants;
|
2002-08-29 13:25:54 +04:00
|
|
|
use Bugzilla::Config qw(:DEFAULT :admin);
|
1998-09-01 08:21:45 +04:00
|
|
|
|
2002-08-29 13:25:54 +04:00
|
|
|
require "CGI.pl";
|
1998-09-01 08:21:45 +04:00
|
|
|
|
2004-03-27 06:51:44 +03:00
|
|
|
Bugzilla->login(LOGIN_REQUIRED);
|
1998-09-16 01:49:26 +04:00
|
|
|
|
2003-05-05 05:15:38 +04:00
|
|
|
print Bugzilla->cgi->header();
|
1998-09-16 01:49:26 +04:00
|
|
|
|
1999-03-11 19:30:54 +03:00
|
|
|
if (!UserInGroup("tweakparams")) {
|
|
|
|
print "<H1>Sorry, you aren't a member of the 'tweakparams' group.</H1>\n";
|
|
|
|
print "And so, you aren't allowed to edit the parameters.\n";
|
2000-01-15 01:35:49 +03:00
|
|
|
PutFooter();
|
1998-09-16 01:49:26 +04:00
|
|
|
exit;
|
1998-09-01 08:21:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-01-12 21:55:24 +03:00
|
|
|
|
2001-08-13 23:11:35 +04:00
|
|
|
PutHeader("Edit parameters");
|
1998-09-16 01:49:26 +04:00
|
|
|
|
|
|
|
print "This lets you edit the basic operating parameters of bugzilla.\n";
|
|
|
|
print "Be careful!\n";
|
|
|
|
print "<p>\n";
|
|
|
|
print "Any item you check Reset on will get reset to its default value.\n";
|
|
|
|
|
1998-11-20 22:18:37 +03:00
|
|
|
print "<form method=post action=doeditparams.cgi><table>\n";
|
1998-09-16 01:49:26 +04:00
|
|
|
|
1998-11-20 22:18:37 +03:00
|
|
|
my $rowbreak = "<tr><td colspan=2><hr></td></tr>";
|
1998-09-16 01:49:26 +04:00
|
|
|
print $rowbreak;
|
|
|
|
|
2002-08-29 13:25:54 +04:00
|
|
|
foreach my $i (GetParamList()) {
|
|
|
|
my $name = $i->{'name'};
|
|
|
|
my $value = Param($name);
|
|
|
|
print "<tr><th align=right valign=top>$name:</th><td>$i->{'desc'}</td></tr>\n";
|
|
|
|
print "<tr><td valign=top><input type=checkbox name=reset-$name>Reset</td><td>\n";
|
|
|
|
SWITCH: for ($i->{'type'}) {
|
2001-10-13 05:36:17 +04:00
|
|
|
/^t$/ && do {
|
2002-08-29 13:25:54 +04:00
|
|
|
print "<input size=80 name=$name value=\"" .
|
1999-01-28 00:17:10 +03:00
|
|
|
value_quote($value) . "\">\n";
|
1998-09-16 01:49:26 +04:00
|
|
|
last SWITCH;
|
2001-10-13 05:36:17 +04:00
|
|
|
};
|
|
|
|
/^l$/ && do {
|
2002-08-29 13:25:54 +04:00
|
|
|
print "<textarea wrap=hard name=$name rows=10 cols=80>" .
|
1998-09-16 01:49:26 +04:00
|
|
|
value_quote($value) . "</textarea>\n";
|
|
|
|
last SWITCH;
|
2001-10-13 05:36:17 +04:00
|
|
|
};
|
1998-09-16 01:49:26 +04:00
|
|
|
/^b$/ && do {
|
|
|
|
my $on;
|
|
|
|
my $off;
|
|
|
|
if ($value) {
|
|
|
|
$on = "checked";
|
|
|
|
$off = "";
|
1998-09-02 00:54:24 +04:00
|
|
|
} else {
|
1998-09-16 01:49:26 +04:00
|
|
|
$on = "";
|
|
|
|
$off = "checked";
|
1998-09-02 00:54:24 +04:00
|
|
|
}
|
2002-08-29 13:25:54 +04:00
|
|
|
print "<input type=radio name=$name value=1 $on>On\n";
|
|
|
|
print "<input type=radio name=$name value=0 $off>Off\n";
|
1998-09-16 01:49:26 +04:00
|
|
|
last SWITCH;
|
|
|
|
};
|
2002-08-11 18:12:33 +04:00
|
|
|
/^m$/ && do {
|
2002-08-29 13:25:54 +04:00
|
|
|
my @choices = @{$i->{'choices'}};
|
2002-08-11 18:12:33 +04:00
|
|
|
## showing 5 options seems like a nice round number; this should
|
|
|
|
## probably be configurable; if you care, file a bug ;-)
|
2002-08-29 13:25:54 +04:00
|
|
|
my $boxSize = scalar(@choices) < 5 ? scalar(@choices) : 5;
|
2002-08-11 18:12:33 +04:00
|
|
|
|
2002-08-29 13:25:54 +04:00
|
|
|
print "<select multiple size=\"$boxSize\" name=\"$name\">\n";
|
2002-08-11 18:12:33 +04:00
|
|
|
|
2002-08-29 13:25:54 +04:00
|
|
|
foreach my $item (@choices) {
|
2002-08-11 18:12:33 +04:00
|
|
|
my $selected = "";
|
|
|
|
|
2002-08-29 13:25:54 +04:00
|
|
|
if (lsearch($value, $item) >= 0) {
|
|
|
|
$selected = "selected";
|
2002-08-11 18:12:33 +04:00
|
|
|
}
|
|
|
|
|
2002-08-29 13:25:54 +04:00
|
|
|
print "<option $selected value=\"" . html_quote($item) . "\">" .
|
|
|
|
html_quote($item) . "</option>\n";
|
2002-08-11 18:12:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
print "</select>\n";
|
|
|
|
last SWITCH;
|
|
|
|
};
|
|
|
|
/^s$/ && do {
|
2002-08-29 13:25:54 +04:00
|
|
|
print "<select name=\"$name\">\n";
|
|
|
|
my @choices = @{$i->{'choices'}};
|
2002-08-11 18:12:33 +04:00
|
|
|
|
2002-08-29 13:25:54 +04:00
|
|
|
foreach my $item (@choices) {
|
2002-08-11 18:12:33 +04:00
|
|
|
my $selected = "";
|
2002-08-29 13:25:54 +04:00
|
|
|
|
|
|
|
if ($value eq $item) {
|
2002-08-11 18:12:33 +04:00
|
|
|
$selected = "selected";
|
|
|
|
}
|
|
|
|
|
2002-08-29 13:25:54 +04:00
|
|
|
print "<option $selected value=\"" . html_quote($item) . "\">" .
|
|
|
|
html_quote($item) . "</option>\n";
|
|
|
|
|
2002-08-11 18:12:33 +04:00
|
|
|
}
|
|
|
|
print "</select>\n";
|
|
|
|
last SWITCH;
|
|
|
|
};
|
1998-09-16 01:49:26 +04:00
|
|
|
# DEFAULT
|
2002-08-29 13:25:54 +04:00
|
|
|
print "<font color=red><blink>Unknown param type $i->{'type'}!!!</blink></font>\n";
|
1998-09-01 08:21:45 +04:00
|
|
|
}
|
1998-09-16 01:49:26 +04:00
|
|
|
print "</td></tr>\n";
|
|
|
|
print $rowbreak;
|
1998-09-01 08:21:45 +04:00
|
|
|
}
|
|
|
|
|
1998-11-20 22:18:37 +03:00
|
|
|
print "<tr><th align=right valign=top>version:</th><td>
|
2002-08-29 13:25:54 +04:00
|
|
|
What version of Bugzilla this is. This can't be modified.
|
|
|
|
<tr><td></td><td>" . $Bugzilla::Config::VERSION . "</td></tr>";
|
1998-09-19 09:48:09 +04:00
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
print "</table>\n";
|
1998-09-01 08:21:45 +04:00
|
|
|
|
1998-11-20 22:18:37 +03:00
|
|
|
print "<input type=reset value=\"Reset form\"><br>\n";
|
|
|
|
print "<input type=submit value=\"Submit changes\">\n";
|
1998-09-01 08:21:45 +04:00
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
print "</form>\n";
|
1998-09-01 08:21:45 +04:00
|
|
|
|
1998-11-20 22:18:37 +03:00
|
|
|
print "<p><a href=query.cgi>Skip all this, and go back to the query page</a>\n";
|
2000-01-15 01:35:49 +03:00
|
|
|
PutFooter();
|