DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Writing a SCOadmin manager

Entering the main procedure

After constructing the main screen, the next stage includes checking for authorization, collecting data, and entering the main procedure for event/callback driven processing. ``Template main procedure: Main'' shows the Main procedure used in the SCOadmin template.

Template main procedure: Main

proc Main {} {
	global appvals

# Where are we? set appvals(localhost) [SaHostGetLocalName] set appvals(managedhost) $appvals(localhost)

# Collect command line options ParseCommandLine

# Initialize UI, build main form, present initial view

# Sample who module needs to tweak a few things first if {$appvals(who)} { WhoInit }

UiStart

# Main UI is now presented and Locked # Time-consuming startup operations can now take place with # optional status messages # # Examples: # + check user authorizations # + collect data to populate main form widgets # + populate main form widgets with live data

UiStatusBarSet [IntlLocalizeMsg APP_MSG_INIT]

# Authorizations

set authorized 1

# Sample when using who module if {$appvals(who)} { set authorized [WhoAuthorized $appvals(managedhost)] }

# Canonical error dialog and exit if not authorized if {!$authorized} { UiDisplayNoAuths $appvals(title) $appvals(managedhost) UiMainLoop return }

# Refresh main form data UiRefreshCB

# Set initial focus (list or menu bar) UiSetAppFocus

# Set sensitivity of all main screen ui selection devices UiSensitizeFunctions

# Setup complete # Wait for user events

UiStatusBarClear UiMainLoop }

Authorization

If you want to prevent most users from running your manager without authorization, you should associate your manager with an existing authorization, or create a new one as described in asroot(ADM).

Authorizations can be checked using auths(C) command with the -q option. A standard message can be displayed for insufficient authorization using SaDisplayNoAuths(TCL_ADM). SaDisplayNotRoot(TCL_ADM) is used to generate a similar message when the user must be root to run the manager.

See also:


Next topic: Processing errors
Previous topic: Template main list procedure: UiBuildMainList

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003