⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 liccfg.tcl

📁 windml3.0.3
💻 TCL
📖 第 1 页 / 共 5 页
字号:
# LICCFG.TCL - Setup procedures for implementing license configuration page
#
# Copyright 1999-2003 Wind River Systems, Inc
#
# modification history
# --------------------
# 03p,15may03,bjl  changed node locked licensing to use table.
# 03o,29apr03,bjl  changed to table to accomodate more features; grammar fix 
#                  (spr 87804).  
# 03n,20feb03,bjl  do not display floating dialog if ELM for sysadmin;
#                  modified sysadmin license wording; fixed error flow
#                  after dbquery for sysadmin.  
# 03m,14feb03,bjl  fixed error dialog display for nodelock reload, modifed
#                  page sequence for db error for ELM.
# 03l,05feb03,wmd  Change back to using prodVer for the release set.
# 03k,02feb03,wmd  Need to use setupVals(torVer) for correct releaseSetVersion
#                  number.
# 03j,28jan03,wmd  Modify lmValsPopulate proc to use ALI 2.0.
# 03i,18sep02,bjl  select licensed product by default only if seats are
#                  available (spr 80884).  
# 03h,30jul02,wmd  Remvoe the Beta period limit of 10 licenses warning.
# 03g,24apr02,j_w  Added detection for existing NL license (SPR 76046)
# 03f,20mar02,bwd  SPR 72885: add pop-up dialog to warn user to install
#                  correct number of floating licenses, not more
# 03e,11mar02,bwd  For Beta period, limit to 10 licenses per host
# 03d,11mar02,bwd  SPR 73927: modified default number of seats requested to 1
# 03c,08mar02,bwd  Adjusted height for each row of products
# 03b,05mar02,bwd  Modified SETUP to be non-tornado centric
# 03a,12jun01,j_w  Added for Tornado 2.2
# 03a,22nov00,bwd  SPR 35941: added a dialog to prompt user to exit if no more
#                  licenses available for configuration.
# 02z,01nov00,j_w  fixed summary page text display
# 02y,30oct00,j_w  Added proc rmPageList to removed the correct page 
#                  list depends on the value of setupVals(lmInstType) 
#                  if transaction is canceled
# 02x,02oct00,wmd  Update a user message for clarity.
# 02w,19sep00,bwd  SPR 34462: reconstruct hostRec for commit request in proc
#                  licConfigCallback
# 02v,25aug00,bwd  Fixed TCL error - infinite loop when enter invalid input
# 02u,30jul00,wmd  Add warning about consequences of configuring LM.
# 02t,07jul00,j_w  fixed typo
# 02s,28jun00,bwd  Changed host checking to use windHostTypeGet instead of
#                  env(WIND_HOST_TYPE)
# 02r,20jun00,wmd  Remove display of setupicon for linux host.
# 02q,02jun00,bwd  Changed all "dialog ok" to use "dialog ok_with_title"
# 02p,31may00,bwd  SPR 31564: uncheck boxes by default for node locked if
#                  reload
# 02o,19may00,bwd  Small bug fix in TEXT mode - SETUP should not exit when
#                  user cancel the commit request.
# 02n,18may00,bwd  SPR 31030 - modified codes to match new page list when
#                  calling sendToALD
# 02m,27apr00,j_w  Constructed hostRec after lmPort is being set
# 02l,19apr00,bwd  Added a workaround to skip license configuration error
#                  checking for Reload until the database is ready
# 02k,13apr00,bwd  Fixed typo on variable names. Fixed error handling and
#                  page displays when CGI errors arise.
# 02j,13apr00,j_w  Updated parameters for licFileConfig and ackCommit
# 02j,13apr00,bwd  Added a column on License Config page to display the no. of
#                  licenses already allocated for current host.
# 02i,12apr00,bwd  Added codes to check that user cannot enter 0 for all
#                  features if first time configuring on this host
# 02h,27mar00,bwd  Fixed error handling for LM Configuration when requesting
#                  for licenses more than available.
# 02g,24mar00,bwd  Fixed TEXT mode to correctly display License Config Summary
#                  page
# 02f,24mar00,bwd  Removed host name from the column headings on License
#                  Configuration pages. Fixed default value to 0 for reload.
# 02e,23mar00,bwd  Fixed lmValsPopulate to correctly populate lmVals with
#                  the new format of data coming in from CGI. Changed codes 
#                  to manipulate new lmVals structure.
# 02d,02mar00,bwd  Changed the title for the License Config summary page to 
#                  fit the dialog box. Fixed isLMFeaturesRequestedNull to 
#                  correctly handle inputs for both GUI and TEXT mode
# 02c,14feb00,wmd  Change all references to prodCode to featureId.
# 02b,03feb00,j_w  Remove commit in the parameter list of commit request call
# 02a,02feb00,j_w  Add licServPort in lmValsPopulate
# 01z,01feb00,bwd  Added a global variable licServPort to store port number
#                  from the license file
# 01y,31jan00,bwd  Fixed error handling for test automation - suppress exit
#                  confirmation dialog
# 01x,27jan00,bwd  Fixed error handlings for test automation and cleaned up
#                  codes
# 01w,25jan00,j_w  move lmValsPopulate to dbQuery page
# 01v,21jan00,j_w  Set lmVals(lmPort) to default port number. 
# 01v,21jan00,bwd  Added codes to display this page for TEXT MODE (Phase 3)
# 01u,20jan00,bwd  Added codes to display this page for TEXT MODE (Phase 2)
# 01t,19jan00,wmd  Remove any requests to rollback database, no longer
#                  required.
# 01s,18jan00,bwd  Added codes to display this page for TEXT MODE
# 01r,06jan00,bwd  No test automation for command line SETUP
# 01q,17dec99,clc  change  switch statement patterns
# 01p,14dec99,wmd  Add icon to wait banner.
# 01p,02dec99,clc  add text mode
# 01o,23nov99,wmd  Add output to setup.log to log license file that is written
#                  to disk.
# 01n,22nov99,bwd  Skipped license confirm display and more work on automating
#                  Floating License installation
# 01m,22nov99,bwd  Corrected TCL error for auto floating license installation
# 01l,19nov99,bwd  Added sections for automatic LM installation
# 01k,19nov99,wmd  Fix the Exceeds number of license error dialog to display
#                  ammended value.
# 01j,17nov99,wmd  Remove spaces from the commit command.
# 01i,15nov99,wmd  Add more error handling.
# 01h,13nov99,wmd  Add error handling.
# 01g,09nov99,wmd  Need to add logic for the configuration of LM.
# 01f,03nov99,wmd  Add code to send request to the database.
# 01e,02nov99,wmd  Use the real data from the database.
# 01d,01nov99,wmd  Fix the node locked license configuration screen to match
#                  the design docs.
# 01c,31oct99,wmd  Modify wording, and add edit boxes.
# 01b,30oct99,wmd  Add a dlgTitle for nodedLock license Configuration.
# 01a,07Oct99,j_w   written
#

