Jargon Building BlocksTM
Developer Guidelines
Version 2.3 - December 2000

Contents

Overview
Menus Online Help
Application Security
Output Routing and Background Job Scheduling
Maintenance Logging

Overview

The Jargon Building BlocksTM system is an application development framework. As such, there are certain guidelines that developers should follow when creating application programs, in order to take advantage of the many features that it offers.

This document discusses how to:


Menus

Jargon Building Blocks has two types of menus: tabpanels with buttons as menu choices, and trees with tree nodes as menu choices. Both types of menus can be used to: The primary Building Blocks "Admin" menu is provided in both types and may be used as an example in constructing your own menus. Sample application menus and template (skeleton) menus of each type are also included.


Tabpanel/Button Menus

The first type of menu uses a tabpanel to group menu choices. The choices are represented by buttons within each tab of the tabpanel. A template for this menu is the "menuskel.xml" file. To use this type of menu:


Tree Menus

The second type of menu uses a tree structure, with intermediate branch nodes providing grouping of menu choices (any number of levels of sub-grouping can be done). Any node, whether an intermediate or end node, can represent a menu choice. A template for this menu is the "tmenuskel.xml" file. To use the tree menu:


Online Help

By default, both the "Help for this Window" menubar choice and the "Help" button will invoke the "x50help.xml" Building Blocks procedure. This utility app opens a web browser window to view the document whose URL is linked to the calling app name in the x_help table. To provide online help for each client app file:


Application Security

The Building Blocks database tables and related procedures provide a comprehensive and flexible security system that you can easily hook up to your application, with a variety of functionality that you can choose to use or not use. A log file is kept in the "x_slog" table in the Building Blocks database for all security violations, including invalid UserID, invalid password, attempting to run a program or do an action for which the user is not authorized, or trying to run a program outside the allowed date/time restrictions.

The granularity of security testing can range from very broad (allowing all users in user group "AR" to have full access to all functions in all programs in an "AR" application module), to very specific (allowing user "tom" to only view certain fields from the customer table and only from 8-5 Monday-Friday). The security matrix can be set up with any combination of general and specific rules, since the tests look on a hierarchical basis for the most specific rule up to the most general rule.

Security tests are done in the following order. Note in particular that, since users can belong to 2 or more user groups, if their security for a given function in a given procedure is only set up at the group level, then their security level for that function (add/delete/view/update) is the highest security level of ANY of the groups to which they belong. To prevent this behavior, simply add a security matrix record for that UserID and Procedure ID with the desired permission levels.

  1. Find the security matrix record for this UserID and Procedure ID.
  2. If no record found in previous step, find the record for this UserID and Application Module.
  3. If no record found in previous step, then step through each User Group to which this user belongs.

To enable any security testing, the following steps must be done:

The following sections describe how to implement various security functions.


Disabling unauthorized menu choices

If this feature is enabled, it will cause a host task to be run in the initial tasklist of client menus, when a user opens a menu. The associated host logic will disable or remove menu choices as determined by the values found in searching the security matrix for this user's permission levels for each menu choice (see menus above). While useful, this feature does impose a minor increase in response times when navigating menus, especially when running over the Internet.

To use this feature:


Block running of unauthorized programs

This test is similar to the above "disable/remove" security test, except that it does not prevent a user from starting a program. Instead, every host task in the application will check the security matrix for this user and procedure to see if the user is allowed any access to the procedure.

If not, the host task will exit after displaying a message box with the text "You are not authorized to run this Procedure". The same message will also be displayed in a textpane named 'tnStatus' (by default) unless it is suppressed or redirected to a different textpane component name (see below).

The security values that will result in this message are the same as for disabling the menu choices (see above).

To use this feature:


Selective blocking of unauthorized actions

This feature allows a user to do some actions in a program (such as viewing records) but not other actions (such as deleting records). This security test will check the security matrix for this user and procedure to see if the user is allowed certain generic functionality within this procedure. If not, the host task will exit after displaying a warning message box with the text "You are not authorized to [action] records in this Procedure". The same message will also be displayed in a textpane named 'tnStatus' (by default) unless it is suppressed or redirected to a different textpane component name (see above).

This feature is done in addition to the previous test that can block running the entire program. To block certain actions, add the include reference "{jsx/securchk.i action [textpane option]}" after the "{jsx/testuser.i}" reference near the top of the include file named in the host task.

