📄 dbquery.tcl
字号:
} elseif { $setupVals(lmInstType) == "endUser" } { pageListAdd "lmExit" } } } dbgputs "dbQuery: $ctrlVals(pageList)" dbgputs "dbQuery choice: $setupVals(dbQueryOptions)" return 1}############################################################################### licInfoGetAllDlgCreate - create dialog box for retrieving customer # data from WRS website## SYNOPSIS# .tS# licInfoGetAllDlgCreate# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc licInfoGetAllDlgCreate {} { global ctrlVals global setupVals global env if { [windHostTypeGet] == "x86-linux2" } { dialogCreate \ -name licInfoGetAllDlg \ -notitle \ -parent $ctrlVals(parentDialog) \ -nocontexthelp \ -width 250 -height 42 \ -init { controlPropertySet licInfoGetAllDlg.message1 -bold 1; \ windowTimerCallbackSet licInfoGetAllDlg \ -milliseconds 200 licInfoGetAllCallBack } \ -controls [list \ [list label -name "message1" -center \ -title [strTableGet DBQUERY_LICINFO_BANNER] \ -x 35 -y 10 -w 200 -h 10 ] \ [list button -name cancel -title "&Cancel" \ -callback onCancel \ -x 100 -y 23 -w 50 -h 15] ] } else { dialogCreate \ -name licInfoGetAllDlg \ -notitle \ -parent $ctrlVals(parentDialog) \ -nocontexthelp \ -width 250 -height 42 \ -init { controlPropertySet licInfoGetAllDlg.message1 -bold 1; \ windowTimerCallbackSet licInfoGetAllDlg \ -milliseconds 200 licInfoGetAllCallBack } \ -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 DBQUERY_LICINFO_BANNER] \ -x 35 -y 10 -w 200 -h 10 ] \ [list button -name cancel -title "&Cancel" \ -callback onCancel \ -x 100 -y 23 -w 50 -h 15] ] }}############################################################################### licInfoGetAllCallBack# GUI mode : a call back function for licInfoGetAllDlg# TEXT mode: retrieves license information from WRS database## This function retrieves customer license information from WRS database. It # parses the license file, populates some lmVals values and calls # lmValsPopulate to fill the rest of lmVals values## SYNOPSIS# .tS# licInfoGetAllCallBack# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc licInfoGetAllCallBack {} { global setupVals lmVals lmTotalRecs global lmHostRecsLen lmHostRecs lmHostFeaturesNum global licInfoRetVal set licInfo "" if { [isGUImode] } { windowTimerCallbackSet licInfoGetAllDlg 0 "" } else { puts "\n[strTableGet DBQUERY_LICINFO_BANNER]" } # get license information here # send the licInfoGetAllRequest = 1 # send WRSLicense and Tornado version # set licInfoGetAllRequest 1 set parms "$setupVals(WRSLicense)|$setupVals(prodVer)" set licInfo [sendToALD $licInfoGetAllRequest $parms] if {[isNumeric $licInfo]} { # error handling code here ... if {$licInfo == 0 || $licInfo == 1} { set licInfoRetVal $licInfo if { [isGUImode] } { windowClose licInfoGetAllDlg } return } } # parse the input into lmVals set licInfo [split $licInfo '\n'] set listLen [llength $licInfo] if {[lindex $licInfo [expr $listLen - 1]] == ""} { set licInfo [lreplace $licInfo [expr $listLen - 1] [expr $listLen - 1]] set listLen [expr $listLen - 1] } # get the PIN field set lmVals(lmPinRequired) [lindex $licInfo 0] # get the token set lmVals(token) [lindex $licInfo 1] # get lmFeaturesTotal info (3rd line) set lmTotalRecs [split [lindex $licInfo 2] "|"] set lmVals(lmFeaturesTotal) "" # populate lmVals(lmFeaturesTotal) foreach feature $lmTotalRecs { set prod [split $feature ":"] set fName [lindex $prod 0] set fID [lindex $prod 1] set fTotal [lindex $prod 2] set lmVals(lmFeaturesTotal) \ [lappend lmVals(lmFeaturesTotal) [list $fName $fTotal]] } # parse the hostRecords, they are of the form: # host|hostID|port|feature:featureId:numLic|... set lmHostRecs [lrange $licInfo 3 $listLen] set lmHostRecsLen [llength $lmHostRecs] set lmHostFeaturesNum {} for {set ix 0} {$ix < $lmHostRecsLen} {incr ix} { set hostRec [split [lindex $lmHostRecs $ix] "|"] # get host information lappend lmVals(lmHosts) [lindex $hostRec 0] lappend lmVals(lmHostIds) [lindex $hostRec 1] lappend lmVals(lmHostPorts) [lindex $hostRec 2] # get the number of features for that host set hostRecLen [llength $hostRec] lappend lmHostFeaturesNum [expr $hostRecLen - 3] } # Populate lmVals from the return record lmValsPopulate $lmVals(lmHostName) set licInfoRetVal "" if { [isGUImode] } { windowClose licInfoGetAllDlg } else { return 0 }}############################################################################### onGrant - callback function when the grant option is selected## This procedure is a callback which sets up wizard pages when the grant # option is selected## SYNOPSIS# .tS# onGrant# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc onGrant {} { global setupVals set setupVals(dbQueryOptions) "onGrant" }############################################################################### onDenied - callback function when the denied option is selected## This procedure is a callback which sets up wizard pages when the denied # option is selected## SYNOPSIS# .tS# onDenied# .tE## PARAMETERS: N/A## RETURNS: N/A# # ERRORS: N/A#proc onDenied {} { global setupVals set setupVals(dbQueryOptions) "onDenied" }proc onSerial {} { global ctrlVals setupVals lmVals set w $ctrlVals(mainWindow) if {[controlChecked $w.vsnChkBox]} { set id [hostIdGen vsn] set idType "(Disk Serial)" } else { set id [hostIdGen] set idType "(MAC)" } set setupVals(hostId) $id set lmVals(lmHostId) $id set msg "Host ID $idType: $setupVals(hostId)" controlValuesSet $w.idInfo $msg}proc onVsnDetails {} { dialog ok_with_title \ "Disk Serial Information" \ [strTableGet DBQUERY_VSN_DETAILS]}############################################################################### onCancel - callback function when user clicks cancel while retrieving information## This procedure is a callback when user clicks cancel button while retrieving# license information from the database## SYNOPSIS# .tS# onGrant# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc onCancel {} { global cancelDBQUERY global lmVals if {$lmVals(httpToken) != ""} { http_reset $lmVals(httpToken) set lmVals(httpToken) "" } controlEnable wizardDialog.backButt 0 controlEnable wizardDialog.nextButt 0 controlEnable wizardDialog.cancelButt 0 controlEnable wizardDialog.helpButt 0 windowClose licInfoGetAllDlg set cancelDBQUERY 1}############################################################################### lmValsInit - routine to clean out values that are volatile## SYNOPSIS# .tS# lmValsInit# .tE## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc lmValsInit {} { global lmVals # clean out values that lmValsPopulate will add set lmVals(lmHostIds) {} set lmVals(lmHostPorts) {} set lmVals(lmLicensedProductNames) {} set lmVals(lmLicensedFeatureIds) {} set lmVals(lmFeaturesAllocated) {} set lmVals(lmFeaturesAvailable) {} set lmVals(lmFeaturesRequested) {}}#############################################################################
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -