home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 November / PCWNOV07.iso / shared / regwiz.cab / RegWizUI.dll / HTML / COMPLETE.VBS < prev    next >
Encoding:
Text File  |  2005-07-13  |  4.6 KB  |  168 lines

  1. Function UpdateUserRegisterStatus()
  2. '{
  3.     Dim objResponse, AppsItems, objApplication, objRespApps
  4.     Dim objCustomData, objRequest, objSubInfo, objReqApp, objAppInfo
  5.     Dim sWebSite, sIni, sRegWizAppDir, sAppCode, sAppId, sRegWizDataDir
  6.     Dim nCount, nCtr, nIdx, nResult, nSubMgrResult, nAppInfoRetVal, nSubInfoRetVal
  7.     Dim bAddForce
  8.  
  9.     Call SetWizardStatus (REGWIZ_SUCCESS)
  10.  
  11.     Set objResponse = gobjExternal.GetParam ( PROP_REGRESPONSE )
  12.  
  13.     Set objRequest = gobjExternal.GetParam ( PROP_REGREQUEST )
  14.     Set objReqApp = objRequest.Item (PROP_APPLICATION)
  15.  
  16.     If IsObject(objResponse) Then
  17.     '{
  18.         nResult = objResponse.Item (PROP_RESULT)
  19.         Call LogDetails ( "Registration result : " & nResult )
  20.  
  21.         If 0 = nResult Then
  22.         '{
  23.             Set objApplication = objResponse.Item (PROP_APPLICATION)
  24.  
  25.             '// Initialize subscription manager object
  26.             Call InitScriptAPI(gobjSubMgr)
  27.             Call LogDetails ( "After Call InitScriptAPI(gobjSubMgr)" )
  28.  
  29.             sRegWizAppDir = GetRegWizAppDir()
  30.             sRegWizAppDir = gobjFS.GetShortPathName ( sRegWizAppDir )
  31.  
  32.             nCount = objApplication.Count
  33.             AppsItems = objApplication.Items
  34.             
  35.             For nCtr = 0 To nCount-1
  36.             '{
  37.                 Set objRespApps = AppsItems(nCtr)
  38.                 
  39.                 sAppId = Trim(objRespApps.Item (PROP_APPCAT))
  40.                 sAppCode = Trim(objRespApps.Item (PROP_APPCODE))
  41.                 sWebSite = Trim(objRespApps.Item (PROP_WEBSITE))
  42.                 sIni = sRegWizAppDir & "\" & objRespApps.Item (PROP_APPCAT) & ".ini"
  43.  
  44.                 Call LogDetails ( sIni & " - " & sAppId & " - " & sAppCode & " - " & sWebSite )
  45.  
  46.                 '// For Response.AppCode = Request.AppCode use SDB with force flag
  47.                 bAddForce = True
  48.                 If False = objReqApp.Exists (LCase(sAppCode)) Then
  49.                 '{
  50.                     bAddForce = False
  51.                 '}
  52.                 End If
  53.  
  54.                 Set objSubInfo = Nothing
  55.                 Set objAppInfo = Nothing
  56.  
  57.                 nSubInfoRetVal = GetSubInfo (sAppId, sAppCode, objSubInfo)
  58.                 nAppInfoRetVal = GetAppInfo (sAppId, sAppCode, objAppInfo)
  59.                 
  60.                 Call LogDetails ( "Affter Call GetSubInfo (sAppId, sAppCode, objSubInfo)" )
  61.  
  62.                 If False = IsObject(objSubInfo) Or objSubInfo Is Nothing Or MCSUBDATA_SUCCESS <> nSubInfoRetVal Then
  63.                 '{
  64.                     Set objSubInfo = Nothing
  65.                     Set objSubInfo = New CSubscriptionData
  66.                 '}
  67.                 End If
  68.  
  69.                 If MCSUBDATA_SUCCESS <> nAppInfoRetVal Then
  70.                     Set objAppInfo = Nothing
  71.                 End If
  72.  
  73.                 Call GetResponseSubscriptionInfo ( objRespApps, objSubInfo )
  74.                 nSubMgrResult = AddSubInfoEx(sAppId, sAppCode, objSubInfo, objAppInfo, bAddForce)
  75.  
  76.                 Call LogDetails ( "AddSubInfoEx returned : " & nSubMgrResult )
  77.  
  78.                 '// Massage urls only if submgr is successfull
  79.                 If MCSUBDATA_MCSUBOBJRET_SUCCESS = nSubMgrResult Then
  80.                 '{
  81.                     '// App ExpiryDate is not updated. This is as per design.
  82.  
  83.                     If "" <> sWebSite Then
  84.                     '{
  85.                         '// Process only if the ini file is present. For bundle it may not be present.
  86.                         If True = gobjFS.IsFile ( sIni ) Then
  87.                         '{
  88.                             Call LogDetails ( "Performing PerformPostReg : " & sIni )
  89.                             Call PerformPostReg ( sIni, sWebSite )
  90.                             Call LogDetails ( "PerformPostReg done for " & sIni )
  91.                         '}
  92.                         End If
  93.                     '}
  94.                     End If
  95.                     Call gobjFS.RemoveFiles ( sIni, "" )
  96.                     Call LogDetails ( "Remove File : " & sIni )
  97.                 '}
  98.                 Else
  99.                 '{
  100.                     Call LogDetails ( "AddSubInfoEx failed for : " & sAppId & ", " & sAppCode & " - Result = " & nSubMgrResult )
  101.                 '}
  102.                 End If
  103.             '}
  104.             Next
  105.  
  106.             sRegWizDataDir = GetRegWizDataDir() & PROFILE_INI
  107.             Call gobjFS.RemoveFiles ( sRegWizDataDir, "" )
  108.             Call LogDetails ( "Remove File : " & sRegWizDataDir )
  109.  
  110.             '// Deinitialize subscription manager object
  111.             Call DeinitScriptAPI()
  112.             Call LogDetails ( "DeinitScriptAPI()" )
  113.  
  114.             Call LogDetails ( "Registration process completed successfully" )
  115.         '}
  116.         Else
  117.         '{
  118.             Call LogDetails ( "Error in registration." )
  119.         '}
  120.         End If
  121.     '}
  122.     End If
  123.  
  124.     divCompleteMsg.style.display = ""
  125.     divCompleteMsg.innerHTML = objResponse.Item (PROP_COMPLETED_MSG)
  126. '}
  127. End Function
  128.  
  129. Function OnFinish()
  130. '{
  131.     Dim strMcUpdate
  132.  
  133.     '// Call LaunchMSCExe( MCDASH_EXE, "" )
  134.  
  135.     strMcUpdate = GetAgentDir() & "\mcupdate.exe"
  136.  
  137.     If True = gobjFS.IsFile(strMcUpdate) Then
  138.     '{
  139.         Call gobjOS.RunProgram ( CStr(strMcUpdate), CStr("/schedule") )
  140.     '}
  141.     End If
  142.  
  143.     Call SetWizardStatus (REGWIZ_SUCCESS)
  144.     Call CloseWindow()
  145. '}
  146. End Function
  147.  
  148. Function OnCompNext()
  149. '{
  150.     Call SetWizardStatus (REGWIZ_SUCCESS)
  151.     Call ShowPostWOW()
  152. '}
  153. End Function
  154.  
  155. Function OnCompleteBodyLoad()
  156. '{
  157.     Dim bShowWOW
  158.  
  159.     Call SetExternalObject(gobjExternal)
  160.     Call SetWizardStatus(REGWIZ_ONREBOOT)
  161.  
  162.     Call UpdateUserRegisterStatus()
  163.  
  164.     bShowWOW = gobjExternal.GetParam ( PROP_SHOW_WOW )
  165.  
  166.     idCompleteWithoutWow.style.display = ""
  167. '}
  168. End Function