This plugin allows for setting up navigation bar links based that can be opened within the MantisBT UI via Iframe, instead of "leaving" the Mantis page. Plays nice with the ProjectPages plugin. Also included is a patch to allow for the Wiki to be opened within the Mantis UI as well.
Extract the release archive to the MantisBT installations plugins folder:
cd /var/www/mantisbt/plugins
wget -O IFramed.zip https://github.com/mantisbt-plugins/IFramed/releases/download/v1.0.0/IFramed.zip
unzip IFramed.zip
rm -f IFramed.zip
Ensure to use the latest released version number in the download url: (version badge available via the ApiExtend Plugin)
Install the plugin using the default installation procedure for a MantisBT plugin in Manage -> Plugins
.
A patched file is included that will allow the Wiki page to be opened within the MantisBT UI, as opposed to 'leaving' the page.
patch/wiki.php
This file was taken from MantisBT v2.21.1. Replace the default file at your own risk and ensure you make a backup of the original before overwriting.
Issues and requests should be submitted on my MantisBT site.
See patch/wiki.php for a patched file that will open Wiki links within the IFrame plugin, simply replace the default wiki.php in your mantisbt installation directory. The patched file adjusts the wiki urls as follows:
if( $f_type == 'project' ) {
if( $f_id !== 0 ) {
project_ensure_exists( $f_id );
}
$t_url = wiki_link_project( $f_id );
$t_url = 'plugin.php?page=IFramed/main&title=Wiki&url='.wiki_link_project( $f_id );
} else {
bug_ensure_exists( $f_id );
$t_url = 'plugin.php?page=IFramed/main&title=Wiki&url='.wiki_link_bug( $f_id );
}
Example config_inc.php entry using ProjectPages plugin:
$g_plugin_ProjectPages_main_menu_options_front = array(
array(
'title' => 'Home',
'access_level' => VIEWER,
'url' => 'plugin.php?page=IFramed/main&title=Home&url=https://my.domain.com/websvn/filedetails.php%3Frepname=pja%26path=%2Fproject_name%2Ftrunk%2FREADME.md%26usemime=1',
'icon' => 'fa-home',
'project_id' => array ( 2, 5, 8 )
)
);
$g_plugin_ProjectPages_main_menu_options_back = array(
array(
'title' => 'Read Me',
'access_level' => VIEWER,
'url' => 'plugin.php?page=IFramed/main&title=Home&url=https://my.domain.com/websvn/filedetails.php%3Frepname=pja%26path=%2Fproject_name%2Ftrunk%2FREADME.md%26usemime=1',
'icon' => 'fa-book',
'project_id' => array ( -1 )
),
array(
'title' => 'WebSVN',
'access_level' => DEVELOPER,
'url' => 'plugin.php?page=IFramed/main&title=WebSVN&url=https://my.domain.com/websvn/listing.php%3Frepname=pja%26path=%2Fproject_name%2Ftrunk%2F',
'icon' => 'fa-code-fork',
'project_id' => array( -1 )
)
);
Note that the keyword project_name
in the URL text is replaced with the currently loaded MantisBT project's name.
Note that the README page configuration above relies on Scott Meesseman's WebSVN build with markdown support.
The project_id is set to the project_id that the link is to be displayed for, where:
0
is theAll Projects
project-1
is all projects except for theAll Projects
project-2
is all projects
See the ProjectPages Documentation for more details.
You must adjust your Content-Security-Policy
response header for any cross domain links in an IFrame, ihis is easily done in config_inc.php using the $g_custom_headers variable:
$g_custom_headers = array("Content-Security-Policy: frame-src http://gist-it.appshot.com/ 'self'; img-src https://secure.gravatar.com/ 'self' data:; default-src 'self'; frame-ancestors 'self'; font-src 'self'; style-src 'self' 'unsafe-inline'; script-src https://cdnjs.cloudflare.com/ http://gist-it.appspot.com/ 'self' 'unsafe-inline'");
Git Gists are supported, any url containing gist-it.appspot.com
will be converted to a Git Gist. Note the cross-domain must be added to the Content-Security-Policy
response header's frame-src
part as shown in the above example.
A rewrite rule may need to be written on the web server to take care of the & problem when viewing filedetails page when using the IFramed plugin, in Apache, this would look something like this:
RewriteCond %{QUERY_STRING} ^repname=(.*)(&)path=(.*)(&)(.*)$
RewriteRule ^(.*)$ https://my.domain.com/websvn/filedetails.php?repname=%1&path=%3&%5 [N]
- User level link access