home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)document.tcl /main/hindenburg/3
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)document.tcl /main/hindenburg/3 17 Oct 1996 Copyright 1996 Cadre Technologies Inc.
-
- # Start user added include file section
- # End user added include file section
-
- require "dsysvdbobj.tcl"
-
- Class Document : {DSysVDbObj} {
- method destructor
- constructor
- method promoter
- method initialize
- method title
- method subject
- method documentedSystem
- method type
- method reference
- method keywords
- method date
- method authors
- method docStatus
- method docEditor
- method setGetProp
- method directory
- attribute editor
- attribute docSys
- attribute initialized
- attribute configVersion
- }
-
- method Document::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this DSysVDbObj::destructor
- }
-
- constructor Document {class this name} {
- set this [DSysVDbObj::constructor $class $this $name]
- return $this
- }
-
- selfPromoter DSysVDbObj {this} {
- Document promote $this
- }
-
- method Document::promoter {this} {
- $this DSysVDbObj::promoter
- $this initialized 0
- }
-
- method Document::initialize {this configVersion} {
-
- # create an instance of the documented system
- $this configVersion $configVersion
- set docSys [$this setGetProp doc_sys]
- set phase [$this phase]
- set phaseV [$configVersion findPhaseVersion \
- "[$phase name]" "[$phase type]"]
- if {"$docSys" == ""} {
- wmtkerror "Documented system not specified\
- for document '[$this getInfo Name]'"
- return
- }
- $this docSys [$phaseV findSystemVersion $docSys system]
-
- if [$this initialized] {
- return
- }
-
- # create the docEditor
- if {"[$this editor]" == ""} {
- set docEditor [$this docEditor]
- if {$docEditor == ""} {
- wmtkerror "Document editor not specified\
- for document '[$this getInfo Name]'"
- return
- }
- # read all the editor specific classes
- require "[string tolower $docEditor].tcl"
- # make the specific editor class
- $this editor [${docEditor}DocEditor new $this.docEditor]
- }
-
- # check the current level
- case "[[ClientContext::global] currentLevel]" in {
- {None Corporate Project Config} {
- return
- }
- }
- if {[[ClientContext::global] currentConfig] != $configVersion} {
- return
- }
-
- if {[[$this editor] dirExtension] != "" } {
- # check if directory name is valid
- set dir [$this getPropertyValue fileSystemPath]
- if {![regexp ".[[$this editor] dirExtension]" $dir]} {
- # invalid name set valid one
- # strip "."
- set name [[$this system] name]
- regsub -all {\.} $name {_} name
- $this setProperty fileSystemPath \
- $name.[[$this editor] dirExtension]
- }
- }
-
- set error [[$this editor] configDirectory [$this directory]]
-
- if {$error != ""} {
- wmtkerror "$error\nChange property 'File System Path Part' to a valid value before using the document."
- return
- }
-
- $this initialized 1
- }
-
- method Document::title {this args} {
-
- return [$this setGetProp title $args]
- }
-
- method Document::subject {this args} {
-
- return [$this setGetProp subject $args]
- }
-
- method Document::documentedSystem {this} {
-
- return [$this docSys]
- }
-
- method Document::type {this args} {
-
- return [$this setGetProp type $args]
- }
-
- method Document::reference {this args} {
-
- return [$this setGetProp ref $args]
- }
-
- method Document::keywords {this args} {
-
- return [$this setGetProp keywords $args]
- }
-
- method Document::date {this args} {
-
- return [$this setGetProp date $args]
- }
-
- method Document::authors {this args} {
-
- return [$this setGetProp authors $args]
- }
-
- method Document::docStatus {this args} {
-
- return [$this setGetProp status $args]
- }
-
- method Document::docEditor {this} {
-
- return [$this setGetProp editor]
- }
-
- method Document::setGetProp {this args} {
-
- set prop [lindex $args 0]
- set value [lindex [lindex $args 1] 0]
-
- if [lempty $value] {
- return [$this getPropertyValue $prop]
- } else {
- $this setProperty $prop $value
- }
- }
-
- method Document::directory {this} {
-
- return [$this path]
- }
-
- proc Document::getClass {editor version type} {
-
- set firstChar [string toupper [string range $type 0 0]]
- set lastPart [string tolower [string range $type 1 end]]
-
- set type ${firstChar}${lastPart}
-
- set class ${editor}${version}${type}Section
- if {! [isCommand $class]} {
- # try without version
- set class ${editor}${type}Section
- if {! [isCommand $class]} {
- # try without editor name
- set class ${type}Section
- if {! [isCommand $class]} {
- return ""
- }
- }
- }
-
- return $class
- }
-
- proc Document::getFileClass {editor version type} {
-
- set class [Document::getClass $editor $version $type]
- if {$class == ""} {
- # unknown class
- return externalBinary
- }
-
- if [isCommand $class::isAscii] {
- if [$class::isAscii] {
- return externalText
- } else {
- return externalBinary
- }
- } else {
- foreach class [Document::getSuperClasses $class] {
- if [isCommand $class::isAscii] {
- if [$class::isAscii] {
- return externalText
- } else {
- return externalBinary
- }
- }
- }
- }
- # no super with isAscii proc found
- return externalBinary
- }
-
- proc Document::getSuperClasses {class} {
-
- set supers [$class info supers]
-
- foreach i $supers {
- set supers "$supers [Document::getSuperClasses $i]"
- }
-
- return $supers
- }
-
- # Do not delete this line -- regeneration end marker
-
-