/* * Copyright (c) 1999 Rob Quince * Author: Rob Quince * EMail : robq@fiendish.demoncouk * * Permission is hereby granted, without written agreement and without * license or royalty fees, to use, copy, modify, and distribute this * software and its documentation for any purpose, provided that the * above copyright notice and the following two paragraphs appear in all * copies of this software and that no charge is made for the software. * * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE * AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER * IS ON AN "AS IS" BASIS, AND THE AUTHOR HAS NO OBLIGATION TO PROVIDE * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * */ package ramicro.directory; import java.io.*; class ImageViewerHTML { /* * The class creates 3 files in the directory passed * in as args[0] * * 1. contains a frameset consisting of the other * generated files, and is called "index.html" * * 2. a blank document to start with called "blank.html" * * 3. a file containing the JavaScript and HTML that * performs the image display and traversal * called "listing.html" * * The directory listing can be trivially filtered * by specifying the suffices of the desired image * files. These suffices are passed as individual * arguments after the directory name. * */ public static void main(String[] args) { try { FileWriter htmlFile; // Write the frameset "index.html" htmlFile = new FileWriter(args[0] + "/index.html"); htmlFile.write(frameSet); htmlFile.close(); // Start-up file htmlFile = new FileWriter(args[0] + "/blank.html"); htmlFile.write(emptyDoc); htmlFile.close(); // Then the business file Lister dirList = new Lister(args[0], args); htmlFile = new FileWriter(args[0] + "/listing.html"); htmlFile.write(listingPreamble); for (int i = 0; i < dirList.files.size(); i++) htmlFile.write("pics[" + i + "]=\"" + dirList.files.elementAt(i) + "\";\n"); htmlFile.write(listingPostamble); htmlFile.close(); } catch (IOException io) { System.err.println(io); } } // The HTML and JavaScript for the files // is hardcoded below. private static final String frameSet = "" + "\n" + "\n" + "\n" + " \n" + " \n" + " \n" + " \n" + "\n" + "\n" + "\n"; private static final String emptyDoc = "" + "\n" + "\n" + "\n" + "\n"; private static final String listingPreamble = "" + "\n" + "\n" + "\n" + "\n" + "\n" + "
\n" + " \n" + " \n" + " \n" + " \" WIDTH=25>\n" + " >\" WIDTH=25>\n" + "  Slide Show \n" + "
\n" + " \n" + "\n"; }