home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: @(#)filerefsec.tcl /main/titanic/8
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)filerefsec.tcl /main/titanic/8 7 Mar 1997 Copyright 1997 Cayenne Software Inc.
-
- # Start user added include file section
- # End user added include file section
-
- require_module_file "docsection.tcl" docwriter
- require_module_file "sfileldbob.tcl" docwriter
-
- Class FileRefSection : {DocSection SFileLDbObj} {
- method destructor
- constructor
- method promoter
- method edit
- method isDocDirUpToDate
- method uiName
- method removeSpecials
- }
-
- method FileRefSection::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this DocSection::destructor
- $this SFileLDbObj::destructor
- }
-
- constructor FileRefSection {class this name document} {
- set this [SFileLDbObj::constructor $class $this $name]
- set this [DocSection::constructor $class $this $name $document]
- return $this
- }
-
- proc FileRefSection::validDocument {obj} {
-
- set document [$obj systemVersion]
- if {"[[$document system] type]" != "document"} {return 0}
-
- set editor [$document editor]
- if {! [isCommand $editor]} {return 0}
-
- return 1
- }
-
- method FileRefSection::promoter {this} {
-
- $this SFileLDbObj::promoter
-
- if {![FileRefSection::validDocument $this]} {
- return
- }
-
- set document [$this systemVersion]
- set editor [$document editor]
-
- $this document $document
- set editorName [$editor name]
- set editorVersion [$editor version]
- set class [Document::getClass $editorName $editorVersion [$this type]]
-
- if {$class != ""} {
- if {![$this isA $class]} {
- $class promote $this
- }
- } else {
- set fileV [$this referredFileVersion]
- if {![$fileV isNil]} {
- if {[$fileV isA ExternalFileVersion]} {
- # for text file references without
- # a section class
- TextRefSection promote $this
- }
- }
- }
-
- # now promote to DocSection
- DocSection::promoter $this
- }
-
- method FileRefSection::edit {this} {
- $this DocSection::edit
- }
-
- method FileRefSection::isDocDirUpToDate {this} {
-
- # do not update if document is frozen
- if {"[[$this document] getInfo Status]" == "frozen"} {
- return 1
- }
-
- # if the timestamp of the docLocation is > then the
- # one of the location the section is up to date
- if {! [file exists [$this docLocation]]} {
- return 0
- }
- set fileV [$this referredFileVersion]
- if [$fileV isNil] {
- return 0
- }
- set source [$fileV updateTime]
- file stat [$this docLocation] info
- if {$source > $info(mtime)} {
- return 0
- }
- return 1
- }
-
- method FileRefSection::uiName {this args} {
-
- if {$args == ""} {
- return [$this name]
- } else {
- # can not change name
- }
-
- return ""
- }
-
- method FileRefSection::removeSpecials {this} {
-
- BasicFS::removeFile [$this docLocation]
- }
-
- # Do not delete this line -- regeneration end marker
-
-