PROMPTED SCRIPTS

NAME

prompt – prompt definition file

DESCRIPTION

prompt files are text files whose names end with ‘.prm’. These files are used by the program ubprompt to generate prompt screens.

prompt files are divided into sections. Each section commences with a capital letter and is terminated by a line starting with a ‘>’. Some sections have subsections in which case there may be more than one line starting with a ‘>’ before the end of the section.

PROMPT SECTIONS

BACKGROUND

DEFINITION

B
{<top>}
>
{<centre>}
>
{<bottom>}
>

DESCRIPTION

Background Text is divided into 9 regions on the screen. Top, middle, and bottom (separated by ‘>’ lines) and left, centre and right on each line (separated by ‘#’ characters).

PROGRAMMED FUNCTION KEYS

DEFINITION

F {E} {R} <key>{<field>}<label>
{<help>}
>
{<command>}
>

DESCRIPTION

Command script to execute when the function key is pressed or the button on an html form is clicked. The default script language is tcl. This can boverriden by starting the script with #!<interperter>. eg #!/bin/bash

The input fields can be referred to by enclosing the field name in `[` and ‘]’. The value entered in the form will be substituted in the command script.

Optional E indicates all fields on the screen are to be erased after executing the command. The current input field is reset to the first field on the screen.

Optional R indicates that the screen is to be repeated i.e. without R, command is executed and ubprompt exits. With R, command is executed and then returns to prompt screen.

Bind this command to function key <key>. This is not optional. key is in the range 1 to 8.

field is optional. If given the standard output of command is captured and placed in field.

label is the label to display on the function key labels at the bottom of the screen or in the html element with id=”functionKeys” id. Only the first 6 characters are significant for terminal sessions. html forms can have longer labels and the can be enclosed in ” to allow spaces in the label.

EXAMPLE

FR1	[user]	USER
USER NAME
USER NAME

Use F1 to put your login name in the user field
>
#!/bin/bash
who am i | awk '{print $1}'
>

HELP MESSAGES

DEFINITION

H {name)
<help>
>

DESCRIPTION>

Help message for menu. See help (4) for format.

POPUP MENUS

DEFINITION

M {B} {<row> <col>{:<users/groups>{:<menu name>}}}
{<help>}
>
{<heading>}
>
{<option>}
>

DESCRIPTION

Pop-up menu. See menu (4) for format details and the Checkpoint Programmers manual.

DATA ENTRY SCREEN

DEFINITION

P
{<field def>}
...
>
{<input screen>}
>

DESCRIPTION

This consists of two parts (subsections). The first is the input field definition and the second is the form definition.

field def is a list of field definitions using the same format as the dictionary format (see dictionary (4)).

input screen is an input screen in the same format as a master file screen. The fields defined by field def are accessible by enclosing the field name in ‘[‘ and ‘]’.

EXAMPLE

P
#LIST USER PROCESSES
user,	8
#USER'S LOGIN ID
>
#PROCESS LIST FOR USER
-
USER LOGIN ID: [user]
>

FIELD INITIALISATION

DEFINITION

S
<field> <expression>
...
>

DESCRIPTION

Set input field to initial value.If field is blank or zero, copy expression into field. This is used to an initial value.

FORM TITLE

DEFINITION

T{1..6} <title>

DESCRIPTION

Displays a form title.

On terminals this is a highlighted bar on the top of the window.

On Web forms this is a header tag at the start of the form. The option number following the T can be used to specify h1, h2, etc.

VALIDATIONS

DEFINITION

V{1. .8X}
<expression>
<message>
...
>

DESCRIPTION

All the expressions must be true before the execute script will be run. If an expression fails, message is displayed and the user is returned to the screen to correct their mistake.

WARNINGS

DEFINITION

W{1. .8X}
<expression>
<message>
...
>

DESCRIPTION

