Dynamic Menus
Requirements
Extension modules sometimes need to modify the menu structure of core modules. For example, a human resources modules may want to add a new submenu "Employees" in the "Users" main menu to show information about this specific kind of user.
Design
We implement configurable menus similar to views and components by storing all menu information in the database.
CREATE TABLE im_menus (
menu_id integer
constraint im_menu_id_pk
primary key
constraint im_menu_id_fk
references acs_objects,
-- the name that should appear on the tab
package_name varchar(200) not null,
name varchar(200) not null,
url varchar(200) not null,
sort_order integer,
-- parent_id allows for tree view for navbars
parent_menu_id integer
constraint im_parent_menu_id_fk
references im_menus,
-- Make sure there are no two identical
-- menus on the same _level_.
constraint im_menus_name_un
unique(name, parent_menu_id)
);