/*****************************************************************************/ /* HyperShelf.c A CGI-compliant script. Can be supported by any server that supplies the CGI variables listed below. PAGE LAYOUT ----------- Page layout and colouration may be specified via the appropriate command-line qualifiers (or corresponding logical/symbol name). Defaults apply for any not specified. See "Qualifiers" section below, and also about the logical name or symbol "HYPERSHELF$PARAM". An example of changing the page colour to white and the banner to red! /PBGCOLOR="#ffffff" /PHBGCOLOR="#ff0000" Don't like explicitly setting a browser's colours? A colour may be disabled by setting it to empty. The following example disables all colours. /PBGCOLOR/PBBGCOLOR/PHBGCOLOR/PHTEXT/PLINK/PTEXT/PVLINK The script can format a page in either of two layouts. 1. Tables are used to create a coloured header and button bar (DEFAULT). Default colours are white page with grey heading and button outlines. 2. Textual header, horizontal rules and a textual button bar. No default colours. Select other than the default using the following: /PLAYOUT=2 Local information may be included in the header. For layout 1 this should be integrated with the
"-
"WASD | "
This is an example of providing a local graphical logo:
/PHLOCAL="" Such local information with layout 2 is included immediately before the header information at the top of the page. Button labels are customizable (potentially to non-English language). They comprise a label, equate symbol and URL-style path suitable for creating a link. Multiple buttons are separated using the semicolon. Note that any such button customization must provide escaped HTML-forbidden characters in the button label and URI-forbidden characters in the path! The backslash character, "\", escapes characters, including the button-delimitting "=" and ";". There are defaults, see DEFAULT_BUTTONS. Here is an example of changing the button labels: /BUTTON="Close;Help=/hypershelf/-/help.html" Always have the equivalent of "Close" for the first button! Additional buttons may be created by adding "label=path;" elements to the button string. In this way an additional information page could be referenced as follows: /BUTTON="Close;Help=/hypershelf/-/help.html;Other VMS=/vms/" DIFFICULTY FITTING ALL THESE QUALIFIERS INTO A COMMAND LINE OR LOGICAL? Use an existing, or create a new, DCL wrapper procedure for the script (same name and directory) and build up a DCL symbol to provide the information. Up to 1024 characters can be included in this way. For example: $ HYPERSHELF$PARAM = "/BUTTON=""Close;Help=/hyperreader/-/help.html""" $ HYPERSHELF$PARAM = HYPERSHELF$PARAM + "/PBGCOLOR/PLINK/PVLINK" $ HYPERSHELF$PARAM = HYPERSHELF$PARAM + "/PHLOCAL="" | ... | """ $ RUN WASD_EXE:HYPERSHELF AND REMEMBER ... HyperShelf can be used as a CGIplus script. This may require the script to be purged from the server before new startup parameters come into effect. Use a command like the following: HTTPD /DO=DCL=PURGE ABOUT HYPERSHELF ---------------- Emulates the "Bookshelf Navigation Utility" (BNU) of 1997ff on-line documentation CD releases, and the Bookreader shelf navigation capability of earlier times. It has some additional capabilities not found in either, the ability to provide access to PostScript, plain-text documents and PDF documents. Page colouration may be specified via the appropriate command-line qualifiers (or corresponding logical name). Defaults for any not specified. Specifiy as /BLAH="" to NOT specify the corresponding colour (i.e. leave it to the browser). Server mapping must include rules for all file paths (devices) which have shelves residing on them. This script munges VMS file paths into URL-style equivalents. For example: DISK$AXPDOCSEP971:[DATABASE]D39QAAA8.BKB would be represented as /disk$axpdocsep971/database/d39qaaa8.bkb Therefore the server must map the "/disk$axpdocsep971/*" into the VMS equivalent, and of course all file paths that can possibly be returned. Actual a useful rule for all BNU CDs is (depending on your architecture): pass /disk$axpdoc* /disk$axpdoc* pass /disk$vaxdoc* /disk$vaxdoc* Thanks to Jeff Goodwin of Fairchild Semiconductor for these VMS Apache mappings AliasMatch ^/disk\$axpdoc(.+) /disk$axpdoc$1 AliasMatch ^/disk\$vaxdoc(.+) /disk$vaxdoc$1 Digital Bookreader supports Bookreader format documents. Digital BNU (currently) supports Bookreader and HTML documents. WASD Hypershelf supports both plus the following extensions; PostScript, plain- text and Adobe PDF documents. It does not support Bristol HyperHelp. Note that the Hypershelf extensions are preceded by two comment characters, either "##" (as in the example) or "!!". The prevents the BNU from barfing on them. If a title is the same as the previous entry (or is missing altogether) the document title becomes a description of the document type. For examples of how they behave do a http:///hypershelf/wasd_root/exercise/library.odl http:///hypershelf/wasd_root/exercise/library.decw$bookshelf HYPERSHELF EXTENSIONS (see examples for examples) --------------------- ##post PostScript document ##plain plain-text document ##pdf Adobe Portable Document Format ##url relative or full Web URL (e.g. 'http://the.host.name/library/') EXAMPLE BNU SHELF (extension: .ODL) ----------------- Title VMS Hypertext Services Library (BNU version!) book /wasd_root/doc/htd/htd.decw$book Technical Overview html /wasd_root/doc/htd/htd_0000.html Technical Overview ##post /wasd_root/doc/htd/htd.ps Technical Overview ##plain /wasd_root/doc/htd/htd.txt Technical Overview ##pdf /wasd_root/doc/htd/htd.pdf Technical Overview book /wasd_root/doc/env/env.decw$book Hypertext Environment html /wasd_root/doc/env/env_0000.html Hypertext Environment # don't have to specify the title for the same document but different type ##post /wasd_root/doc/env/env.ps ##plain /wasd_root/doc/env/env.txt book /wasd_root/doc/sdm2htm/sdm2htm.decw$book SDML to HTML Converter html /wasd_root/doc/sdm2htm/sdm2htm_0000.html SDML to HTML Converter ##post /wasd_root/doc/sdm2htm/sdm2htm.ps SDML to HTML Converter book /wasd_root/doc/menu_primer/menu_primer.decw$book Menu Primer html /wasd_root/doc/menu_primer/menu_primer_0000.html Menu Primer ##url http://the.host.name/library/ The Host Name Library ##url /docs/ Local Server Documents EXAMPLE BOOKREADER SHELF (extension: .DECW$BOOKSHELF or .BKS) ------------------------ title\\VMS Hypertext Services Library (Bookreader version!) book\wasd_root:[doc.htd]htd\Technical Overview ##html\wasd_root:[doc.htd]htd_0000.html\ ##ps\wasd_root:[doc.htd]htd.ps\ ##plain\wasd_root:[doc.htd]htd.txt\ ##pdf\wasd_root:[doc.htd]htd.pdf\ book\wasd_root:[doc.env]env\Hypertext Environment ##html\wasd_root:[doc.env]env_0000.html\ ##post\wasd_root:[doc.env]env.ps\ ##plain\wasd_root:[doc.env]env.txt\ book\wasd_root:[doc.sdm2htm]sdm2htm\SDML to HTML Converter ##html\wasd_root:[doc.sdm2htm]sdm2htm_0000.html\ ##ps\wasd_root:[doc.sdm2htm]sdm2htm.ps\ book\wasd_root:[doc.menu_primer]menu_primer\Menu Primer ##html\wasd_root:[doc.menu_primer]menu_primer_0000.html\Menu Primer ##url\http://the.host.name/library/\The Host Name Library ##url\/docs/\Local Server Documents BNU OR BOOKREADER BEHAVIOUR? ---------------------------- HyperShelf adjusts it's behaviour according to the shelf file it is given in the path. If the file has a type of .ODL it is considered to be in BNU shelf format (see above). Any other type (e.g. .BKS or .DECW$BOOKSHELF) it considers to be in Bookreader format (again, see above). If a path to a shelf is not provided HyperShelf looks into the environment for the DECW$BOOK and DECW$BOOKSHELF logicals. If it finds DECW$BOOK it considers it is a Bookreader environment and BNU is not in use. It they are not found it considers it a BNU environment. To specify a default BNU library for when none is supplied in the path use the /LIBRARY qualifier in a script support procedure. In a Bookreader environment HyperShelf will open any library specified by DECW$BOOKSHELF (or libraries if it has multiple translations). If not defined it searches for a file using DECW$BOOK:LIBRARY.* The first found will become the default library. This will select all libraries (Digital and third party) if DECW$BOOK is defined with multiple translations. The first library encountered is expanded to display it's contents. Subsequent libraries have a shelf link created for them with information appended to the description indicating it is a library. The use of search lists can considerably extend library access (search) times, particularly when slow CD-ROM readers, InfoServers or DECnet/FAL is involved. A faster alternative is to incorporate references to these in an explicit DECW$BOOKSHELF logical. The BNU environment does not use logical names or logical search lists. Everthing appears to be "hard-wired" into the shelves in a URL-style or Unix-style file path (understandable when you consider part of the BNU viewing environment is a browser (Netscape Navigator)). If HyperShelf is not supplied with a path to an ODL shelf it will search for one of those listed in 'OdlShelfDefaults' storage below. The qualifiers /BNU and /BOOKREADER can be used to force one behaviour or the other. SPECIFYING SHELVES ------------------ Shelves are specified in one of four ways, with the indicated precedence. 1. ?file= .......... request query string form field (VMS file spec) 2. /path/to/file ... path into VMS file spec via WWW_PATH_TRANSLATED 3. /LIBRARY= ....... HYPERSHELF script qualifier (VMS file spec) 4. no path ......... DECW$BOOK, DECW$BOOKSHELF, BNU default libraries OSU ENVIRONMENT --------------- Script responses are returned in OSU "raw" mode; the script taking care of the full response header and correctly carriage-controlled data stream, text or binary!! Uses the CGILIB.C to engage in the dialog phase generating, storing and then making available the equivalent of CGI variables. To use the executable directly (no wrapper procedure), as in http://the.host.name/htbin/hypershelf Define a system-wide logical during server startup $ HYPERSHELF_PARAM = - "/buttons=""Close;Help=/wasd/runtime/hypershelfhelp.html""" +- "/icons=""/wasd/runtime""" $ DEFINE /SYSTEM HYPERSHELF$PARAM HYPERSHELF_PARAM APACHE CGI ENVIRONMENT ---------------------- To use the executable directly (no wrapper procedure), as in http://the.host.name/cgi-bin/hypershelf Define a system-wide logical during server startup $ HYPERSHELF_PARAM = - "/buttons=""Close;Help=/wasd/runtime/hypershelfhelp.html""" +- "/icons=""/wasd/runtime""" $ DEFINE /SYSTEM HYPERSHELF$PARAM HYPERSHELF_PARAM CGI VARIABLES ------------- Server generated ... WWW_HTTP_IF_MODIFIED_SINCE if "304 Not modified" are desired (optional) WWW_HTTP_PRAGMA "no-cache" (optional) WWW_HTTP_REFERER "close" button becomes active WWW_PATH_INFO URL path to shelf WWW_PATH_TRANSLATED VMS file specification for shelf WWW_REQUEST_METHOD "GET" only is supported WWW_SCRIPT_NAME path to script WWW_SERVER_CHARSET default character set of server WWW_SERVER_NAME host on which the script is executing WWW_SERVER_SOFTWARE HTTPd identifying string HyperShelf generated ... WWW_FORM_FILE VMS file name for shelf (when path cannot be supplied) WWW_FORM_REFERER overrides the HTTP_REFERER URL WWW_FORM_TITLE explicit title of book QUALIFIERS ---------- /BOOKREADER Bookreader is the default shelf processor /BNU Bookshelf Navigation Utility is the default shelf processor /BUTTONS= string containing button names /CHARSET= "Content-Type: text/html; charset=...", empty suppresses charset /DBUG turns on all "if (Debug)" statements (don't use with OSU) /HYPERREADER= name of 'HyperReader' script (defaults to "/hyperreader") /ICON= path to icons /LIBRARY= specifies the default library (shelf) file (VMS path) /[NO]ODS5 control extended file specification (basically for testing) /PRINT= name of 'Print' script (optional) /PBACKGROUND= background image path /PBGCOLOR= background colour /PBBGCOLOR= button background color /PBBORDER= width of button border /PHBGCOLOR= heading background color /PHBORDER= width of heading and button-bar border /PHLOCAL= local information to be included in header /PHTEXT= heading text colour /PLAYOUT= 1 is coloured header & buttons, 2 is text & horizontal rules /PLINK= link colour /PTEXT= text colour /PVLINK= visited link colour LOGICAL NAMES ------------- HYPERSHELF$DBUG turns on all "if (Debug)" statements HYPERSHELF$PARAM equivalent to (overrides) the command line parameters/qualifiers (define as a system-wide logical) HTTPD$GMT timezone offset from Greenwich Mean Time (e.g. "+09:30" and only needed if DTSS is not in use) BUILD DETAILS ------------- See BUILD_HYPERSHELF.COM procedure. COPYRIGHT --------- Copyright (C) 1996-2005 Mark G.Daniel This program, comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the conditions of the GNU GENERAL PUBLIC LICENSE, version 2. VERSION HISTORY (update SOFTWAREVN as well!) --------------- 10-MAY-2005 MGD v4.7.8, SWS 2.0 ignore query string components supplied as command-line parameters differently to CSWS 1.2/3 23-DEC-2003 MGD v4.7.7, minor conditional mods to support IA64 27-APR-2003 MGD v4.7.6, change DEFAULT_ICON to all lower-case for CSWS 12-APR-2003 MGD v4.7.5, link colour changed to 0000cc 20-AUG-2002 MGD v4.7.4, allow for HTTP/1.1 'Cache-control:' field used by Mozilla variants (instead of HTTP/1.0 'pragma:') 15-AUG-2002 MGD v4.7.3, make MFD ('000000') suppression WASD-only 30-JUN-2002 MGD v4.7.2, bugfix; link path in ProcessShelf() 01-JUL-2001 MGD v4.7.1, add 'SkipParameters' for direct OSU support 28-OCT-2000 MGD v4.7.0, use CGILIB object module 31-AUG-2000 MGD v4.6.0, add URL as bookshelf entry type (good suggestion Gerry..Czadowski@@nav-international..com) 18-JAN-2000 MGD v4.5.0, support extended file specifications (ODS-5) 07-AUG-1999 MGD v4.4.0, use more of the CGILIB functionality 24-APR-1999 MGD v4.3.0, use CGILIB.C, standard CGI environment (Netscape FastTrack) 02-OCT-1998 MGD v4.2.0, provide content-type "; charset=..." 27-AUG-1998 MGD v4.1.1, iteratively translate DECW$BOOK translations 08-AUG-1998 MGD v4.1.0, refinements in shelf and library parsing, OSU output processing reworked, bugfix; TimeSetTimezone() 'Seconds' unsigned->signed 06-AUG-1998 MGD v4.0.2, accomodation for OSU ... reduce HTTP response header carriage control from
\n",
PageScheme[PS_HEADBORDER],
PageScheme[PS_HEADBORDER],
PageScheme[PS_HEADBGCOLOR]);
if (ButtonCount == 0 || !Top1Bottom2)
fprintf (stdout, " \n");
else
{
fprintf (stdout,
"
|
\n", PageScheme[PS_HEADLOCAL], HtmlTitle); } else { fprintf (stdout, "
\n\
\n\
%s\n\
\n\
\ \n\ *HyperReader\n\ \n\ | %s