Source
xxxxxxxxxx
cui_checkbox_new "$dlg" "Domain is &active" 13 7 20 1 $IDC_DOMAINDLG_CHKACTIVE $CWS_NONE $CWS_NONE && ctrl="$p2"
#------------------------------------------------------------------------------
# /var/install/bin/cui-vmail-user-domainhandling.cui.sh
# Copyright (c) 2001-2009 the eisfair team, team(at)eisfair(dot)org
#
# 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.
#----------------------------------------------------------------------------
. /var/install/include/cuilib
. /var/install/include/mysqllib-2
#============================================================================
# global constants
#============================================================================
IDC_LISTVIEW='10' # listview ID
IDC_HELPTEXT='11' # help text ID
IDC_DOMAINDLG_BUTOK='10' # dlg OK button ID
IDC_DOMAINDLG_BUTCANCEL='11' # dlg Cancel button ID
IDC_DOMAINDLG_LABEL1='12' # dlg label ID
IDC_DOMAINDLG_LABEL2='13' # dlg label ID
IDC_DOMAINDLG_LABEL3='14' # dlg label ID
IDC_DOMAINDLG_EDNAME='20' # dlg edit ID
IDC_DOMAINDLG_CBTRANSPORT='21' # dlg edit ID
IDC_DOMAINDLG_EDTRANSPORT='22' # dlg edit ID
IDC_DOMAINDLG_CHKACTIVE='23' # dlg edit ID
IDC_INPUTDLG_BUTOK='10' # dlg OK button ID
IDC_INPUTDLG_BUTCANCEL='11' # dlg Cancel button ID
IDC_INPUTDLG_EDVALUE='20' # dlg edit ID
selected_entry=''
show_help="no"
vmail_sql_server="localhost"
vmail_sql_db_name="vmaildata"
vmail_sql_user="vmailprovider"
vmail_sql_pass="vmail"
if [ -e /etc/config.d/vmail ]
then
. /etc/config.d/vmail
vmail_sql_server="$VMAIL_SQL_HOST"
vmail_sql_db_name="$VMAIL_SQL_DATABASE"
vmail_sql_user="$VMAIL_SQL_USER"
vmail_sql_pass="$VMAIL_SQL_PASS"
fi
#============================================================================
# helper functions
#============================================================================
#----------------------------------------------------------------------------
# check if is a valid list index
#----------------------------------------------------------------------------
function p_valid_index()
{
if [ -n "$1" -a "$1" -ge "0" ]
then
return 0
fi
return 1
}
#----------------------------------------------------------------------------
# check if SQL command was successful
#----------------------------------------------------------------------------
function p_sql_success()
{
if [ -n "$1" -a "$1" != "0" ]
then
return 0
fi
return 1
}
#----------------------------------------------------------------------------
# read data from a MySQL database and copy result to the listview window
#----------------------------------------------------------------------------
function load_data()
{
local win="$1"
local ctrl
local myres
# execute query and return result
cui_window_getctrl "$win" "$IDC_LISTVIEW" && ctrl="$p2"
if cui_valid_handle $ctrl
then