#!/bin/ksh
#
#ident	"@(#)home	1.18	05/04/24 SMI"
#
# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# This is the starting point for HCTS test suite.  It is the first page displayed
# after starting the web browser, pointing at the URL of the machine name under test,
# and accepting the copyright notice page (which is simply index.html in the sws
# web server root dir).

# variables
hctsdir=SUNWhcts            # base directory
prgdir=prgs             # program directory
act=                    # action to be taken
bname=`basename $0`     # shell name
gotocgi="http://$HTTP_HOST/cgi-bin/$hctsdir/`basename $0`"      # program name
i=0                     # loop counter
mdir=menu               # menu directory
rdir=results            # results directory
hname=$1                # test system
option=                 # option selected
technology=		# technology selected
fdir=forms              # forms directory
dname=                  # display system
mname=$2
remotemachine=
running=                        # test running status
browser=                        # user browser, default is mozilla

stfile=/tmp/suite.dat
lvfile=/tmp/level.dat

if [ -s $lvfile ]
then
	rm $lvfile
fi

browser=`echo $HTTP_USER_AGENT | grep -i Mozilla/4`
if [ -n "$browser" ]
then
    browser="netscape4"
else
    browser="mozilla"
fi

running=`ps -e | grep staf.eng`

# functions

# do function
go_fun()
{
        $prgdir/funcs "$*" 2>&1
}

### MAIN ###

# change to base directory
cd `dirname $0`
while [ `basename $PWD` != $hctsdir ]
do
        cd ..
done

# parse input
if [ -n "$CONTENT_LENGTH" ]
then
        eval `$prgdir/pq.p`
        CONTENT_LENGTH=
fi

# option page - Display the starting home page, and offer a technology selection button.


if [ -n "$suite" ]; then
	echo "$suite" > $stfile
else
	suite=`cat $stfile`
fi


go_fun bhtml $hname $mname
	echo '<TABLE WIDTH="100%"><TR><TD WIDTH="100%" ALIGN="CENTER">'
	if [ $suite = CC ]; then	
		echo '<FONT SIZE="+2">Controller Certification</FONT></TD>'
	else
		echo '<FONT SIZE="+2">System Certification</FONT></TD>'
	fi
    echo "</FORM></TD></TR></TABLE>"
	echo '<FORM ACTION="'http://$HTTP_HOST/cgi-bin/$hctsdir/tech_check'" METHOD="POST" onSubmit="return checkSerialClients(this);">' #modified by for ksh issue on solaris 10 
	echo '<P><B><U>Select Level of Testing</U></B>'
        echo '<P><select name="level">'
        echo '<option value="L1">Level 1'
        echo '<option value="L2">Level 2'
        echo '</select>'

	if [ $suite = CC ]; then
		echo "<p><br>Select the type of technology for the driver you are testing "
		echo "and click the Continue button.<br>"        

        	echo '<p><b>Network</b><p>'
#the following line is to give the option to enable ipv6 test
		echo '<input type="checkbox" name="ipv6" value="ipv6" > Enable IPv6 Certification<br><br>'

        	echo '<input type="radio" name="option" value="fast"> Fast Ethernet<br>'
        	echo '<input type="radio" name="option" value="gigabit"> Gigabit Ethernet<br>'

        	echo '<p><b>Storage</b><p>'
        	echo '<input type="radio" name="option" value="raid"> RAID<br>'
        	echo '<INPUT TYPE="radio" name="option" value="scsi"> SCSI<br>'
        	echo '<input type="radio" name="option" value="fibre"> Fibre Channel<br>'
        	echo '<input type="radio" name="option" value="usbdisk"> USB Hard Drives<br>'
        	echo '<input type="radio" name="option" value="sata"> SATA<br>'

        	echo '<p><b>Serial</b><p>'
        	echo '<input type="radio" name="option" value="saip"> SAI/P<br>'
		echo "Enter ppp-client name:"
		echo '<INPUT TYPE="text" NAME="remotemachine" value="" SIZE=15>&nbsp&nbsp(Use commas to indicate multiple clients. For example: client1,client2) <br><br>'
		
	elif [ $suite = SC ]; then
		#add for motherboard certification 
		echo '<p><input type="radio" name="option" value="system"> <b>System</b>'
		echo '<br>Choose optional devices connected to the sytem under test:<br>'
		echo '<input type="checkbox" name="zoption" value="zip"> Zip Drive<br><br>'
		echo '<p><input type="radio" name="option" value="motherboard"> <b>Motherboard</b><br><br>'
		#end add
#		echo '<input type="checkbox" name="coption" value="cdrom" checked> CD-ROM Drive<br>'
#		echo '<input type="checkbox" name="toption" value="tape"> Tape Drive<br>'
#		echo '<input type="checkbox" name="foption" value="floppy"> Floppy Drive<br>'
	fi
		
       	echo '<input type="hidden" name="act" value="technology">'
       	echo '<input type="hidden" name="technology" value="'$technology'">'
       	echo '<input type="hidden" name="hname" value="'$hname'">'
       	echo '<input type="submit" value="Continue">'
        echo "</FORM>"
go_fun ehtml


