The User
Template:
For those with
DHTML, JavaScript and VBScript knowledge, Interface Builder allows for the
development and maintenance of user developed Java or VB scripts for form and
data manipulation. As of the 3.08.20
release there are two different user templates. The user templates are never overwritten by new releases of IB
and are therefore retained from one IB release to another or when generating
new screens. They are used during each
generation to insert custom user-defined functions, which can greatly expand
the functionality beyond what the EAD painter can provide.
The Client-Side:
The user template (IEWEB.USR) contains user written Java scripts called
“chapters”. Chapters are related to
selected ISPEC and data fields, by using field level business rules to contain
strings that invoke the generation and calls of these routines. These routines are generated directly into
the ASP/HTML form and can be invoked at various processing points: form
rendering, form submission and error processing. This provides great flexibility in implementing features by using
your own knowledge of the application.
A significant advantage of the client side scripts is each routine is
generated directly into the ASP/HTML form.
The Server-Side:
The user template (IEWEB.INC) contains user written VBScripts called
“chapters”. Chapters are related to
selected ISPEC and data fields, by using field level business rules to contain
strings that invoke the generation and calls of these routines. These routines are generated into various
INC files and are processed by the web server.
Various customer INC files are associated with various processing points
during the building of the output ASP/HTML form. A significant advantage of the
server side scripts is server scripts are deployed to the web server and filter
each ASP/HTML form dynamically modifying the form, as it is processed by the web
server. This means that changes to the
ASP/HTML forms can be applied without generating a new ASP form but rather by
simply deploying a new INC routine.
How
does the IEWEB.USR Client-Side template work?
Expanded Host
Integration:
Illustrations:
The following
illustrates how a user-developed script could identify and manipulate date
fields. It is common for date fields to
be various lengths and date formats.
Other than the LINC attribute EDIT=D, fields that are date oriented
usually cannot be determined without close examination of LINC logic. In order to make it easier for an end-user
to enter a date field correctly, it has been requested that the user be able to
pop open a calendar from which they can select a specific day. This would in turn populate a designated
field in the correct date format.
The LINC ISPEC before painting a Display
Image:
A data field
named “INDATE2” is defined as ED=N LE=8 and contains date information in the
format of CCYYMMDD. This example could be for any field, with
any edit attributes, representing any date format.
A Display Image is painted next to the INDATE2 field.
The name of the image is DATEADV.USR. IB detects an image that
ends in a suffix of USR. IB will match
this name against entries found in the ieweb.usr template. When a match is found IB will generate html
or java code based on the routine developed and saved in the user template. Any ISPEC/data field can use this routine.

