Implementing and Using the SIRWEB Interface Setup of the CGI script and web procfile Connecting to...

Preview:

Citation preview

Implementing and Using the SIRWEB Interface

• Setup of the CGI script and web procfile

• Connecting to your database using HTML

• Retrieving data using the CGI interface

• Building HTML using VisualPQL

• Tricks and Toys

Setup of the CGI Script

• You will need a working web server to run SIRWEB (i.e. - Microsoft IIS, Microsoft Peer Web Server, Apache Web Server - my testing was done on Apache and IIS)

• Place your CGI script in the CGI-BIN directory on your web server

• The script is ready to be called !

Setup of the Web Procfile

• Keep your procfile close to your CGI script - store the file in the CGI-BIN directory

(this location may cause problems in IIS)

• Your procfile can not have a file extension !

• Remember the full path to the location of your procfile - this path will be used in your PQL code

Connecting to Your Database

• Make explicit connections at all times - you can not guarantee that your database will be open or closed !

• Reusable code can be stored in the procfile to connect to and disconnect from the database

• All connections are made through PQL code called from the CGI interface

Example:

INDEX.HTML<FORM NAME="login" ACTION="cgi-bin/sirweb.cgi" METHOD=POST><INPUT TYPE=HIDDEN NAME="sirapp" VALUE="webproc.cgi.default">Username: <INPUT TYPE=TEXT NAME="userid"><BR>Password: <INPUT TYPE=PASSWORD NAME="passwd"><BR><INPUT TYPE=SUBMIT NAME="action" VALUE="Login"></FORM><BR><BR>

DEFAULT (Procfile Member)programpql connect database "HEART" prefix "K:\ihi\heart\"end program……...programpql disconnect database “HEART”end program

Retrieving Data Using CGI

• Data retrieval is quick and simple with the help of PQL

• Many of your current programs can be easily modified to generate HTML output

• Report destination is a web browser rather than a file

Example:

INCLUDE MEMBER WEBPROC.TOOLS.HTMLCODERETRIEVAL NOAUTOCASESTRING * 50 FULLNAMECOMPUTE FULLNAME = ‘’WRITE (CGI) ‘<HTML>’PROCESS CASESREC IS DEMOGET VARS LNAME FNAME MINTEND RECCOMPUTE FULLNAME = TRIMLR(LNAME) + ‘, ‘ + TRIMLR(FNAME) + ‘ ‘ + TRIMLR(MINT)WRITE (CGI) ‘<H3>’ FULLNAME ’</H3>’COMPUTE FULLNAME = ‘’END CASEWRITE (CGI) ‘</HTML>’END RETRIEVAL

Building HTML

• Your HTML code can be basic or complex

• Java Script and Java Applets can be used

• Style Sheets can be implemented

• Code reuse is a snap !

An HTML form is used to validate a user login via the CGI script. This uses a routine similar to the one used if a user logs in to the system through the DBMS. In addition, the page uses a JavaScript to set a cookie on the user’s system to ensure that the user has been properly authenticated.

HTML forms can be used to gather user input and pass it to a PQL program. The buttons on the forms are set to call the CGI script and include the data typed into the form.

Links are created by the PQL program and they include calls to the CGI and all the necessary parameters to pull the correct patient information.

All tables are created using ifthen structures in the PQL code. Some information may not be displayed if certain conditions are not met.

When the user clicks the logout link, the cookie is removed from the system and the previous cached pages are secured from view.

Tricks and Toys

• Browser Issues

• HTML Frames

• JavaScript code reuse

Browser Issues

• Testing for the HeartBase system was done using Internet Explorer 5.5

• You will experience problems with Internet Explorer versions lower than 5.0 if you are creating links that call and pass variables to the CGI script

HTML Frames

• Frames can be used, but the CGI script will return the results to the frame that called the script unless you specify a target

Example:

<A HREF="http://ind1nt26/cgi-bin/sirweb.cgi?sirapp=webproc.cgi.logout" TARGET="main">

JavaScript

• JavaScript adds powerful functionality to your web pages

• If you use JavaScript, store it in a common place for easy re-use

Example:

write (cgi) '<HTML>'write (cgi) '<HEAD><TITLE>Demographic Information for 'ptname', 'mnum'</TITLE>'include member webproc.cgi.chkloginwrite (cgi) '</HEAD>’

Since all JavaScript code is inserted between the <HEAD> tags in HTML, a common function was written to validate the login and placed in a procfile member called CHKLOGIN.

The code is then included at a common spot in all of the HTML pages that are created by the PQL code.

Contact Me Via Email

Questions ?

Please feel free to contact me. I will be more than happy to share my code.

atbauer@stvincent.org

Recommended