View Issue Details

IDProjectCategoryView StatusLast Update
0005180mantisbtcustom fieldspublic2005-04-18 10:29
Reportervboctor Assigned Tovboctor  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Product Version0.19.2 
Fixed in Version1.0.0a1 
Summary0005180: Support custom fields with dynamic possible values
Description

The user should be able to define a custom field that has a set of possible values that are dynamically generated. An example would be:

  • Versions
  • Categories
  • Developers
  • Other calculated values
  • Other values that depend on external databases.

This can be supported by allowing the user to define the possible values for a custom field as a "=functionname" where "enum" + "functionname" is a custom function. The "enum" is added for security reasons. This will allow the Mantis web users to only use custom functions that produce enums, and will not allow them to use other functions that were not intended for this purpose.

An example of a custom function is:

# --------------------

Construct an enumeration for all versions for the current project.

The enumeration will be empty if current project is ALL PROJECTS.

Enumerations format is: "abc|lmn|xyz"

To use this in a custom field type "=versions" in the possible values field.

function custom_function_default_enum_versions() {
$t_versions = version_get_all_rows( helper_get_current_project() );

$t_enum = array();
foreach( $t_versions as $t_version ) {
    $t_enum[] = $t_version['version'];
}

$t_possible_values = implode( '|', $t_enum );

return $t_possible_values;

}

To override custom functions or define new ones, see the following topic in the manual:

http://manual.mantisbt.org/manual.customizing.mantis.custom.functions.php

Since custom functions are implemented in PHP, it is possible to depend on the returned values on current user, current project, or any other criteria.

TagsNo tags attached.

Relationships

related to 0004451 acknowledged Populating options through a function call 
related to 0004683 closedvboctor Is there a way to localize enumations of custom fields? 
related to 0004640 new New custom field types: "Version", "User" 
related to 0003789 closedgrangeway field possible_values in table mantis_custom_fields_table 
related to 0003961 closedvboctor Add the ability to custom enumerations by project 
related to 0003791 closedvboctor Additional Custom-Field-Type "version" 
related to 0004842 closedvboctor we should be able to giva a target for a given bug. 
related to 0005258 closedgrangeway Be able to enter more than 255 characters when adding a new custom field 

Activities

There are no notes attached to this issue.