Chapter 4. Templates for Server Pages

DynaWeb allows you to modify the layout of the major screens of the server by editing HTML files called template files. The sections in this chapter are

Template Files

The template files and the DynaWeb pages whose layout they control are:

err_access.html, err_assert.html err_badindex.html,err_badscript.html, err_badtdir.html,err_bus.html, err_copen.html, err_cread.html, err_fread.html, err_malloc.html, err_nobook.html, err_nocoll.html, err_nofull.html, err_noopen.html, err_notoc.html, err_pointer.html, err_segv.html, err_timer.html, err_unknown.html  



Error messages

http400.html, http401.html, http402.html, http403.html, http404.html, http405.html, http406.html, http407.html, http408.html, http500.html, http501.html, http502.html, http503.html, http504.html  



Standard HTTP error messages

tmpl_booklist.html 


Book lists

tmpl_booktoc.html 


Book TOCs

tmpl_collectionlist.html 


Collection lists

tmpl_directorylist.html  


Directory lists

tmpl_querylist.html 


Query lists

tmpl_queryform.html 


Query forms

tmpl_stylesform.html 


Stylesheet selection forms

All template files are located in the directory /usr/lib/Insight/dweb/servroot/C.

Variables

By using variables in template files, DynaWeb server pages can contain text that is customized. This customized text can include the hostname of the server, the e-mail address of the server administrator, information about collections, results of searches, and other types of information. Table 4-1 lists the variables that can be used in each of the template files.

Table 4-1. Variables in Template Files

Template File

Variables

confirm.html

$DWEB_ADMINISTRATOR
$DWEB_BODYATTRIBUTES
$DWEB_HOST
$DWEB_ORIGINAL_URL
$DWEB_PORT
$DWEB_REQUEST_SIZE
$DWEB_TRANSFORMED_URL

err_*.html

$DWEB_ADMINISTRATOR
$DWEB_BODYATTRIBUTES
$DWEB_HOST
$DWEB_PORT

http*.html

$DWEB_ADMINISTRATOR
$DWEB_BODYATTRIBUTES
$DWEB_HOST
$DWEB_PORT

tmpl_booklist.html

$DWEB_ADMINISTRATOR
$DWEB_BODYATTRIBUTES
$DWEB_BUTTONBAR
$DWEB_COLLECTIONALIAS
$DWEB_COLLECTIONPATH
$DWEB_HITS
$DWEB_HOST
$DWEB_LISTING
$DWEB_PORT
$DWEB_QUERY
$DWEB_SEARCHHITLINE
$DWEB_URL

tmpl_booktoc.html

$DWEB_ADMINISTRATOR
$DWEB_BODYATTRIBUTES
$DWEB_BOOKALIAS
$DWEB_BOOKPATH
$DWEB_BUTTONBAR
$DWEB_COLLECTIONALIAS
$DWEB_COLLECTIONPATH
$DWEB_HITS
$DWEB_HOST
$DWEB_LISTING
$DWEB_PORT
$DWEB_QUERY
$DWEB_SEARCHHITLINE
$DWEB_TITLE
$DWEB_URL

tmpl_collectionlist.html

$DWEB_ADMINISTRATOR
$DWEB_BODYATTRIBUTES
$DWEB_BUTTONBAR
$DWEB_HITS
$DWEB_HOST
$DWEB_LISTING
$DWEB_PORT
$DWEB_QUERY
$DWEB_SEARCHHITLINE
$DWEB_URL

tmpl_directorylist.html

$DWEB_ADMINISTRATOR
$DWEB_BODYATTRIBUTES
$DWEB_DIRECTORY
$DWEB_HOST
$DWEB_LISTING
$DWEB_PORT

tmpl_queryform.html

$DWEB_ADMINISTRATOR
$DWEB_BODYATTRIBUTES
$DWEB_BOOKALIAS
$DWEB_BOOKPATH
$DWEB_HOST
$DWEB_PORT
$DWEB_QUERY
$DWEB_TITLE
$DWEB_URL

tmpl_querylist.html

$DWEB_ADMINISTRATOR
$DWEB_BODYATTRIBUTES
$DWEB_BOOKALIAS
$DWEB_BOOKPATH
$DWEB_HOST
$DWEB_LISTING
$DWEB_PORT

tmpl_stylesform.html

