home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)propertyse.tcl /main/hindenburg/3
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)propertyse.tcl /main/hindenburg/3 8 Nov 1996 Copyright 1996 Cadre Technologies Inc.
-
- # Start user added include file section
- # End user added include file section
-
- require "docsection.tcl"
-
- Class PropertySection : {DocSection} {
- method destructor
- constructor
- method edit
- method show
- method print
- method preview
- method uiName
- method updateDocDir
- method isDocDirUpToDate
- method setpropKnowledgeDB
- method promoter
- }
-
- 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]} {
- PropKnowledgeDB new $this.propKnowledgeDB
- # set the right context
- set corpId [[[ClientContext::global] currentCorporate] identity]
- set projId [[[ClientContext::global] currentProject] identity]
- set configVId [[[ClientContext::global] currentConfig] identity]
- set phaseVId [[[ClientContext::global] currentPhase] identity]
- set systemVId [[[$this document] documentedSystem] identity]
- $this.propKnowledgeDB context\
- "/$corpId/$projId/$configVId/$phaseVId/$systemVId"
- }
- }
-
- method PropertySection::promoter {this document} {
- $this extension txt
- $this DocSection::promoter $document
- }
-
- # Do not delete this line -- regeneration end marker
-
-