home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
csentrydia.tcl
< prev
next >
Wrap
Text File
|
1997-10-10
|
8KB
|
298 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1996
#
# File: @(#)csentrydia.tcl /main/titanic/11
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)csentrydia.tcl /main/titanic/11 10 Oct 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 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 {
text ""
verStretchFactor 0
columnCount 30
}
}
DlgRow host {
verStretchFactor 0
Label l { text "Host" }
SingleLineText host {
text ""
verStretchFactor 0
columnCount 30
}
}
}
NamedGroup g {
verStretchFactor 100
label "Command Line"
DlgColumn cmdline {
verStretchFactor 100
}
}
}
}
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 options $cmdline.options.options
[$this path] textModified "$this checkOk"
set rep [[$this view] rep]
$rep getServerById [$this id] serverDef
set repName $serverDef(name)
if {$id > 100 && $id < 1000} {
if {[$rep currentName] != $repName} {
if [catch {$rep setCurrent $repName} error] {
[$this view] error $error
}
}
set dbColumn $this.gui.c.g.cmdline.db.col
$this createDbInterface $dbColumn 30
}
$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 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 path [[$this path] text]
protect_backslashes {path exeName} {
set exeName [quoteIf [file tail $path]]
}
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} {
set ok 0
} elseif {[$this policy] == "unshared"} {
[$this path] 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