📄 liccfg.tcl
字号:
if {$lmVals(reload)} { for {set ix 0} {$ix < [llength $lmVals(lmLicensedProductNames)]} {incr ix} { # disable the edit controls if {$isFloatLic} { controlEnable $w.${ix}Requested 0 } else { controlEnable $w.${ix}Boolean 0 } } controlEnable $w.nextButt 1 } # test automation if {$ctrlVals(useInputScript)} { autoSetupLog "License Configuration Page: skipped" nextCallback } } else { # text mode # find the maximum width of the product names set nameWidth 0 foreach name $lmVals(lmLicensedProductNames) { if { [string length $name] > $nameWidth } { set nameWidth [string length $name] } } set host $lmVals(lmHostName) while (1) { # Set title if {$lmVals(reload)} { printPageTitle [strTableGet LICCFG_TITLE_RELOAD] puts "[strTableGet LICCFG_RELOAD_1]\n" } elseif {$isFloatLic} { # Floating License End User printPageTitle [strTableGet LICCFG_TITLE_FLOATING] puts "[strTableGet LICCFG_FLOAT_1]\n" } else { # Nodelocked End User printPageTitle [strTableGet LICCFG_TITLE_NODELOCKED] puts "[strTableGet LICCFG_NODELOCK_1]\n" } # print column labels for table of products # print column label if { $lmVals(reload) || $isFloatLic } { set HEADER_L1 "Additional" set HEADER_L2 "licenses" set HEADER_L3 "to allocate" } else { set HEADER_L1 "Check to" set HEADER_L2 "request lmLicProdInfoGeta" set HEADER_L3 "license" } puts [format " %-4s %-*s\t %-13s %-13s %-11s %-13s %-13s" \ "" $nameWidth "" "Total No." "Total No." \ "Existing" "Licenses" "$HEADER_L1"] puts [format " %-4s %-*s\t %-13s %-13s %-11s %-13s %-13s" \ "" $nameWidth "Licensed" "of licenses" "of licenses"\ "licenses" "available for" "$HEADER_L2"] puts [format " %-4s %-*s\t %-13s %-13s %-11s %-13s %-13s" \ "item" $nameWidth "Product" "purchased" "allocated"\ "on host" "allocation" "$HEADER_L3"] for { set i 0 } { $i < [expr $nameWidth + 80] } { incr i } { puts -nonewline "-" } puts "" # display table contents set hostIndex [lsearch $lmVals(lmHosts) $lmVals(lmHostName)] set numberOfFeatures [lindex $lmHostFeaturesNum $hostIndex] for { set ix 0 } { $ix < [llength $lmVals(lmLicensedProductNames)] } { incr ix } { set feature [lindex $lmVals(lmLicensedProductNames) $ix] set featureId [lindex $lmVals(lmLicensedFeatureIds) $ix] set fHostAllocated 0 set fAllocated [lmFeaturesValueGet lmFeaturesAllocated $feature] set fAvailable [lmFeaturesValueGet lmFeaturesAvailable $feature] set fTotal [lmFeaturesValueGet lmFeaturesTotal $feature] for {set ixf 0} {$ixf < $numberOfFeatures} {incr ixf} { # only if the feature is previously allocated on this host # (name match), retrieve allocated value if { $feature == [lmLicProdInfoGet prodName $lmVals(lmHostName) $ixf] } { set fHostAllocated \ [lmLicProdInfoGet licAllocated $lmVals(lmHostName) $ixf] } } if {$lmVals(reload)} { set lmVals(lmFeaturesRequested) \ [lreplace $lmVals(lmFeaturesRequested) $ix $ix \ 0 $ix] puts [format " %-4s %-*s\t %-13s %-13s %-11s %-13s %-4s" \ [expr $ix + 1] \lmLicProdInfoGet $nameWidth $feature $fTotal $fAllocated $fHostAllocated $fAvailable \ [lindex $lmVals(lmFeaturesRequested) $ix] ] } elseif { $isFloatLic } { puts [format " %-4s %-*s\t %-13s %-13s %-11s %-13s %-4s" \ [expr $ix + 1] \ $nameWidth $feature $fTotal $fAllocated $fHostAllocated $fAvailable 1 ] } else { if { [lindex $lmVals(lmFeaturesRequested) $ix] == 0 } { set request "" } else { set request "x" } puts [format "%4s %-*s %-13s %-13s %-11s %-13s %4s" \ [expr $ix + 1] \ $nameWidth $feature $fTotal $fAllocated $fHostAllocated $fAvailable \ $request ] } } # prompt for user input if {$lmVals(reload)} { # reload current license file puts "\n[strTableGet LICCFG_RELOAD_2_TEXT]\n" set totalProd [llength $lmVals(lmLicensedProductNames)] set ret [prompt] switch -regexp -- $ret { "^$" { set ret [licConfigCallBack] if { $ret == 1} { set licConfigReturn 0 nextCallback return 0 } elseif { $ret == -1 } { set licConfigReturn 1 nextCallback return 0 } elseif { $ret == 0 } { return 0 } else { return [pageCreate(licConfig)] } } "^-$" { backCallback return 0 } "^[eE][xX][iI][tT]$" { set returnValue 0 return 0 } default { puts "Error: Invalid input. You are requesting to\ reload the existing license file." while {[prompt "Press <Enter> to continue."] != "" } { } } } } elseif {$isFloatLic} { #floating license configuration puts "\n\n[strTableGet LICCFG_FLOAT_2_TEXT]\n" set totalProd [llength $lmVals(lmFeaturesAvailable)] set ret [prompt] switch -regexp -- $ret { "^$" { if { [isLMFeaturesRequestedNull] } { puts "Warning: Please enter the number of\ license\(s\) for all products" } else { set ret [licConfigCallBack] if { $ret == 1} { set licConfigReturn 0 nextCallback return 0 } elseif { $ret == -1 } { set licConfigReturn 1 nextCallback return 0 } elseif { $ret == 0 } { return 0 } else { return [pageCreate(licConfig)] } } } "^-$" { backCallback return 0 } "^[eE][xX][iI][tT]$" { set returnValue 0 return 0 } "[ ]+" { puts "Error: please enter select only one item" while {[prompt "Press <Enter> to continue."] != "" } { } } "([1-9])+" { if { $ret > $totalProd } { puts [strTableGet 3145_COMP_SELECT_CHANGE_INVALID] while {[prompt "Press <Enter> to continue."] != "" } { } } else { floatingLicRequestedUpdate [expr $ret - 1] } } default { puts "Error: Invalid input." while {[prompt "Press <Enter> to continue."] != "" } { } } } } else { # nodelock end user mode puts "\n[strTableGet LICCFG_NODELOCK_2_TEXT]" set totalProd [llength $lmVals(lmFeaturesAvailable)] set ret [prompt] switch -regexp -- $ret { "^$" { if { [isLMFeaturesRequestedNull] } { puts "Error: At least one product must be selected." while {[prompt "Press <Enter> to continue."] != "" } { } } else { set ret [licConfigCallBack] if { $ret == 1} { set licConfigReturn 0 nextCallback return 0 } elseif { $ret == -1 } { set licConfigReturn 1 nextCallback return 0 } elseif { $ret == 0 } { return 0 } else { return [pageCreate(licConfig)] } } } "^-$" { backCallback return 0 } "[eE][xX][iI][tT]" { set returnValue 0 return 0 } "([1-9])+" { set okFlag 1 foreach index $ret { if { $index > $totalProd } { set okFlag 0 } } if { $okFlag == 0 } { puts [strTableGet 3145_COMP_SELECT_CHANGE_INVALID] while {[prompt "Press <Enter> to continue."] != "" } { } } else { foreach index $ret { nodelockLicRequestedUpdate [expr $index - 1] } } } default { puts "Warning: The list you have entered is invalid." while {[prompt "Press <Enter> to continue."] != "" } { } } } } } }}############################################################################### licConfigDlgCreate() - Create License Configuration dialog## This procedure will create License Configuration dialog## SYNOPSIS# .tS# licConfigDlgCreate() # .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc licConfigDlgCreate {} { global ctrlVals global setupVals global env if { [windHostTypeGet] == "x86-linux2"} { 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 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -