home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
corpmanvie.tcl
< prev
next >
Wrap
Text File
|
1996-11-28
|
15KB
|
578 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1996
#
# File: @(#)corpmanvie.tcl /main/hindenburg/30
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)corpmanvie.tcl /main/hindenburg/30 28 Nov 1996 Copyright 1996 Cayenne Software Inc.
# Start user added include file section
require "repdbms.tcl"
require "repinfosec.tcl"
require "repnewdial.tcl"
require "repdeleted.tcl"
require "repchanged.tcl"
require "csentrydia.tcl"
require "repoptimdi.tcl"
require "repbackupd.tcl"
require "represtore.tcl"
# End user added include file section
require "reptoolvie.tcl"
Class CorpManView : {RepToolView} {
method destructor
constructor
method initialize
method selectedObjSet
method selectionChanged
method update
method updateRepositories
method selectRepository
method setRepository
method reload
method setFont
method getFont
method fileNew
method fileDelete
method fileOpen
method fileChangeName
method fileChangeServerEntry
method fileOptimize
method fileBackup
method fileRestore
method optionsArchiveCmd
method optionsUnarchiveCmd
method helpOnContext
attribute selectError
attribute repositories
attribute info
attribute infoSection
attribute newDialog
attribute deleteDialog
attribute changeDialog
attribute changeEntryDialog
attribute optimDialog
attribute backupDialog
attribute restoreDialog
}
method CorpManView::destructor {this} {
# Start destructor user section
# End destructor user section
$this RepToolView::destructor
}
constructor CorpManView {class this name} {
set this [RepToolView::constructor $class $this $name repcorp]
$this setTitle "Corporate Management" rep_corp_64
$this infoSection [RepInfoSection new $this]
$this firstExposed "$this initialize"
# Create main interface part.
#
interface DlgColumn $this.gui.col {
HorSeparator h {
}
DlgRow reps {
spaceType NONE
verStretchFactor 0
verShrinkFactor 0
Label l { text "Repository:" }
OptionMenu reps {
horStretchFactor 100
justification CENTER
entrySet "<none>"
}
}
MultiLineText info {
verStretchFactor 100
verShrinkFactor 100
editable 0
columnCount 80
rowCount 24
}
}
$this repositories $this.gui.col.reps.reps
$this info $this.gui.col.info
[$this info] font [m4_var get M4_font -context repcorp]
[$this repositories] selectionChanged "$this selectionChanged"
return $this
}
proc CorpManView::repToolClass {} {
return "CorpManView"
}
method CorpManView::initialize {this} {
busy {
set selected "<none>"
# No level path should be set at this point.
#
catch {set cc [ClientContext::global]}
catch {set cc [ClientContext::global]}
# Set the client context based on passed levelPath options.
# Be careful about finding the selected repository name.
#
if {[$this levelPathIds] != ""} {
if [catch {
$cc setLevelIds [$this levelPathIds]
set corp [$cc currentCorporate]
if ![$corp isNil] {
set selected [$corp name]
}
} error] {
$this error $error
}
} elseif {[$this levelPath] != ""} {
if [catch {$cc setLevelPath [$this levelPath]} error] {
$this error $error
}
regexp {^/([^/]*)} [$this levelPath] dummy selected
}
# Select the repository.
#
[$this repositories] entrySet \
[concat <none> [[$this rep] getAvailableRepositories]]
[$this repositories] selected $selected
$this selectionChanged
}
}
method CorpManView::selectedObjSet {this} {
set sel [[$this repositories] selected]
if {$sel == "<none>"} {
return ""
}
return $sel
}
method CorpManView::selectionChanged {this} {
busy {
$this newDialog ""
$this deleteDialog ""
$this changeDialog ""
$this changeEntryDialog ""
$this optimDialog ""
$this backupDialog ""
$this restoreDialog ""
$this reload
$this setTitle [[$this repositories] selected]
$this RepToolView::selectionChanged
}
}
method CorpManView::update {this} {
busy {
$this updateRepositories
$this reload
}
}
method CorpManView::updateRepositories {this} {
set previousName [[$this repositories] selected]
[$this repositories] entrySet \
[concat <none> [[$this rep] getAvailableRepositories]]
if {$previousName != ""} {
[$this repositories] selected $previousName
}
}
method CorpManView::selectRepository {this name} {
if {$name == ""} {
[$this repositories] selected "<none>"
} else {
[$this repositories] selected $name
}
$this selectionChanged
}
method CorpManView::setRepository {this name} {
[$this rep] setCurrent ""
set error ""
if {$name != "<none>"} {
if [catch {[$this rep] setCurrent $name} error] {
$this message "Cannot access repository '$name'."
$this contextError $error
} else {
$this message "Selected repository '$name'."
$this contextError ""
}
[$this menuHandler] levelChanged
catch {[$this menuHandler] setCurrentContext}
if {$error != 0} {
$this error $error
return 0
}
return 1
} else {
$this message "No repository selected."
$this contextError ""
}
return 0
}
method CorpManView::reload {this} {
set sel [[$this repositories] selected]
$this setRepository $sel
set name [[$this rep] currentName]
set corp [[$this rep] currentCorporate]
if [$corp isNil] {
if {$name == "" || $name == "<none>"} {
[$this info] text ""
return
}
}
# Setup default values.
#
set nameInDb ""
set locationInDb ""
set location ""
set owner ""
set objectId ""
set release ""
set dbDir ""
set dbName ""
set dbUser ""
set dbPassword ""
set dbHost ""
set dbServer ""
set serverId ""
set serverVersion ""
set serverPolicy ""
set serverProtocol ""
set serverExecutable ""
set serverCmdLine ""
set serverHost ""
# Retrieve all info that can be gotten.
#
if [$corp isNil] {
set gotServer [[$this rep] getServerByName $name serverDef]
if $gotServer {
set gotOpts [[$this rep] getInfoFromCmdLine $serverDef(id) \
$serverDef(cmdline) \
cmdLine]
} else {
set gotOpts 0
}
# Get uncrypted password from passwordDialog since
# getInfoFromDatabase needs it.
#
if [RepositoryDBMS::hasPassword] {
set pwDialog [$this passwordDialog]
if {$pwDialog != ""} {
set cmdLine(dbpassword) [$pwDialog plainPassword]
}
}
if $gotOpts {
set gotDb [[$this rep] getInfoFromDatabase \
cmdLine $cmdLine(dbname) dbInfo]
} else {
set gotDb 0
}
if $gotDb {
set nameInDb $dbInfo(name)
set locationInDb [path_name concat $dbInfo(location) $nameInDb]
set location $locationInDb
if [catch {set owner [BasicFS::owner $locationInDb]} error] {
$this error $error
}
if {$owner == "everyone"} {
set owner ""
}
set objectId $dbInfo(id)
set release $dbInfo(productRelease)
}
if $gotOpts {
set dbDir $cmdLine(dbdir)
set dbName $cmdLine(dbname)
set dbUser $cmdLine(dbuser)
set dbPassword [ORB::cryptPassword $cmdLine(dbpassword)]
set dbHost $cmdLine(dbhost)
set dbServer $cmdLine(dbserver)
}
if $gotServer {
set serverId $serverDef(id)
set serverVersion $serverDef(version)
set serverPolicy $serverDef(policy)
set serverProtocol $serverDef(protocol)
set serverExecutable $serverDef(executable)
set serverCmdLine $serverDef(cmdline)
set serverHost $serverDef(host)
}
} else {
set gotServer [[$this rep] getServerByObject [$corp identity] serverDef]
set gotOpts 1
set gotDb 1
set nameInDb [$corp name]
set locationInDb [path_name concat [$corp location] $nameInDb]
set location [path_name concat [$corp location] $name]
set owner [[$this rep] currentOwner]
set objectId [$corp identity]
set release [$corp productRelease]
set dbDir [$corp databaseDirectory]
set dbName [$corp databaseName]
set dbUser [$corp databaseUser]
set dbPassword [$corp databasePassword]
set dbHost [$corp databaseHost]
set dbServer [$corp databaseServer]
if $gotServer {
set serverId $serverDef(id)
set serverVersion $serverDef(version)
set serverPolicy $serverDef(policy)
set serverProtocol $serverDef(protocol)
set serverExecutable $serverDef(executable)
set serverCmdLine $serverDef(cmdline)
set serverHost $serverDef(host)
}
}
set info [$this infoSection]
$info clear
# Repository info.
#
set locationExists ""
if {$location != "<unknown>"} {
if ![file exists $location] {
set locationExists " (NOT FOUND)"
}
}
set locationInDbExists ""
if {$locationInDb != "<unknown>"} {
if ![file exists $locationInDb] {
set locationInDbExists " (NOT FOUND)"
}
}
$info addHeader "Repository"
$info addItem "Name" $name
if {$location != ""} {
$info addItem "Directory" ${location}${locationExists}
}
if {$locationInDb != ""} {
if {$location != $locationInDb} {
$info addItem "Directory in db" ${locationInDb}${locationInDbExists}
}
}
if {$owner != ""} {
$info addItem "Owned by user" $owner
}
if {$objectId != ""} {
$info addItem "Identity" $objectId
}
if {$release != ""} {
$info addItem "Version" $release
}
# Database info.
#
if $gotDb {
set dbNotFound ""
} else {
if {$dbName == ""} {
set dbNotFound "(UNKNOWN)"
} else {
set dbNotFound " (NOT FOUND)"
}
}
$info addHeader "Database"
if {[RepositoryDBMS::shortName] == "ora"} {
set label "Connect String"
} else {
set label "Name"
}
$info addItem $label "${dbName}${dbNotFound}"
if [RepositoryDBMS::hasDirectory] {
if {$dbDir != ""} {
$info addItem "Directory" $dbDir
}
}
if [RepositoryDBMS::hasUser] {
if {$dbUser != ""} {
$info addItem "User" $dbUser
}
}
if [RepositoryDBMS::hasPassword] {
if {$dbPassword != ""} {
$info addItem "Password" $dbPassword
}
}
if [RepositoryDBMS::hasHost] {
if {$dbHost != ""} {
$info addItem "Host" $dbHost
}
}
if [RepositoryDBMS::hasServer] {
if {$dbServer != ""} {
$info addItem "Server" $dbServer
}
}
# Server Entry info.
#
$info addHeader "Server Definition"
$info addItem "Implementation Id" ${serverId}.${serverVersion}
$info addItem "Policy" $serverPolicy
$info addItem "Protocol" $serverProtocol
$info addItem "Executable Path" $serverExecutable
$info addItem "Command Line" $serverCmdLine
$info addItem "Host" $serverHost
$info format
[$this info] text [$info contents]
}
method CorpManView::setFont {this font} {
[$this info] font $font
$this RepToolView::setFont $font
}
method CorpManView::getFont {this} {
return [[$this info] font]
}
method CorpManView::fileNew {this} {
if {[$this newDialog] == ""} {
$this newDialog [RepNewDialog new $this.repnewdlg $this]
}
[$this newDialog] popUp
}
method CorpManView::fileDelete {this} {
if {[$this deleteDialog] == ""} {
$this deleteDialog [RepDeleteDialog new $this.repdeldlg $this]
}
[$this deleteDialog] popUp
}
method CorpManView::fileOpen {this} {
$this message "Starting browser..."
SystemUtilities::fork otk desk -c [get_comm_name]
}
method CorpManView::fileChangeName {this} {
if {[$this changeDialog] == ""} {
$this changeDialog [RepChangeDialog new $this.repchangedlg $this]
}
[$this changeDialog] popUp
}
method CorpManView::fileChangeServerEntry {this} {
if {[$this changeEntryDialog] == ""} {
set rep [$this rep]
set corp [$rep currentCorporate]
if [$corp isNil] {
if [$rep getServerByName [$rep currentName] serverDef] {
set fullId $serverDef(fullId)
} else {
$this error "Could not find server definition for\
'[$rep currentName]'."
return
}
} else {
set list [ORB::decodeObjectId [$corp identity]]
set fullId [ORB::makeImplemId [lindex $list 1] [lindex $list 2]]
}
set name entrydlg-[[$this rep] currentName]
$this changeEntryDialog [CSEntryDialog new \
$this.$name $this $fullId "" \
-helpPressed "$this helpOnName changeRepositoryEntry"]
[$this changeEntryDialog] okPressed {
%this ok
[%this view] selectionChanged
}
}
[$this changeEntryDialog] popUp
}
method CorpManView::fileOptimize {this} {
if {[$this optimDialog] == ""} {
$this optimDialog [RepOptimDialog new $this.repoptimdlg $this]
}
[$this optimDialog] popUp
}
method CorpManView::fileBackup {this} {
if {[$this backupDialog] == ""} {
$this backupDialog [RepBackupDialog new $this.repbackupdlg $this]
}
[$this backupDialog] popUp
}
method CorpManView::fileRestore {this} {
if {[$this restoreDialog] == ""} {
$this restoreDialog [RepRestoreDialog new $this.represtoredlg $this]
}
[$this restoreDialog] popUp
}
method CorpManView::optionsArchiveCmd {this} {
set dlg [EntryDialog new $this.optarchcmd \
-title "Archive Command" \
-message "Command to archive a repository directory:" \
-entry [m4_var get M4_archive_cmd] \
-okPressed { m4_var set M4_archive_cmd [%this entry] } \
-helpPressed "$this helpOnName archiveCommand"]
$dlg popUp
}
method CorpManView::optionsUnarchiveCmd {this} {
set dlg [EntryDialog new $this.optunarchcmd \
-title "Unarchive Command" \
-message "Command to unarchive a repository directory:" \
-entry [m4_var get M4_unarchive_cmd] \
-okPressed { m4_var set M4_unarchive_cmd [%this entry] } \
-helpPressed "$this helpOnName unarchiveCommand"]
$dlg popUp
}
method CorpManView::helpOnContext {this} {
$this helpOnName repToolCorpManView
}
# Do not delete this line -- regeneration end marker