#! /usr/dt/bin/dtksh

# srinfo:  GUI to display pertinent SunRay config info.
#
# Author:   $Author: bobk $
# Date:     $Date: 2003/07/24 19:07:04 $
# Version:  $Revision: 1.3 $
# Module:   $Id: srinfo,v 1.3 2003/07/24 19:07:04 bobk Exp $


# Load the XU utility functions
. ./xutil.sh

function basic
{
  XUset $TEXT value:"Login Name: $LOGNAME\n   Display: 
${SESSION_SVR}${DISPLAY}\n     Token: $SUN_SUNRAY_TOKEN\nIP Address: $addr"
  XUset $LABEL labelString:"Basic SunRay Information"
}

function xconf
{
  txt=`/opt/SUNWut/bin/utxconfig -l`
  XUset $TEXT value:"$txt"
  XUset $LABEL labelString:"SunRay X Config"
}

function sessions
{
  txt=`/opt/SUNWut/sbin/utsession -p`
  XUset $TEXT value:"$txt"
  XUset $LABEL labelString:"SunRay Sessions"
}

function multihead
{
  txt=`/opt/SUNWut/sbin/utmhadm`
  XUset $TEXT value:"$txt"
  XUset $LABEL labelString:"SunRay Multihead Displays"
}

function gui
{
    typeset widgetWidth=35

    XUinitialize TOPLEVEL GUIph "$@" -title "SunRay Display Info"

    # A column stacking parent
    XUcolumn COL $TOPLEVEL

# create the menu
XUmenubar MB $COL
XUmenusystem $MB \
    INFO "Info" I { \
        MB.BASIC "Basic" B basic \
        MB.XCONF "X Config" V xconf \
        MB.SESS "Sessions" X sessions \
        MB.MH "Multihead" X multihead \
        MB.EXIT "Exit" X exit \
    }

XUlabel LABEL $COL labelString:" " alignment:ALIGNMENT_CENTER

    # The output window
    #XUscrolledtext TEXT $COL \
    XUscrolledtext TEXT $COL \
        rows:15 \
        columns:$widgetWidth \
        editMode:MULTI_LINE_EDIT \
        editable:FALSE
       

    # Make it all visible
    XUrealize $TOPLEVEL

basic

    # Enter the X infinite loop
    XUmainloop
}

addr=`xprop -root | grep _SUN_SUNRAY_CONN_INFO | awk '{print $4}' | awk -F= '{print $2}'`

gui