The following entry is entered in the User Template. Indented lines indicate text that is
continued from the line above. In the
Template these lines would be single lines of text. IB will match the name of the image DATEADV against the entries found in the ieweb.usr template. The next token in the user template is INDATE2 and it associates this image with the data item defined in the
ISPEC. The date format is included indicating that this routine will return the
date string as CCYYMMDD. ^dt^ is the user designated chapter ID that will be generated into the
resulting ASP/HTML form. The text after
the last “^” is user information that
will appear as pop-up help
text as the mouse is hovered
over the calendar ICON.
The User Generation String:
00 N^DATEADV^INDATE2^ ^ ^CCYYMMDD^dt^ ^Clicking the calendar will populate the date field according to the date format specified. The following formats are supported:<br>MMDDYY DDMMYY YYMMDD CCYYMMDD MMDDCCYY DDMMCCYY
dt
Y<img align=middle alt="Open Calendar ^VA^"
src="^IM^calendar.gif"
dtiTLB
/= SPACES
dtiY onmouseover="setPopUp('^DN^div',
'visible');" onmouseout="setPopUp('^DN^div', 'hidden');"
dtiTendtest
dt
YonClick="document.IEGIspec.^DN^.value =
DateConvert('^DN^','^VA^',document.IEGIspec.^DN^.value )";
style="left:^PL^; top:^PT^; width:^PW^; height:^PH^;">
dtiTLB
/= SPACES
dtiY<div
id="^DN^div" style="left:^2L^; top:^2T^; visibility:hidden;
z-index: 99; ">
dtiY <table width="^2W^"
height="^2H^" border="2" cellpadding="4"
cellspacing="0" bordercolor="#009900"
bordercolorlight="#99FF99" bordercolordark="#008000"
bgcolor="#CCFFCC">
dtiN <tr><td><span
style="left:5; top:5; font-size:12px font-family:Comic Sans MS; color:#008000;
background-color:#CCFFCC; ">
dtiY ^LB^
dtiN
</span></td></tr></table>
dtiN</div>
dtiTendtest
99
N
The line that starts with “00” represents chapter 00 and this is
the record that associates the user written scripts in chapter “dt” and the painted
display image name DATEADV.USR. Lines
that start with “dt” are the date chapter.
This chapter paints an ICON with an image named “calendar.gif”, creates
a pop-up only if there is text following the last “^” , and populates the
INDATE2 field with the results returned from the DateConvert function.
Once this chapter is written other Chapter 00 lines can call this
routine and be associated with any number of Ispec/data combos.
Generation String
format:
00 N ^<ispec or function name>^<dataname>^lengthvalue^<one of the 4
entry points or blank>^<user variable>^<chapter-ID>^<language
#>^<misc text>
“^” is the delimiter separating field
information. Each delimiter ^ must be separated by a character string or at
least one single space. The generation string
should never have two delimiters together (^^).
The generation
string is retained in the IEWEB.USR template file.
·
All declared
generation strings in the IEWEB.USR template must start with chapter 00.
·
Column 3 is
blank or can have the letter [c,C], which denotes this line is a comment and is
not included in the processing.
·
Column 4
must be the letter “N”.
·
If the data
item is painted in a copyfrom area, you will have to declare each item and name
it according to the naming string in the html, that means the item name
would be something like DATAITEM__AT_01....etc. and you will have to declare
each one.
·
an Ispec = ***** means these rules to this data item in all
ispecs.
·
If a data item has an explicit ISPEC and ***** the explicit ISPEC
rules is applied to the specific ispec and everywhere else the ***** applies.
·
The length parameter is a value up to 4 digits in size and is the
length of the field.
The following
formatting rules apply to the generation string regardless of where it is
declared:
·
The ispec, dataname, call location will all be converted to Upper
Case. Dashes (-) will be converted to underscores(_)
·
There must be a space or character separating each ^.. YOU can not
have ^^.
·
The User Chapter is case sensitive, must start with an alpha
character.
Illustration of
building the User Generation String:
The illustration
builds the generation string with an explanation of each item as it is added.
00 N - All generation strings will start with
this. If a “c” is in the third column
then this line is a comment and is skipped during generation.
00 N^DATEADV^ - The Ispec or function name has now been added. In this case this represents the function
name. DATEADV was entered as the
Display Image File name along with “.USR” in the EAD painter. The image name is compared against the user
generation string for a match and when found triggers the association of this
display image with this function.
00 N^DATEADV^INDATE2^ - The data item named INDATE2 has now been
added. The DATEADV function will now
target this data name as the field to store the result of this function. If the ^DN^ token is used as a wild card in
the chapter script it will be replaced with INDATE2.
00 N^DATEADV^INDATE2^ ^ ^ - The next two tokens following the data
name are empty. They are the length,
which is not used in the function and entry point, which is also not used by
this function.
The entry point
can be one of the following values:
00
N^DATEADV^INDATE2^ ^ ^CCYYMMDD^ - The next token is the ^VA^
user variable. In this date function this
represents the data format of the field INDATE2. Since this is a date routine the typical data formats that might
be specified here are CCYYMMDD, MMDDCCYY, DDMMCCYY, YYMMDD, MMDDYY and DDMMYY. This represents the 6 and 8 character US and
European date formats. The date
function will use this format and return a value to be stored in INDATE2 that
matches this format.
00 N^DATEADV^INDATE2^ ^ ^CCYYMMDD^dt^ - The next token is the user chapter “dt”. This can be and two alpha character strings (Aa –Zz) and 0-9 as long as it begins alpha character. This ID is case sensitive. The chapter “AA” will be different than “aa”.
00
N^DATEADV^INDATE2^ ^ ^CCYYMMDD^dt^ ^ - The language slot has now
been added and is empty. Since the a
Display Image is actually painted in the EAD painter, it is already associated
with a specific ISPEC language version so there is no need to specify the
language number again.
00 N^DATEADV^INDATE2^ ^ ^CCYYMMDD^dt^ ^Clicking the calendar will populate the date field according to the date format specified. The following formats are supported:<br>MMDDYY DDMMYY YYMMDD CCYYMMDD MMDDCCYY DDMMCCYY
Finally the last
part of the user generation string has been added. “Clicking the calendar…” is help text that will appear in a pop-up
window as the user mouses over the ICON.
This window will automatically open and close by the movement of the
mouse.
Chapter Naming:
The value of “dt”
has no special significance other than they represent a unique chapter in the
IEWEB.USR template. If the user wishes
to declare global variables or other Java functions, the chapter “gl” (GL in
lower case) is required. The “gl”
chapter is for user-defined global variables and functions. Chapter IDs must start with an ALPHA
character and cannot be a chapter defined in the IEG standard template,
IEWEB.DAT, or the “gl” chapter,
In the template
IEWEB.USR:
glcN user declared global
variables and Java functions
gl N<script
language="JavaScript">
glcN add more variables or
Java functions here
gl Nvar iegDate = new Date();
gl N</script>
99 N
What tokens are
available?
DN – the selected
data field name (FORMDATE)
FL – the define
length of the field (0008)
ET – the Entry
type (PL, PS, PE)
VA – a user
defined value (MMDDCCYY)
LB – misc. text
after the last “^”
What gets
generated?
The results of
this User DATEADV function:
To handle another
date field the steps are very simple and as follows:
1)
Paint the
display image in EAD painter and name the image DATEADV.USR
2)
In the user template
duplicate the user generation string and change INDATE2 to the name of the
other field, i.e. DATEOUT
Once generation
strings are built, generation of the ASP form will always include these
additional expand integration functions.
How
does the IEWEB.INC Server-Side template work?
<%
IEGGen_JS_Var_Section_Head %> ^INCJSV^
<%
IEGGen_JS_Function %> ^INCJS^
<%
IEGGen_Extra_Fields %>
^INCEXT^
<%
IEGGen_PL %>
^INCPL^
<%
IEGGen_PS %>
^INCPS^
<%
IEGGen_End_Of_PS %>
^INCEPS^
and
… the outer INC level ^INCOUT^
|

