19
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

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

Embed Size (px)

Citation preview

Page 1: 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

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

Page 2: 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

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 !

Page 3: 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

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

Page 4: 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

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

Page 5: 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

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

Page 6: 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

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

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

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

Page 8: 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

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 !

Page 9: 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

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.

Page 10: 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

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.

Page 11: 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

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.

Page 12: 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

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

Page 13: 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

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

Page 14: 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

Tricks and Toys

• Browser Issues

• HTML Frames

• JavaScript code reuse

Page 15: 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

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

Page 16: 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

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">

Page 17: 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

JavaScript

• JavaScript adds powerful functionality to your web pages

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

Page 18: 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

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.

Page 19: 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

Contact Me Via Email

Questions ?

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

[email protected]