back to CUD-Sample page

The following is the header portion of the CUD.JS file ..

/******************************************************************************
 * cud.js
 ******************************************************************************
 * JavaScript functions to enable the CUD (ChmUpDate) feature.
 *
 * This CUD file sample is based on the technology presented by Autodesk at
 * the 2003 WinWriters conference.
 *
 * If HTML files are "CUD-enabled," you can add links and messages to the
 * HTML files without making changes to those files by adding data to a CUD
 * file (a tab-delimited file). When used with a CHM, the CUD file is not
 * compiled into the CHM file, which means that you can to some degree, make
 * changes to the CHM without re-compiling. A variant of this implementation
 * of data binding could be used to replace larger amount of content in a CHM,
 * but note that none of the content defined in the external file is available
 * to the Search tab, so you may want to limit its use to links and notes.
 *
 * This feature could be provided for use by end users, or could be used by the
 * company who produced the CHM as a means to update existing content without
 * replacing the actual files. You could set up a mechanism that updates the
 * CUD files on the user's system on a regular basis to add links to updated
 * information. With some modification to the code below, you could also allow
 * for two CUDs per CHM, one for the end user's use and the other for your use.
 *
 * If this feature was to be exposed to end users, it may be desirable to
 * provide some type of user interface to making modifications to the CUD file.
 * However, most people with a reasonable amount of technical expertise should
 * be able to modify a CUD file without difficulty.
 *
 * The CUD file is a tab-delimited file with the following fields:
 *
 *     <curfile>   <newurl>   <linktext>   <linkdesc>   <sortgrp>
 *
 * <curfile>  - The name of the file to add the link to. This is just the
 *              simple filename, as in "filename.htm," no path information.
 * <newurl>   - The URL of the link's target. This can be as simple as another
 *              filename, or it can reference a web site (http://...), other
 *              filesystem location (file:///...), or a topic in another CHM
 *              using the ms-its: or mk:@MSITStore: protocols. The following
 *              are all valid <linktext> values:
 *                test2.htm
 *                http://www.leximation.com
 *                mk:@MSITStore:C:\Projects\sample\sample.chm::/test2.htm
 *                sample.chm::/test2.htm
 *                ms-its:C:\Projects\sample\sample.chm::/test2.htm
 * <linktext> - The text of the link.
 * <linkdesc> - The description that follows the link.
 * <sortgrp>  - Allows for custom sorting of items. The items added to the
 *              table are sorted by <sortgrp> then <linktext>. This field can
 *              be omitted is not needed.
 *
 * Note that the first line of the CUD file must contain the following headers:
 *
 *       curfile	newurl	linktext	linkdesc	sortgrp
 *
 * Because of the use of the TDC object, this is an IE-specific feature. It
 * works in CHMs and non-compiled HTML (as long as that HTML is viewed with
 * IE).
 *
 * Questions or comments .. contact <tools (at) leximation.com>
 *
 * For more information on the TDC (tabular data control) visit MSDN ..
 *
 *    http://msdn.microsoft.com/library/default.asp?url=/workshop/database/tdc/tabular_data_control_node_entry.asp
 *
 * According to the MSDN documentation, these external data files can live on
 * a remote server, but I've never been able to get that to work. If you can,
 * please send an email to the address above!
 *
 * DISCLAIMER/USE: This sample code is provided on an "as-is" basis with no
 * warranties, expressed or implied. You are solely responsible for making
 * sure that it works as expected under all conditions. You are free to make
 * any changes you see fit and to distribute this and any derivative code
 * however it makes sense to do so.
 *
 * Revision History:
 *
 *     09 Feb 2005 - (v.1.0) Initial version by Leximation, Inc. based on
 *                   sample code presented by Autodesk at the 2003 WinWriters
 *                   conference.
 *
 ******************************************************************************
 * Setting up CUD files:
 *
 * 1. Make the following changes to your HTML files:
 *    a. Add references to the CUD.JS and CUD.CSS files into your HEAD tag
 *          <link rel="StyleSheet" href="cud.css" type="text/css">
 *          <script language=javascript src="cud.js"></script>
 *    b. Add the following code into your HTML files at the location you want
 *       the "CUD message" to appear:
 *          <script language=javascript>fnInsertCudCode();</script>
 * 2. Make sure that CUD.JS and CUD.CSS are available to your HTML files.
 * 3. Add content to your CUD file. For CHMs, the CUD filename is the same as
 *    the CHM filename (CHMNAME.CHM => CHMNAME.CUD), if you are using this
 *    with non-compiled HTML, the CUD name is DEFAULT.CUD (although this can
 *    be changed in the CUD.JS file).
 * 4. Modify the value of the cudMessage variable in CUD.JS (optional).
 * 5. Modify the style definitions in CUD.CSS (optional).
 * 6. Modify (carefully) the layout of the HTML defined by the fnInsertCudCode
 *    function in CUD.JS (optional).
 *
 *****************************************************************************/