📄 dbquery.tcl
字号:
# DBQUERY.TCL - Setup procedures for implementing Database Query Permission
# wizard page
#
# Copyright 1999-2003 Wind River Systems, Inc
#
# modification history
# --------------------
# 03i,29apr03,bjl keep track of successful db query (spr 88068).
# 03h,20feb03,bjl changed licinfo dialogs to wizard page flow; remove
# puf licinfo page if no license servers.
# 03j,14feb03,bjl modified for ELM page sequences.
# 03i,05feb03,wmd Change back to using prodVer for the release set.
# 03h,02feb03,wmd Need to use setupVals(torVer) for correct releaseSetVersion
# number.
# 03g,27jan03,wmd Modify to use licInfoGetAll2 for ALI.
# 03f,22may02,bwd SPR 77766: increased the width for more text to be
# displayed
# 03e,13may02,wmd Fix SPR 77291, fix detail button to mention use with a
# docking station.
# 03d,24apr02,j_w Fixed SPR 76126: able to specify DISK_SERIAL as host id
# 03c,05mar02,bwd Modified SETUP to be non-tornado centric
# 03b,07may01,j_w Update text messages
# 03a,02may01,j_w Display the correct hostId
# 02z,12mar01,wmd Fix spr 63962, add NIC hostId info for Windows hosts.
# 02y,06nov00,bwd Remove resetting lmVals(reload) variable because of change
# in page flow
# 02x,04nov00,wmd Fix typos in text explanations.
# 02w,18oct00,j_w remove tellMeMore button refrence (spr 35340)
# 02v,03oct00,bwd SPR 31034: removed "Tell Me More" dialog since setup online
# help is in place
# 02u,12sep00,bwd SPR 34383: added a dialog box to display instruction for
# End User when encountering DB errors. Change -helpfile to
# -nocontexthelp
# 02t,28jun00,bwd Changed host checking to use windHostTypeGet instead of
# env(WIND_HOST_TYPE)
# 02s,31may00,bwd SPR 31388: removed text DBQUERY_MSG_3 and modified message
# display for TEXT mode
# 02r,30may00,bwd Enable back for reload in TEXT mode
# 02q,26may00,bwd Enable Back button for reload
# 02p,23may00,bwd Fixed message
# 02o,22may00,bwd fixed typo - calPage. Fixed page order when DB errors
# occur.
# 02n,22may00,bwd SPR 31003 - modified to add cancel button to banner
# indicating database transaction.
# 02m,17may00,bwd SPR 31030 - design change for nodelock to be like floating
# license: added lmInstOptions before DBQUERY page and when
# onDenied, go back to lmInstOptions.
# 02l,15may00,bwd SPR 31030 - added lmInstOptions page list when user selects
# "no access to Wind River web site"
# 02k,12may00,wmd Modify the "Tell Me More" text string for clarity.
# 02j,12may00,wmd Fix spr # 31201, warn users that internet access is
# required.
# 02i,23mar00,bwd Fixed licInfoGetAllCallBack to match with the new format of
# data coming in from CGI. Removed licInfoGetAllText and moved
# all TEXT mode codes to licInfoGetAllCallBack. Removed
# lmTotalInfoGetByCode. Created new format for lmVals
# 02h,17mar00,j_w Rewording radiobutton messages
# 02g,14feb00,wmd Change all references to prodCode to featureId.
# 02f,09feb00,wmd Fix text mode as well for "Tell Me More".
# 02e,09feb00,wmd Provide a "Tell Me More" text specifically for end-user
# mode.
# 02d,04feb00,wmd Add text mode error handling.
# 02c,03feb00,j_w Fix lmExit page problem
# 02b,03feb00,j_w Initialize lmHostFeaturesNum to zero in licInfoGetAllText
# 02a,03feb00,wmd Need to initialize lmHostFeaturesNum to zero.
# 01z,31jan00,j_w Renamed lmVals(PinRequired) to lmVals(lmPinRequired)
# 01y,25jan00,j_w Populate lmVals at the end of licInfoGetAllCallBack
# 01x,21jan00,j_w Updated parameter list for sendToALD call
# 01w,06jan00,bwd No test automation for command line SETUP
# 01v,06jan00,j_w Fixed DBQUERY_STATEMENT message layout size
# 01u,17dec99,clc change switch patterns
# 01t,17dec99,clc fix missing-close brace
# 01s,14dec99,wmd Add icon to wait banner.
# 01r,10dec99,j_w Remove autoInst pageList if licInfoRetVal is 1
# 01q,06dec99,wmd Fix the error handling to work correctly.
# 01p,03dec99,wmd Add statement saying that we will not upload any user data.
# 01o,23nov99,wmd Fix wait cursor.
# 01o,23nov99,clc add text mode
# 01n,22nov99,wmd Add lmLicHostIndexGet proc.
# 01m,17nov99,j_w Disable the back button if reload option is selected in the
# current license info page. Reset lmVals(reload) to 0 in
# the onDenied option
# 01l,16nov99,wmd Add record call totalRecs to hold totals.
# 01k,15nov99,j_w set onGrant to be the default option
# 01j,15nov99,j_w Removed desired pagelist if onDenied option is selected
# 01i,15nov99,wmd Add a lmValsInit proc.
# 01h,15nov99,bwd Added sections for automatic setup installation
# 01g,11nov99,wmd Add code to parse the licInfoGetAll request reply.
# 01f,05nov99,wmd Add code to make sure next button is enabled.
# 01e,05nov99,j_w Fixed Next button
# 01d,03nov99,j_w Renamed licInfoGetAll to licInfGetAllCallBack
# 01c,01nov99,j_w Implemented details of licInfoGetAll
# 01b,30oct99,wmd Change how it invokes the lmExit page.
# 01a,04Oct99,j_w written
#
global licInfoRetVal
global cancelDBQUERY
#############################################################################
#
# pageCreate(dbQuery) - Database Query Permission page
#
# SYNOPSIS
# .tS
# pageCreate(dbQuery)
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc pageCreate(dbQuery) {} {
global ctrlVals env setupVals lmVals
set setupVals(WRSLicense) [setupLicenseNumGet]
set idType "(MAC)"
set licInfo "WRS License: $setupVals(WRSLicense)"
set hostInfo "Host Name: $setupVals(hostName)"
set idInfo "Host ID $idType: $setupVals(hostId)"
if { [isGUImode] } {
set ctrlVals(volatileFrm) [list \
[list label -name message1 \
-title [strTableGet DBQUERY_MSG_1] \
-x 99 -y 10 -w 197 -h 20] \
[list label -name licInfo \
-title $licInfo \
-x 99 -y 30 -w 190 -h 10] \
[list label -name hostInfo \
-title $hostInfo \
-x 99 -y 40 -w 190 -h 10] \
[list label -name idInfo \
-title $idInfo \
-x 99 -y 50 -w 190 -h 10] \
[list label -name message3 \
-title [strTableGet DBQUERY_MSG_2] \
-x 99 -y 80 -w 195 -h 35] \
[list choice -name grant -auto \
-title [strTableGet DBQUERY_GRANT] \
-x 99 -y 120 -w 190 -h 10 \
-callback onGrant] \
[list choice -name denied -auto \
-title [strTableGet DBQUERY_DENIED] \
-x 99 -y 130 -w 190 -h 10 \
-callback onDenied] \
[list label -name message4 \
-title [strTableGet DBQUERY_STATEMENT] \
-x 99 -y 145 -w 195 -h 20] ]
if {![isUnix]} {
lappend ctrlVals(volatileFrm) \
[list boolean -name vsnChkBox \
-auto \
-title "Use Disk Serial Number for host ID" \
-x 110 -y 62 -w 130 -h 10 \
-callback onSerial]
lappend ctrlVals(volatileFrm) \
[list button -name "vsn_details" \
-title "Details..." \
-x 250 -y 60 -w 40 -h 12 \
-callback onVsnDetails]
}
set w [dlgFrmCreate [strTableGet DBQUERY_TITLE]]
controlValuesSet $w.nextButt "&Next >"
controlEnable $w.backButt 1
controlEnable $w.nextButt 1
controlEnable $w.cancelButt 1
controlEnable $w.helpButt 1
if { [isTornadoProduct] } {
controlEnable $w.helpButt 1
} else {
controlEnable $w.helpButt 0
}
controlCheckSet $w.grant 1
if {![isUnix]} {
controlCheckSet $w.vsnChkBox 0
}
# test automation
if { $ctrlVals(useInputScript) } {
autoSetupLog "Database Query Permission Page: skipped"
autoSetupLog "\tDB Permission: $setupVals(dbQueryOptions)"
nextCallback
}
} else { # TEXT mode
printPageTitle [strTableGet DBQUERY_TITLE]
puts [strTableGet DBQUERY_MSG_1]
puts "\n$licInfo\n"
puts "[strTableGet DBQUERY_MSG_2]\n"
puts "[strTableGet DBQUERY_STATEMENT]\n"
puts "Choose 1 - [strTableGet DBQUERY_GRANT]\n"
puts " 2 - [strTableGet DBQUERY_DENIED]\n"
set loop 1
while { $loop == 1} {
set ret [prompt "Please enter the number of your selection. \[1\]"]
switch -regexp -- $ret {
"1" {
onGrant
nextCallback
return 0
}
"2" {
onDenied
nextCallback
return 0
}
"^-$" {
backCallback
return 0
}
"[eE][xX][iI][tT]" {
return 0
}
"^$" {
onGrant
nextCallback
return 0
}
default {
}
}
}
}
}
#############################################################################
#
# pageProcess(dbQuery) - process inputs from dbQuery page
#
# This procedure will process inputs from dbQueru page
#
# SYNOPSIS
# .tS
# pageProcess(dbQuery)
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: 1 when successful
#
# ERRORS: N/A
#
proc pageProcess(dbQuery) {} {
global setupVals lmVals ctrlVals
global licInfoRetVal setupPageList
global lmHostRecsLen
# zero out values that are volatile
lmValsInit
switch $setupVals(dbQueryOptions) {
onGrant {
if { [isGUImode] } {
# get license information
set licInfoRetVal 0
while { $licInfoRetVal == 0 } {
# Error occur and retry
licInfoGetAllDlgCreate
}
# Error occur but don't retry
# XXXX Need more work here... XXX
if {$licInfoRetVal == 1} {
set outFile ""
if { [isUnix] } {
set outFile "[destDirGet]/endUserInfo.txt"
} else {
set outFile "[destDirGet]\\endUserInfo.txt"
}
messageBox "[strTableGet DBQUERY_ERROR]\n\
\nThe information will be written to\
$outFile for your convenience.\n"
if { ![catch {open $outFile "w"} outFile] } {
puts $outFile [strTableGet DBQUERY_ERROR]
} else {
puts "ERROR writing to file: $outFile"
}
close $outFile
set setupVals(cancel) 1
applicationExit
}
} else { # TEXT MODE
# get license information
set licInfoRetVal 0
while { $licInfoRetVal == 0 } {
# An error occurred, and retry by user
licInfoGetAllCallBack
}
if { $licInfoRetVal == 1 } {
backCallback
}
}
if { $licInfoRetVal != 1 } {
if { [instTypeGet] != "license" } {
if {$setupVals(ELMUser) == 1} {
set setupVals(lmInstType) "endUser"
if {$lmHostRecsLen == 0} {
# if no servers, remove the next information
# screen
pageRemove lmInfo
pageListAdd ELM
}
} else {
set setupVals(lmInstType) ""
}
}
}
}
onDenied {
if {[instTypeGet] == "license"} {
pageListRemove "autoInst"
# Return to lmInstOptions page and set to email option
set setupVals(lmInstOptions) "onEmail"
# return to the lmInstOptions page
return [calcPage lmInstOptions]
} else {
pageListRemove "dbQuery"
# Return to lmAutoManChoice page and set to manual option
set setupVals(lmAutoManChoice) "onManual"
return [calcPage lmAutoManChoice]
}
}
}
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; \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -