📄 liccfg.tcl
字号:
-title $feature \ -x $XCOL1 -y $newY -w $FEATWIDTH -h $HT] \ [list label -name ${feature}Total -right \ -title $fTotal \ -x [expr $XCOL2 + $INDENT] -y $newY -w $TXTWIDTH -h $HT] \ [list label -name ${feature}Allocated -right \ -title $fAllocated \ -x [expr $XCOL3 + $INDENT] -y $newY -w $TXTWIDTH -h $HT] \ [list label -name ${feature}HostAllocated -right \ -title $fHostAllocated \ -x [expr $XCOL4 + $INDENT] -y $newY -w $TXTWIDTH -h $HT] \ [list label -name ${feature}Available -right \ -title $fAvailable \ -x [expr $XCOL5 + $INDENT] -y $newY -w $TXTWIDTH -h $HT] \ # Add the callback function for nodelocked check boxes lappend ctrlVals(volatileFrm) \ [list boolean -name ${ix}Boolean -auto \ -callback "nodelockBooleanCB $ix"\ -x [expr $XCOL6 + $INDENT] -y $newY -w 22 -h 12] } } # Set title for the dialog if {$lmVals(reload)} { set w [dlgFrmCreate [strTableGet LICCFG_TITLE_RELOAD]] } elseif {$isFloatLic} { if {$setupVals(ELMUser) == 1} { set w [dlgFrmCreate [strTableGet LICCFG_TITLE_ELM]] } else { set w [dlgFrmCreate [strTableGet LICCFG_TITLE_FLOATING]] } } else { set w [dlgFrmCreate [strTableGet LICCFG_TITLE_NODELOCKED]] } controlEnable $w.backButt 1 controlEnable $w.nextButt 0 if {$isFloatLic} { # otherwise, if licenses are available, default to 1 # if no license available, gray out the box for that product # if no license available for all products, display message set noLicenseAllProd 1 set length [llength $lmVals(lmLicensedProductNames)] for {set ix 0} {$ix < $length} {incr ix} { # check if any lmLicProdInfoGetlicenses left set prodName [lindex $lmVals(lmLicensedProductNames) $ix] set fInput [lmFeaturesValueGet lmFLFeaturesAvailable $prodName] if { $fInput <= 0 } { # no license left for this product. Default to 0 and Gray out box controlValuesSet $w.${ix}Requested 0 controlEnable $w.${ix}Requested 0 } else { # default to 1 controlValuesSet $w.${ix}Requested 1 set noLicenseAllProd 0 } } # If no more licenses available for all products, prompt user if { $noLicenseAllProd == 1 } { dialog ok_with_title "No More Licenses" [strTableGet LICCFG_NO_LIC_ERROR] controlEnable $w.nextButt 0 } } else { # node locked if {$lmVals(reload) != 1} { set noLicenseAllProd 1 } else { set noLicenseAllProd 0 } set length [llength $lmVals(lmLicensedProductNames)] for {set ix 0} {$ix < $length} {incr ix} { # check if any lmLicProdInfoGetlicenses left set prodName [lindex $lmVals(lmLicensedProductNames) $ix] set fInput [lmFeaturesValueGet lmNLFeaturesAvailable $prodName] # also check to see if the customer has already configured a node-locked # license for this product, if so set fInput = 0 to disable the checkbox if {[lmLicHostIndexGet $lmVals(lmHostName)] > 0} { if {[isNLSeatAllocated $prodName $lmVals(lmHostName)] == 1} { set fInput 0 } } else { if {$fInput != 0} { set fInput 1 } } if { $fInput <= 0 } { # no license left for this product. Default to 0 and Gray out box controlCheckSet $w.${ix}Boolean 0 controlEnable $w.${ix}Boolean 0 } else { # default to 1 controlCheckSet $w.${ix}Boolean 1 set noLicenseAllProd 0 } } # If no more licenses available for all products, prompt user if { $noLicenseAllProd == 1 } { dialog ok_with_title "No More Licenses" [strTableGet LICCFG_NO_LIC_ERROR] controlEnable $w.nextButt 0 } } if {$lmVals(reload)} { if {$isFloatLic} { # if reload, use existing license info - no new allocation for {set ix 0} {$ix < [llength $lmVals(lmLicensedProductNames)]} \ {incr ix} { controlValuesSet $w.${ix}Requested 0 } } else { for {set ix 0} {$ix < [llength $lmVals(lmLicensedProductNames)]} \ {incr ix} { controlCheckSet $w.${ix}Boolean 0 } } 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 doTextMode $isFloatLic }}############################################################################### doTextMode## This procedure will configure license on current host in text mode## SYNOPSIS# .tS# doTextMode isFloatLic# .tE## PARAMETERS: isFloatLic - parameter indicating if license mode is floating## RETURNS: N/A## ERRORS: N/A##proc doTextMode {isFloatLic} { global ctrlVals setupVals lmVals lmHostFeaturesNum global licConfigReturn global returnValue # 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 a" 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)] if {$hostIndex == -1} { set numberOfFeatures 0 } else { set numberOfFeatures [lindex $lmHostFeaturesNum $hostIndex] } if {$isFloatLic} { 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 lmFLFeaturesAllocated $feature] set fAvailable [lmFeaturesValueGet lmFLFeaturesAvailable $feature] set fTotal [lmFeaturesValueGet lmFLFeaturesTotal $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 licFLAllocated $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] ] } else { puts [format " %-4s %-*s\t %-13s %-13s %-11s %-13s %-4s" \ [expr $ix + 1] \ $nameWidth $feature $fTotal $fAllocated $fHostAllocated $fAvailable 1 ] } } } else { # Node-locked section 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 lmNLFeaturesAllocated $feature] set fAvailable [lmFeaturesValueGet lmNLFeaturesAvailable $feature] set fTotal [lmFeaturesValueGet lmNLFeaturesTotal $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 licNLAllocated $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] ] } 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 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -