New tab within mantis

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
istvanb
Posts: 226
Joined: 22 Aug 2010, 21:00

New tab within mantis

Post by istvanb »

I have created a program which monitors PLCs via an OPC server and I'd like to make these data visible in Mantis. The code can easily create a static HTML source everytime when it refreshes the data.

I'd like to make this HTML source visible within mantis either on the main page, but preferably on a new tab and I'am wondering how can I do that. Currently I work hard to push mantis forward at my current company and I guess it would be great to include some really important data for marketing purposes:) If they would have to navigate to the system anyways to see these PLC stuff then it would be much easier to sell the mantis idea :)

I'd like to store the data in a separate HTML file, so the new tab suppose to include that file.

The html source would be like this (with some more relevant data inside:)

Code: Select all

<table border="1">
  <tr>
    <td>cell 1</td><td>cell 2</td>
  </tr>
  <tr>
    <td>cell 3</td><td>cell 4</td>
  </tr>
</table>
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: New tab within mantis

Post by atrol »

I am not sure that I understand what you want.
To have a new link in main menu there are two options
1. Set configuration option $g_main_menu_custom_options

Code: Select all

* Add custom options to the main menu.  For example:
	 * $g_main_menu_custom_options = array(	array( "My Link",  MANAGER,       'my_link.php' ),
	 *					array( "My Link2", ADMINISTRATOR, 'my_link2.php' ) );
	 * Note that if the caption is found in custom_strings_inc.php, then it will be replaced by the
	 * translated string.  Options will only be added to the menu if the current logged in user has
	 * the appropriate access level.
2. Write a plugin which hooks to EVENT_MENU_MAIN
Please use Search before posting and read the Manual
istvanb
Posts: 226
Joined: 22 Aug 2010, 21:00

Re: New tab within mantis

Post by istvanb »

At the end I'd like to have a new tab and I'd like this tab to show the contents of an html file.

The first part looks really easy (I have tried it and the new menu item appears), but I have no clue about the hooks you have mentioned. Can you give me or point to an example?
atrol wrote: 2. Write a plugin which hooks to EVENT_MENU_MAIN
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: New tab within mantis

Post by atrol »

Please use Search before posting and read the Manual
istvanb
Posts: 226
Joined: 22 Aug 2010, 21:00

Re: New tab within mantis

Post by istvanb »

Alright. I am not exatly aware what is the advantage of a hook (still not a php coder), but if I use

$g_main_menu_custom_options = array( array("PLC Monitor", VIEWER, 'plc_monitor.php'));

then if I create a plc_monitor.php file then it will do the job. Is it possible to move my new tab (PLC monitor in this case) to the beginning of the tabs? (Best would be in between MAIN and MY VIEW)

Code: Select all

<?php
require_once( 'core.php' );

html_page_top1();
html_page_top2();

include 'plcmonitor.html';

html_page_bottom();
?>
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: New tab within mantis

Post by atrol »

If you want it at that place you can write a plugin for EVENT_MENU_MAIN_FRONT
There is no other clean way for it.

There is always the quick and dirty way to change the original source code. I don't recommend such kind of customization if there is a clean solution which will not break after updating.
Please use Search before posting and read the Manual
istvanb
Posts: 226
Joined: 22 Aug 2010, 21:00

Re: New tab within mantis

Post by istvanb »

OK. Its not a priority and I dont believe it will ever be, so I just leave it at the back of the list. In this way I dont need to change anything except the config_inc.php. Thanks for pointing the direction.
Post Reply