This is an old revision of the document!


Create Custom Web Interface Tabs

Since version 1.7.16 of the AstLinux Web Interface there is a method to create Custom Tabs that show up in the standard AstLinux Web Interface:

To add a new tab, for example “Wakeup” at “/admin/wakeup.php”, manually edit the “/mnt/kd/webgui-prefs.txt” preferences file and add the line:

custom_tab_list_cmdstr = "/admin/wakeup.php,Wakeup"

Multiple tab specifications are separated by a ~ (tilde) on the same line, eg:

custom_tab_list_cmdstr = "/admin/wakeup.php,Wakeup~/admin/configure.php,Configure"

Optionally, a third comma separated parameter can be “staff” or “admin” indicating the scope of when the tab should be displayed. By default the scope is “all”. For example if the “Wakeup” custom tab was to only be displayed for staff or admin access rights:

custom_tab_list_cmdstr = "/admin/wakeup.php,Wakeup,staff"

Same example, but display for admin access rights only:

custom_tab_list_cmdstr = "/admin/wakeup.php,Wakeup,admin"

Example PHP Code Template:

A typical custom tab edits fields and reads/writes the data to a text file or Asterisk astDB database. A basic starting template.php can be found here:

http://lonnie.abelbeck.com/astlinux/template.tar.gz

Additionally, if your custom tab mirrors the structure of an existing tab, that would be a good starting point as well. The template.php code is useful in understandng the basic structure and integration into the web interface.

PHP tips:

Use “XHTML 1.0 Transitional” in your HTML coding. Be sure to use http://validator.w3.org/ to validate your XHTML code. In your web browser select “View Source” and save to a file. Then click “Validate by File Upload” at http://validator.w3.org/ to validate your PHP generated XHTML code.

Use multiple browsers, on different platforms, to test the layout of your custom tab.