home *** CD-ROM | disk | FTP | other *** search
/ BUG 11 / BUGCD1998_02.ISO / email / sime / simdemo.z / startup.tcl < prev    next >
Text File  |  1997-12-09  |  15KB  |  367 lines

  1. # MODULE[data]: new_user_startup - All platforms
  2.  
  3. # FUNCTION
  4. # This file is used to query for information that is user specific and 
  5. # not provided in the sysdflt.tcl file.   It is only run the first time
  6. # the user runs Simeon.
  7. # END FUNCTION
  8.  
  9.  
  10. # NOTES
  11. # The intent for this file is to ask new user's whatever questions 
  12. # are needed to complete the initialization their Simeon configuraton.
  13. # The file is run if (and only if) after loading the site default
  14. # file "sysdflt.tcl", we were unable to load a user configuration.
  15. # The test for seeing if the user configuration was loaded is the
  16. # existence (or lack thereof) of the option "General.Fullname".
  17. # Because this option is user specific, the only way that we would
  18. # actually get this option was to have run this file.
  19. #
  20. # As a result, if you (the system administrator) modifies this file,
  21. # then you had better make sure that "General.Fullname" is set into
  22. # the user's configuration after they are done with it.
  23. #
  24. # The file is a Tool Command Language (TCL) file that contains a set of
  25. # "option" commands.  The "option" command is a Simeon extension to TCL
  26. # that supports updating the content of the Simeon runtime option
  27. # (configuration) database.  The file can contain any of the standard
  28. # TCL commands and statements.
  29. #
  30. # Options are defined using the following syntax:
  31. #
  32. #  "option [-default | -permanent | -session] [-readonly] {name} [{value}]
  33. #
  34. # where arguments in the [] are optional, and arguments in {} are
  35. # variables that are provided by you.  If just the option {name} is
  36. # provide with no {value}, then value of the option is returned.  If the
  37. # {name} and {value} are provided, then the value is stored in the
  38. # runtime option database.
  39. # Options can be stored in one of three levels: default, permanent, and
  40. # session.  When options are referenced in the repository, a session
  41. # value is retrieved ahead of a permanent value, and a permanent value
  42. # is retrieved ahead of a default value.  Therefore, a session value
  43. # will "mask" a permanent value which will "mask" a default value.  Only
  44. # permanent values are saved from the option database to the user's
  45. # permanent option repository.
  46. # The file also makes use of a set of user interface extensions to TCL
  47. # that allows you to put up dialogues and ask questions of the user.   A
  48. # procedure named "askQuestion" has been defined that can be used to ask
  49. # any one line question of a user on the way in.  
  50. # END NOTES
  51.  
  52. # HISTORY
  53. # IncrDev Jul 11, 1997 by ll: added code to test for sysdflt version.
  54. # IncrDev Jul 10, 1997 by ll: combined startup.demo into this file and
  55. #                             incorporated the getInstallData procedure
  56. # IncrDev Feb 4, 1995 by ll: modified defaultRemainder to only default
  57. #                            ms2.hostname (News Host) if it is still set
  58. #                            to the factory default of "newshost"
  59. # IncrDev Jan 9, 1997 by ll : added getDemoUserID, defaultDemoMailAddress
  60. #                             procs
  61. # IncrDev Dec 23, 1996 by ll: changes for 4.1. Enhanced documentation.
  62. # IncrDev May 6, 1996 by ll: added default for Page Layout footer to contain
  63. #                            the user's full name as entered during startup
  64. # IncrDev Mar 12, 1996 by ll: added documentation and added IMSP and
  65. #                             signature defaults in proc DefaultRemainder
  66. # IncrDev Mar 12, 1996 by ll: added code in proc askQuestion to not
  67. #                             select the field if it contains @domain.name
  68. # IncrDev Mar 7, 1995 by ll: added code to default to default to option
  69. #                            in sysdflt.tcl file. If not set, THEN default
  70. #                            to Post Office (IMAP) answer 
  71. # IncrDev Dec 28, 1995 by ll: put back other hostname questions but defaulted
  72. #                             answers to the Post Office answer
  73. # IncrDev Dec 28, 1995  by ll: added selection on input field
  74. # IncrDev Nov 2, 1995 by sh: to only ask one hostname question and default others
  75. # Doc____ Nov 5, 1995 by sh: first cut of new documentation
  76. # IncrDev Nov 1, 1995 by sh: added default View options for new users
  77. # END HISTORY
  78.  
  79. if {[info exists sysdflt_version] == 1} {
  80.    if {$sdlog == "yes"} {
  81.       debug_trace "startup.tcl : begin"}
  82.       debug_trace "startup.tcl : guest = $guest"
  83. } else {
  84. # sysdflt.tcl from version earlier than 4.1.2 so 
  85. # initialize variables.
  86.    set sdlog "no"
  87.    set guest "no"
  88.    debug_trace "startup.tcl : sysdflt.tcl file from 4.1.1 or earlier."
  89. }
  90.  
  91. # : This function is called from Simeon, to kick off the 
  92. # : process
  93.  
  94. if {$sdlog == "yes"} {debug_trace "startup.tcl : declare startSetup"}
  95.  
  96. proc startSetup {} {
  97.     global sdlog
  98.     if {$sdlog == "yes"} {debug_trace "startup.tcl : begin startSetup"}
  99.     label t1 -parent startupwin -left 20 -top 60 -right 370 -bottom 80 \
  100.        -title "You'll need to provide a bit of information to start."
  101.     getUserName
  102. }
  103.  
  104. # : askQuestion is called in the following routines to prompt the user
  105. # : for IMAP host, SMTP host, and IMSP (Address book) host.
  106. # : The nextcmd parameter contains the procedure name of the next
  107. # : question to be asked. If you wish to skip a question  from this
  108. # : list, modify the previous routine's call to askQuestion as described
  109. # : in the documentation for the verifyAddrBookHost routine below.
  110.  
  111. if {$sdlog == "yes"} {debug_trace "startup.tcl : declare askQuestion"}
  112.  
  113. proc askQuestion {win nextcmd prompt initval example option} {
  114.     global sdlog
  115.     if {$sdlog == "yes"} {debug_trace "startup.tcl : begin askQuestion"}
  116.     set w startupwin.$win
  117.     frame $w -parent startupwin -left 10 -top 100 -right 390 -bottom 290 \
  118.        -entercommand "option $option \[get_ctl_title $w.resp\]; hide_win $w; $nextcmd"
  119.     label $w.t1 -parent $w -left 20 -top 30 -right 370 -bottom 50 -title $prompt
  120.  
  121.     edit $w.resp -parent $w -left 30 -top 60 -right 360 -bottom 80 \
  122.        -title $initval -command ""
  123.     focus $w.resp
  124.     if { $initval != "" } {
  125. #       if {$initval != "simeon"} {
  126.       if {[string index $initval 0] != "@" } {
  127.          select $w.resp
  128.       }
  129. #       }
  130.     }
  131.     label $w.ex -parent $w -left 30 -top 100 -right 360 -bottom 120 -title $example
  132.     button $w.done -parent $w -left 135 -top 160 -right 195 -bottom 180 -title "OK" \
  133.        -command "option $option \[get_ctl_title $w.resp\]; hide_win $w; $nextcmd"
  134. }
  135.  
  136. # FUNCTION
  137. # : Ask for the user's full name. No default should be supplied from
  138. # : sysdflt.tcl Simeon checks for the presence of this option to determine
  139. # : whether it should run this script.
  140. # END FUNCTION
  141. #
  142. # HISTORY
  143. # IncrDev July 10, 1997 by ll: if a guest account set the next command
  144. #                              to get the DemoUserID rather than getMailAddress
  145. # END HISTORY
  146.  
  147. if {$sdlog == "yes"} {debug_trace "startup.tcl : declare getUserName"}
  148.  
  149. proc getUserName {} {
  150.  
  151.     global sdlog
  152.     global guest
  153.  
  154.     if {$sdlog == "yes"} {debug_trace "startup.tcl : begin getUserName"}
  155.     if {$guest == "yes"} {
  156.        askQuestion name getDemoUserID "What is your full name?" \
  157.       "" "e.g. Bill Smith" General.Fullname
  158.     } else {
  159.        askQuestion name getMailAddress "What is your full name?" \
  160.       "" "e.g. Bill Smith" General.Fullname
  161.     }
  162. }
  163.  
  164. # : Ask for user's email address.
  165. # : General.MailDomain from sysdflt.tcl is defaulted into this field.
  166. # : If the sysdflt.tcl contains "simeon.com" the user will see
  167. # : @simeon.com and the cursor placed ahead of the @ when this question
  168. # : is asked.
  169.  
  170. if {$sdlog == "yes"} {debug_trace "startup.tcl : declare getMailAddress"}
  171.  
  172. proc getMailAddress {} {
  173.     global sdlog
  174.     if {$sdlog == "yes"} {debug_trace "startup.tcl : begin getMailAddress"}
  175.     set init ""
  176.     catch {set init "@[option General.MailDomain]"}
  177.     if { $init=="@"} {set init ""}
  178.     askQuestion email verifyMailHost "What is your email address?" \
  179.        $init "e.g. userid@company.com" General.MailAddress
  180. }
  181.  
  182. # : Ask for user's demo account user id.
  183. # : Only used for demo guest account installations.
  184.  
  185. if {$sdlog == "yes"} {debug_trace "startup.tcl : declare getDemoUserID"}
  186.  
  187. proc getDemoUserID {} {
  188.     global sdlog
  189.     if {$sdlog == "yes"} {debug_trace "startup.tcl : begin getDemoUserID"}
  190.     set init ""
  191.     askQuestion email defaultDemoMailAddress \
  192.        "Enter your Simeon guest account username" \
  193.        $init "e.g. bsmith" General.MailAddress
  194. }
  195.  
  196. # : Get the host name of the mail server.
  197. # : This is the Post Office message service host name and is the server
  198. # : running an IMAP2bis or IMAP4 daemon.
  199. # : NOTE: if the setting in sysdflt.tcl is correct and does not need to
  200. # : be changed by the user, this question can be omitted. See the comments
  201. # : under Verify Address Book Host for information on how to skip a startup
  202. # : question.
  203.  
  204. if {$sdlog == "yes"} {debug_trace "startup.tcl : declare verifyMailHost"}
  205.  
  206. proc verifyMailHost {} {
  207.     global sdlog
  208.     if {$sdlog == "yes"} {debug_trace "startup.tcl : begin verifyMailHost"}
  209.     set init ""
  210.     catch {set init [option MsgService.ms1.Hostname]}
  211.     askQuestion email verifySMTPHost \
  212.        "What is your Post Office (IMAP) server hostname?" \
  213.        $init "e.g. mailhost.company.com" MsgService.ms1.Hostname
  214. }
  215.  
  216. # : Verify SMTP Host
  217. # : General.DeliveryHost from sysdflt.tcl is defaulted into this field.
  218. # : If this field has not been initialized in sysdflt.tcl (ie. still
  219. # : set to "mailhost") default it to the IMAP host instead.
  220. # : NOTE: if the setting in sysdflt.tcl is correct and does not need to
  221. # : be changed by the user, this question can be omitted. See the comments
  222. # : under Verify Address Book Host for information on how to skip a startup
  223. # : question.
  224.  
  225. if {$sdlog == "yes"} {debug_trace "startup.tcl : declare verifySMTPHost"}
  226.  
  227. proc verifySMTPHost {} {
  228.     global sdlog
  229.     if {$sdlog == "yes"} {debug_trace "startup.tcl : begin verifySMTPHost"}
  230.     set init ""
  231.     catch {set init [option General.DeliveryHost]}
  232.     if {$init == "mailhost"} {
  233.     catch {set init [option MsgService.ms1.Hostname]}
  234.     }
  235.     askQuestion email verifyAddrBookHost \
  236.        "What is your mail sending (SMTP) server hostname?" \
  237.        $init "e.g. smtphost.company.com" General.DeliveryHost
  238. }
  239.  
  240.  
  241. # : Verify Address Book Host
  242. # : AddrBook.Hostname from sysdflt.tcl is defaulted into this field.
  243. # : By default this is field is empty in sysdflt.tcl because a value in
  244. # : this field indicates to Simeon that an IMSP host is available and
  245. # : Simeon will search for remote address books when the address book
  246. # : module is started up. For this reason, we do not default this field
  247. # : to the Post Office host.
  248. # : If your site does not run IMSP or will not be using IMSP addressbooks
  249. # : you will not want to ask this question of new users. To eliminate
  250. # : this question from being asked, modify the following line in 
  251. # : verifySMTPHost
  252. # :    askQuestion email verifyAddrBookHost "What is your mail sending...
  253. # : to read
  254. # :    askQuestion email defaultRemainder "What is your mail sending...
  255. # : This causes defaultRemainder to be run after verifySMTPHost instead
  256. # : of verifyAddrBookHost. This mechanism can be used in any of the 
  257. # : verify routines to eliminate a question or to reorder them.
  258. # : You can also write a new routine and add it to the list if you wish.
  259.  
  260. if {$sdlog == "yes"} {debug_trace "startup.tcl : declare verifyAddrBookHost"}
  261.  
  262. proc verifyAddrBookHost {} {
  263.     global sdlog
  264.     if {$sdlog == "yes"} {debug_trace "startup.tcl : begin verifyAddrBookHost"}
  265.     set init ""
  266.     catch {set init [option AddrBook.Hostname]}
  267.     askQuestion email defaultRemainder \
  268.        "What is your address book (IMSP) server hostname?" \
  269.        $init "e.g. addrhost.company.com" AddrBook.Hostname
  270. }
  271.  
  272. # : Default demo account mail address. If this routine is called, it
  273. # : is assumed that the user id is an ESYS guest account id and will
  274. # : append the ESYS demo server domain onto the mail address.
  275. # : Called only from getDemoUserID
  276.  
  277. if {$sdlog == "yes"} {debug_trace "startup.tcl : declare defaultDemoMailAddress"}
  278.  
  279. proc defaultDemoMailAddress {} {
  280.     global sdlog
  281.     if {$sdlog == "yes"} {debug_trace "startup.tcl : begin defaultDemoMailAddress"}
  282.  
  283. # : Set userid in Post Office Message Service
  284.     option MsgService.ms1.Userid [option General.MailAddress]
  285.  
  286. # : Add demo domain to General.MailAddress
  287.        option General.MailAddress [option General.MailAddress]@demo.simeon.com
  288.  
  289.     defaultRemainder
  290. }
  291.  
  292. # : Perform other default actions
  293. # : Note that "doneECSStartup" is a magic token that says ask no
  294. # : more questions.   You must use that token exactly to terminate the question
  295. # : string. 
  296.  
  297. # HISTORY
  298. # Oct 17, 1997 by ll: commented out setting of Reply-To variable
  299. # END HISTORY
  300.  
  301. if {$sdlog == "yes"} {debug_trace "startup.tcl : declare defaultRemainder"}
  302.  
  303. proc defaultRemainder {} {
  304.     global sdlog
  305.     if {$sdlog == "yes"} {debug_trace "startup.tcl : begin defaultRemainder"}
  306.  
  307. # : Default the News host name to that of the Post Office
  308.  
  309.     if {[option MsgService.ms2.Hostname] == "newshost"} {
  310.     option MsgService.ms2.Hostname [option MsgService.ms1.Hostname]
  311.     }
  312.  
  313. # : Default the user's signature to his full name and email address
  314.  
  315.     option Compose.Signature.Lines "3"
  316.     option Compose.Signature.1 "----------------------"
  317.     option Compose.Signature.2 [option General.Fullname]
  318.     option Compose.Signature.3 [option General.MailAddress]
  319.  
  320. # : default the user's Reply-To address to be the same as his
  321. # : email address
  322. # : ReplyTo should only be set if it will be different than
  323. # : From address, so we no longer do this
  324.  
  325. #    option General.ReplyTo [option General.MailAddress]
  326.  
  327. # : default print page footer to contain user's name
  328.  
  329.     option PageLayout.Footer "l 'Printed by: [option General.Fullname]' c 'Page: ' \$page"
  330.  
  331. # : Default the IMSP options hostname to that given for the Address book
  332. # : with the assumption that the the same IMSP host will be used for both.
  333. # : If no IMSP host then these options will just be blank. 
  334.  
  335.     option -session Options.RemoteHost [option AddrBook.Hostname]
  336.     option -session Options.RemotePort [option AddrBook.TCPPort]
  337.  
  338. # : Done the startup script.
  339.  
  340.     doneECSStartup
  341. }
  342.  
  343. # : define default views for new users
  344. # : A first time user will inherit these settings into their personal
  345. # : options file.
  346.  
  347. option FOLDER.ID "1"
  348. option Folder.1.IsSelecting "OFF"
  349. option Folder.1.MS "1"
  350. option Folder.1.Name "inbox"
  351. option Folder.1.ViewMsgGrps "OFF"
  352. option Folder.1.inbox.ID "1"
  353. option Folder.1.inbox.Sort "Most Recent Date Sent"
  354.  
  355. if {$sdlog == "yes"} {debug_trace "startup.tcl : calling startSetup"}
  356.  
  357. # : initiate setup scripts 
  358. startSetup
  359.  
  360. if {$sdlog == "yes"} {debug_trace "startup.tcl : end"}
  361.  
  362. # END MODULE: new_user_startup - All platforms
  363.  
  364.  
  365.