Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
%hash = (
  SampleTable => [
    { Email => { header => 'Table Name', display => 'key,header,text', value => [""] }},
    { Name => { header => 'Display Name', display => 'header,text', value => [""] }},
    { Age => { header => 'Description', display => 'header,text', value => [""] }},
    { Married => { header => 'Married', display => 'popup',value => ["true", "false"] }}, 
  ]
);
SampleTable => [
Is the name of the table, this should match the name, e.g. Table-SampleTable.nmis
  Email => { 
    header => 'Email Address', 
    display => 'key,header,text', 
    value => [""] 
  }
},

Each Column in the table is defined with an entry like this. In this case the column is called Email

To define each column necessary fields are:

    • header - is the what will be displayed when the table is viewed, this includes the work key if it is to be included as the primary key
    • display - header indicates if it should be in the header or not, and text indicates what sort of input box to use.
    • value - what is the default value or select list.

 

  Married => { 
    header => 'Married', 
    display => 'popup',
    value => ["true", "false"] 
  }
}, 
This field would not be displayed in the main view and would contain a select list to select true or false from.

Adding a New Table to NMIS

The following steps are required to add a new table:

  1. Create a table configuration
  2. Add the table to Tables.nmis
  3. Create permissions in Access.nmis
  4. Link to any other data

Create a Table Configuration

Create a file in /usr/local/nmis8/conf/, in our case /usr/local/nmis8/conf/Table-SampleTable.nmis, and add the appropriate configuration.

Add the table to Tables.nmis

Using the GUI or from the Unix prompt add the new table to Tables.nmis.

To add using GUI, access the menu item "System -> System Configuration -> Tables", a dialog will appear, and click on "add" next "Action >" in the top right of the widget.

Enter the properties for the table, the Table Name must match the name in the Table Configuration, in our case SampleTable, the "Display Name" is what you want it to appear in the menu, and Description is so you don't forget.

Refresh the NMIS Dashboard and your new table will exist in the menu, but you can't access it yet.

Create permissions in Access.nmis

You need to tell NMIS what Access permissions to add this with, we have created a script to add the tables with the default permissions which is as described in the table below, the command to run to add the permissions is.

Code Block
/usr/local/nmis8/admin/add_table_auth.pl SampleTable

You should get some output like this:

Code Block
Checking NMIS Authorisation for SampleTable
INFO: Authorisation NOT defined for SampleTable RW Access, ADDING IT NOW
INFO: Authorisation NOT defined for SampleTable View Access, ADDING IT NOW

You can add it again if you want, it will not actually add it twice.

The following table is the default permissions your table will be added with, if you want to change them, you can do that through the Access menu item at "System -> System Configuration -> Access".

LevelPrivilegeViewRead/Write
level0administratorYesYes
level1managerYesYes
level2engineerYesYes
level3operatorYesNo
level4guestNoNo
level5anonymousNoNo
level6securityNoNo

View the Table and Add Something

 

The first step to creating a new table is to define the Table Configuration