www.udel.edu machine may set up a guestbook. A guestbook is
a log which can be used to record user input from an HTML form. Each time a
user presses the submit button all the information they entered on the
form is recorded in the log. Forms designed for this purpose are
called log forms.
The web provider, as the owner of the guestbook log, may at any time generate a in HTML format from this log. Any report in HTML format can be viewed using the localfile feature of a web browser or it can be copied to the public web space for all the world to see.
The guestbook log can also be opened for anybody on the www to read as
they like. Any user with a browser on the network can read all the log
or select entries in the log based on the content of specified fields.
A form can be set up to allow users to selectively look at entries
in the log. Forms designed for this purpose are called
log reading forms.
Reserving a Guestbook Name
All guestbook logs are kept in the same directory, so there can be only
one log with a given name. Names are assigned on a first come first
served basis. To reserve a name a log file must be created. For example,
the command
touch $LOGS/guestbook/rdcomment.logwill create a log file in the proper directory and thus reserve the name. "rdcomment". This command will fail if that name is already in use. If this command succeeds then the file is owned by the web provider user id and can not be renamed by other users.
chmod o+w $LOGS/guestbook/rdcomment.log
From this point on, the name "rdcomment" can be used in the
action of a log form
chmod o-w $LOGS/guestbook/rdcomment.log
Now if a user presses the submit button of a log
form they will get a message indicating that they can not write
to the log file.
action="/cgi-bin/guestbook/signIn/rdcomment"
where "rdcomment" is the guestbook name. When the submit button
in this form is pressed all the information on the form will be
logged in the guestbook named rdcomment, and the user will get
a short confirmation message. The information is logged as
a form data set which is a list of name/value pairs.
In addition to the field names on the form
there are four other names added to the form data set.
name Description of the recorded string
signIn time The current date in format like 1/Jan/1995
signIn date The current time in format like 9:30:15
signIn host The name of the machine running the browser
signIn agent The name and version of the browser.
Even though all the information on the log form is saved, this
guestbook system assumes that each item has it's own name. This
means that TYPE="checkbox" on an input element should
be avoided unless each checkbox has it's own name.
The TYPE="radio" is better since only one button
per name can be checked.
Also the MULTIPLE option or a selection should be avoided
for the same reason.
.reply. This file must be a complete HTML file
with the variables like ${name} in places where information from the form
is to be inserted. The four special signIn names can also be used
variable Description of the substituted string
${signIn time} The sign in date in format like 1/Jan/1995
${signIn date} The sign in time in format like 9:30:15
${signIn host} The name of the machine running the browser
${signIn agent} The name and version of the browser.
This HTML file with these $ variables included is called an HTML template
file and it will be expanded to a complete HTML file by the
guestbook/signIn
action used in the log form.
This allows the reply to include information
the user put on the form. For example, if the form is a short list of
multiple choice questions the .reply file may have the
line like
The answer to question 1 is B and you answered ${answer1}
Once this .reply file is ready it should be installed into
the guestbook log directory with the correct file mode. The following
command will install the HTML template file rdcomment.reply
into the guestbook log directory for use by the rdcomment guestbook.
install -m 604 rdcomment.reply $LOGS/guestbook
guestbook/read which can be put in an
HTML anchor as an href or can be used as an action in a
form designed to let the user read all or a selection of the guestbook
log.
In some cases the guestbook log entries should be kept private.
This is done by removing read access on
guestbook log file. The read script is designed to be run as a
stand-alone script that can be run from a www.udel.edu
account to get a report in HTML format.
Enable log reading
To allow the guestbook/read script to read the
file on behalf of the user on the network, the guestbook log
file must be opened for reading.
chmod o+r $LOGS/guestbook/rdcomment.log
From this point on, any user with a web browser can read the entire
guestbook log either by using an anchor with
href = "/cgi-bin/guestbook/read/rdcomment"
or by using a form with the guestbook/read script as its action.
The form can be constructed to allow selected entries of the guestbook log to
be read.
chmod o-r $LOGS/guestbook/rdcomment.log
The owner of the log file can still generate reports, but a
network users with a web browsers will get a message indicating
that they are not allowed to read the log.
Log reading form
A log reading form can be included in an HTML file by using an
action like
action="/cgi-bin/guestbook/read/rdcomment"
which will read the rdcomment guestbook log. The guestbook/read
script is designed so the form can let the user select the
log entries to be included in a list.
There are four special names that are used in a log reading form
to specify the field to be used in the selection process and the
selection method.
element name element value
field the field used to make the selection
is text to be matched exactly (including case)
contains a pattern used to select by contents
soundslike a word used to select phonetically
If the field name is not present in the form data set then the entire
guestbook will be included on the list. To allow the user to select entries
in the guest book log, one of the
other three element names must also be present. The name used on the
form element determines the selection method used when selecting entries
for the list. Here are some examples of form data sets as present on
the URL query and the coresponding selection criterion.
URL query selection criterion
field=major&is=English major is exactly English
field=question&contains=sas question has the word "sas"
field=name&soundslike=narin name sounds like "narin"
field=signIn+agent&contains=Mozilla agent is Netscape
An element named field must be included to get a selection from the the entire list, but it may be included as a "hidden" input. For example, the two HTML form elements:
<input type="hidden" name="field" value="comment"> <input name="contains">will cause one input box to appear on the form but two names will be included in the form data set. If the user fills this box with the phrase "good job", then the list will have all the entries with "good job" contained in the comment field.
Another way to design a form for selectively reading the guestbook log is to put "field" on the name attribute of the submit element. The value of the element must be the name of the field to be used for the selection process. For example,
<input name="contains""> <input type="submit" name="field" value="topic"> <input type="submit" name="field" value="question">will put one input box and two buttons on the form. If the user presses the button labeled "topic" then the topic field will be searched; if they press the "question" then the question field will be searched.
guestbook/read script
are done using an HTML definition list <dl> markup
command. Each entry in the log starts with a definition term prefixed
with a <dt> tag followed by several
lines with <dd> tags.
The format of each entry can be tailored for different applications
by copying a template file with a .dtdd suffix to
the guestbook log directory. This is just like a
.reply template file except instead
of being a complete HTML files it contains just the <dt>
and <dd> markups necessary to format one
entry. The .dtdd template files still can have the $ variables
to insert information collected from the form and the
signIn action
Once the .dtdd template file is ready it should be copied to
the guestbook log directory so it can be used to generate reports
install -m 604 rdcenter.dtdd $LOGS/guestbook
will install the template file for the rdcenter guestbook log with the
correct file mode.