View Bugs: How to add column for current project only

Post about your customizations to share with others.

Moderators: Developer, Contributor

Post Reply
abram
Posts: 3
Joined: 17 Aug 2006, 18:52

View Bugs: How to add column for current project only

Post by abram »

I added a custom column in Mantis 1.0.3 by adding a $t_columns[] = 'custom_[CUSTOM FIELD NAME]'; to the custom_function_default_get_columns_to_view function in the core/custom_function_api.php file. This works great, but I only want this column to show up in one project.

Does anyone know how to do this?

Thanks in Advance!
Abram
vboctor
Site Admin
Posts: 1293
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post by vboctor »

You should not change the core/custom_functions_api.php you can override such function by creating custom_functions_inc.php and defining custom_function_override_default_get_columns_to_view(). In the implementation of this method you can check for the current project and based on that decide what columns to add.

See custom functions in the manual for more details:
http://manual.mantisbt.org/manual.custo ... ctions.php

In Mantis 1.1, the columns to view will be controlled via the configuration and the configuration will be editable via the web interface. This will allow you to define the columns in general, per user, per project, or per user+project.

Regards,
Victor
http://www.futureware.biz/mantisconnect/
abram
Posts: 3
Joined: 17 Aug 2006, 18:52

Post by abram »

vboctor, Thanks for the clarification on how to create custom functions. What sent me down the wrong path was that the comments on the view bugs manual page said that you add columns by changing the core/custom_functions_api.php file. Anyhow, I’m now using the custom_functions_inc.php now.

Back to my original question. What is the syntax to get the currently selected project? Here is what I’m trying and it is not working.

if ($c_project_id = '2')
{
$t_columns[] = 'custom_field_name';
}
vboctor
Site Admin
Posts: 1293
Joined: 13 Feb 2005, 22:11
Location: Redmond, Washington
Contact:

Post by vboctor »

Following is an example:

Code: Select all

if ( helper_get_current_project() == 2 )
{
    // put your extra columns here for the project with code = 2.
}
Regards,
Victor
http://www.futureware.biz/mantisconnect/
abram
Posts: 3
Joined: 17 Aug 2006, 18:52

Post by abram »

Thanks vboctor! It works great.
Post Reply