Next revision | Previous revision |
mantisbt:customizing_relationships [2007/07/29 02:13] – created vboctor | mantisbt:customizing_relationships [2018/09/07 02:47] (current) – Correct folder for Mantis >= 1.3.x, remove PHP closing tags from code atrol |
---|
| |
**Author:** Victor Boctor | **Author:** Victor Boctor |
| |
| |
===== Introduction ===== | ===== Introduction ===== |
| |
Starting Mantis 1.1.0a4, it is possible to add your own custom relationships. In this example, we will add "origin of" and "originates from" relationships. | Starting Mantis 1.1.0a4, it is possible to add your own custom relationships. In this example, we will add "origin of" and "originates from" relationships. These relationships will be supported the same way as native relationships: i.e. in View Issue page, relationship graphs, filters and email notifications. |
| |
===== Customization Steps ===== | ===== Customization Steps ===== |
==== Define Constants ==== | ==== Define Constants ==== |
| |
Create custom_constant_inc.php in Mantis root folder and add the following code to it: | Create custom_constants_inc.php in Mantis config folder and add the following code to it: |
| |
<code php> | <code php> |
define( 'BUG_CUSTOM_RELATIONSHIP_ORIGIN_OF', 99 ); | define( 'BUG_CUSTOM_RELATIONSHIP_ORIGIN_OF', 99 ); |
define( 'BUG_CUSTOM_RELATIONSHIP_ORIGINATES_FROM', 98 ); | define( 'BUG_CUSTOM_RELATIONSHIP_ORIGINATES_FROM', 98 ); |
?> | |
</code> | </code> |
| |
==== Define Relationship Metadata ==== | ==== Define Relationship Metadata ==== |
| |
Create custom_relationships_inc.php in Mantis root folder and add the following code to it: | Create custom_relationships_inc.php in Mantis config folder and add the following code to it: |
| |
<code php> | <code php> |
'#notify_added' => 'email_notification_title_for_action_origin_of_relationship_added', | '#notify_added' => 'email_notification_title_for_action_origin_of_relationship_added', |
'#notify_deleted' => 'email_notification_title_for_action_origin_of_relationship_deleted', | '#notify_deleted' => 'email_notification_title_for_action_origin_of_relationship_deleted', |
'#edge_style' => array ( 'style' => 'dashed','color' => '808080' ), | '#edge_style' => array ( 'style' => 'dashed', 'color' => '808080' ), |
); | ); |
| |
'#notify_added' => 'email_notification_title_for_action_originates_from_relationship_added', | '#notify_added' => 'email_notification_title_for_action_originates_from_relationship_added', |
'#notify_deleted' => 'email_notification_title_for_action_originates_from_relationship_deleted', | '#notify_deleted' => 'email_notification_title_for_action_originates_from_relationship_deleted', |
'#edge_style' => array ( 'style' => 'dashed','color' => '808080' ), | '#edge_style' => array ( 'style' => 'dashed', 'color' => '808080' ), |
); | ); |
?> | |
</code> | </code> |
| |
| Following is the documentation for the metadata structure: |
| * The array index is the relationship type ID that you define for your custom relationships. |
| * '#forward' is a boolean that specifies the conceptual direction of the relationship: is it forward from this bug to the one specified, or backward from the one specified to this one? |
| * '#complementary' specifies the ID of the complementary relationship: for 'parent', it's 'child', etc. Some relationships are their own complementary; in this case just use the same type ID as the array index. |
| * '#description' is the localization string is defined in custom_strings_inc.php |
| * '#notify_added' and '#notify_deleted' are the string names for email messages when this relationship is modified in a bug. |
| * '#edge_style' is the Graphviz edge style to be used for this relationship type. |
| |
==== Define Custom Strings ==== | ==== Define Custom Strings ==== |
| |
Create custom_strings_inc.php in Mantis root folder and add the following code to it: | Create custom_strings_inc.php in Mantis config folder and add the following code to it: |
| |
<code php> | <code php> |
$s_email_notification_title_for_action_originates_from_relationship_added = 'Originates-From Relationship Added'; | $s_email_notification_title_for_action_originates_from_relationship_added = 'Originates-From Relationship Added'; |
$s_email_notification_title_for_action_originates_from_relationship_deleted = 'Originates-From Relationship Deleted'; | $s_email_notification_title_for_action_originates_from_relationship_deleted = 'Originates-From Relationship Deleted'; |
?> | |
</code> | </code> |
| |
| ===== Problems ===== |
| |
| The legend below the graphs does not contain customized relationships (see issue [[http://www.mantisbt.org/bugs/view.php?id=13203|13203]]). |
| |
===== Acknowledgement ===== | ===== Acknowledgement ===== |
| |
This feature was contributed by kratib ([[http://www.mantisbt.org/bugs/view.php?id=8130|8130]]). | This feature was contributed by kratib ([[http://www.mantisbt.org/bugs/view.php?id=8130|8130]]). |