Title: Implementing and Using the SIRWEB Interface
1Implementing 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
2Setup 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 !
3Setup 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
4Connecting 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
5Example INDEX.HTML ltFORM NAME"login"
ACTION"cgi-bin/sirweb.cgi" METHODPOSTgt ltINPUT
TYPEHIDDEN NAME"sirapp" VALUE"webproc.cgi.defau
lt"gt Username ltINPUT TYPETEXT
NAME"userid"gtltBRgt Password ltINPUT TYPEPASSWORD
NAME"passwd"gtltBRgt ltINPUT TYPESUBMIT
NAME"action" VALUE"Login"gtlt/FORMgtltBRgtltBRgt DEFAU
LT (Procfile Member) program pql connect database
"HEART" prefix "K\ihi\heart\" end
program ... program pql disconnect database
HEART end program
6Retrieving 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
7 Example INCLUDE MEMBER WEBPROC.TOOLS.HTMLCODER
ETRIEVAL NOAUTOCASESTRING 50 FULLNAMECOMPUTE
FULLNAME WRITE (CGI) ltHTMLgtPROCESS
CASESREC IS DEMOGET VARS LNAME FNAME MINTEND
RECCOMPUTE FULLNAME TRIMLR(LNAME) ,
TRIMLR(FNAME) TRIMLR(MINT)WRITE (CGI)
ltH3gt FULLNAME lt/H3gtCOMPUTE FULLNAME END
CASEWRITE (CGI) lt/HTMLgtEND RETRIEVAL
8Building 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 !
9An 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 users system
to ensure that the user has been properly
authenticated.
10HTML 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.
11Links are created by the PQL program and they
include calls to the CGI and all the necessary
parameters to pull the correct patient
information.
12All tables are created using ifthen structures in
the PQL code. Some information may not be
displayed if certain conditions are not met.
13When the user clicks the logout link, the cookie
is removed from the system and the previous
cached pages are secured from view.
14Tricks and Toys
- Browser Issues
- HTML Frames
- JavaScript code reuse
15Browser 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
16HTML Frames
- Frames can be used, but the CGI script will
return the results to the frame that called the
script unless you specify a targetExampleltA
HREF"http//ind1nt26/cgi-bin/sirweb.cgi?sirappwe
bproc.cgi.logout" TARGET"main"gt
17JavaScript
- JavaScript adds powerful functionality to your
web pages - If you use JavaScript, store it in a common place
for easy re-use
18 Example write (cgi) 'ltHTMLgt' write (cgi)
'ltHEADgtltTITLEgtDemographic Information for
'ptname', 'mnum'lt/TITLEgt' include member
webproc.cgi.chklogin write (cgi) 'lt/HEADgt Since
all JavaScript code is inserted between the
ltHEADgt 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.
19Contact Me Via Email
- Questions ?
- Please feel free to contact me. I will be more
than happy to share my code. - atbauer_at_stvincent.org