MenuConfig Element

Top  Previous  Next

MenuConfig element defines how the Javascript steer file is generated. The element must be placed into the Common Definitions page and its properties must be specified.

CompProps

Security Domain Name

If the menu options need to be populated according to the authorities of the current user, a Security component (e.g. mor.Security) should be configured in the project and its security domain name should be given to this property.

Note: This value is usually given as "main".

Connection Name

Menu service retrieves the menu options from a relational database. A JDBC connection must be configured with "mor > RelDBConnection" element and its name must be given to this property.
 

Menu Query (SQL)

The SQL statement that will provide the options of the menu.
 
Example Query:

select
  H as H,  -- Menu Hierarchy
  CAPTION as CAPTION, -- Menu Caption
  HREF as HREF, -- Menu Hyperlink Value
  CPNAME as CPNAME -- The name of the Checkpoint (Optional)
from
  menu
order by
  H -- To sort the menu options in the ascending order according to hierarchy

Menu service expects that the following columns exist in the result set:

H : Menu Hierarcy. The value of this mandatory column should contain 2-byte digits (between 01 and 99) for each level.

Sample hierarchy values:

Hierarchy  Value

Description

01

The first option in the first level

01.02

The second option of the first level 1 option.

01.03.01

The first option of the third level 2 option of the first level 1 option.

The result set must be sorted according to this column.

CPNAME : The name of a security checkpoint. It is not mandatory. If the menu options are generated according to the authorities of the current user then the value of this column should be either blank or the name of the one of the checkpoints existing in the security system.

HREF : The hyperlink for the menu option. The menu service takes no responsibility on how the value of this column is used. However if the value ends with "rand=" definition, the service appends "getRand()" javascript function to the value so that each time the menu option is selected the user a new request is sent to the server.

Please not that the query result set may contain more columns and they can be used as symbols in the Menu JScript Parts properties freely.

 
Menu JScript Parts

Menu JScipt Parts are used to define Javascript code snippets to build the menu steer file dynamically by evaluating and resolving the embedded MScript functions and symbols in it.

The Menu service class provides the following MScript symbols to assist the menu generation:

MScript Symbol

Explanation

menuLevel

The level of the menu option as number

firstInLevel

Contains true if the menu option is the first option in its level, false otherwise.

menuDisabled

Contains true, if the user has no authority on the checkpoint defined with CPNAME column and if the value of the "Show Unauthorized Menus as Disabled" property is true, false otherwise.

hasChildren

Contains true if the menu option contains sub options, false otherwise.

H

Contains the value of the H column

CPNAME

Contains the value of the CPNAME column

The other columns that exist in the result set

All the columns that exist in the result set can be used as a MScript symbol.

 

Top

The part to place at the top of the menu steer Javascript file.

Menu Section Begin

The part to place before the each menu option.

Menu Item

The part the defines the each menu option.

Menu Section End

The part to place after the each menu option.

Bottom

The part to place at the bottom of the menu steer Javascript file.

Generate By

This property defines the method for the building menu tree. If option "1. H Column" is selected then the menu is built according to the H column in the result set as explained above.

If option "2. ID and PARENTD_ID Columns" is selected, then the result set must contain ID and PARENT_ID columns. The PARENT_ID column should contain the id of the parent option's record number. If the value of PARENT_ID column is -1 for an option then that option is top level.

A query example according to ID and PARENT_ID columns:

select
  ID as ID,  -- Menu option id
  PARENT_ID as PARENT_ID, -- The id of the parent menu option
  CAPTION as CAPTION, -- Menu caption
  HREF as HREF, -- Menu hyperlink
  CPNAME as CPNAME -- The name of the Checkpoint (Optional)
from
  menu
order by
  CAPTION 

 

Show Unauthorized Menus as Disabled

If the value of this property is left as false then the menu options that the current user has not authority on it is not included in th menu. If it is desirable that option is visible on the menu but disabled for the use then set this property should be set to true.