--- core/constant_inc.php Fri Jan 16 13:56:28 1970 +++ core/constant_inc.php Fri Jan 16 13:56:28 1970 @@ -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_MANTISUSER', 10 ); # Meta filter values define( 'META_FILTER_MYSELF', -1 ); --- core/custom_field_api.php Fri Jan 16 13:56:28 1970 +++ core/custom_field_api.php Fri Jan 16 13:56:28 1970 @@ -53,6 +53,7 @@ $g_custom_field_types[CUSTOM_FIELD_TYPE_LIST] = 'standard'; $g_custom_field_types[CUSTOM_FIELD_TYPE_MULTILIST] = 'standard'; $g_custom_field_types[CUSTOM_FIELD_TYPE_DATE] = 'standard'; +$g_custom_field_types[CUSTOM_FIELD_TYPE_MANTISUSER] = 'mantisuser'; foreach( $g_custom_field_types as $type ) { require_once( 'cfdefs' . DIRECTORY_SEPARATOR . 'cfdef_' . $type . '.php' ); @@ -1477,3 +1478,19 @@ } return $p_value; } + +/** + * Prepare a string containing a custom field value for use in filters + * NOTE: This probably belongs in the string_api.php + * @param string $p_value value of custom field + * @param int $p_type type of custom field + * @return string value ready for display in filters + * @access public + */ +function string_custom_field_value_for_filter( $p_value, $p_type ) { + global $g_custom_field_type_definition; + if( isset( $g_custom_field_type_definition[$p_type]['#function_string_value'] ) ) { + return call_user_func( $g_custom_field_type_definition[$p_type]['#function_string_value'], $p_value ); + } + return string_display_links( $p_value ); +} \ No newline at end of file --- core/filter_api.php Fri Jan 16 13:56:28 1970 +++ core/filter_api.php Fri Jan 16 13:56:28 1970 @@ -3160,7 +3160,7 @@ } else if( filter_field_is_none( $t_current ) ) { $t_this_string = lang_get( 'none' ); } else { - $t_this_string = string_display( $t_current ); + $t_this_string = string_display( string_custom_field_value_for_filter( $t_current, $t_accessible_custom_fields_types[$i] ) ); } if( $t_first_flag != true ) { @@ -4034,7 +4034,7 @@ if( isset( $t_filter['custom_fields'][$p_field_id] ) ) { check_selected( $t_filter['custom_fields'][$p_field_id], $t_item ); } - echo '>' . string_attribute( string_shorten( $t_item, $t_max_length ) ) . '' . "\n"; + echo '>' . string_attribute( string_shorten( string_custom_field_value_for_filter( $t_item, $t_accessible_custom_fields_types[$j] ), $t_max_length ) ) . '' . "\n"; } } } --- lang/strings_english.txt Fri Jan 16 13:56:28 1970 +++ lang/strings_english.txt Fri Jan 16 13:56:28 1970 @@ -1300,7 +1300,7 @@ $s_linked_projects = 'Linked Projects'; $s_custom_field_sequence = 'Sequence'; -$s_custom_field_type_enum_string = '0:String,1:Numeric,2:Float,3:Enumeration,4:E-mail,5:Checkbox,6:List,7:Multiselection list,8:Date,9:Radio'; +$s_custom_field_type_enum_string = '0:String,1:Numeric,2:Float,3:Enumeration,4:E-mail,5:Checkbox,6:List,7:Multiselection list,8:Date,9:Radio,10:Mantis User'; $s_confirm_used_custom_field_deletion = 'This field is currently linked to at least one project. If you continue all values for this field will be permanently deleted. This action cannot be undone. If you do not want to delete this field, hit the Back button in your browser. To proceed, click the button below'; $s_confirm_custom_field_deletion = 'Are you sure you want to delete this custom field and all associated values?'; --- config_defaults_inc.php Fri Jan 16 13:56:28 1970 +++ config_defaults_inc.php Fri Jan 16 13:56:28 1970 @@ -2985,8 +2985,8 @@ * * @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:mantis user'; + /********************************* * MantisBT Javascript Variables * *********************************/ @@ -3133,6 +3133,13 @@ */ $g_custom_field_edit_after_create = ON; + /** + * If TRUE, displays all users (above the minimum level if specified) in the filter. + * The default behaviour for custom field filters is to only show values that have been selected in issues. + * @global int $g_custom_field_mantisuser_filter_show_all + */ + $g_custom_field_mantisuser_filter_show_all = FALSE; + /**************** * Custom Menus * ****************/