home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
csentrydia.tcl
< prev
next >
Wrap
Text File
|
1997-06-04
|
8KB
|
285 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1996
#
# File: @(#)csentrydia.tcl /main/hindenburg/18
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)csentrydia.tcl /main/hindenburg/18 4 Jun 1997 Copyright 1996 Cayenne Software Inc.
# Start user added include file section
require "repdbms.tcl"
require "reppasswor.tcl"
require "m4optdlgel.tcl"
# End user added include file section
require "repdbdialo.tcl"
Class CSEntryDialog : {RepDbDialog} {
constructor
method destructor
method setFields
method getFields
method popUp
method shutdownServers
method checkOk
method ok
attribute id
attribute name
attribute policy
attribute protocol
attribute path
attribute host
attribute exename
attribute options
attribute node
}
constructor CSEntryDialog {class this name view i_id node} {
set this [RepDbDialog::constructor $class $this $name $view]
$this id $i_id
$this node $node
# Start constructor user section
$this config \
-title "Change Server Definition" \
-modal 1 \
-okPressed { %this ok } \
-cancelPressed { %this setFields } \
-helpPressed { [%this view] helpOnName changeServerEntry }
interface NamedGroup $this.gui {
verStretchFactor 100
DlgColumn c {
DlgColumn c {
spaceType NONE
verStretchFactor 0
DlgRow path {
verStretchFactor 0
Label l { text "Executable Path" }
SingleLineText path { }
}
DlgRow host {
verStretchFactor 0
Label l { text "Host" }
SingleLineText host { }
}
}
NamedGroup g {
verStretchFactor 100
label "Command Line"
DlgColumn cmdline {
verStretchFactor 100
DlgRow exename {
verStretchFactor 0
Label l { text "Executable Name" }
SingleLineText exename { }
}
}
}
}
}
set cmdline $this.gui.c.g.cmdline
ORB::splitImplemId [$this id] id version
if {$id > 100 && $id < 1000} {
interface NamedGroup $cmdline.db {
label "Database"
verStretchFactor 0
DlgColumn col { }
}
}
interface NamedGroup $cmdline.options {
label "M4 Options"
M4OptDlgElem options { }
}
PushButton new $this.shutdown \
-label "Shutdown" \
-activated "busy { $this shutdownServers }"
set params $this.gui.c.c
$this protocol $params.protocol.protocol
$this path $params.path.path
$this host $params.host.host
$this exename $cmdline.exename.exename
$this options $cmdline.options.options
if {$id > 100 && $id < 1000} {
$this createDbInterface $cmdline.db.col
}
[$this path] textModified "$this checkOk"
[$this exename] textModified "$this checkOk"
$this setFields
# End constructor user section
return $this
}
method CSEntryDialog::destructor {this} {
# Start destructor user section
# End destructor user section
$this RepDbDialog::destructor
}
method CSEntryDialog::setFields {this} {
set rep [[$this view] rep]
$rep getServerById [$this id] serverDef
set fullId $serverDef(id).$serverDef(version)
$this.gui label "Server Definition '$serverDef(name)' ($fullId)"
$this name $serverDef(name)
$this policy $serverDef(policy)
$this protocol $serverDef(protocol)
[$this path] text $serverDef(executable)
[$this exename] text [lindex $serverDef(cmdline) 0]
[$this host] text $serverDef(host)
if ![$rep getInfoFromCmdLine $serverDef(id) $serverDef(cmdline) cmdLine] {
return
}
[$this options] options $cmdLine(m4options)
if {$serverDef(id) <= 100 || $serverDef(id) >= 1000} {
# Not a dbserver definition.
return
}
[$this dbname] text $cmdLine(dbname)
if [RepositoryDBMS::hasUser] {
[$this dbuser] text $cmdLine(dbuser)
}
if [RepositoryDBMS::hasPassword] {
if [string length $cmdLine(dbpassword)] {
$this plainPassword $cmdLine(dbpassword)
$this cryptedPassword $cmdLine(dbcryptedpassword)
regsub -all {.} $cmdLine(dbpassword) {*} hiddenPassword
[$this dbpassword] text $hiddenPassword
} elseif [string length $cmdLine(dbcryptedpassword)] {
$this plainPassword ""
$this cryptedPassword $cmdLine(dbcryptedpassword)
[$this dbpassword] text [$this cryptedPassword]
} else {
set hiddenPassword ""
if {[$this plainPassword] != ""} {
if {[$this cryptedPassword] == ""} {
$this cryptedPassword [ORB::cryptPassword \
[$this plainPassword]]
}
regsub -all {.} [$this plainPassword] {*} hiddenPassword
} elseif {[$this cryptedPassword] != ""} {
set hiddenPassword [$this cryptedPassword]
}
[$this dbpassword] text $hiddenPassword
}
}
if [RepositoryDBMS::hasDirectory] {
[$this dbdirectory] text $cmdLine(dbdir)
}
if [RepositoryDBMS::hasServer] {
[$this dbserver] text $cmdLine(dbserver)
}
if [RepositoryDBMS::hasHost] {
[$this dbhost] text $cmdLine(dbhost)
}
}
method CSEntryDialog::getFields {this serverDefRef} {
upvar $serverDefRef serverDef
set rep [[$this view] rep]
ORB::splitImplemId [$this id] id version
if {$id > 100 && $id < 1000} {
if ![$this getDbFields cmdInfo 0] {
return 0
}
}
set cmdInfo(m4options) [[$this options] options]
set exeName [quoteIf [[$this exename] text]]
if [catch {set cmdLine [$rep makeCmdLine $exeName cmdInfo]} error] {
[$this view] error $error
return 0
}
set serverDef(id) $id
set serverDef(version) $version
set serverDef(name) [$this name]
set serverDef(policy) [$this policy]
set serverDef(protocol) [$this protocol]
set serverDef(executable) [[$this path] text]
set serverDef(cmdline) $cmdLine
set serverDef(host) [[$this host] text]
return 1
}
method CSEntryDialog::popUp {this} {
# Don't call passwordChanged!
$this checkOk
$this RepToolDialog::popUp
}
method CSEntryDialog::shutdownServers {this} {
set rep [[$this view] rep]
set name [$this name]
$rep shutdownDbServers $name
}
method CSEntryDialog::checkOk {this} {
set ok 1
if {[$this policy] == "shared" &&
([string length [[$this path] text]] == 0 ||
[string length [[$this exename] text]] == 0)} {
set ok 0
} elseif {[$this policy] == "unshared"} {
[$this path] sensitive 0
[$this exename] sensitive 0
[$this options].gui.r.t.text sensitive 0
}
$this okSensitive $ok
}
method CSEntryDialog::ok {this} {
if ![$this getFields serverDef] {
return
}
[[$this view] rep] changeServerDefinition \
$serverDef(id) \
$serverDef(version) \
$serverDef(name) \
$serverDef(policy) \
$serverDef(protocol) \
$serverDef(executable) \
$serverDef(cmdline) \
$serverDef(host)
if {[$this node] != ""} {
[$this node] update
[$this node] display
} else {
[$this view] update
}
[$this view] message "Changed server entry successfully."
}
# Do not delete this line -- regeneration end marker