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

📄 licw32.tcl

📁 这是vxworks 的图形界面开发软件windML2.0和另一个CP2可以构成完整的界面开发。
💻 TCL
📖 第 1 页 / 共 2 页
字号:

    if {[needUpdateWlmd] && $setupVals(isWlmdRunning)} {
        messageBox -ok -stopicon [strTableGet 1359_LICENSE_SERVER_SHUTDOWN]
        applicationExit
    } {
        set ctrlVals(currPage) welcome
        pageRemove wlmdDetect
        return 1
    }
}


proc needUpdateWlmd {} {
    global ctrlVals setupVals

    set retVal 0
    set installedWlmd [systemDirGet]\\WLMD.EXE
    set cdWlmd $setupVals(WLM_DIR)\\WLMD.EXE

    if {[file exists $installedWlmd]} {
        set retVal [expr [file mtime $installedWlmd] < [file mtime $cdWlmd]]
    }
    return $retVal
}


proc mailSend {} {
    global ctrlVals

    dialogCreate \
        -name mailConfirmDlg \
        -parent $ctrlVals(mainWindow) \
        -title "Mail Confirmation" \
        -width 181 -height 133 \
        -init mailSendInit \
        -controls { \
                { button -title "Send" -name sendButt -default \
                        -xpos 66 -ypos 112 -width 50 -height 14  \
                        -callback onMailSend }
                { button -title "Cancel" -name cancelButt  \
                        -xpos 124 -ypos 112 -width 50 -height 14  \
                        -callback {windowClose mailConfirmDlg} }
                { label -title "Subject:" -name subjectLabel  \
                        -xpos 7 -ypos 41 -width 33 -height 8 }
                { text -name toEdit -readonly \
                        -xpos 47 -ypos 6 -width 126 -height 12 }
                { label -title "To:" -name toLabel  \
                        -xpos 7 -ypos 8 -width 19 -height 8 }
                { label -title "From:" -name fromLabel  \
                        -xpos 7 -ypos 25 -width 18 -height 8 }
                { text -name fromEdit  \
                        -xpos 47 -ypos 23 -width 126 -height 12 }
                { text -name subjectEdit  -readonly \
                        -xpos 47 -ypos 39 -width 126 -height 12 }
                { group -title "Mail Protocol" -name group1  \
                        -xpos 7 -ypos 56 -width 166 -height 47 }
                { choice -title "SMTP host:" -name smtpButt  \
                        -newgroup -auto \
                        -xpos 16 -ypos 74 -width 56 -height 10  \
                        -callback onSmtp }
                { choice -title "MAPI" -name mapiButt  \
                        -auto \
                        -xpos 16 -ypos 86 -width 33 -height 10  \
                        -callback onMapi }
                { text -name smtpEdit  \
                        -xpos 72 -ypos 73 -width 90 -height 13 }
        }
    return 1
}


proc onMailSend {} {
    global setupVals

    set retVal 1
    set attachments ""
    set bccList ""
    set msgContents "$setupVals(mailMsg)"
    set server [controlValuesGet mailConfirmDlg.smtpEdit]
    set toList [controlValuesGet mailConfirmDlg.toEdit]
    set sender [controlValuesGet mailConfirmDlg.fromEdit]
    set ccList $sender
    set subject [controlValuesGet mailConfirmDlg.subjectEdit]
    set mailDate [clock format [clock second] -format "%a, %d %h %Y %X"]

    if {$sender == ""} {
        messageBox [strTableGet 3356_LICENSE_WARN]
        controlFocusSet mailConfirmDlg.fromEdit
        return 0
    }

    if {$server == "" &&  [controlValuesGet mailConfirmDlg.smtpButt] == "1"} {
       messageBox [strTableGet 1541_MAIL_SERVER]
       set retVal 0
    } {
        beginWaitCursor

        if {[controlValuesGet mailConfirmDlg.smtpButt] == "0"} {
            set mailCommand {mapiMailSend $toList $ccList $bccList \
                                $subject $msgContents $attachments}
        } {
            set mailCommand {smtpMailSend $mailDate $sender $toList $ccList \
                            $bccList $subject $msgContents $server $attachments}
            set msgContents [split $msgContents \n]
        }

        if [catch $mailCommand error] {
            endWaitCursor
            messageBox -stop [strTableGet 1240_MAIL_ERROR]
        } {
            endWaitCursor
            messageBox -info  [strTableGet 1250_MAIL_OK]
            windowClose mailConfirmDlg
        }
    }
    return $retVal
}


