SIR and the WEB By Dave Doulton University of Southampton.

28
SIR and the WEB By Dave Doulton University of Southampton

Transcript of SIR and the WEB By Dave Doulton University of Southampton.

Page 1: SIR and the WEB By Dave Doulton University of Southampton.

SIR and the WEB

By

Dave Doulton

University of Southampton

Page 2: SIR and the WEB By Dave Doulton University of Southampton.

Agenda

• Setting up the web server

• Using sirweb.cgi

• Writing HTML

• Using Forms

• Conclusion

Page 3: SIR and the WEB By Dave Doulton University of Southampton.

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

Page 4: SIR and the WEB By Dave Doulton University of Southampton.

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

Page 5: SIR and the WEB By Dave Doulton University of Southampton.

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

Page 6: SIR and the WEB By Dave Doulton University of Southampton.

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

Page 7: SIR and the WEB By Dave Doulton University of Southampton.

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

Page 8: SIR and the WEB By Dave Doulton University of Southampton.

• 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

Page 9: SIR and the WEB By Dave Doulton University of Southampton.

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

Page 10: SIR and the WEB By Dave Doulton University of Southampton.

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’

Page 11: SIR and the WEB By Dave Doulton University of Southampton.

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

Page 12: SIR and the WEB By Dave Doulton University of Southampton.

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

Page 13: SIR and the WEB By Dave Doulton University of Southampton.

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

Page 14: SIR and the WEB By Dave Doulton University of Southampton.

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

Page 15: SIR and the WEB By Dave Doulton University of Southampton.

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

Page 16: SIR and the WEB By Dave Doulton University of Southampton.

Writing HTML

• If you change the earlier program to

Program

Write ‘hello’

Write ‘ world’

• You will find the output is the same as before

Page 17: SIR and the WEB By Dave Doulton University of Southampton.

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

Page 18: SIR and the WEB By Dave Doulton University of Southampton.

Writing HTML

• So the program becomes

Program

Write ‘<pre>’

Write ‘hello’

Write ‘world’

Write ‘</pre>

End program

Page 19: SIR and the WEB By Dave Doulton University of Southampton.

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.

Page 20: SIR and the WEB By Dave Doulton University of Southampton.

Writing HTML

• So the program is now

• Call sysproc.tools.htmlcode

• Program

• Write ‘<pre>’

• Write ‘hello’

• Write ‘ world’

• Write ‘</pre>’

• End program

Page 21: SIR and the WEB By Dave Doulton University of Southampton.

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.

Page 22: SIR and the WEB By Dave Doulton University of Southampton.

Writing HTML

• To format the output the way you want check any book on HTML it is all available to you now.

Page 23: SIR and the WEB By Dave Doulton University of Southampton.

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.

Page 24: SIR and the WEB By Dave Doulton University of Southampton.

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>

Page 25: SIR and the WEB By Dave Doulton University of Southampton.

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>

Page 26: SIR and the WEB By Dave Doulton University of Southampton.

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.

Page 27: SIR and the WEB By Dave Doulton University of Southampton.

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.

Page 28: SIR and the WEB By Dave Doulton University of Southampton.

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