[resolved] Add an element to the main menu

LATEST Official version.
Questions and discussions - NO ISSUES
FOR ISSUES => http://mantis.testlink.org

Moderators: Amaradana, TurboPT, TL Developers

Post Reply
Elana08
Advanced user
Posts: 20
Joined: Fri May 21, 2010 2:32 pm

[resolved] Add an element to the main menu

Post by Elana08 »

Hi everybody,

I hope this question was not asked, but I have to add an element on the main menu :

"Project | Test Specification | Test Execution | Test Report | Mylink"

This link will open on another php page. I need your help because I have only severals days to do this and Testlink is very difficult to understand for a novice like me ;)

Do you know were the list of the main menu are put please ?

Thank you,

Elana.
Last edited by Elana08 on Tue Aug 09, 2011 10:11 am, edited 1 time in total.
Elana08
Advanced user
Posts: 20
Joined: Fri May 21, 2010 2:32 pm

Re: Add an element to the main menu

Post by Elana08 »

Hi, I have founded my own solution (not the best but an work :P)

in lib\functions\common.php :

Code: Select all

function initTopMenu(&$db)
{
	$_SESSION['testprojectTopMenu'] = '';
	$guiTopMenu = config_get('guiTopMenu');

	// check if Project is available
	if (isset($_SESSION['testprojectID']) && $_SESSION['testprojectID'] > 0)
	{
		$idx = 1;	
    	foreach ($guiTopMenu as $element)
		{
			// check if Test Plan is available
			// BUGID 3601: check also if req mgmt is enabled
			if ((!isset($element['condition'])) || ($element['condition'] == '') ||
				(($element['condition'] == 'TestPlanAvailable') && 
				  isset($_SESSION['testplanID']) && $_SESSION['testplanID'] > 0) ||
				(($element['condition'] == 'ReqMgmtEnabled') && 
				  isset($_SESSION['testprojectOptions']->requirementsEnabled) && 
				    $_SESSION['testprojectOptions']->requirementsEnabled))
			{
				// (is_null($element['right']) => no right needed => display always
				if (is_null($element['right']) || has_rights($db,$element['right']) == "yes")
				{
					$_SESSION['testprojectTopMenu'] .= "<a href='{$element['url']}' " .
						"target='{$element['target']}' accesskey='{$element['shortcut']}'" .
	     				"tabindex=''" . $idx++ . "''>" . lang_get($element['label'])."</a> | ";
				}
			}
		}
                                  //modifications
		$_SESSION['testprojectTopMenu'] .= "<a href=\"test.php\" target=\"test.php\" accesskey=test tabindex=test >test </a>";	}
}
fman
Member of TestLink Community
Posts: 3123
Joined: Tue Nov 15, 2005 7:19 am

Re: [resolved] Add an element to the main menu

Post by fman »

why do you choose the dirty solution when with a minor effort you can have what you really need ?
Search on files for guiTopMenu and configure there what you need.
Post Reply