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://www.mantisbt.org/bugs/view.php?id=3298
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.
dors@kittelNOSPAMberger.de
05-Apr-2004 5:43
#101
For the custom_strings_inc.php example, shouldn't the if condition be

$g_lang_current === 'german'

so that the German strings are displayed correctly?
andre at ironcreek dot net
27-May-2004 11:33
#143
Notice that the language variable name has changed. Use:
  if ( $g_current_language === 'english' )
kickthedonkey@gmail.com
16-Jul-2004 10:34
#175
If you're using post-0.18, have a look here instead of doing this the ard way:

http://manual.mantisbt.org/manual.customizing.mantis.custom.fields.php
TomR@proguide.nl
20-Aug-2004 4:30
#188
Notice that the language variable name has changed again. Use:
  if ( $g_active_language === 'english' )
fred@ebooksys.com
20-Jan-2006 2:39
#834
I have tried to follow this manual to customised the severity level, but I still see the "factory default" dropdown list for severity when submitting a bug. Any advise?
null
14-Feb-2006 16:17
#893
fred@ebooksys.com:
Try editing the strings in mantis/lang/strings_english.txt
richard@richardthorntonDOESNTWANTSPAM.com
20-Feb-2006 16:45
#901
I have modified the $g_reproducibility_enum_string to appear in the reverse order. Does anyone know if there are any ramifications of doing so? Thanks!
rford@candis.com.cn
23-Apr-2006 1:55
#1020
How/what do I edit if I want to simply:

A) Reduce the number of enum values for severity and priority

and

B) Change the names of them in english and Chinese

?
rford@candis.com.cn
23-Apr-2006 1:55
#1021
How/what do I edit if I want to simply:

A) Reduce the number of enum values for severity and priority

and

B) Change the names of them in english and Chinese

?
JW00000?gmail!com
03-Jul-2006 11:53
#1176
To rford@candis.com.cn
> How/what do I edit if I want to simply:
> A) Reduce the number of enum values for severity and priority

Why would you want to do that? The first part of this job is quite simple, you can edit the three files as described above. Change every 10 to 1, 20 to 2 (for example)... The second part of the job is a bit harder: these values are stored in the database with their numbers. So, if you would want to reduce them you would have to change every entry in the database. With a bit of knowledge of (My)SQL, this shouldn't be too hard either, but it's simplier to leave the values as they are. After a quick look at the database, it seems like these values can be up to 32767, although I'm not sure about that.
If you don't have (m)any bugs in your database yet, however, you may want to try this, it shouldn't be a problem.

> B) Change the names of them in english and Chinese

As described in the documentation above, you can simply edit lang/strings_english.txt and lang/strings_chinese_simplified(_utf8).txt or lang/strings_chinese_traditional(_utf8).txt, so $s_priority_enum_string and $s_severity_enum_string reflect the changes. They should be somewhere around line 300, if you're searching for them.
If you for example changed 10 to 1, 20 to 2 and so on, you could have the following in lang/strings_english.txt:
$s_priority_enum_string = '1:none,2:low,3:normal,4:high,5:urgent,6:immediate';

I hope I could help,
JW - JW00000?gmail!com - http://jw.clawz.com/blog
JW00000?gmail!com
03-Jul-2006 11:53
#1177
To rford@candis.com.cn
> How/what do I edit if I want to simply:
> A) Reduce the number of enum values for severity and priority

Why would you want to do that? The first part of this job is quite simple, you can edit the three files as described above. Change every 10 to 1, 20 to 2 (for example)... The second part of the job is a bit harder: these values are stored in the database with their numbers. So, if you would want to reduce them you would have to change every entry in the database. With a bit of knowledge of (My)SQL, this shouldn't be too hard either, but it's simplier to leave the values as they are. After a quick look at the database, it seems like these values can be up to 32767, although I'm not sure about that.
If you don't have (m)any bugs in your database yet, however, you may want to try this, it shouldn't be a problem.

> B) Change the names of them in english and Chinese

As described in the documentation above, you can simply edit lang/strings_english.txt and lang/strings_chinese_simplified(_utf8).txt or lang/strings_chinese_traditional(_utf8).txt, so $s_priority_enum_string and $s_severity_enum_string reflect the changes. They should be somewhere around line 300, if you're searching for them.
If you for example changed 10 to 1, 20 to 2 and so on, you could have the following in lang/strings_english.txt:
$s_priority_enum_string = '1:none,2:low,3:normal,4:high,5:urgent,6:immediate';

I hope I could help,
JW - JW00000?gmail!com - http://jw.clawz.com/blog
dhorner@jmesoftware.com
02-Aug-2006 18:23
#1207
1. How would i remove the severity all together?

2. How do i change the ordering of the fields as they appear on screen e.g. i have 2 custom fields that can fit on the same line is it possible to make this happen?
dhorner@jmesoftware.com
02-Aug-2006 18:24
#1208
1. How would i remove the severity all together?

2. How do i change the ordering of the fields as they appear on screen e.g. i have 2 custom fields that can fit on the same line is it possible to make this happen?
dhorner@jmesoftware.com
02-Aug-2006 18:24
#1209
1. How would i remove the severity all together?

2. How do i change the ordering of the fields as they appear on screen e.g. i have 2 custom fields that can fit on the same line is it possible to make this happen?
JW00000?gmail!com
18-Aug-2006 13:31
#1241
To dhorner@jmesoftware.com:
> 2. How do i change the ordering of the fields as they appear on screen e.g. i have 2 custom fields that can fit on the same line is it possible to make this happen?

You can do this by editing the files bug_view_page.php and bug_view_advanced_page.php, and probably bug_update_apage.php and bug_update_advanced_page.php too. These are the files that display the pages for viewing bugs, viewing bugs advanced, updating bugs and updating bugs advanced. By changing the HTML code in it, you can re-arrange these pages to suite your needs.

> 1. How would i remove the severity all together?

To do this, I would simply remove all severity fields from every page. So, not only remove every reference to the severity from the files mentioned above, but also from the page for adding bugs (simple and advanced), the page that displays all bugs, the search page, and so on. Then, the field would still exist in the database, but no one will be able to see the severity anymore.

I hope I could help,
JW - JW00000?gmail!com - http://jw.clawz.com/blog
Add Notes About Notes
Last updated: Fri, 05 Sep 2008 - 15:53:01

Mantis @ SourceForge