Setting up the web server

Download Report

Transcript Setting up the web server

SIR and the WEB
By
Dave Doulton
University of Southampton
Agenda
• Setting up the web server
• Using sirweb.cgi
• Writing HTML
• Using Forms
• Conclusion
Setting up the web server
• This will vary depending on web software
• E.g. PWS or IIS or Unix apache webserver
• Basically you need to
• set up 3 virtual directories.
• Set the path to SIR software
• Set SIRTEMP and possibly SIRDIR
Setting up the web server
• The directories are
• wwwroot a root for the web directories on
MS defaults to c:\inetpub\wwwroot
• 2 apparent subdirectories of root
• cgi-bin and images
Setting up the web server
• Copy sirweb.cgi into the cgi-bin directory
• Copy red.gif from c:\program
files\sir2002\images into the images
directory
Setting up the web server
• Virtual directories
• Web directories are virtual directories
• They can be any directories and the
structure does not necessarily follow actual
directory structure
Setting up the web server
• For example
• C:\inetpub\wwwroot can be http://host/
• The root of the server
• C:\sir2002 can be http://host/cgi-bin
• Which appears to be a subdirectory of root
Setting up the web server
• In any PQL you use the real filenames to
access files.
• You use the virtual filenames in output that
will be used by the web.
Setting up the web server
• The directories need the correct permissions
these are set up on MS by using the
pws.exe program or by setting the web
sharing properties on the folder property
option.
• Read write and execute are assigned as
needed
Using sirweb.cgi
• Once the directories are set up and the
server is running(start by using admin tools)
• Create a pql file in cgi-bin directory
• Program
• Write ‘hello world’
Using sirweb.cgi
• Open a web browser and type in
• http://host/cgi-bin/sirweb.cgi
?sirapp=sysproc.cgi.runfile
&RUNFILE=hello.pql
Contiguously on the address line
Using sirweb.cgi
• You will get some output.
• You have run your first cgi script using SIR
• The sirapp option specifies a member to run
• The provided options most commonly used
are sysproc.cgi.runfile, runmemb and go
Using sirweb.cgi
• Sysproc.cgi.runfile runs the pql in the file
named by the RUNFILE option
• Note uppercase
• The file must be in the same directory as
sirweb.cgi
Using sirweb.cgi
• Sysproc.cgi.runmemb runs a member specified by
the MEMBER option
• From a procfile specified by the PROCFILE option
• http://host/cgi-bin/sirweb.cgi
?PROCFILE=c:\program%20files\sir2002\sirproc.srp
&MEMBER=cgi.hello
Using sirweb.cgi
• Sysproc.cgi.go runs a member in the cgi
family of sysproc as specified by the sirmem
parameter
• http://host/cgi-bin/sirweb.cgi
• ?sirapp=sysproc.cgi.go
• &sirmem=descrip
Writing HTML
• If you change the earlier program to
Program
Write ‘hello’
Write ‘ world’
• You will find the output is the same as
before
Writing HTML
• Whitespace is condensed to single spaces
• To avoid the we need to use some HTML
(HyperText Markup Language) to mark up
how we want the text. The simplest thing we
can do to solve our problem is to add a
<pre> and </pre> to our program
Writing HTML
• So the program becomes
Program
Write ‘<pre>’
Write ‘hello’
Write ‘world’
Write ‘</pre>
End program
Writing HTML
• Did you spot the problem?
• ‘<pre>’ looks just like a global variable
• Which is not set so produces nothing
• To cure this call sysproc.tools.htmlcode
before the program. This defines HTML
codes to be themselves.
Writing HTML
• So the program is now
• Call sysproc.tools.htmlcode
• Program
• Write ‘<pre>’
• Write ‘hello’
• Write ‘ world’
• Write ‘</pre>’
• End program
Writing HTML
• So far I have just used write to produce
output.
• However there is an attribute cgi which
works better in that if you run the program in
ordinary SIR it produces a file called
sircgi.htm which can be viewed in a browser
but behaves like write in sirweb.cgi.
Writing HTML
• To format the output the way you want
check any book on HTML it is all available to
you now.
Using Forms
• Instead of typing parameters in the address
line one can create a file of html that
includes a form which will submit the
parameters for you.
Using Forms
• For example
<html><body>
<form action=“\cgi-bin\sirweb.cgi” method=get>
<input type=hidden name=sirapp
value=“sysproc.cgi.go”>
Enter member name
<input type=text name=sirmem >
</form></body></html>
Using Forms
• If you change the method to post then the
parameters do not appear on the address
bar.
• If more than one field is present then a
button is needed. Use for example
• <input type=submit value=Go>
Using Forms
• There are all the usual form types available.
• Check box, radio box, text box drop down
selection box.
• Also images that can be clicked returning
positions clicked.
• See examples in the notes.
Conclusion
• With HTML combined with sirweb.cgi the
world is yours.
• Your data is available formatted as you like
to the whole world.
• Data can be input directly from anywhere in
the world.
Conclusion
• Example PQL and HTML can be found at
http://www.soton.ac.uk/~sug/conf2002/pql
And
http://www.soton.ac.uk/~sug/conf2002/html