MAX_MILESTONE_SIZE
MAX_COMPONENT_SIZE
MAX_FIELD_VALUE_SIZE
+ MAX_FIELD_LONG_DESC_LENGTH
MAX_FREETEXT_LENGTH
MAX_BUG_URL_LENGTH
MAX_POSSIBLE_DUPLICATES
# The maximum length for values of <select> fields.
use constant MAX_FIELD_VALUE_SIZE => 64;
+# The maximum length for the long description of fields.
+use constant MAX_FIELD_LONG_DESC_LENGTH => 255;
+
# Maximum length allowed for free text fields.
use constant MAX_FREETEXT_LENGTH => 255;
custom => {TYPE => 'BOOLEAN', NOTNULL => 1,
DEFAULT => 'FALSE'},
description => {TYPE => 'TINYTEXT', NOTNULL => 1},
+ long_desc => {TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"},
mailhead => {TYPE => 'BOOLEAN', NOTNULL => 1,
DEFAULT => 'FALSE'},
sortkey => {TYPE => 'INT2', NOTNULL => 1},
id
name
description
+ long_desc
type
custom
mailhead
use constant VALIDATORS => {
custom => \&_check_custom,
description => \&_check_description,
+ long_desc => \&_check_long_desc,
enter_bug => \&_check_enter_bug,
buglist => \&Bugzilla::Object::check_boolean,
mailhead => \&_check_mailhead,
use constant UPDATE_COLUMNS => qw(
description
+ long_desc
mailhead
sortkey
obsolete
return $desc;
}
+sub _check_long_desc {
+ my ($invocant, $long_desc) = @_;
+ $long_desc = clean_text($long_desc || '');
+ if (length($long_desc) > MAX_FIELD_LONG_DESC_LENGTH) {
+ ThrowUserError('field_long_desc_too_long');
+ }
+ return $long_desc;
+}
+
sub _check_enter_bug { return $_[1] ? 1 : 0; }
sub _check_is_numeric {
=over
+=item C<long_desc>
+
+A string providing detailed info about the field;
+
+=back
+=cut
+
+sub long_desc { return $_[0]->{long_desc} }
+
+=over
+
=item C<type>
an integer specifying the kind of field this is; values correspond to
=item C<set_description>
+=item C<set_long_desc>
+
=item C<set_enter_bug>
=item C<set_obsolete>
=cut
sub set_description { $_[0]->set('description', $_[1]); }
+sub set_long_desc { $_[0]->set('long_desc', $_[1]); }
sub set_enter_bug { $_[0]->set('enter_bug', $_[1]); }
sub set_is_numeric { $_[0]->set('is_numeric', $_[1]); }
sub set_obsolete { $_[0]->set('obsolete', $_[1]); }
=item C<description> B<Required> - The field label to display in the UI.
+=item C<long_desc> - A longer description of the field.
+
=item C<mailhead> - boolean - Whether this field appears at the
top of the bugmail for a newly-filed bug. Defaults to 0.
{TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'FALSE'});
$dbh->do('UPDATE fielddefs SET is_numeric = 1 WHERE type = '
. FIELD_TYPE_BUG_ID);
-
+
+ # 2012-04-12 aliustek@gmail.com - Bug 728138
+ $dbh->bz_add_column('fielddefs', 'long_desc',
+ {TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"}, '');
+
Bugzilla::Hook::process('install_update_db_fielddefs');
# Remember, this is not the function for adding general table changes.
$vars->{'field'} = Bugzilla::Field->create({
name => scalar $cgi->param('name'),
description => scalar $cgi->param('desc'),
+ long_desc => scalar $cgi->param('long_desc'),
type => scalar $cgi->param('type'),
sortkey => scalar $cgi->param('sortkey'),
mailhead => scalar $cgi->param('new_bugmail'),
$field || ThrowUserError('customfield_nonexistent', {'name' => $name});
$field->set_description($cgi->param('desc'));
+ $field->set_long_desc($cgi->param('long_desc'));
$field->set_sortkey($cgi->param('sortkey'));
$field->set_in_new_bugmail($cgi->param('new_bugmail'));
$field->set_enter_bug($cgi->param('enter_bug'));
</tr>
<tr>
- <th class="narrow_label">
- <label for="reverse_desc">Reverse Relationship Description:</label>
- </th>
+ <th class="narrow_label">Long Description:</th>
<td>
- <input type="text" id="reverse_desc" name="reverse_desc" value="" size="40" disabled="disabled">
- <br/>
- Use this label for the list of [% terms.bugs %] that link to
- [%+ terms.abug %] with this
- [%+ field_types.${constants.FIELD_TYPE_BUG_ID} FILTER html %]
- field. For example, if the description is "Is a duplicate of",
- the reverse description would be "Duplicates of this [% terms.bug %]".
- Leave blank to disable the list for this field.
+ [% INCLUDE global/textarea.html.tmpl
+ name = 'long_desc'
+ id = 'long_desc'
+ minrows = 3
+ maxrows = 5
+ cols = 46
+ defaultcontent = defaultcontent
+ %]
</td>
<th>
<label for="visibility_field_id">Field only appears when:</label>
</tr>
<tr>
- <td colspan="2"> </td>
+ <th class="narrow_label">
+ <label for="reverse_desc">Reverse Relationship Description:</label>
+ </th>
+ <td>
+ <input type="text" id="reverse_desc" name="reverse_desc" value="" size="40" disabled="disabled">
+ <br/>
+ Use this label for the list of [% terms.bugs %] that link to
+ [%+ terms.abug %] with this
+ [%+ field_types.${constants.FIELD_TYPE_BUG_ID} FILTER html %]
+ field. For example, if the description is "Is a duplicate of",
+ the reverse description would be "Duplicates of this [% terms.bug %]".
+ Leave blank to disable the list for this field.
+ </td>
<th>
<label for="value_field_id">
Field that controls the values<br>
[%- ' checked="checked"' IF field.is_mandatory %]></td>
</tr>
<tr>
- [% IF field.type == constants.FIELD_TYPE_BUG_ID %]
- <th class="narrow_label">
- <label for="reverse_desc">Reverse Relationship Description:</label>
- </th>
- <td>
- <input type="text" id="reverse_desc" name="reverse_desc" size="40"
- value="[% field.reverse_desc FILTER html %]">
- <br/>
- Use this label for the list of [% terms.bugs %] that link to
- [%+ terms.abug %] with this
- [%+ field_types.${constants.FIELD_TYPE_BUG_ID} FILTER html %] field.
- For example, if the description is "Is a duplicate of",
- the reverse description would be "Duplicates of this [% terms.bug %]".
- Leave blank to disable the list for this field.
- </td>
- [% ELSE %]
- <td colspan="2"> </td>
- [% END %]
+ <th class="narrow_label">Long Description:</th>
+ <td>
+ [% INCLUDE global/textarea.html.tmpl
+ name = 'long_desc'
+ id = 'long_desc'
+ minrows = 3
+ maxrows = 5
+ cols = 46
+ defaultcontent = field.long_desc
+ %]
+ </td>
<th>
<label for="visibility_field_id">Field only appears when:</label>
</th>
</select>
</td>
</tr>
+ [% IF field.type == constants.FIELD_TYPE_BUG_ID %]
+ <tr>
+ <th class="narrow_label">
+ <label for="reverse_desc">Reverse Relationship Description:</label>
+ </th>
+ <td>
+ <input type="text" id="reverse_desc" name="reverse_desc" size="40"
+ value="[% field.reverse_desc FILTER html %]">
+ <br/>
+ Use this label for the list of [% terms.bugs %] that link to
+ [%+ terms.abug %] with this
+ [%+ field_types.${constants.FIELD_TYPE_BUG_ID} FILTER html %] field.
+ For example, if the description is "Is a duplicate of",
+ the reverse description would be "Duplicates of this [% terms.bug %]".
+ Leave blank to disable the list for this field.
+ </td>
+ <td colspan="2"> </td>
+ </tr>
+ [% END %]
[% IF field.is_select %]
<tr>
<th> </th>
[%# Add help for custom fields. %]
[% IF !vars.help_html.${help_field}.defined %]
- [% SET field_type = bug_fields.${help_field}.type %]
- [% field_type_desc = BLOCK -%]
- [% field_types.$field_type FILTER html %]
- [%- END %]
- [% vars.help_html.${help_field} =
- "A custom $field_type_desc field in this installation"
- _ " of ${terms.Bugzilla}." %]
+ [% IF bug_fields.${help_field}.long_desc %]
+ [% vars.help_html.${help_field} = bug_fields.${help_field}.long_desc %]
+ [% ELSE %]
+ [% SET field_type = bug_fields.${help_field}.type %]
+ [% field_type_desc = BLOCK -%]
+ [% field_types.$field_type FILTER html %]
+ [%- END %]
+ [% vars.help_html.${help_field} =
+ "A custom $field_type_desc field in this installation"
+ _ " of ${terms.Bugzilla}." %]
+ [% END %]
[% END %]
[%# Add help for the search types, for query.cgi. %]
[% title = "Missing Description for Field" %]
You must enter a description for this field.
+ [% ELSIF error == "field_long_desc_too_long" %]
+ [% title = "Long Description for Field too long" %]
+ The long description you have provided for this field is longer than
+ [% constants.MAX_FIELD_LONG_DESC_LENGTH FILTER html %] characters.
+
[% ELSIF error == "field_missing_name" %]
[% title = "Missing Name for Field" %]
You must enter a name for this field.