The "action" is a required include parameter that can be a variable or single-quoted literal which contains any of the following values:

The [textpane option] is an optional parameter that can suppress or redirect the message being sent to a textpane (same syntax as in previous section).

Here is an example from a "set.i" routine generated by Jargon Replicator which tests security for the add/change/delete logic in a file maintenance program.

assign v-src = tEventSrc. if v-src matches "*Delete*" then v-action = "delete". else if v-src matches "*Apply*" and hAction = "Update" then v-action = "update". else if v-src matches "*Apply*" and hAction = "New" then v-action = "add". /* CHECK USERID AND PASSWORD, MSG AND RETURN IF ERROR */ {jsx/testuser.i} {jsx/securchk.i v-action }


Field-level view and update permissions

Within the business logic of each include file that contains the "{jsx/testuser.i}" reference, you have access to two variables named "xf_SecurUpdateLevel" and "xf_SecurViewLevel". These are integer fields with values from 0 (lowest security) to 9 (highest).

By testing these values, an inquiry program could display all information when xf_SecurViewLevel = 9, but only display some of the information at lower values 1-8, and display nothing at level 0.

Similarly, a host task in an initial tasklist could use the "xf_SecurUpdateLevel" values to selectively disable certain input textfields in the client xml application, to prevent the user from changing the values displayed into those fields.

Two other variables named "xf_SecurAddAllowed" and "xf_SecurDelAllowed" are also available for use if you want to directly control the actions taken when a user is not allowed to add and/or delete records, instead of using the "{securchk.i 'add'}" or "{securchk.i 'delete'}" tests shown in the previous section.


Miscellaneous application-specific security tests

Finally, you have access to three variables that contain miscellaneous character values that can be set up in each security matrix record for application-specific use. These fields are named "xf_SecurValue1", "xf_SecurValue2" and "xf_SecurValue3".

If security is found at the UserID level (by Procedure or Application), these values will be from that specific record. If security is found at the User Group level, these values will be from the LAST group record found, which can be tricky to set up correctly. Consequently,these miscellaneous values are best used at the UserID level, not at the User Group level.

As an example for using these fields, an application designer might test xf_SecurValue1 for a comma-separated list of valid department codes that this user is authorized to use. This list would be put into the "Security Value 1" field of the security matrix record for this User ID and Procedure ID.


Output Routing and Background Job Scheduling

Jargon Building Blocks provides a common utility procedure for selecting output routing of reports and other formatted output and for allowing background processing of reports or other "batch update" procedures which may take many minutes or hours to complete.

This utility is normally run after the user has entered selection criteria for the report or batch update procedure and clicked a "Submit" button. The selection criteria window is then hidden and the scheduling and output routing options window appears. After making all desired selections and entries for output routing and job scheduling, the user again clicks a "Submit" button in this window, which then initiates several host tasks which either run the host procedure immediately online, or add it to a job queue for background processing.

If the procedure is run online and "View in Browser" output is selected, a "View" button will be enabled in the selection criteria window upon completion of the host procedure, and when clicked, will open a web browser with the URL of a temporary HTML file on the host system to view the report or other output from the host procedure.

A template "xrepskel.xml" is provided which has the necessary hooks to the "x99sched.xml" utility procedure. To use this feature:

Note that the "Submit" button in xrepskel.xml is linked, by default, to a "TLSubmit" tasklist that immediately invokes the scheduling/routing utility x99sched.xml. In turn, when the user clicks the "Submit" button in that utility, it does a host task which assigns a job number, stores the scheduling and output routing options for that job, and invokes a "call-back" tasklist in x99sched which then invokes the "TLFinal" tasklist in the calling report app (xrepskel.xml).

This TLFinal tasklist does a host task which submits any entered selection criteria, along with the UserID, password,sessionID, Job number and background scheduling option, as host input parameters. If a background option was chosen, these criteria will be stored in the job tables by the host task and it will immediately return to the client, with a message that the job has been scheduled.

This design does not provide a means to do host-side editing of the selection criteria before putting the job into the job queue. However, this can be easily done with a few minor changes:

Output Routing Options

Subject to overall system configuration, reports and other formatted output can be routed to any or all of the following: Printers
Printers are configured in the Printer setup program from the System Admin menu. See the online help docs for this procedure for detailed setup information.

