home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
newdocvdlg.tcl
< prev
next >
Wrap
Text File
|
1997-02-20
|
5KB
|
179 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1996
#
# File: @(#)newdocvdlg.tcl /main/titanic/2
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)newdocvdlg.tcl /main/titanic/2 20 Feb 1997 Copyright 1996 Cayenne Software Inc.
# Start user added include file section
require "wmt_util.tcl"
# End user added include file section
Class NewDocVDlg : {TemplateDialog} {
constructor
method destructor
method handleCancel
method handleHelp
method handleOk
method handleSelectionChanged
method popUp
attribute dbObj
}
constructor NewDocVDlg {class this name} {
set this [TemplateDialog::constructor $class $this $name]
# Start constructor user section
interface DlgColumn $this.top {
Label nameLab {
text "Document Name:"
}
SingleLineText name {}
Label docsysLab {
text "Documented System:"
}
ComboBox docsys {
rowCount 5
}
Label editorLab {
text "Editor:"
}
OptionMenu editor {
}
}
$this config \
-modal yes \
-title "New Document Version" \
-okPressed "$this handleOk" \
-cancelPressed "$this handleCancel" \
-helpPressed "$this handleHelp"
# Selection-changed callback
$this.top.docsys textModified {
set dialog [getParent [getParent %this]]
$dialog handleSelectionChanged
}
$this.top.name textModified "$this handleSelectionChanged"
# End constructor user section
return $this
}
method NewDocVDlg::destructor {this} {
# Start destructor user section
# End destructor user section
}
method NewDocVDlg::handleCancel {this} {
}
method NewDocVDlg::handleHelp {this} {
[getParent $this] helpOnName [nt_get_type $this]
}
method NewDocVDlg::handleOk {this} {
set dbObj [$this dbObj]
set docsys [$this.top.docsys text]
set docname [$this.top.name text]
set doctype [lindex ${BrowserProcs::systemTypes} 1]
set editor [$this.top.editor selected]
global docwriterEditors
set selEditor ""
foreach name [array names docwriterEditors] {
if {$docwriterEditors($name) == $editor} {
set selEditor $name
break
}
}
if {$selEditor == ""} {
return
}
set script "set docV \[$dbObj createSystemVersion \
[list $docname] cl [list $doctype] [$dbObj getParent ConfigVersion] 0\]"
append script " ;"
append script " \$docV setProperty editor [list $selEditor]"
append script " ;"
append script " \$docV setProperty doc_sys [list $docsys]"
append script " ;"
append script " set propInfo \[PIPropInfo new\]"
append script " ;"
append script " \$propInfo edit \$docV"
append script " ;"
append script " set prop \[\$propInfo findProperty doc_sys\]"
append script " ;"
append script " PIPropItemRef new \$prop cl scopePhase"
append script " ;"
append script " \$propInfo save"
append script " ;"
append script " \$propInfo delete"
if [[$dbObj findSystemVersion -byNameAndType "$docsys" system] isNil] {
set endScript "wmtkwarning \
\"SystemVersion with name '$docsys' does not\
exist within the current PhaseVersion\""
} else {
set endScript ""
}
$wmttoolObj startCommand tcl \
"$script" "$endScript" \
"Creating $doctype version '$docname'..." \
{1 0} 1
}
method NewDocVDlg::handleSelectionChanged {this} {
if {"[rmWhiteSpace [$this.top.name text]]" == "" ||
"[rmWhiteSpace [$this.top.docsys text]]" == ""} {
set selected 0
} else {
set selected 1
}
$this okSensitive $selected
$this okDefault $selected
$this cancelDefault [expr 1 - $selected]
}
method NewDocVDlg::popUp {this} {
# Fill list of documented systems
set entrySet ""
foreach sysV [[$this dbObj] getChildSet systemVersions] {
set sys [$sysV system]
if {"[$sys type]" != "system"} continue
lappend entrySet "[$sys name]"
}
set entrySet [lsort $entrySet]
set text [$this.top.docsys text]
if {"$text" == "" || [lsearch -exact $entrySet "$text"] == -1} {
set text [lindex $entrySet 0]
}
$this.top.docsys config \
-entrySet $entrySet \
-text $text
set entrySet ""
# Fill list of available editors
global docwriterEditors
if [info exist docwriterEditors] {
foreach editor [array names docwriterEditors] {
if {$docwriterEditors($editor) != "" } {
lappend entrySet $docwriterEditors($editor)
}
}
} else {
set entrySet {{<no editors available>}}
}
$this.top.editor config \
-entrySet $entrySet \
-selected [lindex $entrySet 0]
$this handleSelectionChanged
$this TemplateDialog::popUp
}
# Do not delete this line -- regeneration end marker