$DWEB_ADMINISTRATOR
$DWEB_BODYATTRIBUTES
$DWEB_HOST
$DWEB_PORT
$DWEB_TEXTSTYLES
$DWEB_TOCSTYLES
$DWEB_URL

The values of the variables are

$DWEB_ADMINISTRATOR 


The value from the configuration file /usr/lib/Insight/dweb/data/config/dynaweb.cfg.tmpl, with one exception. If DWEB_ADMINISTRATOR in the configuration file does not have an embedded @, the value is DWEB_ADMINISTRATOR@DWEB_HOST.

$DWEB_BODYATTRIBUTES 


The value from the configuration file /usr/lib/Insight/dweb/data/config/dynaweb.cfg.tmpl.

$DWEB_BOOKALIAS 


The descriptive name of the book from the collection's booklist.txt file.

$DWEB_BOOKPATH 


The full path to the book. May be used in a hyperlink, but only if what it points to is in a subdirectory of the book directory, for example:

<A HREF=”$DWEB_BOOKPATH/figures/foo.gif”>

This reference to foo.gif isn't allowed, because foo.gif isn't in a subdirectory of $DWEB_BOOKPATH:

<A HREF=”$DWEB_BOOKPATH/foo.gif”>

$DWEB_BUTTONBAR 


Replaced by the full button bar and the search field, if enabled.

$DWEB_COLLECTIONALIAS 


The descriptive name for the collection, from the list in the configuration file /usr/lib/Insight/dweb/data/config/dynaweb.cfg.tmpl.

$DWEB_COLLECTIONPATH 


The full path to the collection.

$DWEB_DIRECTORY 


The directory name for use in tmpl_directorylist.html only.

$DWEB_HITS 


When encountered in the value of $DWEB_SEARCHHITLINE, it is replaced by the number of hits produced by an active search. It is not directly usable by itself.

$DWEB_HOST 


The value from the configuration file /usr/lib/Insight/dweb/data/config/dynaweb.cfg.tmpl.

$DWEB_LISTING 


In templates that list things, this is the listing. There is no way to directly specify what the lines of the listing look like.

$DWEB_ORIGINAL_URL 


Replaced by the original URL that the client asked for.

$DWEB_PORT 


Replaced by the number of the IP port that the server is listening on.

$DWEB_QUERY 


When encountered in the value of $DWEB_SEARCHHITLINE, it is replaced by a string representing the query initiated by the client. It is not directly usable by itself.

In tmpl_queryform.html, this is the actual query from the *.qrs file.

$DWEB_REQUEST_SIZE 


Replaced by the size of the document fragment that the client requested.

$DWEB_SEARCHHITLINE 


If no search is active, $DWEB_SEARCHHITLINE is replaced by an empty string. If there were no hits, it is replaced by the value of the configuration parameter DWEB_SEARCHHITLINE_0. If there was exactly one hit, it is replaced by the value of the configuration parameter DWEB_SEARCHHITLINE_1. If there were more than one hit, it is replaced by the value of the configuration parameter DWEB_SEARCHHITLINE_N. Before $DWEB_SEARCHHITLINE is substituted into the template, it undergoes a substitution pass itself: instances of $DWEB_HITS and $DWEB_QUERY (described above) are replaced.

$DWEB_TEXTSTYLES 


Replaced by a radio button gizmo listing the default text style and any others from the list in the configuration parameter DWEB_ALTTEXTSTYLES.

$DWEB_TITLE 


The title of the book, as determined from the TOC.

In tmpl_queryform.html this is the descriptive name of the query, from the *.qrs file.

$DWEB_TOCSTYLES 


Replaced by a radio button gizmo listing the default TOC style and any others from the list in the configuration parameter DWEB_ALTTOCSTYLES.

$DWEB_TRANSFORMED_URL 


Replaced by the URL containing a large enough DWEB_MAXBYTES configuration parameter value so that the client can actually see the large document fragment once confirmed.

$DWEB_URL 

In tmpl_booklist.html, tmpl_booktoc.html, and tmpl_collectionlist.html, $DWEB_URL is replaced by a canonical URL for the page that is suitable for use in a <BASE> tag.

In tmpl_queryform.html, $DWEB_URL is replaced by the URL for the form's ACTION attribute.

In tmpl_stylesform.html, $DWEB_URL is replaced by the URL containing the specification for the new style sheet.