All the expressions are expected to be true. If one fails, then message is displayed and the user can accept or reject the warning by selecting the “OK” or “NOT OK” function keys.

INPUT DEFINITIONS

This subsection defines all the fields and help messages to be collected on the screen.

FIELD DEFINITIONS

Each field definition is a single line of text with three fields. Each field is separated by a space(s). Refer to dictionary (4) and type (4) for format details.

HELP MESSAGES

There are two kinds of help messages in the input table. There are form help and field help. Help messages are a set of lines starting with ‘#’ where the rest of the line(s) is the help message.

FORM DEFINITIONS

This is an exact picture of the screen to be used to collect user input. The form will be automatically displayed at the centre of the screen. The width of the form is defined by the widest line in the form. All input fields that are used in the form must be defined in the field definition and it must be enclosed in square brackets ‘[‘ & ‘]’.

VALIDATIONS AND WARNINGS

These have the same format and work the same way as validations and warnings in ubmulti.

UBPROMPT AS A WEB FORM

One of the most important uses of ubprompt is to generate web forms.

Ubprompt is comprehensive in that it includes the form, the field definitions, and the scripts in a single source file.

Some notes:

  • Function keys. These are displayed in a div with the id “functionKeys”. If it exists in the html it is used, if it doesn’t exist it is created at the end of the html.
  • The automatically created div “functionKeys” has a class “fkey”. The look and feel of the function key div can be skinned in the application .css using this class.
  • The function keys themselves are buttons of class “ubprompt”. Again css can be used to skin the buttons.
  • Function key buttons can be completely replaced by something with an id of KEY_F. There is a javascript function “submit_form” that can be used with onclick to activate the function key. e.g.
    <button id="KEY_F1" onclick="submit_form('KEY_F1');"><img src="..." /></button>

    . In this case the button can be anywhere on the screen, not just in a row at the bottom.

  • The output from the ubprompt scripts will normally replace the current page. However it can be directed to a new window (WINDOW= option to ubcgi) or a specific div (ID= option to ubcgi).
  • The T (title) section defines the page heading (an h1 element).

The basic html structure up to and including the body tag are output by ubprompt. The closing body and html tags are also output by ubprompt.

DEPENDENT FIELDS IN WEB FORMS

In general ubprompt will create drop down lists for foreign keys in the attribute list for a form.

Sometimes the content of a drop down list is dependent on a value selected in another drop down list. ubprompt considers these to be dependent attributes or fields and provides special management functions for them.

To indicate that a drop down list has a dependent field use the special element attribute “subField” in the surrounding element. The subField attribute has a space separated list of input attributes as it’s content.

eg consider this snippet from a prompt file

P
customerId, 6 Fcustomers [name]
costCenterId, 6 FcostCenters [description]
>
<table>
 <tr><td>Customer</td><td subFields="costCenterId">[customerId]</td></tr>
 <tr><td>Cost Center</td><td>[costCenterId]</td></tr>
 </table>
>

When this displays, the customer list will be a normal drop down list while the cost center list will be empty. When a customer is chosen the related cost centers will then become available for selection.

To get the subfield list ubprompt calls the server and runs a report called “select.<attribute>.rep”. eg select.costCenterId.rep. This report should return the content-type text/json.

The JSON format per record is

{"master":"",
 "subValue":"",
 "description":"",
 "autofill":{
  "attribute 1":"",
...
  "attribute n":""
  }
 }

Worked example:

{"master":"[customerId]",
 "subValue":"[costCenterId]",
 "description":"[description:T]",
 "autofill": {
  "x":"[x]",
  "y":"[y]"
  }
}

The full example needs a few other things to make the list look correct and for the JSON to be correct – select.costCenterId.rep:

: costCenter
K customerId,description
H
\[
{"":""},
>
F
{"END OF DATA":""}
]
>
R
... as above
>

SEE ALSO

dictionary (4)
help (4)
menu (4)
screen (4)
type (4)

Leave a Reply