# --------------------
# Print an input field
# $p_field_def contains the definition of the custom field (including it's
# field id
# $p_bug_id contains the bug where this field belongs to. If it's left
# away, it'll default to 0 and thus belongs to a new (i.e.
# non-existant) bug
# $p_html_tabindex is the html tabindex to insert in the input field, or nothing if tabindex=-1
# NOTE: This probably belongs in the print_api.php
function print_custom_field_input( $p_field_def, $p_bug_id = null, $p_html_tabindex=-1 ) {
$html_tabindex = '';
if ($p_html_tabindex >= 0)
$html_tabindex = 'tabindex="' . $p_html_tabindex . '"';
$t_id = $p_field_def['id'];
if( null == $p_bug_id ) {
$t_custom_field_value = $p_field_def['default_value'];
} else {
$t_custom_field_value = custom_field_get_value( $t_id, $p_bug_id );
}
$t_custom_field_value = string_attribute( $t_custom_field_value );
switch ($p_field_def['type']) {
case CUSTOM_FIELD_TYPE_ENUM:
echo "';
break;
case CUSTOM_FIELD_TYPE_NUMERIC:
case CUSTOM_FIELD_TYPE_FLOAT:
case CUSTOM_FIELD_TYPE_EMAIL:
default:
case CUSTOM_FIELD_TYPE_STRING:
$maxlen = 255;
if( 0 < $p_field_def['length_max'] ) {
$maxlen = $p_field_def['length_max'];
}
echo "";
}
}