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

📄 liccfg.tcl

📁 windml3.0.3
💻 TCL
📖 第 1 页 / 共 5 页
字号:
            -controls [list \
                    [list label -name "message1" -center \
                        -title [strTableGet LICCFG_BANNER] \
                        -x 35 -y 12 -w 200 -h 10 ]
            ]
    } else {
        dialogCreate \
            -name licConfigDlg \
            -notitle \
            -parent $ctrlVals(parentDialog) \
            -helpfile $setupVals(setupHelp) \
            -width 250 -height 32 \
            -init {
                controlPropertySet licConfigDlg.message1 -bold 1; \
                windowTimerCallbackSet licConfigDlg \
                            -milliseconds 200 licConfigCallBack
            } \
            -controls [list \
                    [list bitmap -name bmp -stretch -title \
                        "[cdFileNameGet \
                        [file join RESOURCE BITMAPS SETUPICO.BMP]]" \
                        -x 10 -y 5 -w 20 -h 20] \
                    [list label -name "message1" -center \
                        -title [strTableGet LICCFG_BANNER] \
                        -x 35 -y 12 -w 200 -h 10 ]
            ]
    }
}

#############################################################################
#
# licConfigCallBack() - Callback routine to send the license request
#
# This procedure will send the license request
#
# SYNOPSIS
# .tS
# licConfigCallBack() 
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: 
#
#    GUI MODE:
#     1 - to go onto the next page
#     0 - to redisplay LICCFG page
#     [calcPage lmInstOptions] - to go back to lmInstOptions page
#
#    TEXT MODE:
#     2 - to redisplay LICCFG page
#     1 - to go onto the next page
#     0 - exit SETUP
#    -1 - to go back to lmInstOptions page
#
#
# ERRORS: N/A
#