global returnValue
global licServPort

#############################################################################
#
# pageCreate(licConfig) - Configure licenses on current host
#
# This procedure will configure license on current host
#
# SYNOPSIS
# .tS
# pageCreate(licConfig)
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc pageCreate(licConfig) {} {
    global ctrlVals setupVals lmVals lmHostFeaturesNum
    global licConfigReturn
    global returnValue    

    # reset values that control the table or user input 
    # controls

    set ctrlVals(tableUpdate) 0
    set ctrlVals(inputUpdate) 0

    if { $setupVals(lmInstType) == "floating" } {
        set isFloatLic 1
    } else {
        set isFloatLic 0
    }

    if { [isGUImode] } {

        if {$isFloatLic && $setupVals(ELMUser) != 1} {
            # Warn user to configure number of floating licenses correctly 
            # (according to what is purchased) 
            dialog ok_with_title "Licenses Configuration" \
                [strTableGet LICCFG_CONFIGURE_LICENSES_WARN]
        }
               
        # hide the setup bitmap to allow more space on the page
        controlHide $ctrlVals(mainWindow).bitmap 1

        # set up constants to be used for control dimensions and spacing

        # dimensions for license display with table

        set XCOL1 10
        set XCOL2 90
        set XCOL3 135
        set XCOL4 175
        set XCOL5 215
        set XCOL6 260
        set Y     24
        set WIDTH 40
        set FEATWIDTH 60
        set HTHDR 25
        set FEAT_HDR_HT  [expr $Y + $HTHDR + 7]
        set HT    11
        set TXTWIDTH 19
        set INDENT 8
        set TABLEWIDTHS {83 38 40 42 42 36}

        # if reload of current license file, change the labels appropriately

        if {$lmVals(reload)} {
            set reloadY 7
            set reloadH $HT

            set ctrlVals(volatileFrm) [list \
                [list label -name Label_1 \
                        -title [strTableGet LICCFG_RELOAD_1] \
                        -x $XCOL1 -y $reloadY -w 300 -h $reloadH] \
                [list label -name label_3 \
                        -title [strTableGet LICCFG_RELOAD_2] \
                        -x $XCOL1 -y 160 -w 300 -h 15]
            ]
        } elseif {$isFloatLic} {
            set label1Text ""
            set label2Text ""

            if {$setupVals(ELMUser) == 1} {
                set label1Text [strTableGet LICCFG_ELM_1] 
                set label2Text [strTableGet LICCFG_ELM_2] 
            } else {
                set label1Text [strTableGet LICCFG_FLOAT_1] 
                set label2Text [strTableGet LICCFG_FLOAT_2] 
            }

            set ctrlVals(volatileFrm) [list \
                [list label -name Label_1 \
                        -title $label1Text \
                        -x $XCOL1 -y 7 -w 300 -h 17] \
                [list label -name label_3 \
                        -title $label2Text \
                        -x $XCOL1 -y 160 -w 300 -h 17] 
            ]
        } else {
            # node-locked

            set ctrlVals(volatileFrm) [list \
                [list label -name Label_1 \
                        -title [strTableGet LICCFG_NODELOCK_1] \
                        -x $XCOL1 -y 7 -w 300 -h 17] \
                [list label -name label_3 \
                        -title [strTableGet LICCFG_NODELOCK_2]  \
                        -x $XCOL1 -y 160 -w 300 -h 15]
            ]
        }

        # place default values in the edit boxes or check boxes 

        if {$isFloatLic} {
            lappend ctrlVals(volatileFrm) \
                [list label -name col6 \
                        -title [strTableGet LICCFG_COL6] \
                        -x $XCOL6 -y $Y -w $WIDTH -h $HTHDR]
        } else { 
            # node locked
            lappend ctrlVals(volatileFrm) \
                [list label -name col6 \
                        -title [strTableGet LICCFG_NODELOCK_COL6] \
                        -x $XCOL6 -y $Y -w $WIDTH -h $HTHDR]
        }


        # add the common controls 

        lappend ctrlVals(volatileFrm) \
            [list label -name col1 \
                        -title [strTableGet LICCFG_COL1] \
                        -x $XCOL1 -y $Y -w $FEATWIDTH -h $HTHDR] \
            [list label -name col2 \
                        -title [strTableGet LICCFG_COL2] \
                        -x $XCOL2 -y $Y -w $WIDTH -h $HTHDR] \
            [list label -name col3 \
                        -title [strTableGet LICCFG_COL3] \
                        -x $XCOL3 -y $Y -w $WIDTH -h $HTHDR] \
            [list label -name col4 \
                        -title [strTableGet LICCFG_COL4] \
                        -x $XCOL4 -y $Y -w $WIDTH -h $HTHDR] \
            [list label -name col5 \
                        -title [strTableGet LICCFG_COL5] \
                         -x $XCOL5 -y $Y -w $WIDTH -h $HTHDR] 

        # set the values for license seats

        set hostIndex [lsearch $lmVals(lmHosts) $lmVals(lmHostName)]
        if {$hostIndex == -1} {
            set numberOfFeatures 0
        } else {
            set numberOfFeatures [lindex $lmHostFeaturesNum $hostIndex]
        }

        for {set ix 0} {$ix < [llength $lmVals(lmLicensedProductNames)]} {incr ix} {
            set feature [lindex $lmVals(lmLicensedProductNames) $ix]
            set newY [expr $FEAT_HDR_HT + ($ix * $HT)]
            set featureId [lindex $lmVals(lmLicensedFeatureIds) $ix]
            set fHostAllocated 0

            if {$isFloatLic} {
                set fAllocated [lmFeaturesValueGet lmFLFeaturesAllocated $feature]
                set fAvailable [lmFeaturesValueGet lmFLFeaturesAvailable $feature]
                set fTotal [lmFeaturesValueGet lmFLFeaturesTotal $feature]
            } else {
                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 {$isFloatLic} {
                    set licTypeAllocated "licFLAllocated"
                } else {
                    set licTypeAllocated "licNLAllocated"
                }
                if { $feature == [lmLicProdInfoGet prodName $lmVals(lmHostName) $ixf] } {
                    set fHostAllocated \
                        [lmLicProdInfoGet $licTypeAllocated $lmVals(lmHostName) $ixf]
                }
            }
                    
            # set initial vales to be added to the table

            if {$isFloatLic} {
                set initialVal 0
            } else {
                set initialVal "No"
            }

            set featureVals [list $feature $fTotal $fAllocated $fHostAllocated $fAvailable $initialVal]
            lappend tableVals $featureVals
        }
                
        # add the table

        lappend ctrlVals(volatileFrm) \
            [list table -name licTable \
                -columns 6 -border \
	 	-x 10 -y 50 -width 295 -height 64 \
                -callback onTableEvent \
                -initial $tableVals ]

        if {$isFloatLic} {
            lappend ctrlVals(volatileFrm) \
                [list label -name tableLabel \
                    -title [strTableGet LICCFG_TABLE_FLOATING] \
                    -x 10 -y 120 -w 295 -h $HT]
        } else {
            lappend ctrlVals(volatileFrm) \
                [list label -name tableLabel \
                    -title [strTableGet LICCFG_TABLE_NODELOCK] \
                    -x 10 -y 120 -w 295 -h $HT]
        }

        # add the requested text entry box and labels

        lappend ctrlVals(volatileFrm) \
            [list label -name selectedProdLabel \
                -title "Selected Product:" \
                -x $XCOL1 -y 132 -w 59 -h $HT] \
            [list label -name selectedProd \
                -title "" \
                -x 72 -y 132 -w 233 -h $HT]

	if {$isFloatLic} {
            lappend ctrlVals(volatileFrm) \
                [list label -name allocateLabel \
                    -title "Additional Licenses to Allocate:" \
                    -x $XCOL1 -y 146 -w 104 -h $HT ]

            lappend ctrlVals(volatileFrm) \
                [list text -name textRequested  \
                    -callback "floatTextCB" \
                    -x [expr $XCOL1 + 106] -y 144 -w 30 -h 12]
        } else {
	    lappend ctrlVals(volatileFrm) \
                [list label -name checkLabel \
                    -title "Request a node locked license:" \
                    -x $XCOL1 -y 146 -w 104 -h $HT ]

            lappend ctrlVals(volatileFrm) \
                [list choice -name yesChoice -newgroup -auto \
                    -title "Yes" \
                    -x [expr $XCOL1 + 106] -y 144 -w 30 -h 12 \
                    -callback "nodelockChoiceCB"] \
                [list choice -name noChoice -auto \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -