home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
custcheckd.tcl
< prev
next >
Wrap
Text File
|
1996-11-12
|
8KB
|
267 lines
#---------------------------------------------------------------------------
#
# (c) Cadre Technologies Inc. 1996
#
# File: @(#)custcheckd.tcl /main/hindenburg/1
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)custcheckd.tcl /main/hindenburg/1 12 Nov 1996 Copyright 1996 Cadre Technologies Inc.
# Start user added include file section
require custcheckp.tcl
require checkbrvie.tcl
require config.tcl
# End user added include file section
Class CustCheckDialog : {NoteBkDialog} {
constructor
method destructor
method createInterface
method read
method edit
method show
method save
method quit
method getGroup
method setGroup
method removeGroup
method getPhase
method setPhase
method removePhase
attribute lvlObj
attribute custObj
attribute readOnly
attribute number
attribute group
attribute phase
}
constructor CustCheckDialog {class this name} {
set this [NoteBkDialog::constructor $class $this $name]
$this group [Dictionary new]
$this phase [Dictionary new]
# Start constructor user section
.main busy TRUE
global classCount
$this number $classCount
# read phases file
getPhases
$this modal 1
$this createInterface
$this config \
-cancelPressed { %this quit } \
-okPressed { %this save ; %this quit} \
-helpPressed {.main helpOnName checkConfigDialog } \
-applyNowPressed { %this save }
# End constructor user section
return $this
}
method CustCheckDialog::destructor {this} {
# Start destructor user section
# End destructor user section
}
method CustCheckDialog::createInterface {this} {
set cc [ClientContext::global]
set currentPhase ""
if {![[$cc currentPhase] isNil]} {
set currentPhase [[[$cc currentPhase] phase] type]
}
set count 0
foreach phase ${BrowserProcs::phases} {
set phaseType [lindex $phase 1]
if {$currentPhase != "" && $currentPhase != $phaseType} continue
if [[$this phase] exists "$phaseType"] continue
set page [CustCheckPage new $this.phase$count \
-label "$phaseType" \
]
$this setPhase "$phaseType" $page
incr count 1
}
}
method CustCheckDialog::read {this levelObject} {
$this lvlObj $levelObject
if {"$levelObject" == "" || [$levelObject isA Corporate]} {
$this custObj ""
} else {
$this custObj \
[$levelObject findCustomFileVersion checkconfig ""]
}
set clientContext [ClientContext::global]
set config [args_file {}]
$clientContext downLoadCustomFile checkconfig "" etc $config
set groups [args_file {}]
$clientContext downLoadCustomFile checkgroups "" etc $groups
set maps [args_file {}]
$clientContext downLoadCustomFile checkmap "" etc $maps
set groupList [readConfigurationFile $groups]
unlink $groups
foreach groupLine $groupList {
set groupArray([lindex $groupLine 0]) [lindex $groupLine 1]
}
set mapList [readConfigurationFile $maps]
unlink $maps
foreach mapLine $mapList {
set msgNr [lindex $mapLine 1]
set msgInfo [list $msgNr "[m4_msg get $msgNr]"]
if {[$this getGroup [lindex $mapLine 0]] != ""} {
set lst [$this getGroup [lindex $mapLine 0]]
lappend lst "$msgInfo"
} else {
set lst [list "$msgInfo"]
}
$this setGroup [lindex $mapLine 0] $lst
}
set configList [readConfigurationFile $config]
unlink $config
foreach configLine $configList {
set phase [lindex $configLine 0]
set group [lindex $configLine 1]
set checkValue [lindex $configLine 2]
set page [$this getPhase $phase]
if {$page == ""} continue
CheckBrObject new $page.DC.CBV.$group
$page.DC.CBV.$group selected "$page.DC.CBV setMessages $group"
$page.DC.CBV.$group group $group
$page.DC.CBV.$group label $group
if [info exists groupArray($group)] {
set grpDesc "$groupArray($group)"
$page.DC.CBV.$group details "$checkValue \"$grpDesc\""
} else {
$page.DC.CBV.$group details "$checkValue"
}
}
[$this phase] foreach key value {
$value.DC.CBV sortit
}
}
method CustCheckDialog::edit {this levelObject} {
$this read $levelObject
$this readOnly 0
if {"[$this custObj]" != ""} {
if [catch {[$this custObj] edit} msg] {
wmtkerror $msg
$this readOnly 1
}
}
if [$this readOnly] {
$this title "Show 'checkconfig'"
} else {
$this title "Edit 'checkconfig'"
}
$this popUp
.main busy FALSE
}
method CustCheckDialog::show {this levelObject} {
$this read $levelObject
$this readOnly 1
$this title "Show 'checkconfig'"
$this popUp
.main busy FALSE
}
method CustCheckDialog::save {this} {
if [$this readOnly] {
return
}
set tmpFile [args_file {}]
set fid [open $tmpFile w]
puts $fid "#-------------------------------------------------------------"
puts $fid "# "
puts $fid "# phase id : The id of the phase. Valid id's are: "
puts $fid "# 'Analysis', 'SystemDesign', 'ObjectDesign' "
puts $fid "# and 'Implementation' "
puts $fid "# group name : The name of the group of checks. With this name"
puts $fid "# you can define in the configuration file "
puts $fid "# 'checkmap' which errors/warnings belong to this"
puts $fid "# group. The name of the group is userdefineable."
puts $fid "# value : Valid values are: 'off', 'default', 'error' "
puts $fid "# and 'warning' With this field you can promote "
puts $fid "# warnings to errors and visa versa. "
puts $fid "# You cannot turn off fatals or normal messages! "
puts $fid "# "
puts $fid "# The key in this table is the phase id combined "
puts $fid "# with the group name "
puts $fid "#-------------------------------------------------------------"
puts $fid "# phase id | group name | value "
puts $fid "#-------------------------------------------------------------"
set formatString "%-15.15s | %-25.25s | %-10.10s"
[$this phase] foreach key value {
foreach obj [$value.DC.CBV objectSet] {
puts $fid "[format $formatString $key \
[$obj label] [lindex [$obj details] 0]]"
}
}
close $fid
require "custfileut.tcl"
CustFileUtilities::save $tmpFile [$this lvlObj] checkconfig ""
unlink $tmpFile
}
method CustCheckDialog::quit {this} {
if {"[$this custObj]" != "" && (! [$this readOnly])} {
[$this custObj] quit
}
$this delete
}
# Do not delete this line -- regeneration end marker
method CustCheckDialog::getGroup {this groupName} {
return [[$this group] set $groupName]
}
method CustCheckDialog::setGroup {this groupName newGroup} {
[$this group] set $groupName $newGroup
}
method CustCheckDialog::removeGroup {this groupName} {
[$this group] unset $groupName
}
method CustCheckDialog::getPhase {this phaseType} {
return [[$this phase] set $phaseType]
}
method CustCheckDialog::setPhase {this phaseType newPhase} {
[$this phase] set $phaseType $newPhase
}
method CustCheckDialog::removePhase {this phaseType} {
[$this phase] unset $phaseType
}