home *** CD-ROM | disk | FTP | other *** search
- Option Explicit
-
- Function OnProfileBodyLoad()
- '{
- Dim sRegWizDataDir, nRegForce
- Dim bOldObfuscate
-
- Call SetExternalObject(gobjExternal)
- Call SetWizardStatus (REGWIZ_ONREBOOT)
-
- sRegWizDataDir = GetRegWizDataDir()
-
- bOldObfuscate = gobjReg.Obfuscate
- gobjReg.Obfuscate = True
-
- txtFName.Value = Trim(CStr(gobjReg.IniGetValue( CStr(sRegWizDataDir & PROFILE_INI), SECTION_USERPROFILE, KEY_FIRSTNAME )))
- txtLName.Value = Trim(CStr(gobjReg.IniGetValue( CStr(sRegWizDataDir & PROFILE_INI), SECTION_USERPROFILE, KEY_LASTNAME )))
- txtEmail.Value = Trim(CStr(gobjReg.IniGetValue( CStr(sRegWizDataDir & PROFILE_INI), SECTION_USERPROFILE, KEY_EMAILADDRESS )))
- ' txtREmail.Value = txtEmail.Value
- txtPwd.Value = Trim(CStr(gobjReg.IniGetValue( CStr(sRegWizDataDir & PROFILE_INI), SECTION_USERPROFILE, KEY_PASSWORD )))
- txtRPwd.Value = txtPwd.Value
-
- gobjReg.Obfuscate = bOldObfuscate
-
- ' Hide Cancel button for force registration
- nRegForce = gobjExternal.GetParam ( PROP_FORCE_REG )
-
- If nRegForce = 1 Then
- idProfileCancel.style.display = "none"
- End If
- '}
- End Function
-
- Function OnProfileBack()
- '{
- If True = CanShowPage ( KEY_SHOW_EULA ) Then
- '{
- Call window.location.replace (CStr(EULA_HTM))
- '}
- Else
- '{
- Call window.location.replace (CStr(UPROSET_HTM))
- '}
- End If
- '}
- End Function
-
- Function OnProfileCancel()
- '{
- Call window.location.replace (CStr(THANKYOU_HTM))
- '}
- End Function
-
- Function LoginUser()
- '{
- Dim bInternetConnection, strRegUrl, objRequest
-
- bInternetConnection = False
- bInternetConnection = gobjOS.InternetGetConnectedState()
-
- LoginUser = False
-
- If False = bInternetConnection Then
- '{
- Call LogDetails ( "Profile/Product Setup: No internet connection available" )
- MsgBox STR_CONNECT_TO_INTERNET, VBSystemModal Or VBInformation Or VBOKOnly, STR_APP_ERROR_TITLE
- Exit Function
- '}
- End If
-
- Set objRequest = gobjExternal.GetParam ( PROP_REGREQUEST )
-
- If (Not objRequest Is Nothing) And IsObject(objRequest) Then
- '{
- If True = objRequest.Exists (PROP_PROFILE) Then
- '{
- objRequest.Remove ( PROP_PROFILE )
- '}
- End If
-
- objRequest.Add PROP_PROFILE, Nothing
- '}
- End If
-
- strRegUrl = gobjExternal.GetParam ( PROP_REGURL )
- strRegUrl = strRegUrl & MODE_LOGIN
-
- LoginUser = True
-
- Call LogDetails ( "Profile/Product Setup: submit data to " & strRegUrl )
- Call window.location.replace (CStr(strRegUrl))
- '}
- End Function
-
- Function SubmitProfile()
- '{
- Dim bIsProfileValid, strErrMsg
-
- bIsProfileValid = ValidateProfile( strErrMsg )
-
- If False = bIsProfileValid Then
- '{
- Call LogDetails ( "Profile/Product Setup: Profile not valid" )
- idProfileErrMsg.style.display = ""
- idProfileErrMsg.innerHTML = strErrMsg
- Exit Function
- '}
- End If
-
- Call CacheUserProfileDetails()
- Call RegisterUser()
- '}
- End Function
-
- Function ClickOnce()
- '{
- '}
- End Function
-
- Function RegisterUser()
- '{
- Dim strRegUrl, strErrMsg
- Dim nRegForce, nSubmitResult
-
- btnProfileSubmit.OnClick = GetRef("ClickOnce")
- btnProfileSubmit.className = "clsStdBtnDisabled"
- btnProfileSubmit.disabled = true
-
- btnProfileBack.OnClick = GetRef("ClickOnce")
- btnProfileBack.className = "clsStdBtnDisabled"
- btnProfileBack.disabled = true
-
- btnProfileCancel.OnClick = GetRef("ClickOnce")
- btnProfileCancel.className = "clsStdBtnDisabled"
- btnProfileCancel.disabled = true
-
-
- nSubmitResult = SubmitDataForRegistration ( MODE_REG )
-
- ' Hide Cancel button for force registration
- nRegForce = gobjExternal.GetParam ( PROP_FORCE_REG )
-
- If REGWIZ_STATUS_NOINTERNET = nSubmitResult Then
- '{
- If 1 = nRegForce Then
- '{
- Call LogDetails ( "Profile/Product Setup: No internet connection available. Goto page : " & SUBMITONCONNECT_HTM )
- Call window.location.replace (CStr(SUBMITONCONNECT_HTM))
- '}
- Else
- '{
- Call LogDetails ( "Profile/Product Setup: No internet connection available. Goto page : " & REMINDME_HTM )
- Call window.location.replace (CStr(REMINDME_HTM))
- '}
- End If
- '}
- End If
- '}
- End Function
-
- Function CacheUserProfileDetails ()
- '{
- Dim objRequest, objProfile, objWP
- Dim sRegWizDir
- Dim bOldObfuscate
-
- Call LogDetails ( "Profile/Product Setup: Cache user profile details" )
-
- sRegWizDir = GetRegWizDataDir()
-
- bOldObfuscate = gobjReg.Obfuscate
- gobjReg.Obfuscate = True
-
- Call gobjReg.IniWriteValue( CStr(sRegWizDir & PROFILE_INI), SECTION_USERPROFILE, KEY_FIRSTNAME, CStr(txtFName.Value) )
- Call gobjReg.IniWriteValue( CStr(sRegWizDir & PROFILE_INI), SECTION_USERPROFILE, KEY_LASTNAME, CStr(txtLName.Value) )
- Call gobjReg.IniWriteValue( CStr(sRegWizDir & PROFILE_INI), SECTION_USERPROFILE, KEY_EMAILADDRESS, CStr(txtEmail.Value) )
- Call gobjReg.IniWriteValue( CStr(sRegWizDir & PROFILE_INI), SECTION_USERPROFILE, KEY_PASSWORD, CStr(txtPwd.Value) )
- Call gobjReg.IniWriteValue( CStr(sRegWizDir & PROFILE_INI), SECTION_USERPROFILE, KEY_LANGUAGE, CStr(REGWIZ_LANG_ID) )
- Call gobjReg.IniWriteValue( CStr(sRegWizDir & PROFILE_INI), SECTION_USERPROFILE, KEY_COUNTRY, CStr(USER_PROFILE_COUNTRY) )
-
- gobjReg.Obfuscate = bOldObfuscate
-
- Set objRequest = gobjExternal.GetParam ( PROP_REGREQUEST )
-
- If (Not objRequest Is Nothing) And IsObject(objRequest) Then
- '{
- If True = objRequest.Exists (PROP_PROFILE) Then
- '{
- objRequest.Remove ( PROP_PROFILE )
- '}
- End If
-
- Set objProfile = CreateObject ( "Scripting.Dictionary" )
-
- objProfile.Add PROP_FIRSTNAME, txtFName.Value
- objProfile.Add PROP_LASTNAME, txtLName.Value
- objProfile.Add PROP_EMAILADDRESS, txtEmail.Value
- objProfile.Add PROP_PASSWORD, txtPwd.Value
- objProfile.Add PROP_COUNTRY, USER_PROFILE_COUNTRY
-
- If True = objRequest.Exists (PROP_WIZARDPARAM) Then
- '{
- Set objWP = objRequest.Item (PROP_WIZARDPARAM)
-
- If IsObject(objWP) Then
- '{
- objProfile.Add PROP_LANGUAGE, objWP.Item(PROP_LANGUAGE)
- '}
- Else
- objProfile.Add PROP_LANGUAGE, REGWIZ_LANG_ID
- End If
- '}
- Else
- objProfile.Add PROP_LANGUAGE, REGWIZ_LANG_ID
- End If
-
- objRequest.Add PROP_PROFILE, objProfile
- '}
- End If
- '}
- End Function
-
- Function ValidateProfile( ByRef strErrMsg )
- '{
- Dim sFName, sLName, sEmail, sPwd, sRPwd, bPwdFlag
-
- sFName = Trim(txtFName.Value)
- sLName = Trim(txtLName.Value)
- sEmail = Trim(txtEmail.Value)
- sPwd = Trim(txtPwd.Value)
- sRPwd = Trim(txtRPwd.Value)
-
- ValidateProfile = True
- bPwdFlag = True
- strErrMsg = ""
-
- idFN.className = "noErrorFields"
- idLN.className = "noErrorFields"
- idEmail.className = "noErrorFields"
- idPwd.className = "noErrorFields"
- idRPwd.className = "noErrorFields"
-
- If False = CheckFields(sFName) Then
- '{
- strErrMsg = REGWIZ_ERR_MSG_ENTER_FIRSTNAME & "|"
- idFN.className = "errorFields"
- '}
- End If
-
- If False = CheckFields(sLName) Then
- '{
- strErrMsg = strErrMsg & REGWIZ_ERR_MSG_ENTER_LASTNAME & "|"
- idLN.className = "errorFields"
- '}
- End If
-
- If False = CheckFields(sEmail) Then
- '{
- strErrMsg = strErrMsg & REGWIZ_ERR_MSG_ENTER_EMAIL & "|"
- idEmail.className = "errorFields"
- '}
- ElseIf False = CheckEmail(sEmail) Then
- '{
- strErrMsg = strErrMsg & REGWIZ_ERR_MSG_ENTER_VALID_EMAIL & "|"
- idEmail.className = "errorFields"
- '}
- End If
-
- If False = CheckFields(sPwd) Then
- '{
- strErrMsg = strErrMsg & REGWIZ_ERR_MSG_ENTER_PWD & "|"
- bPwdFlag = False
- '}
- ElseIf False = CheckPassword(sPwd) Then
- '{
- strErrMsg = strErrMsg & REGWIZ_ERR_MSG_PWD_LENGTH & "|"
- bPwdFlag = False
- '}
- ElseIf sPwd <> sRPwd Then
- '{
- strErrMsg = strErrMsg & REGWIZ_ERR_MSG_PWD_NO_MATCH & "|"
- bPwdFlag = False
- '}
- End If
-
- If bPwdFlag = False Then
- '{
- idPwd.className = "errorFields"
- idRPwd.className = "errorFields"
- txtPwd.value = ""
- txtRPwd.value = ""
- '}
- End If
-
- If "" <> strErrMsg Then
- '{
- strErrMsg = Left(strErrMsg, Len(strErrMsg)-1)
-
- If InStr (strErrMsg, "|") > 0 Then
- '{
- strErrMsg = REGWIZ_ERR_MSG_MULTI_FIELDS
- '}
- End If
- ValidateProfile = False
- '}
- End If
- '}
- End Function