v2html-cgi 8.23 KiB
#!/usr/local/bin/perl -w
###############################################################################
#
# File: v2html-cgi
# RCS: $Header: v2html-cgi,v 3.1 1999/09/21 18:38:43 cc Exp $
# Description: CGI script for helping v2html generated html
# Author: Costas Calamvokis
# Created: Wed Sep 3 08:52:08 1997
# Modified: Tue Sep 21 11:34:21 1999 (Costas Calamvokis) v2html@burbleland.com
# Language: Perl
#
# Copyright 1998 Costas Calamvokis
# Copyright 1997 Hewlett-Packard Company
#
# This file nay be copied, modified and distributed only in accordance
# with the terms of the limited licence contained in the accompanying
# file LICENCE.TXT.
#
###############################################################################
#
# Currently does:
# Expanding/compressing hierarchies:
# - Takes a query like ?k=9437645&x=XXXXCCXC&in=hierarchy.html
# and generates html of the hierarchy in in accoring to the string
# x, each character in the string x represents one list in the .html
# file which can either be eXpanded or Compressed.
# - After each module it also generates a [X] or [C] link which when
# clicked causes this script to be called again with a new string
# which results in that module being expanded or compressed.
# - This is made much easier by v2html which marks each list that is
# with a candidate for expansion/compression with a
# number when it generates the html code.
#
# only have one file error message to avoid leaking information
# through errors (uncomment the helpful error during debugging)
$file_error_message= "v2html-cgi error.<P>\n";
print "Content-Type: text/html\n\n";
# environment variables that should be set by the web server
&check_input('QUERY_STRING',%ENV);
&check_input('SCRIPT_NAME',%ENV);
&check_input('PATH_INFO',%ENV);
&check_input('PATH_TRANSLATED',%ENV);
# Get the arguements specified in the URL
%args= getcgivars();
# query variables that should be set in the URL
# (eg .. ?k=9999x=CXCX&in=hierarchy.html
&check_input('x',%args);
&check_input('f',%args);
&check_input('in',%args);
&check_input('k',%args);
$k = $args{'k'};
$expand_string =$args{'x'};
$infile = $args{'in'};
$framed = $args{'f'};
# remove the / from script name if it is there
$ENV{'SCRIPT_NAME'} =~ s#^/## ;
# set up the cgi script and path info that we'll put in the expand/compress
# links
$cgi_script_and_path_info= "/" . $ENV{'SCRIPT_NAME'} . $ENV{'PATH_INFO'};