Giter Club home page Giter Club logo

customcontent's Introduction

MantisBT CustomContent Plugin

Copyright (c) 2017-2018, Ryadel - https://www.ryadel.com/

Released under the GNU General Public License v3

Description

The CustomContent plugin can be used to include custom HTML, PHP, JS or CSS content within the MantisBT HTML layout structure. It has been originally developed to provide a workaround for the MantisBT bug #22098, based upon the fact that the $g_top_include_page and $g_bottom_include_page global variables are not supported / not working anymore (as of MantisBT 2.16.0, at least).

Installation

  1. Download this package as a single zip file & unzip it in the /mantisbt/plugins/ folder of your current MantisBT installation.

  2. Rename the resulting folder to /CustomContent/, so that the main plugin PHP file will have the following path: /mantisbt/plugins/CustomContent/CustomContent.php.

  3. While logged into your Mantis installation as an administrator, go to Manage -> Manage Plugins.

  4. In the Available Plugins list, you'll find the CustomContent plugin.

CustomContent Plugin Installation - 01

  1. Click the Install button to install the plugin into your current MantisBT environment.

CustomContent Plugin Installation - 02

  1. Navigate to the /mantisbt/plugins/CustomContent/inc folder and edit/modify the content files accordingly (see Usage below).

  2. Open the /mantisbt/config/config_inc.php (the MantisBT configuration file) and add the following lines:

# CustomContent Plugin settings
# ------------------------------------------------------

# this file will be included right before the closing <header> tag
$custom_head_file = "%absolute_path%/plugins/CustomContent/inc/custom_head_file.php";

# this file will be included right after the opening <body> tag
$g_custom_body_begin_file = "%absolute_path%/plugins/CustomContent/inc/custom_body_begin_file.php";

# this file will be included at the end of the header layout section, i.e. the main menu
$g_custom_page_header_file = "%absolute_path%/plugins/CustomContent/inc/custom_page_header_file.php";

# this file will be included at the end of the footer layout section, i.e the Mantis copyright
$g_custom_page_footer_file = "%absolute_path%/plugins/CustomContent/inc/custom_page_footer_file.php";

# this file will be included right before the closing <body> tag
$g_custom_body_end_file = "%absolute_path%/plugins/CustomContent/inc/custom_body_end_file.php";

Feel free to change the folders, paths & filenames accordingly to your needs.

IMPORTANT NOTE: As of MantisBT 2.16.0, the $custom_body_begin_file is not working because of a bug in the current Mantis source code, which doesn't trigger the corresponding EVENT_LAYOUT_PAGE_HEADER hook. However, you can easily work around it through HTML injection using the HEADER insert point (which is working) and a simple JavaScript/JQuery script such as the following working examples:

$(function() { 
    // insert brand/logo with link BEFORE the "MantisBT" text
    $('.navbar-container').prepend('<a class="navbar-brand" href="#">Brand</a>'); 
    
    // insert additional content AFTER the "MantisBT" text
    $('.navbar-header').append('<p class="navbar-text">your custom content</p>'); 
    
    // ... and so on.
});

Check out the Bootstrap 3 Navbar API for additional info on what you can do.

This arguably is the most "cleaner" approach until the MantisBT team will fix the source code.

Usage

You can use the included files just any other PHP file: you can include PHP code, <script>, <link> and <style> elements to link external JS and CSS files or include internal code, images, text and so on.

HINT: this plugin can be used to bring back the MantisBT 1.x row-level coloring feature thanks to this JQuery script. Here's a screenshot showing the result:

MantisBT 2.x row-level coloring

Acknowledgements

A huge thanks to Xenos, to his MyKingCustomPlugin and to all the crew of the MantisBT bug #22098 who strongly inspired me to write this plugin.

Supported Versions

  • MantisBT 1.x - not supported
  • MantisBT 2.x - supported

Official Resources

customcontent's People

Contributors

darkseal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

darknami

customcontent's Issues

Configuration variables

$g_custom_head_file is missing from the documentation and there is no include file for it.

$g_custom_page_header should be $g_custom_page_header_file

$g_custom_page_footer should be $g_custom_page_footer_file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.