User Tools

  • Logged in as: anonymous (anonymous)
  • Log Out

Site Tools


mantisbt:customizing_relationships

This is an old revision of the document!


Customizing Issue Relationships

Author: Victor Boctor

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.

Customization Steps

Define Constants

Create custom_constant_inc.php in Mantis root folder and add the following code to it:

<?php
	define( 'BUG_CUSTOM_RELATIONSHIP_ORIGIN_OF',       99 );
	define( 'BUG_CUSTOM_RELATIONSHIP_ORIGINATES_FROM', 98 );
?>

Define Relationship Metadata

Create custom_relationships_inc.php in Mantis root folder and add the following code to it:

<?php
	$g_relationships[ BUG_CUSTOM_RELATIONSHIP_ORIGIN_OF ] = array(
		'#forward' => true,
		'#complementary' => BUG_CUSTOM_RELATIONSHIP_ORIGINATES_FROM,
		'#description' => 'rel_origin_of',
		'#notify_added' => 'email_notification_title_for_action_origin_of_relationship_added',
		'#notify_deleted' => 'email_notification_title_for_action_origin_of_relationship_deleted',
		'#edge_style' => array ( 'style' => 'dashed','color' => '808080' ),
	);
 
	$g_relationships[ BUG_CUSTOM_RELATIONSHIP_ORIGINATES_FROM ] = array(
		'#forward' => false,
		'#complementary' => BUG_CUSTOM_RELATIONSHIP_ORIGIN_OF,
		'#description' => 'rel_originates_from',
		'#notify_added' => 'email_notification_title_for_action_originates_from_relationship_added',
		'#notify_deleted' => 'email_notification_title_for_action_originates_from_relationship_deleted',
		'#edge_style' => array ( 'style' => 'dashed','color' => '808080' ),
	);
?>

Define Custom Strings

Create custom_strings_inc.php in Mantis root folder and add the following code to it:

<?php
	$s_rel_origin_of = 'origin of';
	$s_rel_originates_from = 'originates from';
 
	$s_email_notification_title_for_action_origin_of_relationship_added = 'Origin-Of Relationship Added';
	$s_email_notification_title_for_action_origin_of_relationship_deleted = 'Origin-Of Relationship Deleted';
	$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';
?>

Acknowledgement

This feature was contributed by kratib (8130).

mantisbt/customizing_relationships.1185689586.txt.gz · Last modified: 2008/10/29 04:31 (external edit)

Driven by DokuWiki