FIELD_TYPE_FREETEXT
FIELD_TYPE_SINGLE_SELECT
FIELD_TYPE_MULTI_SELECT
+ FIELD_TYPE_TEXTAREA
USAGE_MODE_BROWSER
USAGE_MODE_CMDLINE
use constant FIELD_TYPE_FREETEXT => 1;
use constant FIELD_TYPE_SINGLE_SELECT => 2;
use constant FIELD_TYPE_MULTI_SELECT => 3;
+use constant FIELD_TYPE_TEXTAREA => 4;
# The maximum number of days a token will remain valid.
use constant MAX_TOKEN_AGE => 3;
FIELD_TYPE_FREETEXT, { TYPE => 'varchar(255)' },
FIELD_TYPE_SINGLE_SELECT, { TYPE => 'varchar(64)', NOTNULL => 1,
DEFAULT => "'---'" },
+ FIELD_TYPE_TEXTAREA, { TYPE => 'MEDIUMTEXT' },
};
# Field definitions for the fields that ship with Bugzilla.
my $saved_type = $type;
# The constant here should be updated every time a new,
# higher field type is added.
- (detaint_natural($type) && $type <= FIELD_TYPE_MULTI_SELECT)
+ (detaint_natural($type) && $type <= FIELD_TYPE_TEXTAREA)
|| ThrowCodeError('invalid_customfield_type', { type => $saved_type });
return $type;
}
},
# Wrap a displayed comment to the appropriate length
- wrap_comment => \&Bugzilla::Util::wrap_comment,
+ wrap_comment => [
+ sub {
+ my ($context, $cols) = @_;
+ return sub { wrap_comment($_[0], $cols) }
+ }, 1],
# We force filtering of every variable in key security-critical
# places; we have a none filter for people to use when they
}
sub wrap_comment {
- my ($comment) = @_;
+ my ($comment, $cols) = @_;
my $wrappedcomment = "";
# Use 'local', as recommended by Text::Wrap's perldoc.
- local $Text::Wrap::columns = COMMENT_COLS;
+ local $Text::Wrap::columns = $cols || COMMENT_COLS;
# Make words that are longer than COMMENT_COLS not wrap.
local $Text::Wrap::huge = 'overflow';
# Don't mess with tabs.
}
}
+ chomp($wrappedcomment); # Text::Wrap adds an extra newline at the end.
return $wrappedcomment;
}
padding-left: 1em;
}
+/* For bug fields */
+.uneditable_textarea {
+ white-space: pre;
+ font-family: monospace;
+}
+
div.user_match {
margin-bottom: 1em;
}
[% IF field.type == constants.FIELD_TYPE_MULTI_SELECT %]
<input type="hidden" name="defined_[% field.name FILTER html %]">
[% END %]
+ [% CASE constants.FIELD_TYPE_TEXTAREA %]
+ [% INCLUDE global/textarea.html.tmpl
+ id = field.name name = field.name minrows = 4 maxrows = 8
+ cols = 60 defaultcontent = value %]
[% END %]
+[% ELSIF field.type == constants.FIELD_TYPE_TEXTAREA %]
+ <div class="uneditable_textarea">[% value FILTER wrap_comment(60)
+ FILTER html %]</div>
[% ELSE %]
[% value.join(', ') FILTER html %]
[% END %]
${constants.FIELD_TYPE_FREETEXT} => "Free Text",
${constants.FIELD_TYPE_SINGLE_SELECT} => "Drop Down",
${constants.FIELD_TYPE_MULTI_SELECT} => "Multiple-Selection Box",
+ ${constants.FIELD_TYPE_TEXTAREA} => "Large Text Box",
} %]
[% status_descs = { "UNCONFIRMED" => "UNCONFIRMED",