Using htmlHost with the Impression CCT
Logicdriven recommends using htmlHost, a tool that combines a localhost web server with an instance of Internet Explorer, as a previewing application. This document describes how to use htmlHost as a previewing tool with the Impression Content Creation Tool.
Previewing Mechanics
To preview a lesson or storyboard using the CCT, the CCT must pass the lesson XML object and the media path to the hosting application. The CCT does this by performing the following actions:
- The CCT saves a copy of the currently selected lesson as an XML file located in the user's temp directory, optimizing the file as specified in the content database's project properties.
- The CCT detokenizes the Preview Command field as entered in the General tab of the Project Properties dialog.
- The CCT then launches the executable file specified in the
detokenized field, passing three arguments:
- The name of the XML file
- The media path
- The window handle (hWnd) of the CCT
Once these steps are complete, the CCT resumes normal program execution. Note that the CCT does not wait for the previewing application to close, nor does it delete the generated copy of the lesson XML.
Previewing with htmlHost
The htmlHost tool, starting with version 4, includes explicit support for working as a runtime hosting utility (RHU) for the CCT.
htmlHost automatically switches to RHU mode when three parameters (corresponding to the three arguments passed by the CCT) are discovered on the command line. If the parameters are valid RHU parameters, RHU mode is enabled. To be valid, The command line parameters must:
- Consist of exactly 3 parameters (ignoring information passed from the server instance to the client)
- The first parameter must identify a file that exists in the disk filesystem.
- The third parameter must be a 32-bit integer.
Note that the second parameter (the media path) is not validated, since the CCT cannot guarantee that the media path identified for the specific lesson to be previewed is valid.
When running in RHU mode, htmlHost begins by serving the initial file specified in the [RHU] section of the .INI file; this file's location is used as the root for serving most files. When the initial file is first loaded, htmlHost creates a querystring value (accessible from the JavaScript via thewindow.location.search string) containing GUID values that are used as placeholders for the lesson XML file and the media path passed from the CCT. The querystring is appended to the initial URL before the client window or external browser is opened.
Note:
The actual filenames are NOT passed to the HTML page, only the substituted GUIDs are passed. If the actual files were passed, the runtime would attempt to load these files from disk. Since the runtime is running from localhost, attempting to access the local filesystem would cause a sandbox violation error. When using htmlHost as a runtime hosting utility, any variables in your code that reference the media path or the lesson XML file will contain these GUIDs.
When htmlHost receives a request containing one of these GUIDs, the lesson XML file or media path (depending on the GUID used) is retrieved and used to service the request. Note that both GUIDs are prepended with a slash (/) character, and htmlHost considers the slash character to be part of the GUID.
In RHU mode, htmlHost will delete the passed lesson XML file if the option is set in the .INI file. If enabled, the file is moved to the Recycle Bin; it can be retrieved if necessary.
Complete htmlHost documentation is available by running htmlHost without any arguments and without a startup file (hold down SHIFT while launching if necessary). The latest version of htmlHost is available for download from the Impression LCF support page.