home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
represtcor.tcl
< prev
next >
Wrap
Text File
|
1997-11-28
|
4KB
|
152 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)represtcor.tcl /main/titanic/10
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)represtcor.tcl /main/titanic/10 28 Nov 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
require "represtdia.tcl"
Class RepRestCorporateDialog : {RepRestDialog} {
constructor
method destructor
method objType
method objDescription
method restore
method restoreFinished
attribute dbOptions
attribute optionDict
}
constructor RepRestCorporateDialog {class this name view} {
set this [RepRestDialog::constructor $class $this $name $view]
# Start constructor user section
$this config \
-title "Restore Entire Corporate" \
-helpPressed "$view helpOnName restoreCorporate"
interface NamedGroup [$this dbColumn].g {
label "Database"
DlgColumn c {
verStretchFactor 0
VerRadioGroup options {
entrySet { }
}
}
}
if $win95 {
$this createDbInterface [$this dbColumn].g.c 35
} else {
$this createDbInterface [$this dbColumn].g.c 30
}
$this setDbFields
[$this dbname] textModified "$this checkOk"
[$this dirLabel] text "From Corporate Directory\
(created by unarchive command)"
[$this nameLabel] text "New Corporate Name\
(defaults to directory name)"
set rep [[$this view] rep]
set corp [$rep currentCorporate]
if ![$corp isNil] {
[$this dirField] text [$rep currentRepDir]
}
$this dbOptions [$this dbColumn].g.c.options
set contents [list \
"Create new database." new \
"Delete existing database and create new database." replace ]
$this optionDict [Dictionary new]
[$this optionDict] contents $contents
set sel [lindex $contents 0]
while {![lempty $contents]} {
set option [lvarpop contents]
lappend options $option
set short [lvarpop contents]
if {([$corp isNil] && $short == "new") ||
(![$corp isNil] && $short == "replace")} {
set sel $option
}
}
[$this dbOptions] entrySet $options
[$this dbOptions] selected $sel
# End constructor user section
return $this
}
method RepRestCorporateDialog::destructor {this} {
# Start destructor user section
# End destructor user section
$this RepRestDialog::destructor
}
method RepRestCorporateDialog::objType {this} {
return "Corporate"
}
method RepRestCorporateDialog::objDescription {this} {
set name [[$this nameField] text]
if {$name == ""} {
set name [file tail [[$this dirField] text]]
}
return "repository '$name'"
}
method RepRestCorporateDialog::restore {this dbInfo} {
upvar $dbInfo info
set rep [[$this view] rep]
set opts {}
switch [[$this optionDict] set [[$this dbOptions] selected]] {
new {
}
replace {
$rep deleteRepositoryDb info
}
default {
error "Bad database option."
}
}
set repDir [[$this dirField] text]
set name [file tail $repDir]
set newName [[$this nameField] text]
return [$rep restoreRepository "$this restoreFinished" info \
$opts $repDir $newName]
}
method RepRestCorporateDialog::restoreFinished {this {exitCode 0} } {
if {$exitCode != 0} {
$this RepRestDialog::restoreFinished $exitCode
return
}
set name [[$this nameField] text]
if {$name == ""} {
set name [file tail [[$this dirField] text]]
}
[$this view] updateRepositories
[$this view] selectRepository $name
$this RepRestDialog::restoreFinished $exitCode
}
# Do not delete this line -- regeneration end marker