#!/bin/sh
#
# guestmenu.sh - menu for guests (visitors and new users)
#

ISPUTIL="/var/lib/ISPutil"
HOSTNAME=`hostname`
DNSDOMAINNAME=`dnsdomainname`
TITLE="$HOSTNAME.$DNSDOMAINNAME Visitor"
EDITOR="/usr/bin/pico -t"
VISUAL="$EDITOR"
CHAT="/usr/local/bin/vchat -s peak"
FEEDBACK=/usr/bin/feedback
MODEMHOST="god"


DONE=
while [ -z $DONE ]; do
	reset
	dialog --title " $TITLE " \
	--menu   "MAIN MENU" 12 40 5 \
	"BACK"   "Back from menu" \
	"CHAT"   "Online Chat" \
	"HELP"   "Write for help" \
	"LOGIN"  "Change login password" \
	"ONLINE" "See who is online" \
	"X=EXIT" "Exit this menu" 2> /tmp/gmenu.tmp.$$
	if [ $? = 1 -o $? = 255 ]; then
		/tmp/gmenu.tmp.$$
		exit
	fi
	choice=`cat /tmp/gmenu.tmp.$$`
	/bin/rm -f /tmp/gmenu.tmp.$$

        if [ "$choice" = "BACK" ]; then
        DONE=DONE
        fi
        if [ "$choice" = "CHAT" ]; then
        $CHAT
        fi
        if [ "$choice" = "HELP" ]; then
        $FEEDBACK
        fi
        if [ "$choice" = "DISK" ]; then
        /usr/sbin/quota >/tmp/gmenu.tmp.$$
        dialog --title "Disk Quotas" \
        --textbox /tmp/gmenu.tmp.$$ 18 76
        /bin/rm -f /tmp/gmenu.tmp.$$
        fi
        if [ "$choice" = "LOGIN" ]; then
        /usr/bin/passwd
        fi
	if [ "$choice" = "ONLINE" ]; then
	/usr/bin/finger @$MODEMHOST > /tmp/gmenu.tmp.$$
        dialog --title "Users Online" \
        --textbox /tmp/gmenu.tmp.$$ 18 76
        /bin/rm -f /tmp/gmenu.tmp.$$
        fi
        if [ "$choice" = "X=EXIT" ]; then
        DONE=DONE
        fi
done
