⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 register.tcl

📁 windml3.0.3
💻 TCL
📖 第 1 页 / 共 4 页
字号:
# REGISTER.TCL - Setup procedures for implementing user registration wizard 
#                page
#
# Copyright 1999-2003 Wind River Systems, Inc
#
# modification history
# --------------------
# 03q,29apr03,bjl  text rewording.
# 03p,11oct02,wmd  Fix the dimensions of the frame and label for the
#                  information section.
# 03o,29jul02,wmd  Modified to add condition to check for LM error, if so
#                  skip call to setupInit.
# 03n,25jul02,wmd  Remove updating the windows register for projInfo - it
#                  clears the info.
# 03m,22jul02,wmd  Remove setting project values to null or 0.
# 03l,19jul02,wmd  Fix the text for patches to say "root of the directory".
# 03k,12jul02,wmd  Modify to allow patch user to type PATCH=<pathTopatch> as
#                  installation key, skip the path dialog, set instkey=none.
# 03j,27jun02,bwd  SPR 74406: don't save install key if license number is 0
#                  for non-BSP CDs only
# 03i,22may02,bwd  SPR 77766: use setupVals(WRS) variable for company name
# 03h,02may02,bwd  SPR 72883: more fix on infinite loop on BSP CD
# 03g,15mar02,bwd  SPR 74406: don't save install key if license number is 0
# 03f,12mar02,bwd  SPR 72883: fixed infinite loop problems on BSP CD.
# 03e,05mar02,bwd  Rename regValues.. to registrationValues..
# 03d,05mar02,bwd  Modified SETUP to be non-tornado centric
# 03c,05feb02,wmd  Fix the warning message about the install key.
# 03b,21dec01,bwd  Added codes to handle BSP CD installation
# 03a,12jun01,j_w  Modified for Tornado 2.2
# 02t,07may01,j_w  Update error messages
# 02s,08jan01,bwd  SPR 63373: error message stored in the registries after
#                  using ALT+f functionality
# 02r,13nov00,wmd  Modify error message to be clear about need to exit.
# 02q,07nov00,bwd  Increased the size of CD description box to fit new
#                  description
# 02p,30oct00,j_w  SPR 35775: read setup.log for CD description if no DISK_ID
#                  is found when running setup /L from an installed tree
# 02o,14aug00,bwd  SPR 33171: added a check to display error if the key
#                  entered exceed max key length (45)
# 02n,07jun00,bwd  SPR 31613: skip displaying error message on NO_ZIP_FILE if
#                  running SETUP due to License Management errors
# 02m,20mar00,bwd  Fixed TEXT mode to default the installation key value if
#                  there's only one key
# 02l,09feb00,bwd  Removed double quote at the end of product descriptions and
#                  part descriptions
# 02k,07feb00,bwd  Fixed TEXT mode to use instKeyDataGet to display
#                  installation key from the register
# 02j,03feb00,wmd  Need to add a REGISTRATION_WARN_4_TEXT string.
# 02i,31jan00,bwd  Replaced setupVals(cmdMode) with isGUImode and removed redundant codes
# 02h,25jan00,wmd  Product names changed, need to alter how we detect Tornado
#                  products.
# 02g,06jan00,bwd  No test automation for command line SETUP
# 02f,17dec99,clc  testing
# 02e,03dec99,j_w  Enable the help button
# 02d,16nov99,j_w  Fixed return value if no or invalid user inputs
# 02c,16nov99,clc  change text mode variable to setupVals(cmdMode)
# 02b,14oct99,bjl  catch controlDestroy of noKeyText in case control
#                  was not previously created.
# 02b,12oct99,clc  add command-line setup
# 02a,30Sep99,j_w  Modified for T3
# 01i,22jul99,j_w  added text messages
# 01h,15apr99,wmd  If ALT-F is used, remove the corresponding key if it exists
#                  in the registry.
# 01g,15apr99,wmd  Need to destroy the "nokey" control created when no
#                  installation key is required.
# 01f,12apr99,wmd  Need to add full simulator product to the tornadoIndex in 
#                  the setupVals array.
# 01e,31mar99,wmd  Fix spr# 26130, blank components page.
# 01d,24mar99,bjl  turn off inf write to registry after queueExecute.
# 01c,19mar99,wmd  Output to a file any debug messages.
# 01b,01feb99,tcy  moved procs from INSTALL.TCL.
# 01a,26jan99,tcy  extracted from INSTW32.TCL.
#

