###########################################################################
#                                                                         #
#               Copyright (C) 1995, Silicon Graphics, Inc.                #
#                                                                         #
#   These coded instructions, statements, and computer programs  contain  #
#   unpublished  proprietary  information of Silicon Graphics, Inc., and  #
#   are protected by Federal copyright law.  They  may  not be disclosed  #
#   to  third  parties  or copied or duplicated in any form, in whole or  #
#   in part, without the prior written consent of Silicon Graphics, Inc.  #
#                                                                         #
###########################################################################

#%COMMENT_BEGIN
# Filename:	vmInfoDlg
# Version:	$Revision: 1.2 $
# Synopsis:	Provides central point from which to determine what objects
#		information was requested upon.  It then realizes dialogs that
#		are capable of displaying the information.
# Functions:	vmInfo:fill
#%COMMENT_END

#########################################
#		Public			#
#########################################
#%COMMENT_BEGIN
# Function:	vmInfo:fill
# Synopsis:	Looks at each object passed in and discards any templates.  It
#		then brings up an information dialog for each type of object.
# Arguments:	- handle	The identifier for the desired instance.
#		- parent	Reserved for future use.
#		- mode		Reserved for future use.
#		- lst		The list of objects for which information was
#				requested.
#%COMMENT_END
proc vmInfo:fill { handle parent mode lst } \
{
	global		_GW_vmi _GD_vmi G_data
	set name	vmInfo

	if {! [llength $lst]} { return }

	if {! [info exists _GD_vmi(initialized)]} {
		set _GD_vmi(initialized) true

		set _GD_vmi(types)	{VOL PLEX VE}
	}

	foreach obj $lst {
		obj:parse $obj o_class o_host o_nm o_type

		if {$o_class == "_TEMPLATE_"} {
			continue
		}
		lappend objs($o_type) $obj
	}

	foreach type $_GD_vmi(types) {
		if {! [info exists objs($type)]} {
			continue
		}
		if {$type == "VOL"} {
			if {! [info exists G_data(source,vmMkVolDlg)]} {
				source $G_data(sourcedir)/vmMkVolDlg
				set G_data(source,vmMkVolDlg) true
			}
			vmMkVol:realize infovol "" info
			if {[vmMkVol:fill infovol $objs($type)]} {
				vmMkVol:manage infovol
			}
		} elseif {$type == "PLEX"} {
			if {! [info exists G_data(source,vmMkPlxDlg)]} {
				source $G_data(sourcedir)/vmMkPlxDlg
				set G_data(source,vmMkPlxDlg) true
			}
			vmMkPlx:realize infoplx "" info
			if {[vmMkPlx:fill infoplx $objs($type)]} {
				vmMkPlx:manage infoplx
			}
		} elseif {$type == "VE"} {
			if {! [info exists G_data(source,vmVeInfoDlg)]} {
				source $G_data(sourcedir)/vmVeInfoDlg
				set G_data(source,vmVeInfoDlg) true
			}
			vmVeInfo:realize infove ""
			if {[vmVeInfo:fill infove replace $objs($type)]} {
				vmVeInfo:manage infove
			}
		}
	}
}