00
N^ ^ ^ ^INCPL ^ ^ ^ ^
00
N^ ^ ^ ^INCJSV ^ ^ ^ ^
00
N^ ^ ^ ^INCEXT ^ ^ ^ ^
00
N^ ^ ^ ^INCJS ^ ^ ^ ^
00
N^ ^ ^ ^INCOUT ^ ^ ^ ^
00
N^ ^ ^ ^INCEPS ^ ^ ^ ^
Creating
custom INC files will be illustrated with the following example ASP forms. The purpose
The
next image shows the same form
A
00 N^ ^incEXT.inc ^
^INCEXT
^<!-- #INCLUDE
FILE="incEXT.inc" -->^
^
^
00 N^*****^globalitems ^
^INCEXT
^ ^GL ^
^
00 N^*****^IEGPBUTTON0002 ^
^INCEXT
^ ^nc ^
^
nccN another way to manipulate
CLASSes
nc N
nc N<%
nc Yif (IspecName = "^IS^") or ("^IS^" =
"*****") then
nc Yif (IEGLang = "" ) or ("" = "^LB^")
or (IEGLang = "^LB^") then
nccN Condition the response write with the correct ISPEC and LANGUAGE
nc N
response.write("<style>
" & vbcrlf)
nc Y response.write(".^DN^
{font-family:VERDANA; font-size:9; color:#0000FF; background-color:transparent;
text-decoration:underline; border:0; cursor:hand;} " & vbcrlf)
nc N
response.write("</style> " & vbcrlf)
nc Nend if
nc Nend if
nc N%>
99 N
GLcN defining dims
GL N<%
GL Ndim IEGLang
GL Ndim LocalLangs
GL Ndim IspecName
GL Ndim i
GL NLocalLangs = Session("LangNames")
GL NIEGLang =
Trim(UCase(objCurrentIspec.getFieldValue("IEGVIEW")))
GL NIf IEGLang = "" then IEGLang = LocalLangs(0) ' where we want to go '16
GL NIspecName = trim(objCurrentIspec.getName())
GL N%>
99 N
B
C
D
Explanation:
The “A” record is the token definition record. IB will use the INCEXT location within the IEGGLB.INC and will insert the INCLUDE statement to include the file named INCEXT.INC. (Note the case of the file name does not matter).
The “B” records define what is to be generated and with what parameters. A global chapter is requested as defined by the “GL” chapter. The first 00 record (globalitems) causes IB to generate, into the INCEXT file, some global variables (dim) which are set by the ASP code to define the ISPEC and Language being processed by the web server. The second 00 record inserts the user chapter “nc” which is the routine that modifies the form and inserts a new CLASS definition for the IEGPBUTTON0002 with the desired style attributes. By locally defining this CLASS in the ASP form, the local style attributes override those declared in the CSS file.
The results:
The iegglb.inc will have the following code generated:
|
|
The web server will dynamically insert the following line in the ASP/HTML form. (Note line 2 is broke into 2 lines for readability.)
|
|
|