proc generateIniFile {} {
    global ctrlVals
    global setupVals

    set Inifile "[setupWinDirGet]\\WindLM.ini"

    if {![file exists "$Inifile"] && ![catch {open "$Inifile" "w"} f]} {
        puts $f "\[WindLM\]"
        puts $f "Debugging=off"
        puts $f "Verbosity=3"
        puts $f "KeyDir=[licenseHomeDirGet]"
        puts $f "StartTime=0"
        puts $f "Zombie=180"
        puts $f "ResourceFile="
        puts $f "LogFile=[licenseHomeDirGet]\\windlm.log"
        puts $f "LogFileSizeLimit=1m"
        puts $f "Startup=automatic"
        close $f
        uninstLog file "window\t$Inifile"
    }
}


proc licenseFilesCopy {} {
    global ctrlVals
    global setupVals

    set wlmPath $setupVals(WLM_DIR)
    set winBinDir "system"
    if {$ctrlVals(NT)} {set winBinDir "system32"}

    fileDupLog "$wlmPath\\WLMD.CPL" window "$winBinDir\\WLMD.CPL" update
    fileDupLog "$wlmPath\\WLMD.EXE" window "$winBinDir\\WLMD.EXE" update

    generateIniFile

    set licenseFileList [list WLMADMIN.EXE]
    set relDestDir "host\\[windHostTypeGet]\\bin"

    foreach file $licenseFileList {
        fileDupLog "$wlmPath\\$file" wind_base "$relDestDir\\$file" update
    }
}


proc onLicChoice {opt} {
    global setupVals

    set setupVals(licAction) $opt
}


proc onRemoveLic {} {
    global ctrlVals
    global setupVals

    set sel [controlSelectionGet $ctrlVals(mainWindow).licList -string]

    set index [lsearch $setupVals(licenseKeyList) "$sel"]

    if {$index != "-1"} {
        set setupVals(licenseKeyList) [lreplace \
                $setupVals(licenseKeyList) $index $index]

        controlValuesSet $ctrlVals(mainWindow).licList \
             $setupVals(licenseKeyList)

        for {set i 1} {$i < 6} {incr i} {
            controlValuesSet $ctrlVals(mainWindow).ctrl$i ""
        }
    } {
        messageBox "Please select a license key first."
        set retVal 0
    }


    controlSelectionSet $ctrlVals(mainWindow).licList 0
}


proc onAddLic {} {
    global ctrlVals
    global setupVals

    set retVal 1
    set selKey [controlValuesGet $ctrlVals(mainWindow).licenseKeyText]

    if {[string trim $selKey] != "" && \
        [lsearch $setupVals(licenseKeyList) "$selKey"] == "-1"} {

        if [catch {decodeKey $selKey} error] {
            set setupVals(licenseKey) $selKey
            messageBox [strTableGet 1281_LICENSE_KEY_ERROR_2 \
                                    $setupVals(licenseKey)]

            set setupVals(licenseKey) ""
            set retVal 0
        } {
            lappend setupVals(licenseKeyList) $selKey

            controlValuesSet $ctrlVals(mainWindow).licList \
                 $setupVals(licenseKeyList)

            controlSelectionSet $ctrlVals(mainWindow).licList \
                            [expr [llength $setupVals(licenseKeyList)] - 1]
        }
    } elseif {[string trim $selKey] == ""} {
        messageBox "Please enter a license key first."
        controlFocusSet $ctrlVals(mainWindow).licenseKeyText
        set retVal 0
    }

    controlValuesSet $ctrlVals(mainWindow).licenseKeyText ""
    return $retVal
}


proc keyInfoUpdate {} {
    global ctrlVals
    global setupVals

    set retVal 1

    if {[llength $setupVals(licenseKeyList)] != 0} {
        set key [controlSelectionGet $ctrlVals(mainWindow).licList -string]
        set pList [split [decodeKey $key] "\n"]
        controlValuesSet $ctrlVals(mainWindow).ctrl1 [lindex $pList 0]
        controlValuesSet $ctrlVals(mainWindow).ctrl2 \
            [featureDescGet [lindex $pList 0]]
        controlValuesSet $ctrlVals(mainWindow).ctrl3 [lindex $pList 2]
        controlValuesSet $ctrlVals(mainWindow).ctrl4 \
            [clock format [lindex $pList 3] -format "%b %d %Y"]
        controlValuesSet $ctrlVals(mainWindow).ctrl5 \
            [clock format [lindex $pList 4] -format "%b %d %Y"]
    } {
        set retVal 0
    }
}


proc mailSendInit {} {
    controlValuesSet mailConfirmDlg.toEdit [strTableGet 1220_MAIL_TO]
    controlValuesSet mailConfirmDlg.subjectEdit [strTableGet 1230_MAIL_SUBJECT]
    controlValuesSet mailConfirmDlg.smtpEdit "mailhost"
    controlValuesSet mailConfirmDlg.smtpButt 1
}


proc onSmtp {} {
    controlEnable mailConfirmDlg.smtpEdit 1
}


proc onMapi {} {
    controlEnable mailConfirmDlg.smtpEdit 0
}

#
# licenseHomeDirGet/Set() from GLOBAL.TCL
#
proc licenseHomeDirGet {} {
    global setupVals

    if [info exists setupVals(licenseHomeDir)] {
        return $setupVals(licenseHomeDir)
    } {
        return ""
    }
}

proc licenseHomeDirSet {val} {
    global setupVals
    set setupVals(licenseHomeDir) $val
}

#
# license messages from MESSAGES.TCL
# 
set strTable(1261_LICENSE) "Wind License Manager"

set strTable(1072_WARN_1) \
    "Please enter a valid license server host name."

set strTable(1205_FINISH) \
    "SETUP detected that there was at least one installed product that will\
     not work without the [strTableGet 1261_LICENSE] running.  You might\
     need to run \'SETUP -L\' to setup the [strTableGet 1261_LICENSE].  For\
     more information, consult the Wind River Product Installation Guide."

set strTable(1220_MAIL_TO) "license@wrs.com"
set strTable(1230_MAIL_SUBJECT) "License Key Request"
set strTable(1240_MAIL_ERROR) "Cannot send mail.  Please contact WRS instead."
set strTable(1541_MAIL_SERVER) "Please enter a valid server name."

set strTable(1250_MAIL_OK) \
    "Your request for the License Key has been sent to\
     [strTableGet 1220_MAIL_TO].  Please allow us one business day for\
     processing your request."

set strTable(1260_LICENSE_KEY) \
    "format %s \"SETUP will now configure the [strTableGet 1261_LICENSE]\
                 on this machine, \[lindex \$args 0\], to recognize the new\
                 license key(s).\""

set strTable(1270_LICENSE_KEY_ERROR) \
    "At least one license key needs to be added."

set strTable(1280_LICENSE_KEY_ERROR_1) \
    "format %s \"Cannot create license file: \[lindex \$args 0\]\""

set strTable(1281_LICENSE_KEY_ERROR_2) \
    "format %s \"The license key you entered, \[lindex \$args 0\], is not\
                 valid.  Please enter a valid key.\""

set strTable(1261_LICENSE_KEY_FINISH_OK) \
    "format %s \"SETUP has finished installing the \[cdromDescGet\].  SETUP\
                 has launched the \[cdromDescGet\] with a default\
                 configuration.  You can reconfigure \[cdromDescGet\] later\
                 from the control panel.\""

set strTable(1262_LICENSE_KEY_FINISH_BAD) \
    "format %s \"SETUP has finished installing \[cdromDescGet\].\
                 \n\nYou must reboot this computer before using\
                 \n\[cdromDescGet\].\""

set strTable(3356_LICENSE_WARN) \
    "You must enter the return email address"

set strTable(1290_LICENSE_CHOICE) \
    "The [strTableGet 1261_LICENSE] must be configured before you can use the\
     following licensed product feature(s)."

set strTable(1291_LICENSE_CHOICE) \
    "Select the appropriate option listed below to continue."

set strTable(1300_LICENSE_CHOICE_0) \
    "Configure to use a floating [strTableGet 1261_LICENSE]"

set strTable(3300_LICENSE_CHOICE_0) \
    "1 - Configure to use a floating [strTableGet 1261_LICENSE]"

set strTable(1300_LICENSE_CHOICE_1) \
    "Have license key, go to the next step"

set strTable(3300_LICENSE_CHOICE_1) \
    "2 - Have license key, go to the next step"

set strTable(1310_LICENSE_CHOICE_2) \
    "Contact WRS via email to obtain the license key"

set strTable(3310_LICENSE_CHOICE_2) \
    "3 - Contact WRS via email to obtain the license key"

set strTable(1320_LICENSE_CHOICE_3) \
    "Contact WRS to obtain the license key"

set strTable(3320_LICENSE_CHOICE_3) \
    "4 - Contact WRS to obtain the license key"

set strTable(3325_LICENSE_CHOICE_QUESTION) \
    "Select 1, 2, 3, or 4. \[1\]"

set strTable(3355_LICENSE_QUESTION) \
    "Do you have another license key? \[n\]"

set strTable(1330_LICENSE_MAIL) \
    "The following message will be sent to [strTableGet 1220_MAIL_TO]."

set strTable(1340_LICENSE_MAIL_HEADER_LINE1) "To Wind River Systems,"

set strTable(1340_LICENSE_MAIL_HEADER_LINE2) \
    "This is a request for a License Key:"

set strTable(1340_LICENSE_MAIL_HEADER_LINE3) \
    "format %s \"Customer Name\t:  \[lindex \$args 0\]\""

set strTable(1340_LICENSE_MAIL_HEADER_LINE4) \
    "format %s \"Company Name\t:  \[lindex \$args 0\]\""

set strTable(1340_LICENSE_MAIL_HEADER_LINE5) \
    "format %s \"Installation Key:  \[lindex \$args 0\]\""

set strTable(1340_LICENSE_MAIL_HEADER_LINE5a) \
    "format %s \"Installation Key\t:  \[lindex \$args 0\]\""

set strTable(1340_LICENSE_MAIL_HEADER_LINE6) \
    "format %s \"License Number\t:  \[lindex \$args 0\]\""

set strTable(1340_LICENSE_MAIL_HEADER_LINE7) \
    "format %s \"Host Name\t:  \[lindex \$args 0\]\""

set strTable(1340_LICENSE_MAIL_HEADER_LINE8) \
    "format %s \"Host Id\t\t:  \[lindex \$args 0\]\""

set strTable(1340_LICENSE_MAIL_HEADER_LINE9) \
    "Licensed product feature(s):"

set strTable(3340_LICENSE_MAIL_QUESTION) \
    "Press <Return> to send mail or type \"-\" to go to previous page."

set strTable(1350_LICENSE_CALL) \
    "To obtain a license key in North America, call 1-800-545-9463 \
     with the information listed below.  For other countries, consult \
     the Wind River Products Installation Guide for instructions."

set strTable(1352_LICENSE_WARNING) \
    "format %s \"You must have System Administrator privileges to install\
                 \[cdromDescGet\] under Windows NT.\""

set strTable(1353_LICENSE_REMOTE) \
    "The floating [strTableGet 1261_LICENSE] is a daemon that keeps track of\
     all available licenses floating on your network, and serves the license\
     request from the client applications.\
     \n\nEnter the name of the host on which the [strTableGet 1261_LICENSE]\
     is running."

set strTable(1354_LICENSE_REMOTE) \
    "format %s \"SETUP has saved the floating license server host name.  From\
                 now on, all the WRS licensed product(s) will first attempt to\
                 contact the specified host to checkout its license.\""

set strTable(1355_LICENSE_SUCCESS) \
    "format %s \"SETUP completed successfully.  For information on starting up\
                 the [strTableGet 1261_LICENSE], consult the Wind River Product\
                 Installation Guide.\""

set strTable(1356_LICENSE_FAIL) \
    "format %s \"The license key, \[lindex \$args 0\], was not created for this\
                 host, \[lindex \$args 1\].  Please remove it from the list,\
                 then continue.\""

set strTable(1357_LICENSE_REMOTE_FAIL) \
    "format %s \"There is no [strTableGet 1261_LICENSE] running on\
                 \[lindex \$args 0\].  Please select again.\""

set strTable(1358_LICENSE_SERVER_DETECT) \
    "Please wait, while SETUP is detecting if there is a\
     [strTableGet 1261_LICENSE] running on this machine..."

set strTable(1359_LICENSE_SERVER_SHUTDOWN) \
    "SETUP detects that there is an out-dated version of\
     [strTableGet 1261_LICENSE] running on this machine,  Please shut it down,\
     and restart the SETUP program."

set strTable(1510_TITLE_LICENSE_KEY) "License Key"
set strTable(1520_TITLE_LICENSE_CHOICE) "License Options"
set strTable(1530_TITLE_LICENSE_MAIL) "Email License"
set strTable(1540_TITLE_LICENSE_CALL) "Contact WRS"
set strTable(1561_TITLE_LICENSE_REMOTE) "Floating [strTableGet 1261_LICENSE]"

⌨️ 快捷键说明

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