RSS

trunk : 6035

lpsolit%gmail.com
2008-04-20 09:49:44
Revision ID: cvs-1:lpsolitgmail.com-20080420144944-flmzkvtfb2pvnr0a
Bug 429847: config.cgi should include additional information about custom fields - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat

collapse all collapse all

added added

removed removed

383
                                 $table, $column);
383
                                 $table, $column);
384
}
384
}
385
 
385
 
386
sub bz_get_field_defs {
 
 
387
    my ($self) = @_;
 
 
388
 
 
 
389
    my $extra = "";
 
 
390
    if (!Bugzilla->user->in_group(Bugzilla->params->{'timetrackinggroup'})) {
 
 
391
        $extra = "AND name NOT IN ('estimated_time', 'remaining_time', " .
 
 
392
                 "'work_time', 'percentage_complete', 'deadline')";
 
 
393
    }
 
 
394
 
 
 
395
    my @fields;
 
 
396
    my $sth = $self->prepare("SELECT name, description FROM fielddefs
 
 
397
                              WHERE obsolete = 0 $extra
 
 
398
                              ORDER BY sortkey");
 
 
399
    $sth->execute();
 
 
400
    while (my $field_ref = $sth->fetchrow_hashref()) {
 
 
401
        push(@fields, $field_ref);
 
 
402
    }
 
 
403
    return(@fields);
 
 
404
}
 
 
405
 
 
 
406
#####################################################################
386
#####################################################################
407
# Database Setup
387
# Database Setup
408
#####################################################################
388
#####################################################################
1273
  my $column = $dbh->bz_column_info($table, $column);
1253
  my $column = $dbh->bz_column_info($table, $column);
1274
  my $index  = $dbh->bz_index_info($table, $index);
1254
  my $index  = $dbh->bz_index_info($table, $index);
1275
 
1255
 
1276
  # General Information
 
 
1277
  my @fields    = $dbh->bz_get_field_defs();
 
 
1278
 
 
 
1279
=head1 DESCRIPTION
1256
=head1 DESCRIPTION
1280
 
1257
 
1281
Functions in this module allows creation of a database handle to connect
1258
Functions in this module allows creation of a database handle to connect
1949
 
1926
 
1950
=back
1927
=back
1951
 
1928
 
1952
=item C<bz_get_field_defs>
 
 
1953
 
 
 
1954
=over
 
 
1955
 
 
 
1956
=item B<Description>
 
 
1957
 
 
 
1958
Returns a list of all the "bug" fields in Bugzilla. The list
 
 
1959
contains hashes, with a C<name> key and a C<description> key.
 
 
1960
 
 
 
1961
=item B<Params> (none)
 
 
1962
 
 
 
1963
=item B<Returns>
 
 
1964
 
 
 
1965
List of all the "bug" fields
 
 
1966
 
 
 
1967
=back
 
 
1968
 
 
 
1969
=back
1929
=back
1970
 
1930
 
1971
=head2 Database Setup Methods
1931
=head2 Database Setup Methods
87
$vars->{'closed_status'} = \@closed_status;
87
$vars->{'closed_status'} = \@closed_status;
88
 
88
 
89
# Generate a list of fields that can be queried.
89
# Generate a list of fields that can be queried.
90
$vars->{'field'} = [Bugzilla->dbh->bz_get_field_defs()];
90
my @fields = @{Bugzilla::Field->match({obsolete => 0})};
 
 
91
# Exclude fields the user cannot query.
 
 
92
if (!Bugzilla->user->in_group(Bugzilla->params->{'timetrackinggroup'})) {
 
 
93
    @fields = grep { $_->name !~ /^(estimated_time|remaining_time|work_time|percentage_complete|deadline)$/ } @fields;
 
 
94
}
 
 
95
$vars->{'field'} = \@fields;
91
 
96
 
92
display_data($vars);
97
display_data($vars);
93
 
98
 
113
var field = [
113
var field = [
114
[% FOREACH x = field %]
114
[% FOREACH x = field %]
115
  { name:        '[% x.name FILTER js %]', 
115
  { name:        '[% x.name FILTER js %]', 
116
    description: '[% (field_descs.${x.name} OR x.description) FILTER js %]' },
116
    description: '[% (field_descs.${x.name} OR x.description) FILTER js %]',
 
 
117
    [%-# These values are meaningful for custom fields only. %]
 
 
118
    [% IF x.custom %]
 
 
119
    type:        '[% x.type FILTER js %]',
 
 
120
    type_desc:   '[% field_types.${x.type} FILTER js %]',
 
 
121
    enter_bug:   '[% x.enter_bug FILTER js %]',
 
 
122
    [% END %]
 
 
123
  },
117
[% END %]
124
[% END %]
118
];
125
];
119
 
126
 
204
          <bz:field rdf:about="[% urlbase FILTER xml %]field.cgi?name=[% item.name FILTER url_quote %]">
204
          <bz:field rdf:about="[% urlbase FILTER xml %]field.cgi?name=[% item.name FILTER url_quote %]">
205
            <bz:name>[% item.name FILTER html %]</bz:name>
205
            <bz:name>[% item.name FILTER html %]</bz:name>
206
            <bz:description>[% (field_descs.${item.name} OR item.description) FILTER html %]</bz:description>
206
            <bz:description>[% (field_descs.${item.name} OR item.description) FILTER html %]</bz:description>
 
 
207
            [%-# These values are meaningful for custom fields only. %]
 
 
208
            [% IF item.custom %]
 
 
209
              <bz:type>[% item.type FILTER html %]</bz:type>
 
 
210
              <bz:type_desc>[% field_types.${item.type} FILTER html %]</bz:type_desc>
 
 
211
              <bz:enter_bug>[% item.enter_bug FILTER html %]</bz:enter_bug>
 
 
212
            [% END %]
207
          </bz:field>
213
          </bz:field>
208
        </li>
214
        </li>
209
      [% END %]
215
      [% END %]

Loggerhead runs on Bazaar branches