proc licConfigCallBack {} {
    global setupVals ctrlVals
    global lmVals
    global LicFileConfigRequest CommitRequest
    global env
    global returnValue

        set hostRec {}

    if { ![isGUImode] } {

        # TEXT mode: for update, prompt error if user entered all 0 for requests

        if { !$lmVals(reload) } {

            set isAllZero 1
            for {set ix 0} {$ix < [llength $lmVals(lmFeaturesRequested)]} {incr ix} {
                if { [lindex $lmVals(lmFeaturesRequested) $ix] != 0 } {
                    set isAllZero 0
                }
            }

            if { $isAllZero } {
                puts "[strTableGet LICCFG_ZERO_ERROR]\n\n\Press <Enter> to return\
                      to the License Configuration page and enter license\(s\) for\
                      at least one feature."

                while { [prompt] != "" } {
                }

                return 2
            }
        }
    }

    if { [isGUImode] } {
        windowTimerCallbackSet licConfigDlg 0 ""
    } else {
        puts "[strTableGet LICCFG_BANNER]\n"
    }

    # license calculation and error checking here...
 
    set lmVals(token) 0

    # format the parameters to send to the ALD

    set configList {}
    for {set ix  0} {$ix < [llength $lmVals(lmLicensedProductNames)]} {incr ix} {
        set featureSet ""
        append featureSet "[lindex $lmVals(lmLicensedProductNames) $ix]:"
        append featureSet "[lindex $lmVals(lmLicensedFeatureIds) $ix]:"
        append featureSet "[lindex $lmVals(lmFeaturesRequested) $ix]"
        set featureSet [string trim $featureSet]

        if {$ix != [expr [llength $lmVals(lmLicensedProductNames)]- 1]} {
            append featureSet "|"
        }
        append configList $featureSet
    }


    # check that if port is NULL use 27000

    if {$lmVals(lmPort) == ""} {
        set lmVals(lmPort) $lmVals(defaultServPort)
    }

        set hostRec \
                "$lmVals(lmHostName)|$lmVals(lmHostId)|$lmVals(lmPort)|$configList"

    set params [format "%s|%s|%s|%s" \
                                $setupVals(WRSLicense) $setupVals(prodVer) \
                $setupVals(lmInstType) $hostRec]

    # send to ALD

    set reply 0
    while {$reply == 0} {
        set reply [sendToALD  $LicFileConfigRequest $params]
	 
        if { [isGUImode] } {

            # if an error occurs either retry or go to lm options
            # if error occurs during test automation, exit SETUP
  
            if {[isNumeric $reply]} {
                                
                if {$reply == 1} {

                    if { $ctrlVals(useInputScript) } {
                        autoSetupLog "ERROR in sendToALD: $CommitRequest $params"
                        autoSetupLog "Reply: $reply"
                        autoSetupLog "Application Exit\n"
                        set setupVals(cancel) 1                
                        applicationExit
                        set returnValue 0
                        return $returnValue
                    } else {
                        controlEnable wizardDialog.nextButt 1
                        controlEnable wizardDialog.backButt 1
                                                
                        windowClose licConfigDlg
                        
                        # remove autoInst or nodelock page list 
                        rmPageList

                        if {[instTypeGet] == "license"} {
                            # Return to lmInstOptions page and set to email option

                            set setupVals(lmInstOptions) "onEmail"                                                             
                            set returnValue [calcPage lmInstOptions]
                        } else {
                            # Return to lmAutoManChoice page and set to manual 
                            # option
                            
                            set setupVals(lmAutoManChoice) "onManual"                                  
                            set returnValue [calcPage lmAutoManChoice]
                            controlHide $ctrlVals(mainWindow).bitmap 0
                        }
                        
                        return $returnValue
                    }
                }
            }
        } else { # TEXT MODE

            # if an error occurs go to lm options page
  
            if {[isNumeric $reply]} {
                if {$reply == 1} {
                    return -1
                }
            }
        }
    }

    # No error, the reply is a valid token to be saved for the commit request

    set lmVals(token) [string trim $reply]
    set retVal [licenseConfirm]

    # check to make sure directory paths exists and is writable

    set path [destDirGet]
    set outFileName [file join $path .wind license WRSLicense.lic]
    set path1 [file join $path .wind license]

    while {![file isdirectory $path1]} {
        if {[catch [file mkdir $path1] err]} {

            # invalid path...exit SETUP

            if { [isGUImode] } {

                if { $ctrlVals(useInputScript) } {

                    autoSetupLog "[strTableGet CANNOT_CREATE_PATH_1_TEXT]"
                    autoSetupLog "Application Exit\n"
                    set setupVals(cancel) 1                
                    applicationExit
                    set returnValue 0
                    return $returnValue

                } else {
                    set ans [dialog resume_exit \
                            "License Management Configuration" \
                            [strTableGet CANNOT_CREATE_PATH_1]]

                    dbgputs "Cannot create $path1"

                    if {$ans == "1"} {  applicationExit  }
                }

            } else {
                dbgputs "Cannot create $path1"
                puts [strTableGet CANNOT_CREATE_PATH_1_TEXT]

                set msg "\nPress 1 to retry , 2 to exit SETUP\n"
                while (1) {
                    switch -regexp -- [prompt $msg] {
                        "^1$" { break }
                        "^2$" { return 0 }
                    }
                }
            }
        }
    }
    
    # update the return value to user's input (OK or CANCEL)
    set returnValue $retVal

    if {$retVal} { # OK on Summary page...commit
 
        # send the commit command and save the license file into the 
        # licensefile dir [destDirGet]/.wind/license

        dbgputs "Commit: hostRec"

        set hostRec \
               "$lmVals(lmHostName)|$lmVals(lmHostId)|$lmVals(lmPort)|$configList"

        set params [format "%s|%s|%s|%s|%s|%s|%s|%s|%s" \
                                $setupVals(WRSLicense) $setupVals(prodVer) \
                                $lmVals(token) $setupVals(sysAdminName) \
                                $setupVals(userPhone) $setupVals(userEmail) \
                                "SETUP" $setupVals(lmInstType)  \
                                $hostRec]

        set reply 0
        while {$reply == 0} {
            set reply [sendToALD $CommitRequest $params]
  
            if { [isGUImode] } {

                # if an error occurs either retry or go to lm options
                # if test automation, exit and put error log

                if {[isNumeric $reply]} {

                    if {$reply == 1} {

                        if { $ctrlVals(useInputScript) } {
                            autoSetupLog "ERROR in sendToALD: $CommitRequest $params"
                            autoSetupLog "Reply: $reply"
                            autoSetupLog "Application Exit\n"
                            set setupVals(cancel) 1                
                            applicationExit

                            set returnValue 0
                            return $returnValue

                        } else {
                            controlEnable wizardDialog.nextButt 1
                            controlEnable wizardDialog.backButt 1

                            windowClose licConfigDlg  

                            # remove autoInst or nodeLock page list
                            rmPageList

                            if {[instTypeGet] == "license"} {
                                # Return to lmInstOptions page and set to email option

                                set setupVals(lmInstOptions) "onEmail"                                                             
                                set returnValue [calcPage lmInstOptions]
                            } else {
                                # Return to lmAutoManChoice page and set to manual 
                                # option
                            
                                set setupVals(lmAutoManChoice) "onManual"                                  
                                set returnValue [calcPage lmAutoManChoice]
                                controlHide $ctrlVals(mainWindow).bitmap 0
                            }

                            return $returnValue
                        }
                    }
                }
            } else { # TEXT MODE 

                # if an error occurs, go to lm options

                if {[isNumeric $reply]} {
                    if {$reply == 1} {
                        return -1
                    }
                }
            }
        }

        if { [isGUImode] } {  beginWaitCursor  }

        # opening license file to update

        if {[catch {open $outFileName w} fd]} {

            # If errror, prompt message and exit SETUP

            set msg "Error opening license file output filename: $outFileName"
            uninstLog setup $msg
            dbgputs $msg

            if { $ctrlVals(useInputScript) } {            
                autoSetupLog "$msg"
                autoSetupLog "Application Exit\n"
                set setupVals(cancel) 1                
                applicationExit

                set returnValue 0
                return $returnValue
            }

            if { [isGUImode] } {     
                endWaitCursor

                windowClose licConfigDlg  
                set returnValue 0
                return $returnValue

            } else {
                set msg "Press <Enter> to Continue"
                while { [prompt $msg] != "" } {
                }
                return 0
            }
        } else {
            puts $fd $reply

            # closing license file

            if {[catch {close $fd} err]} {

⌨️ 快捷键说明

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