Page tree

Versions Compared

Key

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

PUIATEXMNU - This program returns the valid Menu Items for a specified user and Menu Group (a.k.a. [ Menu Item ] Parent).

Build the Atrium Menu

Code Block
D PUIATEXMNU      PR                  ExtPgm('PUIATEXMNU')
D  iUser                       128A   Const
D  iType                         1A   Const     N=NavMenu T=Toolbar H=homepages
D  iParent                     128A   Const
D  ioItem                             LikeDS(Item)
D  oError                         N
D  oErrorMsg                   256A

This program returns the valid menu items for a given user and tree parent. If the parent is blank, the root level menu items will be returned.

The menu items Menu Items are returned by the PUIATEXMNU exit program one at a time by one in the ioItem Item data structure.

Code Block
D Item            DS                  Qualified
D  Code                        128A
D  Parent                      128A             blank = root
D  Type                          1A             0=NONLEAF 1 = LEAF
0 = NONLEAF
D  ActionType                    1A             20=richURL dsply1=Macro 02=urlRDFApp 3=PCCmd
D  Action                      512A             libLIB/pgmPGM or urlURL
D  Text                        128A
D  Icon                        128A
D  OpenInWindow                  1A
D  OpenOnceOnly                  1A 
D  Parm						   256A


Code

Each menu item must have a unique code

Parent

The code of the parent menu item (blank if at the root level)

Type

1=Leaf Node (will run a program), 0=NonLeaf Node (submenu)

ActionType

2 = rich display file, 0 = regular URL

Action

The Program to run (if a leaf node)

Text

The text displayed in the menu

Icon

the path of the image icon for the menu item.  If blank, the default icon is used

OpenInWindow

set to 1 if the program should open in a new window, else 0

OpenOnceOnly

set to 1 if the menu item can be opened once only, else 0

Parm

Add/Pass a parameter
SubfieldSubfield Values ExplanationPurpose

Code

  • Packed Decimal of length 9 and no decimals.
    [ 0 - 999999999 ]
Used as a unique reference value for Menu Items and Menu Groups, must be unique.

Parent

  • Packed Decimal of length 9 and no decimals.
    [ 0 - 999999999 ]
  • *BLANKS for root level Menu Items.
If not at root level, value is Code for Menu Group the Menu Item is directly under. If the Parent value is *BLANKS, the root level Menu Items will be returned.

Type

  • 0 = Non-Leaf Node - Menu Group item to display/hide child node(s), if any, when clicked.
  • 1 = Leaf Node - Menu Item to execute Action as ActionType when clicked.
Specifies Node as being a Menu Item or Menu Group.

ActionType

  • 0 = Regular URL
  • 1 = Genie Macro
  • 2 = Rich Display File Application
  • 3 = PC Command 1
Determines how Action value is to be executed.

Action

  • Character String of length 512 characters.
[ If Leaf Node, ] Execute Action value as ActionType.

Text

  • Character String of length 128 characters.
Name of Menu Item.

Icon

  • Character String of length 128 characters.
  • *BLANKS for default menu icon.
Path of the image to be used as the menu icon for the Menu Item

OpenInWindow

  • 0 = Open in Atrium Tab.
  • 1 = Open in New Browser Window or Tab. 2
Determines whether the Action should be executed in a new Atrium Tab or in a New Browser Window or Tab.

OpenOnceOnly

  • 0 = Number of Menu Item Atrium instances is not limited to 1.
  • 1 = Menu Item may only open one Atrium Tab.3
Determines the number of times a Menu Item can be opened in Atrium Tabs.

Parm

  • Character String of length 256 characters.
Parameter to be added to the URL or passed to the Application.

1 Requires PC Command Listener, Launcher or Applet.

2 Which one the browser opens the Action in can be affected by user's browser settings. 

3 If Menu Item is being opened in a New Browser Window or Tab, this value will not be able to limit the number of instances.

Program Operation

Because there can be an unknown number of menu items Menu Items to return, when Atrium calls this exit program, just one menu item Menu Item (in the item Item data structure) is returned. Atrium repeatedly calls the program until there are no more menu items  Menu Items to return, in which case PUIATEXMNU returns the item Item data structure empty.

PUIATEXMNU runs in stateless environment and has no way to determine how many menu items it has returned or which one to send next.   To resolve handle this, Atrium keeps track of this. Atrium will clear the item Item data structure before the first call to indicate that is wants the first menu item Menu Item of parent Item.Parent  On . On subsequent calls Atrium does not alter the Item data structure previously returned (on the second call the , first menu item Menu Item is still in the Item data structure). This allows PUIATEXMNU to determine which menu item Menu Item to return next. After the last menu item Menu Item has been returned, Atrium will call PUIATEXMNU again, the item data structure will be returned cleared to indicate that there are no more menu items Menu Items.

Atrium Calls PUIATEXMNU

PUIATEXMNU responds

Item data

structure 

structure is cleared.

Returns the first

menu item

Menu Item in the item data

structure 

structure.

Item data structure contains the first

menu item

Menu Item.

Sets

the

file pointer and returns the second

menu item

Menu Item.

Item data structure contains the second

menu item

Menu Item.

Sets

the

file pointer and returns the third

menu item

Menu Item.

Item data structure

contains  menu item n

contains thenth Menu Item.

Sets

the

file pointer and returns

menu item

Menu Item n+1.

Item data structure contains second to last

menu item

Menu Item.

Sets

the

file pointer and returns the last

menu item

Menu Item.

Item data structure contains

 last menu item

 last Menu Item.

Sets

the

file pointer

and

, determines

it is

pointer at EOF

so it clears the item

, and returns cleared Item data structure

before it is returned

.