home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / fileprdbob.tcl < prev    next >
Text File  |  1996-10-08  |  5KB  |  179 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. #      (c)     Cadre Technologies Inc.    1996
  4. #
  5. #      File:           @(#)fileprdbob.tcl    /main/hindenburg/1
  6. #      Author:         <generated>
  7. #      Description:
  8. #---------------------------------------------------------------------------
  9. # SccsId = @(#)fileprdbob.tcl    /main/hindenburg/1   8 Oct 1996 Copyright 1996 Cadre Technologies Inc.
  10.  
  11. # Start user added include file section
  12. # End user added include file section
  13.  
  14. require "browsdbobj.tcl"
  15.  
  16. Class FilePRDbObj : {BrowsDbObj FilePropertyReference} {
  17.     method destructor
  18.     constructor
  19.     method browserObjType
  20.     method browserType
  21.     method editFile
  22.     method hasChildren
  23.     method initializeInfo
  24.     method pathName
  25.     method previewFile
  26.     method selectFixed
  27.     method showFile
  28.     method versionName
  29. }
  30.  
  31. method FilePRDbObj::destructor {this} {
  32.     # Start destructor user section
  33.     # End destructor user section
  34.     $this BrowsDbObj::destructor
  35. }
  36.  
  37. constructor FilePRDbObj {class this name} {
  38.     set this [FilePropertyReference::constructor $class $this $name]
  39.     set this [BrowsDbObj::constructor $class $this $name]
  40.     return $this
  41. }
  42.  
  43. selfPromoter FilePropertyReference {this} {
  44.     FilePRDbObj promote $this
  45. }
  46.  
  47. proc FilePRDbObj::associations {} {
  48.     return {accessRuleSet}
  49. }
  50.  
  51. method FilePRDbObj::browserObjType {this} {
  52.     return "FilePRDbObj"
  53. }
  54.  
  55. method FilePRDbObj::browserType {this} {
  56.     return [$this type]
  57. }
  58.  
  59. proc FilePRDbObj::childTypes {assoc} {
  60.     if {[lsearch -exact "[FilePRDbObj::associations]" "$assoc"] == -1} {
  61.     return ""
  62.     }
  63.     return "[BrowserProcs::childTypes $assoc]"
  64. }
  65.  
  66. proc FilePRDbObj::controlledLists {} {
  67.     return ""
  68. }
  69.  
  70. method FilePRDbObj::editFile {this} {
  71.     $this edit
  72. }
  73.  
  74. method FilePRDbObj::hasChildren {this} {
  75.     return 1
  76. }
  77.  
  78. proc FilePRDbObj::infoProperties {} {
  79.     return [concat \
  80.     [BrowserProcs::infoProperties] \
  81.         {Status Version "Controlled Actions" Path} \
  82.     ]
  83. }
  84.  
  85. method FilePRDbObj::initializeInfo {this confV} {
  86.     [$this info] contents ""
  87.     $this setInfo FileVersion [$this referredFileVersion $confV]
  88. }
  89.  
  90. method FilePRDbObj::pathName {this} {
  91.     return "[path_name concat \
  92.     [[$this document] directory] [$this getPropertyValue fileSystemPath] \
  93.     ]"
  94. }
  95.  
  96. method FilePRDbObj::previewFile {this} {
  97.     $this preview
  98. }
  99.  
  100. method FilePRDbObj::selectFixed {this} {
  101.     set versionList ""
  102.     set file [$this referredFile]
  103.     set fileV [[$this info] set FileVersion]
  104.     foreach version [$file fileVersions] {
  105.     if {"$version" == "$fileV"} continue
  106.     lappend versionList $version
  107.     }
  108.  
  109.     if [lempty $versionList] {
  110.     wmtkinfo "There are no other versions to select from"
  111.     return
  112.     }
  113.  
  114.     set headerSpecList {
  115.     {Version 25 ascii {increasing 1}}
  116.     {Status 14 ascii {increasing 2}}
  117.     {"Frozen date" 30 ascii {none}}
  118.     {Comments 50 ascii {none}}
  119.     }
  120.     set objectSpecList ""
  121.     foreach version $versionList {
  122.     set typeSpec [getObjectSpec [$wmttoolObj objectHdlr] \
  123.         [$version uiClass] [$version browserType] \
  124.     ]
  125.     if {"$typeSpec" != ""} {
  126.         set icon [$typeSpec smallIcon]
  127.     } else {
  128.         set icon ""
  129.     }
  130.     lappend objectSpecList [list $icon \
  131.         [$version versionName] \
  132.         [$version status] \
  133.         [$version freezeTime2String] \
  134.         [$version comments] \
  135.     ]
  136.     }
  137.  
  138.     require "browsviewd.tcl"
  139.     set box $wmttoolObj.selectFixed
  140.     ClassMaker::extend BrowsViewDialog SelectFixedBrowsViewDialog dbObj
  141.     SelectFixedBrowsViewDialog new $box \
  142.     -title "Select Fixed" \
  143.     -message "File '[$file name].[$file type]'" \
  144.     -headerSpecList $headerSpecList \
  145.     -objectSpecList $objectSpecList \
  146.     -objectList $versionList \
  147.     -dbObj $this \
  148.     -cancelPressed {%this delete} \
  149.     -okPressed {
  150.         set dbObj [%this dbObj]
  151.         set version [[lindex [[%this view] selectedSet] 0] object]
  152.         set script "$dbObj fixate $version"
  153.         set confVId [[$dbObj getParent ConfigVersion] identity]
  154.         set sysVId [[$dbObj getParent SystemVersion] identity]
  155.         set argsfile [args_file [$dbObj identity]]
  156.         set args "updateDocDir $confVId $sysVId [list $argsfile]"
  157.         set cmd "$wmttoolObj startDocbatch mtool [list $args] \"\" {0 0} 0"
  158.         $wmttoolObj startCommand tcl "$script" "$cmd" "" {1 0} 1
  159.         %this delete
  160.     }
  161.     [$box view] selectionPolicy BROWSE
  162.     $box popUp
  163. }
  164.  
  165. method FilePRDbObj::showFile {this} {
  166.     $this show
  167. }
  168.  
  169. method FilePRDbObj::versionName {this} {
  170.     set fileV [[$this info] set FileVersion]    
  171.     if [$fileV isNil] {
  172.     return ""
  173.     }
  174.     return [$fileV versionName]
  175. }
  176.  
  177. # Do not delete this line -- regeneration end marker
  178.  
  179.