1. ZenTao API development guides
1.1 Configuration and FAQ
1.2 Examples of the calling SDK
1.3. Department interface
1.3.1 Get the department list
1.3.2 Batch create departments
1.4. User interface
1.4.1 Get patameters of adding users
1.4.2 Add a single user
1.4.3 Get the user list
1.5. Product interface
1.5.1 Get the product list
1.5.2 Optional information for adding a single product
1.5.3 Create a single product
1.6. Project interface
1.6.1 Get the project list
1.6.2 Optional information for adding a single project
1.6.3 Create a single project
1.7. Task interface
1.7.1 Get the task list
1.7.2 Optional information for adding a single task
1.7.3 Create a single task
1.7.4 Optional information for finishing a single task
1.7.5 Finish a single task
1.8. Bug interface
1.8.1 Get the bug list
1.8.2 Optional information for reporting a single bug
1.8.3 Report a single bug
1.8.4 Optional information for resolving a single bug
1.8.5 Resolve a single bug
2. ZenTao API documents (V1.0)
2.1. Token
2.1.1 Get Token
2.2. Department
2.2.1 Get the department list
2.2.2 Get department details
2.3. User
2.3.1 Access to my profile
2.3.2 Get the user list
2.3.3 Get user information
2.3.4 Edit user information
2.3.5 Delete users
2.3.6 Create users
2.4. Program
2.4.1 Get the program list
2.4.2 Edit programs
2.4.3 Access to program details
2.4.4 Delete programs
2.4.5 Create programs
2.5. Product
2.5.1 Get the product list
2.5.2 Create products
2.5.3 Get product details
2.5.4 Edit products
2.5.5 Delete products
2.6. Product plan
2.6.1 Get the list of product plans
2.6.2 Create plans
2.6.3 Get plan details
2.6.4 Edit plans
2.6.5 Delete plans
2.6.6 Link the stories to the product plan
2.6.7 Cancel the link between the product plans and stories
2.6.8 Link the bugs to the product plan
2.6.9 Cancel the link between the product plan and bugs
2.7. Release
2.7.1 Get the release list of product
2.7.2 Get the release list of project
2.8. Story
2.8.1 Get the story list of product
2.8.2 Get the story list of project
2.8.3 Get the story list of execution
2.8.4 Create story
2.8.5 Get story details
2.8.6 Change a story
2.8.7 Change some other fileds of story
2.8.8 Delete a story
2.9. Project
2.9.1 Get project list
2.9.2 Create a project
2.9.3 Get project details
2.9.4 Modify a project
2.9.5 Delete a project
2.10. Build
2.10.1 Get the build list of project
2.10.2 Get the build list of execution
2.10.3 Create a build
2.10.4 Get build details
2.10.5 Modify a build
2.10.6 Delete a build
2.11. Execution
2.11.1 Get the execution list of project
2.11.2 Create execution
2.11.3 Check the details of execution
2.11.4 Modify execution
2.11.5 Delete execution
2.12. Task
2.12.1 Get the task list of execution
2.12.2 Create task
2.12.3 Get task details
2.12.4 Modify task
2.12.5 Delete task
2.12.6 Start task
2.12.7 Suspend task
2.12.8 Continue task
2.12.9 Finish task
2.13. Bug
2.13.1 Get the bug list of product
2.13.2 Create bug
2.13.3 Get bug details
2.13.4 Modify bug
2.13.5 Delete bug
2.14. Use case
2.14.1 Get use case list of product
2.14.2 Create use case
2.14.3 Get use case details
2.14.4 Modify test case
2.14.5 Delete test case
2.14.6 Run test case
2.15. Test request
2.15.1 Get test request list
2.15.2 Get the test request of project
2.15.3 Get the details of test reuqest
2.16. Feedback
2.16.1 Create feedback
2.16.2 Assign feedback
2.16.3 Close feedback
2.16.4 Delete feedback
2.16.5 Modify feedback
2.16.6 Get feedback details
2.16.7 Get feedback list
2.17. Ticket
2.17.1 Get the ticket list
2.17.2 Get the ticket details
2.17.3 Modify a ticket
2.17.4 Create a ticket
2.17.5 Delete a ticket
3. Customized development
3.1 Secondary development mechanism
3.2 The directory structure of ZenTao
3.3 Find your target file to be modified
3.4 The database structure of ZenTao
3.5 Public module - common
3.6 How to register on menu
3.7 How to register on permission
3.8 Example: how to modify the prompt
3.9 Example: priority field setting when creating bugs
3.10 The online extension editor
3.11 Secondary development editor and translation function restrictions instructions
3.12 ZenTao project management software packaging specification (V1.1)

How to register on menu

2023-01-04 16:21:39
Last edited by Hongyan on 2023-01-04 16:44:00
Share links

One of the problems we encountered in extending ZenTao was how to register the features we added to the menu, and this article is about how to implement this feature.

1. Composition of the menu

There are 3 parts in ZenTao navigation menus: top menu, module menu, and the function menu.

2. The definition of menu

The code definition of the menu is in the language file zentao/module/common/lang/zh-cn. Now let's check the definition of the main menu.

2.1 The definition of the main navigation menu

80 $lang->menu->my = ' dashboard|my|index';

81 $lang->menu->product = 'product view|product|index';

82 $lang->menu->project = 'project view|project|index';

83 $lang->menu->qa = 'QA view|qa|index';

Let's check the meaning of the code: 83 $lang->menu->qa = 'QA view|qa|index';

This line of code defines the code of the test view, where menu->qa defines the keys of the menu, which can be defined according to the actual module. The following are three parameters separated by vertical lines, which are the text of the menu, corresponding to the module and method. This statement means that you want to define a top-level menu with the text "test view", linked to the index method of the qa module.

2.2 The definition of the module menu

Let's take the module menu of the product view as an example.

144 $lang->product->menu->list = '%s';

145 $lang->product->menu->story = array('link' => 'story|product|browse|productID=%s', 'subModule' => 'story');

155 $lang->product->menu->create = array('link' => ' new added product|product|create', 'float' => 'right');

158 $lang->productplan->menu = $lang->product->menu;

159 $lang->release->menu = $lang->product->menu;

These lines of code define the module menu for the Product View module, which appears to define a number of new methods.

2.2.1 Defining links by arrays

145 $lang->product->menu->story = array('link' => 'story|product|browse|productID=%s', 'subModule' => 'story');

This line of code defines the link by an array, which defining 2 elements: link and subModule. There is one more parameter filed in "link": productID=%s, which means that the "story" menu of the product view will be linked to the browse method of the product module, and the passed parameter is productID=%s, where the %s will be replaced by the current product id.

2.2.2 Defining sub-modules by subModule

145 $lang->product->menu->story = array('link' => 'strory|product|browse|productID=%s', 'subModule' => 'story');

The subModule defines its sub-modules, which is needed to keep the menu highlighted. This way, when the story module is accessed, the "product view" definition menu will remain highlighted.

2.2.3 Defining method aliases by alias

151 $lang->product->menu->view = array('link' => 'overview|product|view|productID=%s', 'alias' => 'edit');

The alias here means that the edit page of the product and the view page of the product are the same, so that the "overview" menu will remain highlighted when the product is edited.

2.2.4 Defining the location of the menu

All menus are displayed on the left side by default, if you need to display the menu on the right side, you need to define its float parameter.

155 $lang->product->menu->create = array('link' => ' new added product|product|create', 'float' => 'right');

By setting the float parameter, you can define this new product link to be displayed on the right side of the page.

2.3 The definition of the function menu

The function menu is printed inside the view file of each module and is expanded in the same way as the view is expanded, which will be covered later.

3. The definition of the menu sequence

The previous section describes the definition of the ZenTao menu, and the following section defines the menu sequence. Under common/lang/ there is a menuOrder.php file, in which the display order of each menu is defined.

/* Sort of main menu. */
$lang->menuOrder[5] = 'my';
$lang->menuOrder[10] = 'product';
$lang->menuOrder[15] = 'project';
$lang->menuOrder[20] = 'qa';
$lang->menuOrder[25] = 'doc';
$lang->menuOrder[30] = 'report';
$lang->menuOrder[35] = 'company';
$lang->menuOrder[40] = 'admin';
/* index menu order. */
$lang->index->menuOrder[5] = 'product';
$lang->index->menuOrder[10] = 'project';

4. How to register your page to the menu

Once you understand the menu mechanism of ZenTao, it's very easy to make extensions. Let's check the procedures.

  1. Create a file under module/common/ext/lang/zh-cn/, for example it is called abc.php (the name of the file can be defined arbitrarily)

  2. Just add your own menu to this file, such as the repository menu in ZenTao Pro:

    $lang->menu->repo = 'repository|repo|browse';

    $lang->menuOrder[21] = 'repo';

    $lang->repo->menu->list = '%s' . $lang->arrow;

    $lang->repo->menu->browse = array('link' =>'browse|repo|browse|repoID=%s', 'alias' => 'diff, log, view, revision, showsynccomment');

    $lang->repo->menu->settings = 'settings|repo|settings|repoID=%s';

    $lang->repo->menu->delete = array('link' => 'delete|repo|delete|repoID=%s', 'target' => 'hiddenwin');

    $lang->repo->menu->create = array('link' => 'new added repository|repo|create|', 'float' => 'right');

5. How to add external links to the menu

For example, we want to hang a Sina URL in the top menu of ZenTao, and we want to open this URL in a new window.

  1. Create a new file footer.sina.html.hook.php under module/common/ext/view
  2. After adding the following and saving it, you can open ZenTao to see the new link appear in the top menu, and it opens in a new window.
        $("#navbar ul.nav").append('<li><a id="menusina" href="http://www.sina.com.cn"  target="_blank">Sina</ a><\/li>');
Write a Comment
Comment will be posted after it is reviewed.