#############################################################################
#
# onClickFaeBox - prompt FAEs to save the installation key
#
# This procedure will prompt FAEs to save the installation key
#
# SYNOPSIS
# .tS
# onClickFaeBox
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc onClickFaeBox {} {
    global setupVals

    if {![dialog yes_no "Setup" [strTableGet REGISTRATION_FAE_WARN_1]]} {
         set setupVals(instKeyNotSaved) 1
    } elseif [info exists setupVals(instKeyNotSaved)] {
         unset setupVals(instKeyNotSaved)
    }
}

#############################################################################
#
# pageCreate(registration) - displays CD information and prompt users for
#                            registration information
#
# This procedure will display CD information and prompt users for
# registration information such as user name, company name and installation key
#
# SYNOPSIS
# .tS
# pageCreate(registration)
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc pageCreate(registration) {} {
    global ctrlVals
    global setupVals

    # WRS products: read user's information from registries
    if { ![isStandAlone] } {
        registrationValuesReadFromRegistry
    }

    if { "$setupVals(keyList)" == "" } {
        set numKeys 0
    } else {
        set numKeys [llength $setupVals(keyList)]
    }


    if {[string length $setupVals(CDdescription)] > 45} {
        set cdDesc [cdromDescGet]
    } else {
        set cdDesc [strTableGet WELCOME_CD_DESC]
    }

    # use the user key as default; otherwise use the first key as default

    set index 0
    if { [instKeyGet] != "" } {
        set keyList [split [instKeyDataGet]]
        set index [lsearch -exact $keyList [instKeyGet]]
        if {$index == -1} {
            set index 0
        }
    }

    set headerText ""
    if { [isBSPcd] } {
        set headerText [strTableGet REGISTRATION_MSG_1_BSP]
    } else {
        set headerText [strTableGet REGISTRATION_MSG_1]
    }

    if { [isGUImode] } {
        set ctrlVals(volatileFrm) [list \
                    [list label -name message1 \
                                -title $headerText \
                                -x 99 -y 10 -w 206 -h 37] \
                    [list label -name message2 \
                                -title [strTableGet REGISTRATION_MSG_2] \
                                -x 99 -y 56 -w 32 -h 10] \
                    [list label -name message3 \
                                -title [strTableGet REGISTRATION_MSG_3] \
                                -x 99 -y 80 -w 35 -h 10] \
                    [list label -name message4 \
                                -title [strTableGet REGISTRATION_MSG_4] \
                                -x 99 -y 104 -w 35 -h 8] \
                    [list text -name nameText -border \
                               -x 139 -y 56 -w 166 -h 13 \
                               -callback {onTextChange nameText name}] \
                    [list text -name companyText -border \
                               -x 139 -y 79 -w 166 -h 13 \
                               -callback {onTextChange companyText company}] \
                    [list combo -name keyText -x 139 -y 102 -w 166 \
                               -h [expr 13 * ($numKeys + 1)] \
                               -editable \
                               -callback {onTextChange keyText instKey}]\
                    [list label -name Information \
                                -title [strTableGet REGISTRATION_MSG_5] \
                                -x 105 -y 125 -w 40 -h 8] \
                    [list frame -name frm1 \
                               -xpos 100 -ypos 135 -width 207 -height 35] \
                    [list label -name cdInfo \
                                -x 106 -y 140 -w 200 -h 30] \
                    [list button -name fae -title "&f" \
                                 -x 280 -y 35 -w 1 -h 1 \
                                 -callback {onClickFaeBox} ] \
        ]

        set w [dlgFrmCreate [strTableGet REGISTRATION_TITLE]]

        if { [isTornadoProduct] } {
  	        # Enable the help button for Tornado
            controlEnable $w.helpButt 1
        } else {
  	        # non-tornado prod - no help
            controlEnable $w.helpButt 0
        }

        controlHide $w.fae 1
        controlValuesSet $w.companyText [companyNameGet]
        controlValuesSet $w.nameText [userNameGet]
        controlValuesSet $w.keyText [instKeyDataGet]

    
        controlValuesSet $w.cdInfo "CD number      :  $setupVals(CDnumber)\
                                  \nCD description :  $cdDesc"

        # overwrite keyText
        # test automation

        if { $ctrlVals(useInputScript) } {
            controlValuesSet $w.keyText $setupVals(instKey2)
        }

        if {[string compare "none" [instKeyGet]] == 0} {
              
            # if the key "none" works, set the value and hide 
                        # the key edit text box
  
            instKeySet "none"
            controlHide $w.keyText 1
            controlHide $w.message4 1

            # shows message informing user that no key is required for 
                        # installation

            controlCreate $w [list label -name noKeyText \
                               -title [strTableGet REGISTRATION_WARN_1] \
                               -x 99 -y 102 -w 206 \
                               -h [expr 24 * ($numKeys + 1)]]

        } else {
            controlSelectionSet $w.keyText $index
        }

        if {"[userNameGet]" == ""} {
            controlFocusSet $w.nameText
        } elseif {"[companyNameGet]" == ""} {
            controlFocusSet $w.companyText
        } else {
            controlFocusSet $w.keyText
        }

        # test automation

        if { $ctrlVals(useInputScript) } {
            autoSetupLog "Registration page:"
            autoSetupLog "\tUser name:    [userNameGet]"
            autoSetupLog "\tCompany Name: [companyNameGet]"
            autoSetupLog "\tInstall Key:  $setupVals(instKey2)"
            if {[isUnix]} { pageRemove projectInfo }
            nextCallback
        }

    } else { # TEXT mode
        printPageTitle [strTableGet REGISTRATION_TITLE]
        puts "$headerText\n"
        
        set question "name"
        while {[string compare $question "done"] != 0} {
            switch -exact $question {
                "name"  {                
                    # get user name
                    if { "[userNameGet]" == "" } {
                        set msg "Enter your name:"
                    } else {
                        set msg "Enter your name: \[[userNameGet]\]"
                    }
                    set ret [prompt "$msg"]
                    switch -regexp -- $ret {
                        "^-$" { 
                            backCallback
                            return 0 
                        }
                        "^$" { 
                            if { "[userNameGet]" != "" } {
                                set question "company" 
                            } 
                        }
                        "[eE][xX][iI][tT]"  { return 0 }
                        default { 
                            userNameSet $ret
                            set question "company" 
                        }
                    }
                }
                "company" {
                    # get company name
                    if { "[companyNameGet]" == "" } {
                        set msg "Enter your company:" 
                    } else {
                        set msg "Enter your company: \[[companyNameGet]\]"
                    }
                    set ret [prompt "$msg"]
                    switch -regexp -- $ret {
                        "^-$"   { set question "name" }
                        "^$" { 
                            if { "[companyNameGet]" != "" } {
                                set question "key" 
                            }
                        } 
                        "[eE][xX][iI][tT]"  { return 0 }
                        default { 
                            companyNameSet $ret
                            if { [string compare "none" [instKeyGet]] == 0 } {
              
                                                    # if the key "none" works, 
                                                    # set the value

                                instKeySet "none"
                                puts "[strTableGet REGISTRATION_WARN_1]\n"
                                set question "done" 
                            } else { 
                                set question "key" 
                            }
                        }
                    }
                }
                "key" {
                    # get registration key

                    set length [llength [instKeyDataGet]]

                    if { $length > 0 } {

                        if { $length == 1 } {
                            puts "Enter your key: \[[lindex [instKeyDataGet] 0]\]\n"
                        } else {
                            puts "Please enter the item number to choose one\
                                  of the following keys or enter a new key: \[1\]\n"
                        }

                        if { $length > 1 } {
                            set ix 1
                            foreach k [instKeyDataGet] {
                                puts "$ix - $k\n"
                                incr ix
                            }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -