Graphical User Interface in XML

The ServiceManager allows to add new graphical user interfaces (GUI) by using PHP and XML.

The focus of this article is the XML part. The PHP part is here.

XML

The structure of a GUI is written in XML. The file name of a XML file has to be the visible service name (file extension .xml). All XML files are located at /var/www/en/sm/services_xml/.

The XML file has to use the gui tag as root. This tag defines which kind of service this XML file contains (normal, generic). It also defines the category of this service. (see ServiceManager for a general description of services)

The following is a minimalistic example for a new graphical user interface. It describes a normal service and the category of this service is showcase.

<?xml version="1.0" encoding="UTF-8"?>
<gui type="service" category="showcase" defaultbuttons="yes">
</gui>

This service can be opened by using the fragment identifier #services_showcase.

Widgets

Below the gui root node are all graphical components defined. These components are also called widgets. The ServiceManager provides several widgets like simple textboxes and tables.

The following XML file displays a textbox in a table.

<?xml version="1.0" encoding="UTF-8"?>
<gui type="service" category="showcase" defaultbuttons="yes">
  <table>
    <row>
      <col><label>Textbox:</label></col>
      <col><textbox id="textbox" /></col>
    </row>
  </table>
</gui>

The textbox has an attribute id which identifies this widget. The id has to be unique in the XML file. The id is required to access the widgets properties using PHP.

To get a list of all attributes, visit the widgets wiki pages.

Links

You could leave a comment if you were logged in.