siremis:install40x:new-views

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

siremis:install40x:new-views [2013/05/08 22:02] (current)
Line 1: Line 1:
 +====== Siremis v4.0.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:
 +
 +<​code>​
 +make toolsx
 +</​code>​
 +
 +To run the db table view generation tool, you have to install command line php - php5-cli. On Debian/​Ubuntu:​
 +
 +<​code>​
 +apt-get install php5-cli
 +</​code>​
 +
 +===== 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.
 +
 +<​code>​
 +php gen_meta.php Serdb mtree ser.rtg.mtree
 +</​code>​
 +
 +In this example, Siremis submodule ID is **ser.srv.mtree**,​ meaning:
 +
 +  * it is part of Siremis module **ser** (where all components related to Kamailio are located)
 +  * generated forms should be inside directory **siremis/​modules/​ser/​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/​ser/​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:
 +
 +<​code>​
 +siremis/​modules/​ser/​view/​MtreeListView.xml
 +</​code>​
 +
 +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 **ser** is located at:
 +
 +<​code>​
 +siremis/​modules/​ser/​mod.xml
 +</​code>​
 +
 +Edit it and add a new entry in the XML tree. For **mtree**, we added it to **Server Services**:
 +
 +<code xml>
 +...
 +    <​Menu>​
 +        <​MenuItem Name="​System.Ser"​ Title="​SER Menu" Description="​SER Management"​ URL="/​ser/​ser_default"​ IconImage="​spacer.gif"​ IconCssClass=""​ Order="​25">​
 +...
 +              <​MenuItem Name="​System.Ser.Srv"​ Title="​Server Services"​ Parent="​System.Ser"​ Order="​20">​
 +...
 +                    <​MenuItem Name="​System.Ser.Srv.Mtree.List"​ Title="​Mtree List" Description=""​
 + URL="​{@home:​url}/​ser/​mtree_list"​ Order="​90"/>​
 +...
 +</​code>​
 +
 +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
 +    * **ser** 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
 +
 +===== 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:
 +
 +<​code>​
 +make cleantoolsx
 +</​code>​
 +
 +===== More Docs =====
 +
 +Siremis is built on top of **phpopenbiz** and **cubi** frameworks, you can read more documentation about how to extend it at:
 +
 +  * http://​code.google.com/​p/​openbiz-cubi/​
 +
 +Many tutorials are available in project'​s wiki pages:
 +
 +  * http://​code.google.com/​p/​openbiz-cubi/​w/​list
  


Copyright 2010-2019 Asipto.com