Friday, April 17, 2009

Customizing Tabs

One of the questions I've heard multiple times is "how can I change the tabs and the urls they point to in Epiware?".

Actually, it isn't that hard; it just takes a little SQL. The tabs across the top of Epiware are generated from entries in the following DB tables: sys_menus, sys_modules, and group_modules.

sys_menus: contains a list of menus. All you need to know is menu_id = 0 (as in zero). Don't worry too much about this table as it is mostly a remnant of older code where we were building custom menus for different Epiware enabled applications.

sys_modules: contains a list of modules, where module is just a loose term we've taken to using for the different parts of Epiware. In this table, you can define the default tabs for Epiware. The fields of this table are as follows:
  • menu_id : set to 0
  • module_id: unique identifier for menu
  • module_name: this is the label for the tab
  • module_file_name: this is the url for the tab. The defaults are relative urls, but full urls and javascript are possible (example: javascript:myFunc())
  • module_order: the order, left to right, in which the tab should appear with 1 coming before 2, etc, etc
  • config_path: not currently used. This field was put in place to store a url pointing to an administrative configuration script for the module. It was never implemented.
  • status: the current visibility status of the tab; 0 = hidden, 1 = visible
  • is_flipped: deprecated. This field used to indicate if the table was flipped to the bottom side of the tab row. Epiware used to have sub-menus that appeared below the main set of tabs. We lost them as there were just too many tabs.

group_modules: contains lists of the modules (tabs) for each web-group. So the tab order and status can be set specifically for a particular web-group. Fields:

  • group_id: unique identifier for web-group (check groups table for the group_ids)
  • menu_id: 0
  • module_id: unique identifier for the module
  • mod_order: same as module_order from sys_modules but specific to the web-group
  • summary_order: deprecated (I think); This used to control the order on the My Desktop screen back when there was just one column of lists.
  • summary_length: deprecated; This used to control how many items were listed in each summary.
  • status: same as in sys_modules: 0=hidden or off; 1 = visible or on

Some things to know that might be helpful:

  • The menu is drawn in the function display_nav_menu which can be found in the file: epi_nav_menu.php
  • There is a hardcoded limit of 7 tabs in that function

Okay... that is the structure. Now, a couple of sample SQL statements. Be sure to check your db tables to make sure your module_id values match the examples.

To change the url on the About Us tab:
update sys_modules set module_file_name = 'my_url' where module_id = 2;

To remove the About Us from all web_groups:
delete from sys_modules where module_id=2
delete from group_modules where module_id=2

The defaults are loaded whenever a new web-group is created in Epiware. If memory serves, I believe if one were to wipe out all the records in sys_modules, the defaults would be reloaded automatically as would the records for a particular web_group in the group_modules table.

No comments:

Post a Comment