diff -ur mantisbt-1.2.4-orig/admin/schema.php mantisbt-1.2.4/admin/schema.php
--- mantisbt-1.2.4-orig/admin/schema.php 2010-12-15 03:26:31.000000000 +0100
+++ mantisbt-1.2.4/admin/schema.php 2010-12-15 17:22:24.000000000 +0100
@@ -608,3 +608,7 @@
$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_bug_tag_tag_id', db_get_table( 'mantis_bug_tag_table' ), 'tag_id' ) );
$upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_email_id', db_get_table( 'mantis_email_table' ), 'email_id', array( 'DROP' ) ), Array( 'db_index_exists', Array( db_get_table( 'mantis_email_table' ), 'idx_email_id') ) );
$upgrade[] = Array( 'UpdateFunction', 'correct_multiselect_custom_fields_db_format' );
+
++ /* Patch to add textareas as custom fields */
++ $upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'custom_field_string' ), "
++ text XL NULL DEFAULT NULL " ) );
diff -ur mantisbt-1.2.4-orig/config_defaults_inc.php mantisbt-1.2.4/config_defaults_inc.php
--- mantisbt-1.2.4-orig/config_defaults_inc.php 2010-12-15 03:26:31.000000000 +0100
+++ mantisbt-1.2.4/config_defaults_inc.php 2010-12-15 16:54:20.000000000 +0100
@@ -2985,7 +2985,7 @@
*
* @global string $g_custom_field_type_enum_string
*/
- $g_custom_field_type_enum_string = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio';
+ $g_custom_field_type_enum_string = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio,10:textarea';
/*********************************
* MantisBT Javascript Variables *
diff -ur mantisbt-1.2.4-orig/core/cfdefs/cfdef_standard.php mantisbt-1.2.4/core/cfdefs/cfdef_standard.php
--- mantisbt-1.2.4-orig/core/cfdefs/cfdef_standard.php 2010-12-15 03:26:31.000000000 +0100
+++ mantisbt-1.2.4/core/cfdefs/cfdef_standard.php 2010-12-15 16:54:20.000000000 +0100
@@ -31,6 +31,20 @@
'#function_string_value_for_email' => null,
);
+$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_TEXTAREA] = array (
+ '#display_possible_values' => TRUE,
+ '#display_valid_regexp' => TRUE,
+ '#display_length_min' => TRUE,
+ '#display_length_max' => TRUE,
+ '#display_default_value' => TRUE,
+ '#function_return_distinct_values' => null,
+ '#function_value_to_database' => null,
+ '#function_database_to_value' => null,
+ '#function_print_input' => 'cfdef_input_textarea',
+ '#function_string_value' => null,
+ '#function_string_value_for_email' => null,
+);
+
$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_NUMERIC ] = array (
'#display_possible_values' => TRUE,
'#display_valid_regexp' => TRUE,
@@ -300,6 +314,16 @@
echo ' value="' . string_attribute( $t_custom_field_value ) .'">';
}
+function cfdef_input_textarea($p_field_def, $t_custom_field_value) {
+ echo '';
+}
+
/**
* Prints the controls for the date selector.
*
diff -ur mantisbt-1.2.4-orig/core/constant_inc.php mantisbt-1.2.4/core/constant_inc.php
--- mantisbt-1.2.4-orig/core/constant_inc.php 2010-12-15 03:26:31.000000000 +0100
+++ mantisbt-1.2.4/core/constant_inc.php 2010-12-15 16:54:20.000000000 +0100
@@ -414,6 +414,7 @@
define( 'CUSTOM_FIELD_TYPE_MULTILIST', 7 );
define( 'CUSTOM_FIELD_TYPE_DATE', 8 );
define( 'CUSTOM_FIELD_TYPE_RADIO', 9 );
+define( 'CUSTOM_FIELD_TYPE_TEXTAREA', 10 );
# Meta filter values
define( 'META_FILTER_MYSELF', -1 );
diff -ur mantisbt-1.2.4-orig/core/custom_field_api.php mantisbt-1.2.4/core/custom_field_api.php
--- mantisbt-1.2.4-orig/core/custom_field_api.php 2010-12-15 03:26:31.000000000 +0100
+++ mantisbt-1.2.4/core/custom_field_api.php 2010-12-15 16:54:20.000000000 +0100
@@ -45,6 +45,7 @@
# *******************************************
$g_custom_field_types[CUSTOM_FIELD_TYPE_STRING] = 'standard';
+$g_custom_field_types[CUSTOM_FIELD_TYPE_TEXTAREA] = 'standard';
$g_custom_field_types[CUSTOM_FIELD_TYPE_NUMERIC] = 'standard';
$g_custom_field_types[CUSTOM_FIELD_TYPE_FLOAT] = 'standard';
$g_custom_field_types[CUSTOM_FIELD_TYPE_ENUM] = 'standard';
@@ -991,8 +992,10 @@
return false;
}
+ $t_value_field = ( $row['type'] == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value' );
$t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' );
- $query = "SELECT value
+
+ $query = "SELECT $t_value_field
FROM $t_custom_field_string_table
WHERE bug_id=" . db_param() . " AND
field_id=" . db_param();
@@ -1334,8 +1337,10 @@
$t_type = custom_field_get_field( $p_field_id, 'type' );
$t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' );
+ $t_value_field = ( $t_type == CUSTOM_FIELD_TYPE_TEXTAREA ) ? 'text' : 'value';
+
# Determine whether an existing value needs to be updated or a new value inserted
- $query = "SELECT value
+ $query = "SELECT $t_value_field
FROM $t_custom_field_string_table
WHERE field_id=" . db_param() . " AND
bug_id=" . db_param();
@@ -1343,16 +1348,16 @@
if( db_num_rows( $result ) > 0 ) {
$query = "UPDATE $t_custom_field_string_table
- SET value=" . db_param() . "
+ SET $t_value_field=" . db_param() . "
WHERE field_id=" . db_param() . " AND
bug_id=" . db_param();
db_query_bound( $query, Array( custom_field_value_to_database( $p_value, $t_type ), $c_field_id, $c_bug_id ) );
$row = db_fetch_array( $result );
- history_log_event_direct( $c_bug_id, $t_name, custom_field_database_to_value( $row['value'], $t_type ), $p_value );
+ history_log_event_direct( $c_bug_id, $t_name, custom_field_database_to_value( $row[$t_value_field], $t_type ), $p_value );
} else {
$query = "INSERT INTO $t_custom_field_string_table
- ( field_id, bug_id, value )
+ ( field_id, bug_id, $t_value_field )
VALUES
( " . db_param() . ', ' . db_param() . ', ' . db_param() . ')';
db_query_bound( $query, Array( $c_field_id, $c_bug_id, custom_field_value_to_database( $p_value, $t_type ) ) );
diff -ur mantisbt-1.2.4-orig/core/filter_api.php mantisbt-1.2.4/core/filter_api.php
--- mantisbt-1.2.4-orig/core/filter_api.php 2010-12-15 03:26:31.000000000 +0100
+++ mantisbt-1.2.4/core/filter_api.php 2010-12-15 16:55:37.000000000 +0100
@@ -916,10 +916,11 @@
if( strpos( $c_sort, 'custom_' ) === 0 ) {
$t_custom_field = utf8_substr( $c_sort, utf8_strlen( 'custom_' ) );
$t_custom_field_id = custom_field_get_id_from_name( $t_custom_field );
-
+ $t_def = custom_field_get_definition( $t_custom_field_id );
+ $t_value_field = ( $t_def['type'] == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value' );
$c_cf_alias = str_replace( ' ', '_', $t_custom_field );
$t_cf_table_alias = $t_custom_field_string_table . '_' . $t_custom_field_id;
- $t_cf_select = "$t_cf_table_alias.value $c_cf_alias";
+ $t_cf_select = "$t_cf_table_alias.$t_value_field $c_cf_alias";
# check to be sure this field wasn't already added to the query.
if( !in_array( $t_cf_select, $p_query_clauses['select'] ) ) {
@@ -1902,6 +1903,10 @@
$t_where_params[] = '%|' . $t_filter_member . '|%';
array_push( $t_filter_array, db_helper_like( "$t_table_name.value" ) );
break;
+ case CUSTOM_FIELD_TYPE_TEXTAREA:
+ $t_where_params[] = '%' . $t_filter_member . '%';
+ array_push( $t_filter_array, db_helper_like( "$t_table_name.text" ) );
+ break;
default:
array_push( $t_filter_array, "$t_table_name.value = '" . db_prepare_string( $t_filter_member ) . "'" );
}
@@ -4014,6 +4021,8 @@
} else if( isset( $t_accessible_custom_fields_names[$j] ) ) {
if( $t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_DATE ) {
print_filter_custom_field_date( $j, $p_field_id );
+ } else if( $t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_TEXTAREA ) {
+ echo '';
} else {
echo '