Online documentation - Websydian v6.0

Users Guide | Patterns Reference | WebsydianExpress | Search

 

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 AllFusion 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:

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 AllFusion 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 AllFusion 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 AllFusion Plex INI File

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

The AllFusion Plex default execution INI file is located in the AllFusion Plex bin folder, e.g. C:/Program files/Ob350/BIN/Ob350rc.ini for AllFusion 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 Identify Functions Scoped under the Event Handlers

If using the iSeries variant of Websydian and if not already done, generate and build the internal IdentifyInputFields functions scoped under each Event Handler function used by the Page Generator.  These functions will be called during Document Template generation in order to identify the input fields specified for each Event Handler function in the variable WebInput.

Example:

IdentifyFieldsGeneration.gif (4957 bytes)

The Document Template Generator function uses IdentifyInputFields functions when building the Document Template at development-time (for iSeries web server only).

Generate and Build Document Template Generator

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

The _DocumentTemplateGenerator function inherits from the scoping Page Generator function.  This means that any Event Handler function scoped under the Page Generator function will also be inherited and scoped under the  _DocumentTemplateGenerator function:

Example:

PageGeneratorScopingEvents3.gif (7452 bytes)

Event Handler functions (and their scoping functions) scoped under the Page Generator are also inherited by the _DocumentTemplateGenerator function.  These functions should be ignored.

These inherited Event Handler functions should be ignored - they should not be opened and they do not need not to be generated.  You may choose to set the functions to implement No.

Run the Document Template Generator Function

After being generated and built, the Document Template Generator function can be executed from inside the AllFusion Plex environment in the 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).