siremis:install53x:new-views

Siremis v5.3.x - Adding New DB Table Views

Siremis offers a flexible way of managing the records inside database tables used by Kamailio. Most of them are covered by existing Siremis distribution, still there are some missing (expected to be added in the next releases), but also it many cases you may have custom tables used by Kamailio (via sqlops module for example).

Starting with this version, Siremis comes with several PHP tools that allows you to generate views for tables in Kamailio database in no time.

Preparing The Tools

First you have to install Siremis so that Kamailio's database connection attributes are set. Then, in the top directory of Siremis (i.e., /var/www/siremis-x.y.z) do:

make toolsx

To run the db table view generation tool, you have to install command line php - php5-cli or php7.0-cli. On Debian/Ubuntu:

apt-get install php-cli
# or
apt-get install php5-cli
# or
apt-get install php7.0-cli

Generating New Table View

From Siremis' top directory, go to siremis/bin/toolx.

You have to execute gen_meta.php, giving as parameter the database connection ID (for Kamailio database this is Serdb), name of the table and the Siremis submodule ID.

Next command shows how the view for mtree table was generated.

cd siremis/bin/toolx
php gen_meta.php Sipdb mtree sipadmin.rtg.mtree

In this example, Siremis submodule ID is sipadmin.srv.mtree, meaning:

  • it is part of Siremis module sipadmin (where all components related to Kamailio are located)
  • generated forms should be inside directory siremis/modules/sipadmin/srv/mtree/
    • practically, if you replace dot (.) with forward slash, Siremis submodule ID matches the path inside directory siremis/modules

If you look inside siremis/modules/sipadmin/srv/mtree/, there are two subdirectories:

  • do - data object specifications
  • form - web forms specifications - adding new, editing, copying, viewing or seaching mtree records

Another file that was generated is the Siremis Web View for mtree management. It is located at:

siremis/modules/sipadmin/view/MtreeListView.xml

It includes the references to the Form objects used for this view.

Inserting New View In Menu

All that is needed to manage the records in mtree table was generated in previous step, Missing part is linking it from Siremis menu in order to access the operations to manage mtree table.

The menu of Siremis module sipadmin is located at:

siremis/modules/sipadmin/mod.xml

Edit it and add a new entry in the XML tree. For mtree, we added it to Server Services:

...
    <Menu>
        <MenuItem Name="System.Sipadmin" Title="SIPAdmin Menu" Description="SIP Admin Management" URL="/sipadmin/sipadmin_default" IconImage="spacer.gif" IconCssClass="" Order="25">
...
              <MenuItem Name="System.Sipadmin.Srv" Title="Server Services" Parent="System.Sipadmin" Order="20">
...
                    <MenuItem Name="System.Sipadmin.Srv.Mtree.List" Title="Mtree List" Description=""
					URL="{@home:url}/sipadmin/mtree_list" Order="90"/>
...

The mtree entry is the last MenuItem node in the above snippet. The main attributes for it are:

  • name - it has to be an unique identifier in the menu
  • title - it is the text that appears in the menu
  • url - it is the web URL of the view for mtree management
    • {@home:url} - this is an internal variable pointing to the HTTP URL of current Siremis instance
    • sipadmin is the name of the Siremis module which includes the view
    • mtree_list - is built from the name of the view file (in this case MtreeListView.xml), by starting with lower case, before any upper case letter put an underscore (_), the suffix View and the extension .xml are ignored
  • order - set the order in the menu

Removing The Tools

The tools files are available via web browser. Although they require command line interaction, their security exposure was not analyzed, so as soon as you finish using them, just remove them. In the top directory of Siremis run:

make cleantoolsx

More Docs

Siremis is built on top of phpopenbiz and cubi frameworks, you can read more documentation about how to extend it at:

Many tutorials are available in project's wiki pages:


100%


Copyright 2010-2020 Asipto.com