cT and Mosaic


Using cT as an external viewer in Mosaic

It is possible to use cT as an external viewer for documents selected in Mosaic. Put another way, you can use Mosaic as an application launcher, and with a little work, the cT executor can be launched to view cT compiled binary files. This is a handy feature of Mosaic, because it allows you to have one generic interface to organize a wide variety of materials.

Configuring the X11 version of Mosaic

How do you configure Xmosaic to launch the cT executor for the appropriate documents? There are several steps involved, some to be performed by the person writing the HTML pages that will reference some cT binary files, and some to be performed by every user of Mosaic that wants the cT executor to be launched for viewing those same binary files:

  1. Create an experimental MIME type. Without getting into all the details of what MIME is really for, for this purpose you can simply think of it as a way of categorizing the kinds of external viewers you may want to launch from programs like Mosaic. It is best if all users of MIME types create names in a consistent way. There are some official ones with predefined meanings, but you are allowed to create experimental unregistered ones. I'm proposing that the MIME type for cT binary files should be application/x-ct. It doesn't really matter whether the Mosaic user or the HTML page writer does this, although consistency is desireable.

  2. The person writing the HTML pages must decide on a common filename extension to use, and which Mosaic users expect to look for, ie: one that does not change for versions of cT running on different platforms. Given the naming convention in use already, I'm proposing ctb as that common filename extension for cT binary files. Note that this doesn't mean that the Unix versions of cT need to change their current default filename extensions for generated binaries (eg: decmips.ctb on the DECstation versions of cT), but it does mean that we need to rename files or create links that allow us to use a consistent naming scheme for cT binaries named in HTML pages.

  3. Every user of Mosaic needs to add the information from steps 1 and 2 to a file called .mime.types in your $HOME directory. The following single-line file would do the job:

    application/x-ct      ctb
    
  4. Every user of Mosaic needs to know the exact commands to start the cT executor with a particular binary file. How you do this will depend on how you've installed cT at your site.

  5. Every user of Mosaic needs to add the information from steps 1 and 4 to a file called .mailcap in their $HOME directory. For MIT users of the Athena computing environment, the following single-line file will work:

    application/x-ct;   attach ct\; /mit/ct/`machtype`bin/cTx %s \; sleep 60
    

    From what I've been able to see, the use of the sleep command gives Mosaic time to finish the hand-off to cT of the temporary binary file it retrieved. Your mileage may vary.

    Important Note: For Athena users, until further notice, use the ct_new locker and ctexec script in your .mailcap file, and not ct and cTx as shown above. Those names will apply when I make the new and reorganized ct locker available towards the end of August 1994.

  6. The person writing the HTML files must name the cT binary files in accordance with step 2, and refer to them appropriately whenever they create an anchor (ie: a link) to those files. Here is an example of such an anchor:

    <a href="file://localhost/mit/mylocker/www/sample.ctb">A sample file</a>
    

    Mosaic will be expecting to find a file actually named sample.ctb in the indicated location, which in this particular example would only work if the locker mylocker was attached.

    There is an extremely important limitation that the HTML writer must be aware of at this point. When you create the anchor, you must use either file or ftp URLs. These are the only two types of file access that allow the Mosaic WWW client to determine the mime type of a file. For other kinds of URL, like http or gopher, it is the server that determines the mime type. This means that you can't add support for a new mime type unless you run your own server. Use file or ftp URLs instead, and avoid relative URLs.

  7. Finally, if you have binary files for a variety of Unix platforms, then the writer of the HTML document must have some way dealing with the fact that the binary format of cT files is different on (for example) DECstations and Suns. I only know of three ways to address this:
    1. Provide access to the source files instead of binary files, and invoke the cT authoring environment instead of the executor.
    2. Provide separate links to the different types of binaries, and instruct users to select the binary appropriate for the type of computer that they are using Mosaic and cT on.
    3. If you use the Andrew File System (AFS) then you can use a collection of @sys links to automatically select the correct type of binary file. If you do this, then users absolutely must use Mosaic access the files locally, and not through an HTTP server. Otherwise they'll retrieve the type of binary file suitable for the machine type of the HTTP server, which might not be suitable for the end user sitting in front of an entirely different kind of Unix workstation.

    At this point in time, I suspect that the second option is the best one, since it lets you provide suitable cT binaries to users of any type of computer that has both cT and Mosaic (or a comparable WWW client). It also has the potential for letting you provide access to cT binaries for Mosaic users across the Internet, which option 3 would not support. However, for Athena users (such as faculty) only wanting to provide access for other Athena users, the third option might be the best.

Configuring the Mac version of Mosaic

I haven't tested this myself, but the process is essentially the same as for configuring Xmosaic, except that instead of creating the .mime.types and .mailcap files, you configure the Mac Mosaic preferences to contain this information. Go to the Options menu, select Preferences..., and then click on Helper Applications.... On the left-hand side of the dialog you place the information:

CTB -> application/x-ct
and on the right-hand side you place the information:
application/x-ct -> cT Executor 2.0

Remember, unless the Mac user is accessing a copy of a cT binary file sitting on their own machine, or unless you (as an HTML document creator) have an anonymous ftp server available so that you can use ftp URLs to provide access to your cT files, Mac Mosaic won't start up the cT Executor to view the selected file, it will simply download it instead. Of course, once the file is downloaded, if the Mac user then uses Mosaic to open the file locally, the cT Executor should be invoked as an external viewer.

Configuring the Windows version of Mosaic

This is definitely uncharted territory on my part. Since there isn't a Windows version of cT, I suspect you'd need to test to see if you could launch the DOS version of cT from within Mosaic.

Let me try it!

Here is an example that should work for MIT Athena users if you are on a DECstation Ultrix machine, and if you create the .mime.types and .mailcap files as discussed earlier. Make sure you restart Mosaic after creating those files. By selecting the sample file you will invoke version 2.0 of the cT executor. This link was designed so that when in the future we use Solaris and RS/6000 versions of cT, you would get the correct version of the binary automatically.


Last modified: 94/08/03 (reidmp@mit.edu)