From b8f2c324a9a4133f264254d61993ff8c7e0233a2 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Wed, 12 Oct 2005 15:51:52 +0000 Subject: Bug 46296: Make editparams.cgi be multi-panel by category - Patch by Frédéric Buclin r=joel a=justdave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/Config/Admin.pm | 105 ++++++++++ Bugzilla/Config/Auth.pm | 135 +++++++++++++ Bugzilla/Config/BugChange.pm | 142 ++++++++++++++ Bugzilla/Config/BugFields.pm | 108 +++++++++++ Bugzilla/Config/BugMove.pm | 93 +++++++++ Bugzilla/Config/Common.pm | 386 +++++++++++++++++++++++++++++++++++++ Bugzilla/Config/Core.pm | 103 ++++++++++ Bugzilla/Config/DependencyGraph.pm | 52 +++++ Bugzilla/Config/GroupSecurity.pm | 81 ++++++++ Bugzilla/Config/L10n.pm | 78 ++++++++ Bugzilla/Config/LDAP.pm | 81 ++++++++ Bugzilla/Config/MTA.pm | 173 +++++++++++++++++ Bugzilla/Config/PatchViewer.pm | 75 +++++++ Bugzilla/Config/Query.pm | 78 ++++++++ Bugzilla/Config/ShadowDB.pm | 73 +++++++ Bugzilla/Config/UserMatch.pm | 71 +++++++ 16 files changed, 1834 insertions(+) create mode 100644 Bugzilla/Config/Admin.pm create mode 100644 Bugzilla/Config/Auth.pm create mode 100644 Bugzilla/Config/BugChange.pm create mode 100644 Bugzilla/Config/BugFields.pm create mode 100644 Bugzilla/Config/BugMove.pm create mode 100644 Bugzilla/Config/Common.pm create mode 100644 Bugzilla/Config/Core.pm create mode 100644 Bugzilla/Config/DependencyGraph.pm create mode 100644 Bugzilla/Config/GroupSecurity.pm create mode 100644 Bugzilla/Config/L10n.pm create mode 100644 Bugzilla/Config/LDAP.pm create mode 100644 Bugzilla/Config/MTA.pm create mode 100644 Bugzilla/Config/PatchViewer.pm create mode 100644 Bugzilla/Config/Query.pm create mode 100644 Bugzilla/Config/ShadowDB.pm create mode 100644 Bugzilla/Config/UserMatch.pm (limited to 'Bugzilla/Config') diff --git a/Bugzilla/Config/Admin.pm b/Bugzilla/Config/Admin.pm new file mode 100644 index 000000000..f416b7fe6 --- /dev/null +++ b/Bugzilla/Config/Admin.pm @@ -0,0 +1,105 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::Admin; + +use strict; + +use Bugzilla::Config::Common; + +$Bugzilla::Config::Admin::sortkey = "01"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'allowbugdeletion', + type => 'b', + default => 0 + }, + + { + name => 'allowemailchange', + type => 'b', + default => 0 + }, + + { + name => 'allowuserdeletion', + type => 'b', + default => 0 + }, + + { + name => 'supportwatchers', + type => 'b', + default => 0 + }, + + { + name => 'maxpatchsize', + type => 't', + default => '1000', + checker => \&check_numeric + }, + + { + name => 'maxattachmentsize', + type => 't', + default => '1000', + checker => \&check_numeric + }, + + # The maximum size (in bytes) for patches and non-patch attachments. + # The default limit is 1000KB, which is 24KB less than mysql's default + # maximum packet size (which determines how much data can be sent in a + # single mysql packet and thus how much data can be inserted into the + # database) to provide breathing space for the data in other fields of + # the attachment record as well as any mysql packet overhead (I don't + # know of any, but I suspect there may be some.) + + { + name => 'maxlocalattachment', + type => 't', + default => '0', + checker => \&check_numeric + }, + + { + name => 'convert_uncompressed_images', + type => 'b', + default => 0, + checker => \&check_image_converter + } ); + return @param_list; +} + +1; diff --git a/Bugzilla/Config/Auth.pm b/Bugzilla/Config/Auth.pm new file mode 100644 index 000000000..6b0cf7683 --- /dev/null +++ b/Bugzilla/Config/Auth.pm @@ -0,0 +1,135 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::Auth; + +use strict; + +use Bugzilla::Config::Common; + +$Bugzilla::Config::Auth::sortkey = "02"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'auth_env_id', + type => 't', + default => '', + }, + + { + name => 'auth_env_email', + type => 't', + default => '', + }, + + { + name => 'auth_env_realname', + type => 't', + default => '', + }, + + # XXX in the future: + # + # user_verify_class and user_info_class should have choices gathered from + # whatever sits in their respective directories + # + # rather than comma-separated lists, these two should eventually become + # arrays, but that requires alterations to editparams first + + { + name => 'user_info_class', + type => 's', + choices => [ 'CGI', 'Env', 'Env,CGI' ], + default => 'CGI', + checker => \&check_multi + }, + + { + name => 'user_verify_class', + type => 's', + choices => [ 'DB', 'LDAP', 'DB,LDAP', 'LDAP,DB' ], + default => 'DB', + checker => \&check_user_verify_class + }, + + { + name => 'rememberlogin', + type => 's', + choices => ['on', 'defaulton', 'defaultoff', 'off'], + default => 'on', + checker => \&check_multi + }, + + { + name => 'loginnetmask', + type => 't', + default => '32', + checker => \&check_netmask + }, + + { + name => 'requirelogin', + type => 'b', + default => '0' + }, + + { + name => 'emailregexp', + type => 't', + default => q:^[\\w\\.\\+\\-=]+@[\\w\\.\\-]+\\.[\\w\\-]+$:, + checker => \&check_regexp + }, + + { + name => 'emailregexpdesc', + type => 'l', + default => 'A legal address must contain exactly one \'@\', and at least ' . + 'one \'.\' after the @.' + }, + + { + name => 'emailsuffix', + type => 't', + default => '' + }, + + { + name => 'createemailregexp', + type => 't', + default => q:.*:, + checker => \&check_regexp + } ); + return @param_list; +} + +1; diff --git a/Bugzilla/Config/BugChange.pm b/Bugzilla/Config/BugChange.pm new file mode 100644 index 000000000..6ea20b6a8 --- /dev/null +++ b/Bugzilla/Config/BugChange.pm @@ -0,0 +1,142 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::BugChange; + +use strict; + +use Bugzilla::Config::Common; + +$Bugzilla::Config::BugChange::sortkey = "03"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'letsubmitterchoosepriority', + type => 'b', + default => 1 + }, + + { + name => 'letsubmitterchoosemilestone', + type => 'b', + default => 1 + }, + + { + name => 'defaultpriority', + type => 't', + default => 'P2', + checker => \&check_priority + }, + + { + name => 'musthavemilestoneonaccept', + type => 'b', + default => 0 + }, + + { + name => 'commentoncreate', + type => 'b', + default => 0 + }, + + { + name => 'commentonaccept', + type => 'b', + default => 0 + }, + + { + name => 'commentonclearresolution', + type => 'b', + default => 0 + }, + + { + name => 'commentonconfirm', + type => 'b', + default => 0 + }, + + { + name => 'commentonresolve', + type => 'b', + default => 0 + }, + + { + name => 'commentonreassign', + type => 'b', + default => 0 + }, + + { + name => 'commentonreassignbycomponent', + type => 'b', + default => 0 + }, + + { + name => 'commentonreopen', + type => 'b', + default => 0 + }, + + { + name => 'commentonverify', + type => 'b', + default => 0 + }, + + { + name => 'commentonclose', + type => 'b', + default => 0 + }, + + { + name => 'commentonduplicate', + type => 'b', + default => 0 + }, + + { + name => 'noresolveonopenblockers', + type => 'b', + default => 0, + } ); + return @param_list; +} + +1; diff --git a/Bugzilla/Config/BugFields.pm b/Bugzilla/Config/BugFields.pm new file mode 100644 index 000000000..ac0ef85d9 --- /dev/null +++ b/Bugzilla/Config/BugFields.pm @@ -0,0 +1,108 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::BugFields; + +use strict; + +use Bugzilla::Config::Common; + +$Bugzilla::Config::BugFields::sortkey = "04"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'useclassification', + type => 'b', + default => 0 + }, + + { + name => 'showallproducts', + type => 'b', + default => 0 + }, + + { + name => 'usetargetmilestone', + type => 'b', + default => 0 + }, + + { + name => 'useqacontact', + type => 'b', + default => 0 + }, + + { + name => 'usestatuswhiteboard', + type => 'b', + default => 0 + }, + + { + name => 'usevotes', + type => 'b', + default => 1 + }, + + { + name => 'usebugaliases', + type => 'b', + default => 0 + }, + + { + name => 'defaultseverity', + type => 't', + default => 'normal', + checker => \&check_severity + }, + + { + name => 'defaultplatform', + type => 't', + default => '', + checker => \&check_platform + }, + + { + name => 'defaultopsys', + type => 't', + default => '', + checker => \&check_opsys + } ); + return @param_list; +} + +1; diff --git a/Bugzilla/Config/BugMove.pm b/Bugzilla/Config/BugMove.pm new file mode 100644 index 000000000..87f6cbd73 --- /dev/null +++ b/Bugzilla/Config/BugMove.pm @@ -0,0 +1,93 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::BugMove; + +use strict; + +use Bugzilla::Config::Common; + +$Bugzilla::Config::BugMove::sortkey = "05"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'move-enabled', + type => 'b', + default => 0 + }, + + { + name => 'move-button-text', + type => 't', + default => 'Move To Bugscape' + }, + + { + name => 'move-to-url', + type => 't', + default => '' + }, + + { + name => 'move-to-address', + type => 't', + default => 'bugzilla-import' + }, + + { + name => 'moved-from-address', + type => 't', + default => 'bugzilla-admin' + }, + + { + name => 'movers', + type => 't', + default => '' + }, + + { + name => 'moved-default-product', + type => 't', + default => '' + }, + + { + name => 'moved-default-component', + type => 't', + default => '' + } ); + return @param_list; +} + +1; diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm new file mode 100644 index 000000000..721651830 --- /dev/null +++ b/Bugzilla/Config/Common.pm @@ -0,0 +1,386 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +# This file defines all the parameters that we have a GUI to edit within +# Bugzilla. + +# ATTENTION!!!! THIS FILE ONLY CONTAINS THE DEFAULTS. +# You cannot change your live settings by editing this file. +# Only adding new parameters is done here. Once the parameter exists, you +# must use %baseurl%/editparams.cgi from the web to edit the settings. + +# This file is included via |do|, mainly because of circular dependency issues +# (such as globals.pl -> Bugzilla::Config -> this -> Bugzilla::Config) +# which preclude compile time loading. + +# Those issues may go away at some point, and the contents of this file +# moved somewhere else. Please try to avoid more dependencies from here +# to other code + +# (Note that these aren't just added directly to Bugzilla::Config, because +# the backend prefs code is separate to this...) + +package Bugzilla::Config::Common; + +use strict; + +use Socket; + +use Bugzilla::Config qw(:DEFAULT $templatedir $webdotdir); +use Bugzilla::Util; +use Bugzilla::Constants; + +use base qw(Exporter); +@Bugzilla::Config::Common::EXPORT = + qw(check_sslbase check_priority check_severity check_platform + check_opsys check_shadowdb check_urlbase check_webdotbase + check_netmask check_user_verify_class check_image_converter + check_languages check_mail_delivery_method +); + +# Checking functions for the various values + +sub check_multi { + my ($value, $param) = (@_); + + if ($param->{'type'} eq "s") { + unless (scalar(grep {$_ eq $value} (@{$param->{'choices'}}))) { + return "Invalid choice '$value' for single-select list param '$param->{'name'}'"; + } + + return ""; + } + elsif ($param->{'type'} eq "m") { + foreach my $chkParam (@$value) { + unless (scalar(grep {$_ eq $chkParam} (@{$param->{'choices'}}))) { + return "Invalid choice '$chkParam' for multi-select list param '$param->{'name'}'"; + } + } + + return ""; + } + else { + return "Invalid param type '$param->{'type'}' for check_multi(); " . + "contact your Bugzilla administrator"; + } +} + +sub check_numeric { + my ($value) = (@_); + if ($value !~ /^[0-9]+$/) { + return "must be a numeric value"; + } + return ""; +} + +sub check_regexp { + my ($value) = (@_); + eval { qr/$value/ }; + return $@; +} + +sub check_sslbase { + my $url = shift; + if ($url ne '') { + if ($url !~ m#^https://([^/]+).*/$#) { + return "must be a legal URL, that starts with https and ends with a slash."; + } + my $host = $1; + if ($host =~ /:\d+$/) { + return "must not contain a port."; + } + local *SOCK; + my $proto = getprotobyname('tcp'); + socket(SOCK, PF_INET, SOCK_STREAM, $proto); + my $sin = sockaddr_in(443, inet_aton($host)); + if (!connect(SOCK, $sin)) { + return "Failed to connect to " . html_quote($host) . + ":443, unable to enable SSL."; + } + } + return ""; +} + +sub check_priority { + my ($value) = (@_); + &::GetVersionTable(); + if (lsearch(\@::legal_priority, $value) < 0) { + return "Must be a legal priority value: one of " . + join(", ", @::legal_priority); + } + return ""; +} + +sub check_severity { + my ($value) = (@_); + &::GetVersionTable(); + if (lsearch(\@::legal_severity, $value) < 0) { + return "Must be a legal severity value: one of " . + join(", ", @::legal_severity); + } + return ""; +} + +sub check_platform { + my ($value) = (@_); + &::GetVersionTable(); + if (lsearch(['', @::legal_platform], $value) < 0) { + return "Must be empty or a legal platform value: one of " . + join(", ", @::legal_platform); + } + return ""; +} + +sub check_opsys { + my ($value) = (@_); + &::GetVersionTable(); + if (lsearch(['', @::legal_opsys], $value) < 0) { + return "Must be empty or a legal operating system value: one of " . + join(", ", @::legal_opsys); + } + return ""; +} + +sub check_shadowdb { + my ($value) = (@_); + $value = trim($value); + if ($value eq "") { + return ""; + } + + if (!Param('shadowdbhost')) { + return "You need to specify a host when using a shadow database"; + } + + # Can't test existence of this because ConnectToDatabase uses the param, + # but we can't set this before testing.... + # This can really only be fixed after we can use the DBI more openly + return ""; +} + +sub check_urlbase { + my ($url) = (@_); + if ($url !~ m:^http.*/$:) { + return "must be a legal URL, that starts with http and ends with a slash."; + } + return ""; +} + +sub check_webdotbase { + my ($value) = (@_); + $value = trim($value); + if ($value eq "") { + return ""; + } + if($value !~ /^https?:/) { + if(! -x $value) { + return "The file path \"$value\" is not a valid executable. Please specify the complete file path to 'dot' if you intend to generate graphs locally."; + } + # Check .htaccess allows access to generated images + if(-e "$webdotdir/.htaccess") { + open HTACCESS, "$webdotdir/.htaccess"; + if(! grep(/ \\\.png\$/,)) { + return "Dependency graph images are not accessible.\nAssuming that you have not modified the file, delete $webdotdir/.htaccess and re-run checksetup.pl to rectify.\n"; + } + close HTACCESS; + } + } + return ""; +} + +sub check_netmask { + my ($mask) = @_; + my $res = check_numeric($mask); + return $res if $res; + if ($mask < 0 || $mask > 32) { + return "an IPv4 netmask must be between 0 and 32 bits"; + } + # Note that if we changed the netmask from anything apart from 32, then + # existing logincookies which aren't for a single IP won't work + # any more. We can't know which ones they are, though, so they'll just + # take space until they're preiodically cleared, later. + + return ""; +} + +sub check_user_verify_class { + # doeditparams traverses the list of params, and for each one it checks, + # then updates. This means that if one param checker wants to look at + # other params, it must be below that other one. So you can't have two + # params mutually dependent on each other. + # This means that if someone clears the LDAP config params after setting + # the login method as LDAP, we won't notice, but all logins will fail. + # So don't do that. + + my ($list, $entry) = @_; + for my $class (split /,\s*/, $list) { + my $res = check_multi($class, $entry); + return $res if $res; + if ($class eq 'DB') { + # No params + } elsif ($class eq 'LDAP') { + eval "require Net::LDAP"; + return "Error requiring Net::LDAP: '$@'" if $@; + return "LDAP servername is missing" unless Param("LDAPserver"); + return "LDAPBaseDN is empty" unless Param("LDAPBaseDN"); + } else { + return "Unknown user_verify_class '$class' in check_user_verify_class"; + } + } + return ""; +} + +sub check_image_converter { + my ($value, $hash) = @_; + if ($value == 1){ + eval "require Image::Magick"; + return "Error requiring Image::Magick: '$@'" if $@; + } + return ""; +} + +sub check_languages { + my @languages = split /[,\s]+/, trim($_[0]); + if(!scalar(@languages)) { + return "You need to specify a language tag." + } + foreach my $language (@languages) { + if( ! -d "$templatedir/$language/custom" + && ! -d "$templatedir/$language/default") { + return "The template directory for $language does not exist"; + } + } + return ""; +} + +sub check_mail_delivery_method { + my $check = check_multi(@_); + return $check if $check; + my $mailer = shift; + if ($mailer eq 'sendmail' && $^O =~ /MSWin32/i) { + # look for sendmail.exe + return "Failed to locate " . SENDMAIL_EXE + unless -e SENDMAIL_EXE; + } + return ""; +} + +# OK, here are the parameter definitions themselves. +# +# Each definition is a hash with keys: +# +# name - name of the param +# desc - description of the param (for editparams.cgi) +# type - see below +# choices - (optional) see below +# default - default value for the param +# checker - (optional) checking function for validating parameter entry +# It is called with the value of the param as the first arg and a +# reference to the param's hash as the second argument +# +# The type value 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) +# b -- A boolean value (either 1 or 0) +# m -- A list of values, with many selectable (shows up as a select box) +# To specify the list of values, make the 'choices' key be an array +# reference of the valid choices. The 'default' key should be an array +# reference for the list of selected values (which must appear in the +# first anonymous array), i.e.: +# { +# name => 'multiselect', +# desc => 'A list of options, choose many', +# type => 'm', +# choices => [ 'a', 'b', 'c', 'd' ], +# default => [ 'a', 'd' ], +# checker => \&check_multi +# } +# +# Here, 'a' and 'd' are the default options, and the user may pick any +# combination of a, b, c, and d as valid options. +# +# &check_multi should always be used as the param verification function +# for list (single and multiple) parameter types. +# +# s -- A list of values, with one selectable (shows up as a select box) +# To specify the list of values, make the 'choices' key be an array +# reference of the valid choices. The 'default' key should be one of +# those values, i.e.: +# { +# name => 'singleselect', +# desc => 'A list of options, choose one', +# type => 's', +# choices => [ 'a', 'b', 'c' ], +# default => 'b', +# checker => \&check_multi +# } +# +# Here, 'b' is the default option, and 'a' and 'c' are other possible +# options, but only one at a time! +# +# &check_multi should always be used as the param verification function +# for list (single and multiple) parameter types. + +sub get_param_list { + return; +} + +1; + +__END__ + +=head1 NAME + +Bugzilla::Config::Common - Parameter checking functions + +=head1 DESCRIPTION + +All parameter checking functions are called with two parameters: + +=head2 Functions + +=over + +=item C + +Checks that a multi-valued parameter (ie type C or type C) satisfies +its contraints. + +=item C + +Checks that the value is a valid number + +=item C + +Checks that the value is a valid regexp + +=back diff --git a/Bugzilla/Config/Core.pm b/Bugzilla/Config/Core.pm new file mode 100644 index 000000000..e2ff8746d --- /dev/null +++ b/Bugzilla/Config/Core.pm @@ -0,0 +1,103 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::Core; + +use strict; + +use Bugzilla::Config::Common; + +$Bugzilla::Config::Core::sortkey = "00"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'maintainer', + type => 't', + default => 'THE MAINTAINER HAS NOT YET BEEN SET' + }, + + { + name => 'urlbase', + type => 't', + default => 'http://you-havent-visited-editparams.cgi-yet/', + checker => \&check_urlbase + }, + + { + name => 'sslbase', + type => 't', + default => '', + checker => \&check_sslbase + }, + + { + name => 'ssl', + type => 's', + choices => ['never', 'authenticated sessions', 'always'], + default => 'never' + }, + + + { + name => 'cookiedomain', + type => 't', + default => '' + }, + + { + name => 'cookiepath', + type => 't', + default => '/' + }, + + { + name => 'timezone', + type => 't', + default => '', + }, + + { + name => 'utf8', + type => 'b', + default => '0', + }, + + { + name => 'shutdownhtml', + type => 'l', + default => '' + } ); + return @param_list; +} + +1; diff --git a/Bugzilla/Config/DependencyGraph.pm b/Bugzilla/Config/DependencyGraph.pm new file mode 100644 index 000000000..db784c135 --- /dev/null +++ b/Bugzilla/Config/DependencyGraph.pm @@ -0,0 +1,52 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::DependencyGraph; + +use strict; + +use Bugzilla::Config::Common; + +$Bugzilla::Config::DependencyGraph::sortkey = "06"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'webdotbase', + type => 't', + default => 'http://www.research.att.com/~north/cgi-bin/webdot.cgi/%urlbase%', + checker => \&check_webdotbase + } ); + return @param_list; +} + +1; diff --git a/Bugzilla/Config/GroupSecurity.pm b/Bugzilla/Config/GroupSecurity.pm new file mode 100644 index 000000000..e48cd4966 --- /dev/null +++ b/Bugzilla/Config/GroupSecurity.pm @@ -0,0 +1,81 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::GroupSecurity; + +use strict; + +use Bugzilla::Config::Common; + +$Bugzilla::Config::GroupSecurity::sortkey = "07"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'makeproductgroups', + type => 'b', + default => 0 + }, + + { + name => 'useentrygroupdefault', + type => 'b', + default => 0 + }, + + { + name => 'chartgroup', + type => 't', + default => 'editbugs' + }, + + { + name => 'insidergroup', + type => 't', + default => '' + }, + + { + name => 'timetrackinggroup', + type => 't', + default => '' + }, + + { + name => 'usevisibilitygroups', + type => 'b', + default => 0 + } ); + return @param_list; +} + +1; diff --git a/Bugzilla/Config/L10n.pm b/Bugzilla/Config/L10n.pm new file mode 100644 index 000000000..6fed0ed70 --- /dev/null +++ b/Bugzilla/Config/L10n.pm @@ -0,0 +1,78 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::L10n; + +use strict; + +use File::Spec; # for find_languages + +use Bugzilla::Config qw($templatedir); +use Bugzilla::Config::Common; + +$Bugzilla::Config::L10n::sortkey = "08"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'languages' , + extra_desc => { available_languages => find_languages() }, + type => 't' , + default => 'en' , + checker => \&check_languages + }, + + { + name => 'defaultlanguage', + type => 't' , + default => 'en' , + checker => \&check_languages + } ); + return @param_list; +} + +sub find_languages { + my @languages = (); + opendir(DIR, $templatedir) || return "Can't open 'template' directory: $!"; + foreach my $dir (readdir(DIR)) { + next unless $dir =~ /^([a-z-]+)$/i; + my $lang = $1; + next if($lang =~ /^CVS$/i); + my $deft_path = File::Spec->catdir('template', $lang, 'default'); + my $cust_path = File::Spec->catdir('template', $lang, 'custom'); + push(@languages, $lang) if(-d $deft_path or -d $cust_path); + } + closedir DIR; + return join(', ', @languages); +} + +1; diff --git a/Bugzilla/Config/LDAP.pm b/Bugzilla/Config/LDAP.pm new file mode 100644 index 000000000..3f123243b --- /dev/null +++ b/Bugzilla/Config/LDAP.pm @@ -0,0 +1,81 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::LDAP; + +use strict; + +use Bugzilla::Config::Common; + +$Bugzilla::Config::LDAP::sortkey = "09"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'LDAPserver', + type => 't', + default => '' + }, + + { + name => 'LDAPbinddn', + type => 't', + default => '' + }, + + { + name => 'LDAPBaseDN', + type => 't', + default => '' + }, + + { + name => 'LDAPuidattribute', + type => 't', + default => 'uid' + }, + + { + name => 'LDAPmailattribute', + type => 't', + default => 'mail' + }, + + { + name => 'LDAPfilter', + type => 't', + default => '', + } ); + return @param_list; +} + +1; diff --git a/Bugzilla/Config/MTA.pm b/Bugzilla/Config/MTA.pm new file mode 100644 index 000000000..25f70761b --- /dev/null +++ b/Bugzilla/Config/MTA.pm @@ -0,0 +1,173 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::MTA; + +use strict; + +use Bugzilla::Config::Common; + +$Bugzilla::Config::MTA::sortkey = "10"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'mail_delivery_method', + type => 's', + choices => $^O =~ /MSWin32/i + ? ['smtp', 'testfile', 'sendmail', 'none'] + : ['sendmail', 'smtp', 'qmail', 'testfile', 'none'], + default => 'sendmail', + checker => \&check_mail_delivery_method + }, + + { + name => 'sendmailnow', + type => 'b', + default => 1 + }, + + { + name => 'smtpserver', + type => 't', + default => 'localhost' + }, + + { + name => 'passwordmail', + type => 'l', + default => 'From: bugzilla-daemon +To: %mailaddress% +Subject: Your Bugzilla password. + +To use the wonders of Bugzilla, you can use the following: + + E-mail address: %login% + Password: %password% + + To change your password, go to: + %urlbase%userprefs.cgi +' + }, + + { + name => 'newchangedmail', + type => 'l', + default => 'From: bugzilla-daemon +To: %to% +Subject: [Bug %bugid%] %neworchanged%%summary% +%threadingmarker% +X-Bugzilla-Reason: %reasonsheader% +X-Bugzilla-Product: %product% +X-Bugzilla-Component: %component% + +%urlbase%show_bug.cgi?id=%bugid% + +%diffs% + +--%space% +Configure bugmail: %urlbase%userprefs.cgi?tab=email +%reasonsbody%' + }, + + { + name => 'whinedays', + type => 't', + default => 7 + }, + + { + name => 'whinemail', + type => 'l', + default => '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 or REOPENED 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 + default assignee 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/REOPENED bugs, you can use this URL (bookmark +it if you like!): + + %urlbase%buglist.cgi?bug_status=NEW&bug_status=REOPENED&assigned_to=%userid% + +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! + +' + }, + + { + name => 'voteremovedmail', + type => 'l', + default => 'From: bugzilla-daemon +To: %to% +Subject: [Bug %bugid%] Some or all of your votes have been removed. + +Some or all of your votes have been removed from bug %bugid%. + +%votesoldtext% + +%votesnewtext% + +Reason: %reason% + +%urlbase%show_bug.cgi?id=%bugid% +' + } ); + return @param_list; +} + +1; diff --git a/Bugzilla/Config/PatchViewer.pm b/Bugzilla/Config/PatchViewer.pm new file mode 100644 index 000000000..8de04ef76 --- /dev/null +++ b/Bugzilla/Config/PatchViewer.pm @@ -0,0 +1,75 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::PatchViewer; + +use strict; + +use Bugzilla::Config::Common; + +$Bugzilla::Config::PatchViewer::sortkey = "11"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'cvsroot', + type => 't', + default => '', + }, + + { + name => 'cvsroot_get', + type => 't', + default => '', + }, + + { + name => 'bonsai_url', + type => 't', + default => '' + }, + + { + name => 'lxr_url', + type => 't', + default => '' + }, + + { + name => 'lxr_root', + type => 't', + default => '', + } ); + return @param_list; +} + +1; diff --git a/Bugzilla/Config/Query.pm b/Bugzilla/Config/Query.pm new file mode 100644 index 000000000..c259bea53 --- /dev/null +++ b/Bugzilla/Config/Query.pm @@ -0,0 +1,78 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::Query; + +use strict; + +use Bugzilla::Config::Common; + +$Bugzilla::Config::Query::sortkey = "12"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'quip_list_entry_control', + type => 's', + choices => ['open', 'moderated', 'closed'], + default => 'open', + checker => \&check_multi + }, + + { + name => 'mostfreqthreshold', + type => 't', + default => '2' + }, + + { + name => 'mybugstemplate', + type => 't', + default => 'buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&email1=%userid%&emailtype1=exact&emailassigned_to1=1&emailreporter1=1' + }, + + { + name => 'defaultquery', + type => 't', + default => 'bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailqa_contact2=1&order=Importance&long_desc_type=substring' + }, + + { + name => 'quicksearch_comment_cutoff', + type => 't', + default => '4', + checker => \&check_numeric + } ); + return @param_list; +} + +1; diff --git a/Bugzilla/Config/ShadowDB.pm b/Bugzilla/Config/ShadowDB.pm new file mode 100644 index 000000000..f9af4fb6d --- /dev/null +++ b/Bugzilla/Config/ShadowDB.pm @@ -0,0 +1,73 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::ShadowDB; + +use strict; + +use Bugzilla::Config::Common; + +$Bugzilla::Config::ShadowDB::sortkey = "13"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'shadowdbhost', + type => 't', + default => '', + }, + + { + name => 'shadowdbport', + type => 't', + default => '3306', + checker => \&check_numeric, + }, + + { + name => 'shadowdbsock', + type => 't', + default => '', + }, + + # This entry must be _after_ the shadowdb{host,port,sock} settings so that + # they can be used in the validation here + { + name => 'shadowdb', + type => 't', + default => '', + checker => \&check_shadowdb + } ); + return @param_list; +} + +1; diff --git a/Bugzilla/Config/UserMatch.pm b/Bugzilla/Config/UserMatch.pm new file mode 100644 index 000000000..819247e99 --- /dev/null +++ b/Bugzilla/Config/UserMatch.pm @@ -0,0 +1,71 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Terry Weissman +# Dawn Endico +# Dan Mosedale +# Joe Robins +# Jacob Steenhagen +# J. Paul Reed +# Bradley Baetz +# Joseph Heenan +# Erik Stambaugh +# Frédéric Buclin +# + +package Bugzilla::Config::UserMatch; + +use strict; + +use Bugzilla::Config::Common; + +$Bugzilla::Config::UserMatch::sortkey = "14"; + +sub get_param_list { + my $class = shift; + my @param_list = ( + { + name => 'usemenuforusers', + type => 'b', + default => '0' + }, + + { + name => 'usermatchmode', + type => 's', + choices => ['off', 'wildcard', 'search'], + default => 'off' + }, + + { + name => 'maxusermatches', + type => 't', + default => '1000', + checker => \&check_numeric + }, + + { + name => 'confirmuniqueusermatch', + type => 'b', + default => 1, + } ); + return @param_list; +} + +1; -- cgit v1.2.3-24-g4f1b