The Carapace Videotex Server uses a page specification to define the layout of data on the Videotex page -- click here for an example.
A page specification is built from the following elements:
| page name | the page name uniquely identifies this page amongst all pages for the Videotex service |
| input fields | defines the input fields, treating the Videotex page as a form to hold the user's input |
| pre-processing | defines the pre-processor run when before this page is generated -- for example, this could access a remote server etc. |
| output data | contains the sequence of commands which generate the data to be sent down the Videotex client |
| validation | defines page-specific validation to perform on the user-supplied data |
| post-processing | defines the post-processing function which takes the attribute-value
list of field data entered by the Videotex user
and takes whatever action is appropriate -- e.g. store in a database.
The name of the next page to process by the Server is returned. |
The inputFields page element defines all the input fields.
An input field is defined as follows:
abtaNumber, destination
Defines the pre-processor trigger run before this page is generated -- for example, this could access a remote server to setup the data for the page.
If the pre-processor is a Symbol
then it must be the name of a Carapace script trigger
function.
Any other non-() value is taken to be an expression to evaluate in
a restricted environment.
The outputData page element holds the list of page commands
which generate the Videotex to be sent to the user. Each page command is itself
a list where the command is the first element and any
required arguments follow.
Defines page-specific validation to perform on the user-supplied data.
If the validation expression is a Symbol
then it must bbe the name of a Carapace script trigger
function. In addition, this trigger function must return a
String.
Any other non-() value is taken to be an expression to evaluate in
the restricted environment.
If the resultant string is not empty, it is treated as an error message to display to the user and the Server does not leave the current page.
Defines the post-processor run when the user has completed this page -- for example, this could access a remote server or store the values in a database etc.
If the post-processor expression is a Symbol
then it must bbe the name of a Carapace script trigger
function. In addition, this trigger function must return a
String which is the name of the next page to
display.
Any other non-() value is taken to be an expression to evaluate in
the restricted environment. This evaluation must return
a String.
The following page commands are understood by the Carapace Videotex Server:
up |
move the cursor up by the supplied no. of rows |
down |
move the cursor down by the supplied no. of rows |
left |
move the cursor left by the supplied no. of characters |
right |
move the cursor right by the supplied no. of characters |
text |
output the supplied text to the user |
blockText |
output the supplied block of text to the user -- the width of the block and any display attributes can also be supplied |
moveTo |
move to the supplied screen co-ordinate |
home |
move the cursor to the initial row and column without changing the screen contents |
attribute |
send the supplied display attribute |
attributes |
send the supplied display attributes |
mosaic |
send the supplied mosaic graphic |
table |
present a table of values |
Move the cursor up by the supplied no. of rows -- the default no. of rows is 1.
Move the cursor down by the supplied no. of rows -- the default no. of rows is 1.
Move the cursor by the supplied no. of characters to the left --
the default no. of characters is 1.
Move the cursor by the supplied no. of characters to the right --
the default no. of characters is 1.
Output the supplied text to the user.
E.g.:
The second example above illustrates the output of the
(text "Enter your password")
(text (pageData.get "userName"))
userName as
filled in by a pre-processor function.
Output the supplied block of text to the user -- the width of the block and any display attributes can also be supplied. Multiple text strings can be supplied.
E.g.:
The second example above illustrates the output of the
(blockText 20 fgRed fgToBg fgBlue
"This is a large amount of text which the"
"server will split into lines of less than"
"20 characters and display on the screen using"
"the supplied attributes for each row"
)
userName as
filled in by a pre-processor function.
Move to the supplied screen co-ordinate.
Move the cursor to the initial row and column without changing the screen contents.
Send the supplied display attribute. The supplied attribute must be one of the following:
fgRed
fgGreen
fgYellow
fgBlue
fgMagenta
fgCyan
fgWhite
flashOn
flashOff
singleHeight
doubleHeight
mosaicRed
mosaicGreen
mosaicYellow
mosaicBlue
mosaicMagenta
mosaicCyan
mosaicWhite
bgBlack
bgFromFg
mosaicOn
mosaicOff
Send the supplied display attributes -- click here for the allowed attribute values.
Send the supplied mosaic graphic -- the graphic is defined by a binary string
where "abcdef" represents the following picture:
ab
cd
ef
Display a formatted table of data at the supplied position. A format for the fields within each row is supplied -- this defines the field with, justification (left or right), whether to pad with zeroes or spaces and whether the value is integer, real or string. Optional foreground and background colours for the fields can also be supplied.
The table syntax is as follows:
where:
(table nRows rowFormat data)
nRows is an Integer giving
the number of rows to display
rowFormat is a String which
defines the layout of each row -- this is a comma-separated sequence of
field format strings where the field format defines:
data is an expression which returns a List
of row data where each row data is itself a List of
String,
Integer or
Real values.
For example, consider the following table statement:
Here, the
(table 5
"%12s,Red;%10s,Blue"
(::db.sql "select firstName, lastName from user")
)
::db variable is assumed to be a Db
database connection. The row format is a sequence of
field format strings each separated by semi-colons.
Each field format is obeys one of the following patterns:
The colours are taken from the following list: Red, Green, Yellow, Blue, Magenta, Cyan, White
The data format is constructed as follows:
%
+ | right justified -- the default |
- | left justified |
d | integer -- printed as a decimal |
x | integer -- printed in hex with lower case letters |
X | integer -- printed in hex with upper case letters |
f | floating point number (real) |
s | string |
The following are valid String data formats:
%8s
%-12s
The following are valid Integer data formats:
%08d
%-4x
All trigger functions for the Videotex server take the following arguments:
page |
VideotexServerPage |
the definition of the current page |
environment |
HashTable |
an environment for this session presented to each page function |
pageData |
HashTable |
an empty table into which this function can put the initial field values to be presented to the user |
helper |
Object |
a helper object which persists for the lifetime of the Videotex session |
Expressions which are evaluated -- e.g. in page or field validation, page triggers etc. -- are done so in a very restricted environment. This environment has the following variables defined:
expr |
Object |
the expression to evaluate |
page |
VideotexServerPage |
definition of the current Videotex page |
environment |
HashTable |
an environment for this session presented to each page function |
pageData |
HashTable |
table of values presented to or extracted from the user |
helper |
Object |
a helper object which persists for the lifetime of the Videotex session |
The following script functions can be defined to create and destroy a 'helper' object
for the Videotex session -- for example, this could be a connection to a remote
system:
The value returned by
# initialise the connection
(function Object vtServerInitialise ( (config HashTable) ) )
# terminate the connection
(function NIL vtServerTerminate ( (helper Object) (config HashTable) ) )
vtServerInitialise is made available
in each evaluation environment as the helper.
| Contents | Current topic: videotex | Related topics: Carapace Hub |