Hi guys,
The best way to customize Mantis (even 2.X) is to build a Plugin. In fact, it is very easy once you've understand the plugin structure and events systems. This prevents from modifying to much core code.
1. Register your plugin, like in :
https://www.mantisbt.org/docs/master-1. ... lding.html
2. Select the events to hook to customize specific locations in your Mantis :
https://www.mantisbt.org/wiki/doku.php/ ... ins_events
[ The event you should hook to customize footer logo is :
'EVENT_LAYOUT_PAGE_FOOTER'. ]
3. Once the event is correctly hooked, you might be able to change bottom page logo using JQuery
In example, in an other page named 'logo_by_project.js' in plugin's
/files directory:
In this example, I can switch the logo depending on wich project is selected.
I hadded the class #mantis-logo to the IMG tag in layout_api.php (function
layout_footer() ) between line 1130 and 1150.
Code: Select all
jQuery( document ).ready( function(){
# 1 -> get the project name from the dropdown list
var project_name = $( "#dropdown-toggle" ).text();
# 2 -> PHP function trim() to delete any blank before and after the project_name
var m_project_name = $.trim( project_name ) + "";
var logo_url_project = "/mantisbt/images/" + m_project_name.toLowerCase() + ".png";
# 3 -> make sure it's LowerCase, and rename your custom logo with the project name (i. e. : myproject.png in yourmantisroot/images)
$( "#mantis-logo" ).attr( 'src', logo_url_project );
$( "#mantis-logo" ).attr( 'alt', '' );
});
4. In the function that is hooked to the
FOOTER event, include the script:
Code: Select all
function footer() {
echo '<script src="' . plugin_file( "logo_by_project.js" ) . '"></script>';
}
Make sure that the JS file your calling is in the
/files plugin's directory.
5. Install your plugin, and test it.
Hope you'll find this helpful