|
2. BOATSCH1
The html issued by program
BOATSCH0
contains a
form
with a button
When the user presses that button, program
BOATSCH1
(which is mentioned in the
action of the
form)
is invoked.
The following input string is made available to the program:
(the *** stay for the user inputs)
lng=***&bckgnd=***&boatnbr=0&type=***&maker=***&units=*** &minlen=***&maxlen=***&minpri=***&maxpri=***&city=***&state=*** &country=***&lstbrd=*** |
Program flow
- Receive the input string (subprocedure zhbGetInput)
- Parse the input string into program variables (subprocedure zhbGetVar)
- Load skeleton output html member
BOATSCH1
in CGIDEV2/DEMOHTML (subprocedure GetHtml)
- Get server's protocol
for later html output display (subprocedure getEnv)
- Set html output variables
- for the <FORM>s hidden input fields
related to the background color and the national
language desired
- for the HTML <BODY parameters>
- for the user-specified search criteria
and write out html output section top (the first part of the html script)
using subprocedure wrtSection
- If the first time through,
override and open database file
cgidev2/boatsale
containing the boats catalog.
Note that this file is never closed,
in order to provide the best performance.
- Position the file to the next boat not yet listed
(input field boatnbr
is used for that).
This input field contains 0 when the program is called
through the html output from
BOATSCH0. On the other site, when the program
is called by pressing the button
Show nnn more, this input field contains
the serial number of the last boat listed.
- Read the database file
to find how many boats match the search criteria.
Write the html output section howmany
and, if more than 30 boats matching, the html output session
30more
- Write the html output section tablestr
which defines the start of a html table
- Set again at the starting database record and read through
until maximum 30 boats matching the search criteria
are found.
For each such record, set the variables, and write html output section
tablerow showing boat length, make, type, year built,
price, and city where located.
However, this table row is not that simple,
as it carries information able to activate CGI program
BOATSCH2,
the one that displays boat detailed information
along with images and boat dependent html text.
- It contains a link to program
BOATSCH2,
along with a string that this program should receive in order
to show a single boat. The link, before variable substitution, is
<a href="/cgidev2p/boatsch2.pgm?serno=/%bnbr%/">
where
/%bnbr%/
will be replaced by the serial number of the boat
- It also contains the following checkbox
<input type="checkbox" name="serno" value="/%bnbr%/">
When the user presses the button
Show these vessels,
program
BOATSCH2
(mentioned in the
action
of the
<form >)
will be invoked and will receive a string
containing both the hidden fields
(such as national language and background color)
and the values of the checkboxes checked-in.
As an example, the input string could be
lng=&bckgnd=white&serno=0008745&serno=0009784&serno=0012509
if the user selected three boats.
- When no more matches, or 30 matches found, write html output section
tablend which ends the html table
- If at least one row in the table, write html output section
foundsome containing the submit button
Show these vessels. Please note that the action of this submit button
(call program BOATSCH2) is defined
in the
action
of the
<form >,
up in the output skeleton html
- If more than 30 matches found, write html output section
showmore which allows to relink to program
BOATSCH1 passing the same values for search criteria
along with the boat number it should start from
- Finally, the program would
- write html section endhtml
(after setting its output variables, including
the response time)
- send the html output buffer (by writing the
pseudo section *fini
- return leaving the LR indicator off,
to provide more performance the next time it is called.
|