E-Mail
A sample API (Application Program Interface) for Email output via the UNIX "mailx" utility is provided in the "jsx/api" directory as "unixmail.p". You can modify this model program or copy it to a new name to interface to the specific email software on your host system.

Enter the name of this API in the "Email API" entry on the Output Routing tab in the System Control setup procedure. The output routing program passes three input parameters to this API program:

  1. The pathname of the report file
  2. A comma-separated list of value pairs for each recipient -- (1) email address (2) name
    Example: tom@xyz.com,Tom Smith,joe@xyz.com,Joe Brown
  3. The title to use as the email "Subject" line
Fax
A template API (Application Program Interface) for fax output is provided in the "jsx/api" directory as "faxskel.p". You can modify this model program or copy it to a new name to interface to the specific fax software on your host system.

Enter the name of this API in the "Fax API" entry on the Output Routing tab in the System Control setup procedure. The output routing program passes two input parameters to this API program:

  1. The pathname of the report file
  2. A comma-separated list of value triplets for each fax recipient -- (1) their fax telephone number (2) their organization name (3) their individual name.
    Example: "555-1212,XYZ Inc,Tom Smith,555-2323,XYZ Inc,Joe Brown"

Background Job Scheduling

The background job processor continuously scans the job queue, looking for jobs which are in the correct status to be run and which are either scheduled to "run immediately" or are scheduled to run one time or on a recurring basis and have reached that date and time. When it finds a job to be run, it "marshals" all the output routing and selection criteria that the user originally entered from the job tables and runs the specified program and internal procedure in the background. When completed, the job is flagged as completed (unless it has errors), a job history entry is made, and the program output will have been routed as specified in the job parameters.

Note that you MUST use the repskel.i structure and do "report" output in any batch update program, in order to enable background processing capability for this host task. (Of course, it could simply create a report file saying "Job so-and-so ran okay"). In specific, the various "jsx/out***.i" include files are where background jobs are released into the queue to be run at a later point by the background job processor.

A user's update level in the security matrix for "x99sched" determines what job scheduling options can be used. This security matrix record can be specific to this User ID or it can default to record(s) for the User Group(s) to which this user belongs. The special meanings assigned to this update level for the "x99sched" Procedure ID are:

9 = all background job scheduling options are allowed
7 = no recurring background job scheduling allowed
5 = no recurring background job scheduling or one-time background scheduling at a specific date/time (only immediate background jobs allowed)
3 = no background scheduling of any kind
To configure background job processors, edit the selections in the Job Processor tab in System Control setup. In the "Job Proc. Cmd" field, enter the full pathname of a UNIX shell script or Windows ".bat" script (or equivalent) that will start one background Progress session for the same database(s) as the online sessions (e.g. "/home/webspeed/wrk/jsx/runbatch.sh" for a UNIX shell script).

A sample UNIX script is provided in "jsx/runbatch.sh". This script will be used in the job processor control panel to add additional background job processors on demand.

In the script, specify the full pathname to "jsx/x90jobproc.p" as the startup program for the background session, using the Progress "-p" option for "mbpro". Output from the background session should be directed to a "batch.log" file in the J/P logs directory specified in the System Control "Directory for JP Logs" entry.

You should also set up UNIX 'cron' entries (or equivalent means on WinNT/2000) to start one or more background jobs whenever the database server(s) are started, so they do not have to be started manually each time. These automatic methods should run the same script described above, if possible, to avoid potential problems when future changes are made to the startup parameters.


Maintenance Logging

Jargon Building Blocks includes an option to automatically log all add/change/delete actions done to the tables in the "Xfiles" database. The option is enabled by checking the "Log Maintenance?" checkbox in the "General Info." tab in System Control setup.

This feature can also be used by application programs wherever desired. Information which is captured in each record in the "x_log" table includes:

The "Comments" field can be used in several ways. Building Blocks puts a description field from the record into "Comments" on "add" and "delete" actions, and puts a comma-separate list of the names of fields whose values were changed on "update" actions. For tables with a very small number of fields, the actual new values of each field are shown, but this is impractical for tables with many fields.

Where a table has more than two fields in its primary index, such as the x_security table, multiple keys can be put into the two key value fields that are provided in the x_log table, with the key values separated by a "/" character or other delimiter that would not occur in the key values themselves.

To use this logging feature in an application program: