OpenInsight is capable of enabling both static and dynamic web publishing. Static publishing is the process of making an HTML file available on the web server. The file is delivered to a browser when it is requested. The contents of the file remain unchanged until the document is edited and republished. Dynamic publishing is the process of responding to a request that creates an HTML document on the fly. The document, which does not sit on the web server, is created by a running application (such as OpenInsight) and delivered to the browser. Subsequent requests will reflect any changes that have been made to the data.
What you need:
OpenInsight for Workgroups version 3.3 or above
Web server software that supports CGI 1.1.
A browser that supports HTML 3.0.
If you do not have a web server, you can go to http://www.softseek.com/Internet/Web_Publishing_Tools/Servers/index.html
and download free web server software so that you can experiment with OpenInsight s web capabilities.
Step One Setting Up OpenInsight as a Web Server Extension
A web server extension enables a browser to communicate with an executing program. A CGI gateway program accepts OpenInsight requests from the web server. To provide this functionality you must:
1. Copy the executable file OICGI from your OpenInsight for Workgroups directory to a directory on your web server where it can be executed as a CGI module. (Refer to your web server documentation for specifics.) Typically this is the subdirectory \CGI-BIN. Note: some web servers require that the OICGI file be renamed OICGI.EXE.
2. Install your development copy of OpenInsight for Workgroups. Unlike other web server extensions, OpenInsight can be installed on the web server or on a network drive. If OpenInsight is on a network drive, it can simultaneously be used as a web server extension and a development system.
3. Start OpenInsight from the web server. If, in the previous step, you chose to install OpenInsight on a network drive, you will need to map to the appropriate drive in order to launch OpenInsight.
4. Start the Internet Gateway Services (a gateway traffic monitoring service) on this copy of OpenInsight by executing the OpenInsight window executable INET_GATEWAY from the repository outline. To automate this step, you can set INET_GATEWAY as an entry window. (If this copy of OpenInsight is on a network and is accessed by other users, be sure you install a Collaborative Development disk for each user. When determining your user count, don t forget to include the web server as one user.)
OpenInsight is now ready to serve as a web server extension.
Step Two Creating a Web Page with the OpenInsight Form Designer
You can use OpenInsight s Form Designer to create a static HTML page. To do this, you simply create a form in the usual way, dragging controls onto the form and adjusting their appearance. Save the form and then select HTML Publishing from the Form Designer s File menu (if you are using version 3.3, you must access the HTML publisher through the Repository), and click on Compile the HTML Page. The HTML Publisher then converts your OpenInsight form to an HTML document, which can be viewed by a browser and edited by any HTML editor.
Because of the nature of HTML and the web environment, there are a few things to bear in mind when creating your web page with the OpenInsightForm Designer. The first is that the Form Designer does not offer a true WYSIWYG HTML design interface. In fact, this is true of virtually all web page creation tools. For example, when you place a control in the center of a form, that control will be centered when you run the form. However, when you convert the form to HTML, that control will be flush left when viewed through a browser. This is simply the way HTML works there is nox,y coordinate positioning in HTML. The second thing to keep in mind is that not all of a control s functionality is available via the web. Following is a starter list of the controls that can be used on a web page, and some of their limitations.
Static Text HTML ignores any size, font, and color formatting applied to the text and uses the browser s default
Button
Bitmap the file must be a .GIF or a .JPG
Checkbox all checkboxes are 2-state, even if 3-state is selected
Edit Line
List Box hierarchical list boxes do not work; if this option is selected, the code in the text portion of your list box (indicating bitmaps and levels) will be printed as text.
Edit Box
Combo Box
Radio Button
Another thing you might want to include on your form is a hyperlink to another web page. In order to create a hyperlink, you use the static text control, and append a pipe symbol ( | ) followed by the URL of the desired link to the text property. For example, if you wanted to create a link to Revelation s web site, you would place the following into the Text property of the control:
go to our web site|http://www.revelation.com
Alternatively, you could create a link that enables a user to email Revelation s general information mailbox. In that case, you would place the following into the Text property:
click here to email|mailto:info@revelation.com
The phrases go to our web site and click here to email are automatically underlined when they are converted into hyperlinks.
Step Three Understanding the SUBMIT Event
HTML pages do not respond to events in the way that OpenInsight forms and controls do. We can, however, simulate events and event-handler behavior to add dynamic functionality to the HTML page. Internet-specific functionality is added to the OpenInsight form before it is converted to an HTML document. In OpenInsight we refer to this document as an OI Page. The SUBMIT event and its event handler (QuickEvent or custom Internet procedure) provide the mechanism for converting OpenInsight functionality into HTML code and for communicating with OICGI. The SUBMIT event could be used with the following controls:
Static Text is converted to a hyperlink that specifies the required OICGI call .
Button enables you to dynamically publish a report or access a static web page.
Window works in conjunction with the button controls.
The QuickEvent Options for the SUBMIT event for the above controls are:
Publish Report creates a dynamic HTML page using a report layout defined with Report Builder. (Report Builder, a wrapper for RLIST, can be run by shift double-clicking on the OpenInsight form executable ORMAIN.) The parameter REPORT_ID is the name of the report layout created in Report Builder and is defined in the window s SUBMIT event.
Read the Document performs a similar function as the hyperlink (display an HTML page) except that it uses OICGI (it will pass through theOpenInsight Internet Gateway) to access the static web page. The parameter DOC_ID is the name of the HTML document to be accessed and is defined in the window s SUBMIT event. If you want to access an HTML document that was not created with OpenInsight, simply add it to the repository.
Step Four Adding Internet QuickEvents to your OpenInsight Form
OICGI is a CGI (Common Gateway Interface) a 32-bit Windows executable that enables communication between a browser and OpenInsight. In order implement the functionality of the Internet QuickEvent Options or custom procedures, the OI Page itself must be accessed via OICGI. (If you don t access the OI Page via OICGI, you would have to manually edit the HTML form to specify the path to OICGI.) The form should be accessed via a URL that looks something like this:
http://websitename/cgi-bin/oicgi.exe/INET_REPOS?DOC_ID=FORMNAME
Here is a simple example of how to use the Internet QuickEvents that to dynamically access a report or access a static web page:
1. Create a report with Report Builder called EX_REPORT.
2. Create a form in Form Designer, called EX_FORM with two button controls. Label one Report and the other Other Doc.
3. In the SUBMIT event for the button labeled Report , choose the Publish Report QuickEvent Option.
4. In the SUBMIT event for the button labeled Other Doc, choose the Read the Document QuickEvent Option.
5. In the SUBMIT event for the form, choose the QuickEvent Option Publish Report and in the Parameters group, fill in: REPORT_ID=EX_REPORT, DOC_ID=EX_FORM
6. Save the form and use the HTML Publisher to convert it to an OI Page called EX_HTML.htm.
7. To launch the HTML page, go to the URL: http://websitename/cgi-bin/oicgi.exe/INET_REPOS?DOC_ID=EX_FORM
Step Five Adding Custom Internet Procedures
The current version of OpenInsight for Workgroups delivers several pre-defined Internet procedures (i.e. INET_REPOS, INET_RLIST,INET_TRACE). Future releases will include new Internet procedures. OpenInsight also gives you the flexibility to write your own. For example, you can create a procedure that reads and specified number of rows in a table and displays them in a browser.
The first step in a creating custom Internet procedure is understanding the requirements of an Internet procedure. A BASIC+ stored procedure is an Internet procedure when all of the following are true:
The name of the stored procedure begins with INET_.
The only required parameter of the stored procedure (which must be first) is an HTTP-Request. The user does not pass anything into this parameter explicitly, but other Internet procedures use this parameter to pass things between each other.
The stored procedure is declared as a function and has as its return value is HTML code. (If you looked at the variable returned, it would look like the source code of an HTML page.)
Other parameters are passed as the QUERY_STRING$ field of an HTTP-Request and have to be parsed using the Inet_QueryParam function.
The following example uses a custom Internet procedure that opens up the system table, SYSREPOSTYPES, reads the first 15 records, and outputs them to the browser. While this may be a simple example, it is designed to show how the process works.
1. Go to the System Editor. Type in (or cut and paste) the code that follows below. Then hit F9 to compile. Save as INET_READEXAMPLE.
2. In Form Designer, open the EX_FORM form from the example in Step Four.
3. Add a new button control labeled Ad Hoc Report. In the SUBMIT event for this button, choose the QuickEvent Option Execute a Procedure.
4. In the Send Message To combobox, select the Procedure INET_READEXAMPLE. The Message combobox should contain EXECUTE, and delete any information in the Parameters combobox.
5. Save the form and use the HTML Publisher to convert the modified form into HTML.
From your browser, access the OI Page with a URL that should look something like this: http://websitename/cgi-bin/oicgi.exe/INET_REPOS?DOC_ID=EX_FORM
There will be a new button on the page labeled Ad Hoc. When this button is clicked, the custom Internet procedure will be processed, and the first 15 records of the SYSREPOSTYPES table will be dynamically published to the browser.
======================================
Code for the Example in Step Five
function Inet_ReadExample(request)
declare function Inet_Msg
EOF = 0
count = 0
/* CGI requires a header that tells the web server what type of document this request will be returning to the browser. In this case, the document will be text. In addition, this header must be followed by a carriage return or a line feed, or both. The next line provides this information. */
varhtml = 'Content-type: text/plain':\0A0A\
varhtml←1> = 'A Partial Listing of the Table SYSREPOSTYPES'
varhtml←1> = '(the first 15 entries)':@FM:@FM
* Open the table, read the row, and format the varhtml variable
open 'SYSREPOSTYPES' to hCur else
return Inet_Msg(request, 'An error occurred while trying to open.')
end
select hCur
loop
readnext KeyVal then
count += 1
read Row from hCur, KeyVal then
html←1> = KeyVal:" ": Row<1>:@FM: " ":Row<2>
end
if count = 15 then
EOF = 1
end
end else
EOF = 1
end
until EOF
repeat
/* Change the @FM characters to a linefeed/carriage return. This formats the output data. Note that the beginning of the varhtml variable contains the Content-type info. This must be there for this line implement the linefeed */
convert @FM to \0A\ in varhtml
return varhtml