#!/bin/sh
dialog \
--title "Select monitor class" \
--menu "Please choose the appropriate monitor class.\n(current: $1)" \
21 60 10 \
\
"multisync"        "monitor" \
\
2> /tmp/.monclass 

MON_CLASS=$1
MON_TYPE=$2

NEW_MON_CLASS=`cat /tmp/.monclass`

if [ "$NEW_MON_CLASS" != "" ]; then
  if [ "$NEW_MON_CLASS" = "$MON_CLASS" ]; then
    monitor/$NEW_MON_CLASS/.configure $2;
   else
    monitor/$NEW_MON_CLASS/.configure;
  fi 
  NEW_MON_TYPE=`cat /tmp/.montype`
  if [ "$NEW_MON_TYPE" != "" ]; then
    MON_CLASS=$NEW_MON_CLASS
    MON_TYPE=$NEW_MON_TYPE
  fi
fi

echo $MON_CLASS>/tmp/.monclass
echo $MON_TYPE>/tmp/.montype
