Mantis Logo
Mantis Manual
Manual
Customizing Mantis

Custom Fields
Enumerations
Email Notifications
Customizing Status Values
LDAP
Custom Functions


Partner Links


Enumerations
Last Modified: September 14, 2004 18:09PM
(0.18.0)
Description

Enumerations are used in Mantis to represent a set of possible values for an attribute. Enumerations are used for access levels, severities, priorities, project statuses, project view state, reproducibility, resolution, ETA, and projection.

Mantis provides the administrator with the flexibility of altering the values in these enumerations. The rest of this topic explains how enumerations work, and then how they can be customised.

How enumerations work?

core/constant_inc.php

This file defines the constants that correspond to those in the enumeration. These are useful to refer to these enumerations in the configs and the code.
define( 'VIEWER', 10 ) define( 'REPORTER', 25 ) define( 'UPDATER', 40 ) define( 'DEVELOPER', 55 ) define( 'MANAGER', 70 ) define( 'ADMINISTRATOR', 90 )

config_defaults_inc.php

This file includes the defaults for the enumerations. The configuration options that are defaulted here are used in specifying which enumerations are active and should be used in Mantis. However, the strings included in the enumerations here are just for documentation purpose, they are not shown to the user (due to the need for localisation). Hence, if an entry in this enumeration is not found in the corresponding localised enumeration (i.e. 70:manager), then it will be printed to the user as @70@.
$g_access_levels_enum_string = '10:viewer,25:reporter,40:updater,55:developer,70:manager,90:administrator';

lang/strings_german.txt

The specific language strings provide the localised strings for enumerations. But again, the master list is the enumeration in the configs, the ones in the language files are just used for finding the localised equivalent for an entry. Hence, if a user changes the config to have only two types of users developers and administrators, then only those will be prompted to the users even if the enumerations in the language files still includes the full list.
$s_access_levels_enum_string = '10:Betrachter,25:Reporter,40:Updater,55:Entwickler,70:Manager,90:Administrator';


How can they be customised?

Let say we want to remove access level "Updater" and add access level "Senior Developer".

custom_constant_inc.php

This file is supported for the exclusive purpose of allowing administrators to define their own constants while maintaining a simple upgrade path for future releases of Mantis. Note that this file is not distributed with Mantis and you will need to create it if you need such customisation. In our example, we need to define a constant for the new access level.
define ( 'SENIOR_DEVELOPER', 60 );

config_inc.php

// Remove Updater and add Senior Developer $g_access_levels_enum_string = '10:viewer,25:reporter,55:developer,60:senior_developer,70:manager,90:administrator'; // Give access to Senior developers to create/delete custom field. $g_manage_custom_fields_threshold = SENIOR_DEVELOPER;

custom_strings_inc.php

This file is introduced for a similar reason to that of custom_constant_inc.php, which is to define custom strings. The advantage of defining them here is to provide a simple upgrade path, and avoid having to re-do the changes when upgrading to the next Mantis release. Note that you will need to create this file if you need such customisation. The file is automatically detected and included by Mantis code (v0.18.0aX).
# Note that we don't have to remove the Updater entry from the localisation file if ( lang_get_current() === 'english' ) { $s_access_levels_enum_string = '10:Betrachter,25:Reporter,40:Updater,55:Entwickler,60:Senior Developer,70:Manager,90:Administrator'; }

Conclusion

We have covered how enumerations work in general, and how to customise one of them. If you are interested in customising other enumerations, a good starting point would be to go to "Mantis Enum Strings" section in
config_defaults_inc.php. This section defines all enumerations that are used by Mantis.


For versions that are older than 0.18.0, custom_*_inc.php files are not supported, and hence you will need to change in the actual constants / language files directly.

User Contributed Notes
Enumerations
Add Notes About Notes
victor @ mantis
19-Aug-2003 16:33
#2
This is a clarification about the paths of the files:

/.../mantis/custom_constant_inc.php
/.../mantis/custom_strings_inc.php
/.../mantis/config_inc.php

I added this in response to http://mantis.calaquendi.net/bug_view_advanced_page.php?bug_id=0003298
david@ethell.com
31-Oct-2003 5:36
#18
If you customize the status_enum_string with a new status you will need to add a status color to match it in the g_status_colors array. For example, we added a status of "in test". Here are the additions to the config_inc.php file:

$g_status_enum_string = '10:new,20:feedback,30:acknowledged,40:confirmed,50:assigned,60:in test,80:resolved,90:closed';
# Status color additions
$g_status_colors['in test'] = '#B09FF1';

Of course, we also had to add the relevant commands to custom_constant_inc.php and custom_strings_inc.php
michael s
19-Jan-2004 16:44
#52
---for 0.18.0 and later---------

the three files that need to be edited are:
* mantis/config_inc.php
* mantis/lang/strings_english.txt (or your language)
* mantis/core/constant_inc.php

works like a charm. great software, mantis guys. we love it.
Add Notes About Notes
Last updated: Mon, 08 Apr 2013 - 23:24:21

Mantis @ SourceForge