Websydian v6.1 online documentationOnline documentation - Websydian v6.5

Implementing Document Template Generator Functions

Setting up the Document Template Generation Process

The two steps described below only have to be performed once by the developer for each CA Plex model.

Names and Location of Document Templates

The name of the generated Document Template will be set to the file name of the Page Generator function scoping the Document Template Generator function, appended with the extension HTM.   E.g. if the Page Generator function has the triple:

Source Object Verb Target Object
SomePageGenerator FNC file name NME PGFNC

the Document Template is created with the name PGFNC.HTM.

The function writes the Document Template in a folder named HTML. This folder must be located at the same level as the compiled run-time objects, i.e. under the Win32 folder at the same level as the Release folder for CA Plex 3.5.

This folder must be created manually prior to the execution of the Document Template Generator function.

Example:

dirlist.gif (9070 bytes)

Location of generated HTML templates for the Tutorial application.   The Html folder is located at the same level as the Release folder containing the compiled run-time objects (DLL's).

Specify Path to Dispatcher in Plex INI File

For each Event Handler specified by the Page Generator function, the generated Document Template will contain a call to the Dispatcher function of the Websydian application.  The exact location of the Dispatcher function is specified in the CA Plex INI-file, and the location is read during the Document Template generation.

Example:

If the name of the Dispatcher function file is OnlineOrders.EXE and it will be installed in a WebApplications folder on the web server, then the INI file key must contain the following declaration:

[HTML]
DISPATCHER_URL=/WebApplications/OnlineOrders.EXE

The HTML form header will then be generated as:

<FORM ACTION="/WebApplications/OnlineOrders.EXE" METHOD="POST">

The CA Plex INI File

The name of the CA Plex INI file is on the form Obvvvxxx.INI, where vvv is the CA Plex version number and xxx is one of the following codes:

The CA Plex default execution INI file is located in the CA Plex bin folder, e.g. C:/Program files/Ob350/BIN/Ob350rc.ini for CA Plex version 3.5, 32-bit version.

Associate Event Handlers to Page Generator

In order to generate the Document Template correctly, the Event Handler functions used by the Page Generator function must be associated to the Page Generator.  The association to an Event Handler function is specified either by a FNC includes FNC triple or a FNC comprised by FNC triple.

Usually the FNC includes FNC triple is used to specify the association, and in this way the Event Handler functions will be scoped under the Page Generator.  The FNC comprised by FNC triple is used when the same Event Handler function is shared among multiple Page Generator functions.

Example:

wpe112.jpg (29600 bytes)

The Page Generator function specified above uses its own five 'private' Event Handler functions as well as it refers to the unscoped Event Handler function WebDisplayDepartments.

Based on these triple definitions, the Document Template Generator function will be able to locate all the Event Handler functions that are associated with the corresponding HTML page.  The input fields declared for these Event Handler functions will appear as input fields on HTML forms on the Document Template.

Generate and Build Document Template Generator

Each Page Generator function will always have a _DocumentTemplateGenerator function scoped to it. Generate and build this function from the Generate and Build window.

Run the Document Template Generator Function

After being generated and built, the Document Template Generator function can be executed from inside the CA Plex Generate and Build window. The generated first-cut Document Template will now reside in the HTML folder under the Gen library and from here it can be moved to the web server.

Editing the Document Template

After the initial generation, an HTML Document Template can be edited in an HTML editor in order to design the layout of the HTML pages.  Any web editor tool can be used to edit the Document Templates, as long as the guidelines below are followed:

  1. Manual changes will be overwritten if the Document Template is re-generated.  Do always make a copy of the Document Templates and apply HTML layout to these.
  2. Do not alter the replacement markers in the Document Template.
  3. On grid pages the two grid markers (<!--/(Grid)-->) must not be deleted, and each grid marker must be on a single line.
  4. If an event (or replacement markers)  depends on values calculated during the grid load, this event should always follow the grid table (see also the Specify Sum Fields for a Grid Page section in the Other Uses page of the Page Generator function).