add a new MENU option link

Post about your customizations to share with others.

Moderators: Developer, Contributor

tetsunami
Posts: 26
Joined: 21 Apr 2010, 14:45

add a new MENU option link

Post 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!! :)
tetsunami
Posts: 26
Joined: 21 Apr 2010, 14:45

Re: add a new MENU option link

Post by tetsunami »

someone can help me plz? im still loking for that i thought it was on the configuration menu , like a complex type? :?:
Kirill
Posts: 638
Joined: 25 Nov 2007, 08:05
Location: Kaliningrad, RF
Contact:

Re: add a new MENU option link

Post 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,
MCKiller
Posts: 5
Joined: 28 Jul 2010, 13:08
Location: Germany
Contact:

Re: add a new MENU option link

Post 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
_____________________________
Member of
Maniac Mansion 3d
http://www.vampyregames.de
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: add a new MENU option link

Post by atrol »

Add the following code to your function links

Code: Select all

if ( access_has_global_level ( MANAGER ) ) {
# print your links
}
Please use Search before posting and read the Manual
MCKiller
Posts: 5
Joined: 28 Jul 2010, 13:08
Location: Germany
Contact:

Re: add a new MENU option link

Post 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..
_____________________________
Member of
Maniac Mansion 3d
http://www.vampyregames.de
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: add a new MENU option link

Post 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)
Please use Search before posting and read the Manual
tetsunami
Posts: 26
Joined: 21 Apr 2010, 14:45

Re: add a new MENU option link

Post 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 :)
Kirill
Posts: 638
Joined: 25 Nov 2007, 08:05
Location: Kaliningrad, RF
Contact:

Re: add a new MENU option link

Post by Kirill »

For what you did pkg file? MantisBT not support pkg-plugins.
tetsunami
Posts: 26
Joined: 21 Apr 2010, 14:45

Re: add a new MENU option link

Post 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
atrol
Site Admin
Posts: 8366
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: add a new MENU option link

Post 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
Please use Search before posting and read the Manual
tetsunami
Posts: 26
Joined: 21 Apr 2010, 14:45

Re: add a new MENU option link

Post by tetsunami »

Youre right my bad :(
jpmoraez
Posts: 6
Joined: 11 Aug 2011, 12:17

Re: add a new MENU option link

Post 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
Kirill
Posts: 638
Joined: 25 Nov 2007, 08:05
Location: Kaliningrad, RF
Contact:

Re: add a new MENU option link

Post 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.
jpmoraez
Posts: 6
Joined: 11 Aug 2011, 12:17

Re: add a new MENU option link

Post 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
Post Reply