home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
propertyse.tcl
< prev
next >
Wrap
Text File
|
1997-10-14
|
4KB
|
169 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)propertyse.tcl /main/titanic/9
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)propertyse.tcl /main/titanic/9 14 Oct 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
require_module_file "docsection.tcl" docwriter
Class PropertySection : {DocSection} {
method destructor
constructor
method edit
method show
method print
method preview
method uiName
method updateDocDir
method isDocDirUpToDate
method setpropKnowledgeDB
method removeSpecials
}
method PropertySection::destructor {this} {
# Start destructor user section
# End destructor user section
$this DocSection::destructor
}
constructor PropertySection {class this name document} {
set this [DocSection::constructor $class $this $name $document]
return $this
}
method PropertySection::edit {this} {
# default no edit possible
# redefine this function to be sure not the base edit is taken
wmtkerror "No edit possible for this section."
}
method PropertySection::show {this} {
set cmd [list \
"viewer PropertySection" \
[$this docLocation] \
[$this uiName] \
]
$this execute "$cmd" m4
}
method PropertySection::print {this} {
set cmd [list \
"[m4_var get M4_a_printer] [$this docLocation]" \
[$this uiName] \
]
$this execute "$cmd"
}
method PropertySection::preview {this} {
set cmd [list \
"previewer PropertySection" \
[$this docLocation] \
[$this uiName] \
]
$this execute "$cmd" m4
}
method PropertySection::uiName {this args} {
return [$this name]
}
method PropertySection::updateDocDir {this} {
set filled 0
$this setpropKnowledgeDB
set keyValues {}
set cv [[$this document] configVersion]
foreach property [$this referredProperties $cv] {
set keyValue "[$property name]"
lappend keyValue "[$property value]"
lappend keyValues $keyValue
}
# put the properties in the file
set fid [open [$this docLocation] w]
foreach property $keyValues {
set filled 1
set key "[lindex $property 0]"
set propDef [$this.propKnowledgeDB definition $key]
if {$propDef == ""} {
puts "'$key' not found in property database"
continue
}
set key [$propDef longName]
set value "[lindex $property 1]"
if [regexp \n $value] {
puts $fid "$key :"
puts $fid $value
} else {
puts $fid "$key : $value"
}
}
# to keep some doc editors happy
if {$filled == 0} {
puts $fid " "
}
close $fid
return 1
}
method PropertySection::isDocDirUpToDate {this} {
# do not update if document is frozen
if {"[[$this document] getInfo Status]" == "frozen"} {
return 1
}
if {! [file exists [$this docLocation]]} {
return 0
}
set cv [[$this document] configVersion]
set source [$this referredUpdateTime $cv]
file stat [$this docLocation] info
if {$source > $info(mtime)} {
return 0
}
return 1
}
method PropertySection::setpropKnowledgeDB {this} {
if [isCommand $this.propKnowledgeDB] return
PropKnowledgeDB new $this.propKnowledgeDB $globalModuleHandler
# set the right context
set document [$this document]
set corpId [[$document corporate] identity]
set projId [[$document project] identity]
set configV [$document configVersion]
set configVId [$configV identity]
set phaseVId [[[$document phase] selectedVersion $configV] identity]
set systemVId [[$document documentedSystem] identity]
$this.propKnowledgeDB context\
"/$corpId/$projId/$configVId/$phaseVId/$systemVId"
}
method PropertySection::removeSpecials {this} {
BasicFS::removeFile [$this docLocation]
}
# Do not delete this line -- regeneration end marker