📄 liccfg.tcl
字号:
## 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 # Return to lmInstOptions page and set to email option set setupVals(lmInstOptions) "onEmail" set returnValue [calcPage lmInstOptions] 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 # Return to lmInstOptions page and set to email # option set setupVals(lmInstOptions) "onEmail" set returnValue [calcPage lmInstOptions] 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]} { set msg "Error closing file $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 } } uninstLog setup "Setup wrote \"$reply\" to $outFileName" if { $ctrlVals(useInputScript) } { autoSetupLog "Setup wrote the following information\ to $outFileName:\n\"$reply\"" } } # success in updating the license file # proceed to next page if { [isGUImode] } { endWaitCursor # turn on the setup bitmap for next page controlHide $ctrlVals(mainWindow).bitmap 0 windowClose licConfigDlg } } else { # user click Cancel on Summary page (retVal=0) # Return to License Configuration page if { [isGUImode] } { windowClose licConfigDlg } else { # return to LICCFG page return 2 } } return $returnValue}############################################################################### pageProcess(licConfig) - process inputs from the licConfig page## This procedure will process inputs from the licConfig page## SYNOPSIS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -