Extending Admin Web UI Menu

Introduction

As with XX-9311, plugins (that is any jar file placed in sipXconfig classpath - share/java/sipXecs/sipXconfig) can contribute with own menu items and pages to admin interface.

Adding pages

If you want your plugin to add new pages in admin interface you have to:

- add plugin Tapestry page class under org.sipfoundry.sipxconfig.web.plugin package

- add Tapestry page specification, page template and properties files under "plugin" directory inside jar file

E.g. for a page named PluginPageTest.html, the packaged plugin should have the following structure:

--- plugin

---- PluginTestPage.html

---- PluginTestPage.page

---- PluginTestPage.properties

-- org

---- sipfoundry

------ sipxconfig

-------- web

---------- plugin

------------ PluginTestPage.class

Such page can be accessed from a browser as https://localhost:8443/sipxconfig/plugin/PluginTestPage.html

Adding menu items

Plugins can contribute menu items at the top or at the bottom of existing menus (User, Devices, System, Features, System, Diagnostics) or with its own menu. In order to add such menu items a plugin should contain a Tapestry page named PluginMenu (added as explained in section above), with one or more of the following Tapestry Block components:

- topUserMenu / bottomUserMenu for user menu items added by plugin

- topDevicesMenu / bottomDevicesMenu for devices menu items added by plugin

- topFeaturesMenu / bottomFeaturesMenu for features menu items added by plugin

- topSystemMenu / bottomSystemMenu for system menu items added by plugin

- topDiagnosticsMenu / bottomDiagnosticsMenu for diagnostics menu items added by plugin

- pluginMainMenu for new menu added by plugin

As an example, if you want to add a menu item named "Plugin Page" to point to the page created above and placed at the top of User menu, you will need to have the following code inside PluginMenu.html:

<span jwcid="topUserMenu@Block">
  <li><a jwcid="@PageLink" page="plugin/PluginTestPage">Plugin Page</a></li>
</span>

If you want to place this menu item under a new menu (such User menu), PluginMenu.html should contain a Block named pluginMainMenu as in below example:

<span jwcid="pluginMainMenu@Block">
  <li>
    <div class="roundedMainSectionBoxTopLeft"></div><div class="roundedMainSectionBoxTopRight"></div>
    <div class="roundedMainSectionBoxInside">
      <a class="heading"><span key="menu.plugin">Plugin Menu</span></a>
      <ul>
        <li><a jwcid="@PageLink" page="plugin/PluginTestPage">Menu1</a></li>
      </ul>
    </div>
  </li>
</span>

Plugin sample

The attached Eclipse project can be used to build a custom plugin - it contains a plugin page and plugin menu items samples and should be imported in the same workspace with the rest of sipXconfig projects. For deploying the plugin Right Click on project name, choose Export > Java > JAR file and on the Select the export destination specify INSTALL_DIR/share/java/sipXecs/sipXconfig/plugin.jar. Restart sipXconfig process in order to consider the plugin.
PluginProj.zip

For a quick demo you can copy the jar file below and restart sipXconfig:

plugin.jar