From aea95887f82a6066ebadb99068d94ef05087909b Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Sun, 20 Apr 2008 14:49:44 +0000 Subject: Bug 429847: config.cgi should include additional information about custom fields - Patch by Frédéric Buclin r/a=mkanat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/DB.pm | 40 ------------------------------------- config.cgi | 7 ++++++- template/en/default/config.js.tmpl | 9 ++++++++- template/en/default/config.rdf.tmpl | 6 ++++++ 4 files changed, 20 insertions(+), 42 deletions(-) diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm index d74284b27..1617b7fc2 100644 --- a/Bugzilla/DB.pm +++ b/Bugzilla/DB.pm @@ -383,26 +383,6 @@ sub bz_last_key { $table, $column); } -sub bz_get_field_defs { - my ($self) = @_; - - my $extra = ""; - if (!Bugzilla->user->in_group(Bugzilla->params->{'timetrackinggroup'})) { - $extra = "AND name NOT IN ('estimated_time', 'remaining_time', " . - "'work_time', 'percentage_complete', 'deadline')"; - } - - my @fields; - my $sth = $self->prepare("SELECT name, description FROM fielddefs - WHERE obsolete = 0 $extra - ORDER BY sortkey"); - $sth->execute(); - while (my $field_ref = $sth->fetchrow_hashref()) { - push(@fields, $field_ref); - } - return(@fields); -} - ##################################################################### # Database Setup ##################################################################### @@ -1273,9 +1253,6 @@ Bugzilla::DB - Database access routines, using L my $column = $dbh->bz_column_info($table, $column); my $index = $dbh->bz_index_info($table, $index); - # General Information - my @fields = $dbh->bz_get_field_defs(); - =head1 DESCRIPTION Functions in this module allows creation of a database handle to connect @@ -1949,23 +1926,6 @@ Last inserted ID (scalar) =back -=item C - -=over - -=item B - -Returns a list of all the "bug" fields in Bugzilla. The list -contains hashes, with a C key and a C key. - -=item B (none) - -=item B - -List of all the "bug" fields - -=back - =back =head2 Database Setup Methods diff --git a/config.cgi b/config.cgi index 026b070d6..ebdf71241 100755 --- a/config.cgi +++ b/config.cgi @@ -87,7 +87,12 @@ $vars->{'open_status'} = \@open_status; $vars->{'closed_status'} = \@closed_status; # Generate a list of fields that can be queried. -$vars->{'field'} = [Bugzilla->dbh->bz_get_field_defs()]; +my @fields = @{Bugzilla::Field->match({obsolete => 0})}; +# Exclude fields the user cannot query. +if (!Bugzilla->user->in_group(Bugzilla->params->{'timetrackinggroup'})) { + @fields = grep { $_->name !~ /^(estimated_time|remaining_time|work_time|percentage_complete|deadline)$/ } @fields; +} +$vars->{'field'} = \@fields; display_data($vars); diff --git a/template/en/default/config.js.tmpl b/template/en/default/config.js.tmpl index 628a918d0..66617007d 100644 --- a/template/en/default/config.js.tmpl +++ b/template/en/default/config.js.tmpl @@ -113,7 +113,14 @@ var component_exceptions = new Array( var field = [ [% FOREACH x = field %] { name: '[% x.name FILTER js %]', - description: '[% (field_descs.${x.name} OR x.description) FILTER js %]' }, + description: '[% (field_descs.${x.name} OR x.description) FILTER js %]', + [%-# These values are meaningful for custom fields only. %] + [% IF x.custom %] + type: '[% x.type FILTER js %]', + type_desc: '[% field_types.${x.type} FILTER js %]', + enter_bug: '[% x.enter_bug FILTER js %]', + [% END %] + }, [% END %] ]; diff --git a/template/en/default/config.rdf.tmpl b/template/en/default/config.rdf.tmpl index 99850fa71..8d2c5a282 100644 --- a/template/en/default/config.rdf.tmpl +++ b/template/en/default/config.rdf.tmpl @@ -204,6 +204,12 @@ [% item.name FILTER html %] [% (field_descs.${item.name} OR item.description) FILTER html %] + [%-# These values are meaningful for custom fields only. %] + [% IF item.custom %] + [% item.type FILTER html %] + [% field_types.${item.type} FILTER html %] + [% item.enter_bug FILTER html %] + [% END %] [% END %] -- cgit v1.2.3-24-g4f1b