Page 1 of 2

add a new MENU option link

Posted: 23 Jun 2010, 20:08
by tetsunami
well now i tried the mantis report plugin doesent fit at all for me, so im creating my own report on php
but now im looking for add a new MENU OPTION called reports
who refresh de content of the web with my report1.php report
i remember someone said its the way for create a plugin but i dont know how can make a link in the menu bar and refresh in the same page the content only

well thanks for the help ..

by the way mantis rocks!! :)

Re: add a new MENU option link

Posted: 08 Jul 2010, 21:16
by tetsunami
someone can help me plz? im still loking for that i thought it was on the configuration menu , like a complex type? :?:

Re: add a new MENU option link

Posted: 27 Jul 2010, 13:16
by Kirill
How? See example http://github.com/Kirill/search/blob/ma ... Search.php.
What hock event use - see core/events_inc.php.

Code: Select all

	# Menu Events
	'EVENT_MENU_MAIN' => EVENT_TYPE_DEFAULT,
	'EVENT_MENU_MAIN_FRONT' => EVENT_TYPE_DEFAULT,
	'EVENT_MENU_MANAGE' => EVENT_TYPE_DEFAULT,
	'EVENT_MENU_MANAGE_CONFIG' => EVENT_TYPE_DEFAULT,
	'EVENT_MENU_SUMMARY' => EVENT_TYPE_DEFAULT,
	'EVENT_SUBMENU_SUMMARY' => EVENT_TYPE_DEFAULT,
	'EVENT_MENU_DOCS' => EVENT_TYPE_DEFAULT,
	'EVENT_MENU_ACCOUNT' => EVENT_TYPE_DEFAULT,
	'EVENT_MENU_FILTER' => EVENT_TYPE_DEFAULT,
	'EVENT_MENU_ISSUE' => EVENT_TYPE_DEFAULT,

Re: add a new MENU option link

Posted: 28 Jul 2010, 13:13
by MCKiller
Ok. That is easy.

So I have this in my plugin file:

Code: Select all

	function hooks( ) {
		$hooks = array(
			'EVENT_MENU_MAIN' => 'links',
		);
		return $hooks;
	}
But what do I have to do If the link should only be visible to administrators or reporters?

Thanks for help..
Heiko

Re: add a new MENU option link

Posted: 28 Jul 2010, 15:22
by atrol
Add the following code to your function links

Code: Select all

if ( access_has_global_level ( MANAGER ) ) {
# print your links
}

Re: add a new MENU option link

Posted: 28 Jul 2010, 15:43
by MCKiller
ok, so I have to do something like that:

Code: Select all

   function hooks( ) {
      if ( access_has_global_level ( MANAGER ) ) {
          # print your links
          $hooks = array(
               'EVENT_MENU_MAIN' => 'links',
          );
      }
      return $hooks;
   }
I will test it when I am at home...

thx..

Re: add a new MENU option link

Posted: 28 Jul 2010, 19:21
by atrol
no, not in functions hooks, but in the function where you return the link (your function link, in Kirill's example this is function print_menu_search)

Re: add a new MENU option link

Posted: 30 Jul 2010, 14:06
by tetsunami
Excellent i made the plugin folder , well now im trying to package this on a .pkg file .... someone can share a link plz XD

thanks for your help it really helps :)

Re: add a new MENU option link

Posted: 01 Aug 2010, 04:40
by Kirill
For what you did pkg file? MantisBT not support pkg-plugins.

Re: add a new MENU option link

Posted: 06 Aug 2010, 15:38
by tetsunami
Kirill wrote:For what you did pkg file? MantisBT not support pkg-plugins.

well i was looking on mantisbt main page and all the plugin were in .pkg files

Re: add a new MENU option link

Posted: 06 Aug 2010, 16:15
by atrol
tetsunami wrote: well i was looking on mantisbt main page and all the plugin were in .pkg files
The MantisBT main page is http://www.mantisbt.org
MantisBT does not use any pkg files.
I am pretty sure you are talking about 3rd party plugins.
They are devloped by user deboutv in this forum.
His plugins are not working with MantisBT 1.2

Re: add a new MENU option link

Posted: 06 Aug 2010, 17:18
by tetsunami
Youre right my bad :(

Re: add a new MENU option link

Posted: 11 Aug 2011, 12:39
by jpmoraez
Hi Kiril,

Im trying to add a new item link at main menu bar in mantis 1.2.3

the link you´ve posted (http://github.com/Kirill/search/blob/ma ... Search.php) is forbidden

if you have another example explaining how to add a new item link would be great.


Thanks

Re: add a new MENU option link

Posted: 11 Aug 2011, 22:56
by Kirill
My plugins move to mantis-plugins group. New link
https://github.com/mantisbt-plugins/sea ... Search.php
Look source code of mantisbt https://github.com/mantisbt and plugins in https://github.com/mantisbt-plugins.

Re: add a new MENU option link

Posted: 17 Aug 2011, 13:25
by jpmoraez
Thanks,

But what exactaly have to be done on adding a new Main Item Link ?
I´ve added this line to config_ing.php:
$g_main_menu_custom_options = array( array( "NewMenu", UPDATER, 'NewMenu.php' ));

Im trying to do a new page (NewMenu.php) that list bugs grouping by status.... so each status is a field (column) containing bugs related to the status field.
After adding that line the menu was ok but when Im in NewMenu.php and change current project (combobox) mantis redirects the page to main_view.php while it shoud reload NewMenu.php.... so is there anything else to be done besides adding $g_main_menu_custom_options variable ?

Cheers