Menu¶
Menu element¶
The menu of the Scolvo client is described by the menu keyword, what is mandatory for each client device type script: each one must have exactly one menu defined. It is mandatory to define the default menu item globally using the defaultItem keyword.
Syntax of the menu element¶
menu defaultItem <name-of-the-default-item> {<item-list>}
where:
The <item-list-definition> consists of items, group definitions and default items definition.
The usage of the defaultItem keyword is mandatory, the given <name-of-the-default-item> must be one of the defined menu items or groups.
Every menu item or group can have roles definition what is used to filer menu items and groups according to the roles of the actual user.
When a client session is started, then the default or the first available menu item is selected by the system, and the corresponding menu event is executed.
Events of the menu¶
When a menu item is selected, then the function with name on<menu-item-name>(originId) is executed.
1menu defaultItem Item1 {
2 item Item1
3}
4
5function onItem1(originId) {
6 // some logic
7}
Dictionary keys of the menu¶
Every client application instance uses a dictionary to resolve values when building UIs. The UI values of the menu are also defined in the dictionary. The corresponding keys have the form of ‘menu_<menu-item-name>_label’ (the pattern is similar for menu items in group: menu_<group-name>_<menu-item-name>_label).
1menu_Item1_label=This is the UI value of the Item1 menu
Items of the menu¶
A menu definition contains a list of menu items. These can be simple menu items, item groups, and default item definition section for user roles.
Syntax of the <item-list>¶
((<menu-item>|<menu-group>|<default-items>)[,])+
where:
At least one of the possible types must be defined.
If more than one item is defined, then the definitions can be seprarated by ‘,’
Menu item¶
The item definition represents a selectable menu item. It has name, and it can be defined for which roles it is available. If the active user does not have the one of the defined roles, then the menu item is not visible.
Syntax of the <menu-item>¶
item <item-name> [{<roles-definition>}]
where:
The <item-name> is the name of the menu item in form of string.
The <roles-definition> is optional.
Syntax of the <roles-definition>¶
roles: <role-list>
where:
The <role-list> is a list of names with double quotes in form of list of strings ([“role-name1”, “role-name2”].
Menu group¶
A menu group can be used to form groups of menu items and other menu groups.
Note
Only first level group is supported by the Scolvo clients, a group cannot contain another group.
Syntax of the <menu-group>¶
group defaultItem <name-of-the-default-item> {<group-item-list>}
where:
The defaultItem is mandatory, the <name-of-the-default-item> must be one of the defined menu items.
The <group-item-list> consists of role definition and item definitions.
Syntax of the <group-item-list>¶
((<roles-definition>|<menu-item>)[,])+
where:
At least one of <menu-item> must be defined.
If more than one defined, then the definitions are optionally seprarated by ‘,’.
The <roles-definition> syntax is described above in item definition.
The defaultItems of a menu¶
Sometimes the globally defined defaultItem is not enough to define default menu items for different user roles. For this scenario the defaultItems keyword can be used where different user roles and corresponding default menu items can be defined.
Syntax of the <default-items>¶
defaultItems: {<default-item-list>}
where:
The <default-item-list> is mandatory.
Syntax of the <default-item-list>¶
(<role-name>: <default-menu-item-name>[,])+
where:
The <role-name> is given in form of quoted string.
The <default-menu-item-name> is given in form of string with-or-without double quotes.
Complex menu example¶
In this setion a complex menu definition is given, where all above described details are used.
1menu defaultItem Item1 {
2 item Item1 {
3 roles: "role1"
4 },
5 item Item2 {
6 roles: ["role2"]
7 },
8 item Item3 {
9 roles: ["role1", "role2"],
10 },
11 item Item4 {
12 roles: ["role1"]
13 },
14 group Group1 defaultItem GroupItem1 {
15 roles: ["role1", "role2"],
16 item GroupItem1 {
17 roles: ["role1"],
18 },
19 item GroupItem2 {
20 roles: ["role2"],
21 }
22 },
23 defaultItems: {
24 "role1": Item1,
25 "role2": Item2
26 }
27}
1menu_Item1_label=Item1
2menu_Item2_label=Item2
3menu_Item3_label=Item3
4menu_Item4_label=Item4
5menu_Group1_label=Group1
6menu_Group1_GroupItem1_label=GroupItem1
7menu_Group1_GroupItem2_label=GroupItem2