home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1996
- #
- # File: @(#)repdeleted.tcl /main/hindenburg/12
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)repdeleted.tcl /main/hindenburg/12 29 Oct 1996 Copyright 1996 Cayenne Software Inc.
-
- # Start user added include file section
- require "repository.tcl"
- # End user added include file section
-
- require "repdbdialo.tcl"
-
- Class RepDeleteDialog : {RepDbDialog} {
- constructor
- method destructor
- method doDelete
- method popUp
- method checkOk
- method ok
- attribute parts
- }
-
- constructor RepDeleteDialog {class this name view} {
- set this [RepDbDialog::constructor $class $this $name $view]
- # Start constructor user section
-
- set rep [[$this view] rep]
- set corp [$rep currentCorporate]
- set name [$rep currentName]
-
- $this config \
- -title "Delete Repository '$name'" \
- -okPressed { busy { %this ok } } \
- -helpPressed { [%this view] helpOnName deleteRepository }
-
- interface DlgColumn $this.gui {
- verStretchFactor 0
- NamedGroup delete {
- label "Delete Repository"
- DlgColumn c {
- verStretchFactor 0
- CheckButton db {
- label "Database"
- state 1
- }
- CheckButton dir {
- label "Directory"
- state 1
- }
- CheckButton entry {
- label "Server Entry"
- state 1
- }
- }
- }
- NamedGroup db {
- label "Database"
- DlgColumn attr {
- verStretchFactor 0
- }
- }
- }
-
- $this parts $this.gui.delete.c
- [$this parts].db stateChanged "$this checkOk"
- [$this parts].dir stateChanged "$this checkOk"
- [$this parts].entry stateChanged "$this checkOk"
-
- $this createDbInterface $this.gui.db.attr
- $this setDbFields
- $this setupForPassword
-
- # End constructor user section
- return $this
- }
-
- method RepDeleteDialog::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this RepDbDialog::destructor
- }
-
- method RepDeleteDialog::doDelete {this db dir entry} {
- set rep [[$this view] rep]
- set name [$rep currentName]
- set corp [$rep currentCorporate]
-
- if ![$rep shutdownDbServers $name] {
- [$this view] message "Repository not deleted."
- return
- }
-
- if $db {
- if [$this getDbFields cmdInfo] {
- set database $cmdInfo(dbname)
- [$this view] message "Deleting database '$database' ..."
- if [$rep deleteRepositoryDb cmdInfo] {
- [$this view] message \
- "Database '$database' deleted successfully."
- } else {
- [$this view] message \
- "Database '$database' not deleted."
- }
- } else {
- [$this view] message \
- "Database not deleted."
- }
- }
-
- if {$dir && ![$corp isNil]} {
- set loc [path_name concat [$corp location] $name]
- [$this view] message "Deleting repository directory '$loc' ..."
- if [$rep deleteRepositoryDir] {
- [$this view] message \
- "Repository directory '$loc' deleted successfully."
- } else {
- [$this view] message \
- "Repository directory '$loc' not deleted."
- }
- }
-
- if $entry {
- [$this view] message "Deleting server entry of '$name' ..."
- if [$rep deleteServerEntry] {
- [$this view] message \
- "Server entry of '$name' deleted successfully."
- [$this view] updateRepositories
- [$this view] selectRepository ""
- [$this view] viewRefresh
- } else {
- [$this view] message \
- "Server entry of '$name' not deleted."
- }
- }
- }
-
- method RepDeleteDialog::popUp {this} {
- $this checkOk
- $this RepDbDialog::popUp
- }
-
- method RepDeleteDialog::checkOk {this} {
- if {([[$this parts].db state] ||
- [[$this parts].dir state] ||
- [[$this parts].entry state]) && [$this passwordOk]} {
- $this okSensitive 1
- } else {
- $this okSensitive 0
- }
- }
-
- method RepDeleteDialog::ok {this} {
- set rep [[$this view] rep]
- set corp [$rep currentCorporate]
- set name [$rep currentName]
-
- if ![$this getDbFields cmdInfo] {
- return
- }
-
- set database $cmdInfo(dbname)
-
- set db [[$this parts].db state]
- set dir [[$this parts].dir state]
- set entry [[$this parts].entry state]
-
- set what ""
- if $db {
- append what "\n - database '$database'"
- }
- if $dir {
- set location ""
- if ![$corp isNil] {
- set location [path_name concat [$corp location] [$corp name]]
- } else {
- if [$rep getInfoFromDatabase cmdInfo $database dbInfo] {
- set location [path_name concat $dbInfo(location) $dbInfo(name)]
- } else {
- set location ""
- }
- }
- if {$location != ""} {
- append what "\n - directory '$location'"
- }
- }
- if $entry {
- append what "\n - server entry of '$name'"
- }
- if {$what == ""} {
- set dlg [InfoDialog new [$this view].delinfodlg \
- -title "Delete Repository" \
- -message "Nothing to delete." \
- -okPressed { %this delete }]
- $dlg delHelpButton
- $dlg popUp
- return
- }
-
- set msg "This action will cause loss of data if\n"
- append msg "the repository is not backed up first!\n\n"
- append msg "Do you really want to delete $what?"
-
- set dlg [WarningDialog new [$this view].deleterepconfirm \
- -title "Delete Repository" \
- -message $msg \
- -okPressed "busy { $this doDelete $db $dir $entry }"]
- $dlg delHelpButton
- $dlg popUp
- }
-
- # Do not delete this line -- regeneration end marker
-
-