home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
localsecti.tcl
< prev
next >
Wrap
Text File
|
1997-09-24
|
8KB
|
321 lines
#--------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)localsecti.tcl /main/titanic/9
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)localsecti.tcl /main/titanic/9 24 Sep 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 "extfvdbobj.tcl"
Class LocalSection : {DocSection ExtFVDbObj} {
method destructor
constructor
method promoter
method browserObjType
method canBeDragged
method edit
method editFile
method showFile
method previewFile
method generateStructure
method generateContents
method generateTypeContents
method isDocDirUpToDate
method updateDocDir
method type
method name
method uiName
method uiClass
}
method LocalSection::destructor {this} {
# Start destructor user section
# End destructor user section
$this DocSection::destructor
$this ExtFVDbObj::destructor
}
constructor LocalSection {class this name document} {
set this [ExtFVDbObj::constructor $class $this $name]
set this [DocSection::constructor $class $this $name $document]
return $this
}
proc LocalSection::validDocument {obj} {
if [info exists SysVDbObj::this] {
set document ${SysVDbObj::this}
if {![isCommand $document]} {return 0}
} else {
set document [[ClientContext::global] currentSystem]
}
if [$document isNil] {return 0}
# Make sure that we have a document and
# that the ExternalFileVersion belongs to it
set system [$document system]
if {"[$system type]" != "document"} {return 0}
if {$system != [$obj system]} {return 0}
set editor [$document editor]
if {! [isCommand $editor]} {return 0}
return 1
}
method LocalSection::promoter {this} {
ExtFVDbObj::promoter $this
if {![LocalSection::validDocument $this]} {
return
}
if [info exists SysVDbObj::this] {
set document ${SysVDbObj::this}
} else {
set document [[ClientContext::global] currentSystem]
}
$this document $document
set editor [$document editor]
set editorName [$editor name]
set editorVersion [$editor version]
set type [[$this file] type]
set class [Document::getClass $editorName $editorVersion $type]
if {$class != "" && ![$this isA $class]} {
$class promote $this
}
# now promote to DocSection
DocSection::promoter $this
}
proc LocalSection::associations {} {
return "[ExtFVDbObj::associations]"
}
method LocalSection::browserObjType {this} {
return "LocalSection"
}
method LocalSection::canBeDragged {this} {
return 0
}
proc LocalSection::childTypes {assoc} {
if {[lsearch -exact "[LocalSection::associations]" "$assoc"] == -1} {
return ""
}
return "[BrowserProcs::childTypes $assoc]"
}
proc LocalSection::controlledLists {} {
return "[ExtFVDbObj::controlledLists]"
}
proc LocalSection::infoProperties {} {
return "[ExtFVDbObj::infoProperties]"
}
method LocalSection::edit {this} {
$this DocSection::edit
}
method LocalSection::editFile {this} {
set updateList {}
set indent [$this getIndentation]
incr indent
foreach obj [$this recursiveObjSet {NoneUiObj}] {
if {$indent >= [$obj getIndentation]} {
if {! [$obj isDocDirUpToDate]} {
lappend updateList [$obj identity]
}
}
}
if {![lempty $updateList]} {
set confVId [[$this getParent ConfigVersion] identity]
set sysVId [[$this getParent SystemVersion] identity]
set argsfile [args_file $updateList]
set args "updateDocDir $confVId $sysVId [list $argsfile]"
set cmd "\
if \[lindex \[$wmttoolObj exitStatusList\] 0\] {\
$this edit\
}"
$wmttoolObj startDocbatch mtool "$args" "$cmd" {0 0} 0
} else {
$this edit
}
}
method LocalSection::showFile {this} {
$this show
}
method LocalSection::previewFile {this} {
set updateList {}
set indent [$this getIndentation]
incr indent
foreach obj [$this recursiveObjSet {NoneUiObj}] {
if {$indent >= [$obj getIndentation]} {
if {! [$obj isDocDirUpToDate]} {
lappend updateList [$obj identity]
}
}
}
if {![lempty $updateList]} {
set confVId [[$this getParent ConfigVersion] identity]
set sysVId [[$this getParent SystemVersion] identity]
set argsfile [args_file $updateList]
set args "updateDocDir $confVId $sysVId [list $argsfile]"
set cmd "\
if \[lindex \[$wmttoolObj exitStatusList\] 0\] {\
$this preview\
}"
$wmttoolObj startDocbatch mtool "$args" "$cmd" {0 0} 0
} else {
$this preview
}
}
method LocalSection::generateStructure {this withContents} {
# read the property structureGen of the section
set structureGen [$this findProperty structureGen]
if [$structureGen isNil] {
return
}
set structureGen [$structureGen value]
regsub -all " |\\t" "$structureGen" "" strippedValue
if {"$strippedValue" == ""} {
return
}
set tmpFile [args_file {}]
if [catch {eval "$structureGen [list $tmpFile] $this"} msg] {
wmtkerror "Error while executing structure generator\
procedure '$structureGen'\n\tfor section '[$this uiName]'.\
\n\t:$msg"
}
generator generateSection $this $tmpFile $withContents
unlink $tmpFile
}
method LocalSection::generateContents {this} {
# read the property contentsGen of the section
set contentsGen [$this findProperty contentsGen]
# check if there's a generate defined with this section
# if not, generate contents according to the section type
wmtkmessage "Generate contents for section '[$this uiName]'"
if [$contentsGen isNil] {
$this generateTypeContents
return
}
set contentsGen [$contentsGen value]
regsub -all " |\\t" "$contentsGen" "" strippedValue
if {"$strippedValue" == ""} {
$this generateTypeContents
return
}
if [catch {eval "dispatchContentsGen $contentsGen $this"} msg] {
wmtkerror "Error while executing contents generator\
procedure '$contentsGen'\n\tfor section '[$this uiName]'.\
:\n\t$msg"
}
}
method LocalSection::generateTypeContents {this} {
# default no contents generated
}
method LocalSection::isDocDirUpToDate {this} {
# do not update if document is frozen
if {"[[$this document] getInfo Status]" == "frozen"} {
return 1
}
if {! [file exists [$this docLocation]]} {
return 0
}
# do not update frozen section
if {"[$this getInfo Status]" == "frozen"} {
return 1
}
if {[[[$this document] editor] printsIncluded] == "y"} {
# check also the 'not-localsection-children'
[$this childSectionSet] foreach child {
if {![$child isA LocalSection]} {
if {![$child isDocDirUpToDate]} {
return 0
}
}
}
}
return 1
}
method LocalSection::updateDocDir {this} {
set path [$this docLocation]
if {"[$this getInfo Status]" != "working"} {
catch {BasicFS::removeFile $path}
}
if {! [file exists $path]} {
$this synchWithFileSystem
set retval 0
} else {
set retval 1
}
if {[[[$this document] editor] printsIncluded] == "y"} {
# update also the 'not-localsection-children'
[$this childSectionSet] foreach child {
if {![$child isA LocalSection]} {
if {![$child updateDocDir]} {
set retval 0
}
}
}
}
return $retval
}
method LocalSection::type {this} {
return [[$this file] type]
}
method LocalSection::name {this} {
return [$this uiName]
}
method LocalSection::uiName {this args} {
set longName [$this findProperty longName]
if [$longName isNil] {
return [[$this file] name]
}
return [$longName value]
}
method LocalSection::uiClass {this} {
return LocalSection
}
# Do not delete this line -- regeneration end marker