#!/bin/sh
#
# View documentation
#
# Copyright 2000 Wilmer van der Gaast (lintux@dds.nl)
#

#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

. $WEBSERVE_ROOT/cgi-bin/functions
. $WEBSERVE_ROOT/smart.conf

echo -ne "Content-Type: text/html\\n\\n"

checkrefer
checkparams $*

case "$*" in
	smart )
		cat << EOF
<HTML>
<HEAD>
<TITLE>SMArT documentation</TITLE>
</HEAD>
<BODY BGCOLOR=#C0C0C0>
<TABLE BORDER>
<TR>
<TH COLSPAN=2 BGCOLOR=$HEADER_BACK ALIGN=LEFT>
<TABLE BORDER=0 FRAME=0 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD><IMG SRC="/smart_icon.jpg"></TD>
<TD><FONT COLOR=$HEADER_BACK>-</FONT></TD>
<TH><FONT COLOR=$HEADER_FORE>SMArT documentation</FONT></TH>
</TR>
</TABLE>
<TR>
<TH><A HREF="/cgi-bin/doc?smart_faq">FAQ</A>
<TD>Frequently asked questions about SMArT.
<TR>
<TH><A HREF="/cgi-bin/doc?smart_readme">Read Me</A>
<TD>Some useful (?) information about SMArT.
<TR>
<TH><A HREF="/cgi-bin/doc?smart_install">Installation</A>
<TD>Well, you don't need that file anymore, do you?
<TR>
<TH><A HREF="/cgi-bin/doc?smart_changes">Changes</A>
<TD>Things that have been changed since the previous version.
<TR>
<TH><A HREF="/cgi-bin/doc?smart_todo">To Do</A>
<TD>Things that still have not been changed in this version.
<TR>
<TH><A HREF="/cgi-bin/doc?smart_copying">GPL</A>
<TD>The GNU Public License.
</TABLE>
</BODY>
</HTML>
EOF
;;
	smart_* )
		cat << EOF
<HTML>
<HEAD>
<TITLE>SMART documentation</TITLE>
</HEAD>
<BODY BGCOLOR=#C0C0C0>
<TABLE BORDER>
<TR>
<TH BGCOLOR=$HEADER_BACK ALIGN=LEFT>
<TABLE BORDER=0 FRAME=0 CELLSPACING=0 CELLPADDING=0>
<TR>
<TD><IMG SRC="/smart_icon.jpg"></TD>
<TD><FONT COLOR=$HEADER_BACK>-</FONT></TD>
<TH><FONT COLOR=$HEADER_FORE>Documentation ($*)</FONT></TH>
</TR>
</TABLE>
<TR>
<TD>
<PRE>
EOF
		case "$*" in
			smart_faq ) cat $SMART_DOC/FAQ ;;
			smart_readme ) cat $SMART_DOC/README ;;
			smart_todo ) cat $SMART_DOC/TODO ;;
			smart_changes ) cat $SMART_DOC/CHANGES ;;
			smart_install ) cat $SMART_DOC/INSTALL ;;
			smart_copying ) cat $SMART_DOC/COPYING ;;
		esac | sed -e "s/>/\&gt;/g" -e "s/</\&lt;/g"
		cat << EOF
</PRE>
<TR>
<TH>
<A HREF="/cgi-bin/doc?`echo "$*" | cut -d_ -f1`">SMArT documentation index</A>
</TABLE>
</BODY>
</HTML>
EOF
;;
esac
