Page 1 of 1
View Bugs: How to add column for current project only
Posted: 17 Aug 2006, 18:57
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
Posted: 18 Aug 2006, 03:09
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/
Posted: 18 Aug 2006, 16:15
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';
}
Posted: 19 Aug 2006, 00:04
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/
Posted: 21 Aug 2006, 13:03
by abram
Thanks vboctor! It works great.