home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 November / PCWNOV07.iso / shared / agentdui.cab / scui.dll / HTML / TABS.VBS < prev    next >
Encoding:
Text File  |  2005-07-27  |  6.6 KB  |  211 lines

  1. Option Explicit
  2. Dim garrAppTabs, gTabCount
  3.  
  4. ' Initialize the Tab Array
  5. Function InitTabs()
  6. '{
  7.     Dim szHelpUrl, szAppUrl, szOEMIniFile, nShow
  8.  
  9.     garrAppTabs = Array()
  10.     gTabCount = 0
  11.  
  12.     szHelpUrl = gDBobjOS.GetObjectModuleDir( CLSID_MCAgent )
  13.     If (0 < Len(szHelpUrl)) Then
  14.         szHelpUrl = szHelpUrl & "\" & AGENT_HELP
  15.     End If
  16.     
  17.     '////////////////////////////////////////////////
  18.     ' MYS - My Security the default Dashboard Tab
  19.  
  20.     Call AddTabInfo(-1, "MYS", "images\mysecurity_b_40x40.gif", "images\mysecurity_40x40.gif", SERVICE_NAME_STR, "mys.htm", szHelpUrl, "recentvirus.htm", "SecurityCenter")
  21.     
  22.     
  23.     '////////////////////////////////////////////////
  24.     ' VSO Tab
  25.  
  26.     szOEMIniFile = GetOEMIniFile(gDBobjReg, gDBobjFS, gDBobjOS)
  27.  
  28.     'By Default show this tab
  29.     nShow = ShowTab("VSO", szOEMIniFile, 1)
  30.  
  31.     If (1 = nShow) Then
  32.         szAppUrl = "vso.htm"
  33.         If (0 = IsVSO4Installed( gDBobjReg, gDBobjOS, gDBobjFS )) Then
  34.             'If an old VSO version is installed then show update page if available or knock off the tab
  35.             If ( 0 < Len(gDBobjReg.RegQueryValue(DB_REGKEY_LINK_STR, LINK_UPDATE_VSO_URL)) ) Then
  36.                 szAppUrl = "vsoupd.htm"
  37.             Else
  38.                 szAppUrl = ""
  39.             End If
  40.         End If
  41.  
  42.         If ("" <> szAppUrl) Then
  43.             Call AddTabInfo(-1, "VSO", "images\VSO_b_40x40.gif", "images\VSO_40x40.gif", DEF_VSO_PRODUCT_LOWER_CASE_TAG_NAME, szAppUrl, szHelpUrl, "", DEF_VSO_PRODUCT_NAME)
  44.         End If
  45.     End If
  46.     
  47.     
  48.     '////////////////////////////////////////////////
  49.     ' MPF Tab
  50.  
  51.     Dim dwMPFVer
  52.  
  53.     'By Default show this tab
  54.     nShow = ShowTab("MPF", szOEMIniFile, 1)
  55.  
  56.     If (1 = nShow) Then
  57.         dwMPFVer = GetInstalledMPFVersion( gDBobjReg, gDBobjOS, gDBobjFS )
  58.  
  59.         szAppUrl = ""
  60.         If 4 = dwMPFVer Or -1 = dwMPFVer Then
  61.             szAppUrl = "mpf.htm"
  62.         ElseIf ( 0 < Len(gDBobjReg.RegQueryValue(DB_REGKEY_LINK_STR, LINK_UPDATE_MPF_URL)) ) Then
  63.             szAppUrl = "mpfupd.htm"
  64.         End If
  65.  
  66.         If ("" <> szAppUrl) Then
  67.             If (IsPlus("MPF", szOEMIniFile, False)) Then
  68.                 Call AddTabInfo(-1, "MPF", "images\FirewallPlus_b_40x40.gif", "images\FirewallPlus_40x40.gif", "personal firewall plus", szAppUrl, szHelpUrl, "", "Personal Firewall Plus")
  69.             Else
  70.                 Call AddTabInfo(-1, "MPF", "images\firewall_b_40x40.gif", "images\firewall_40x40.gif", "personal firewall", szAppUrl, szHelpUrl, "", "Personal Firewall")
  71.             End If
  72.         End If
  73.     End If
  74.     
  75.     '////////////////////////////////////////////////
  76.     ' MPS Tab
  77.  
  78.     'By Default show this tab
  79.     nShow = ShowTab("MPS", szOEMIniFile, 1)
  80.  
  81.     If (1 = nShow) Then
  82.         szAppUrl = "mps.htm"
  83.         If (0 = IsMPSInstalled( gDBobjReg, gDBobjOS, gDBobjFS )) Then
  84.             'If an old MPS version is installed then show update page if available or knock off the tab
  85.             If ( 0 < Len(gDBobjReg.RegQueryValue(DB_REGKEY_LINK_STR, LINK_UPDATE_MSK_URL)) ) Then
  86.                szAppUrl = "mpsupd.htm"
  87.             Else
  88.                 szAppUrl = ""
  89.             End If
  90.         End If
  91.  
  92.         If ("" <> szAppUrl) Then
  93.             Call AddTabInfo(-1, "MPS", "images\privacy_b_40x40.gif", "images\privacy_40x40.gif", "privacy service", szAppUrl, szHelpUrl, "", "Privacy Service")
  94.         End If
  95.     End If
  96.  
  97.     '////////////////////////////////////////////////
  98.     ' MSK Tab
  99.  
  100.     'By Default show this tab
  101.     nShow = ShowTab("MSK", szOEMIniFile, 1)
  102.  
  103.     If (1 = nShow) Then
  104.         szAppUrl = "msk.htm"
  105.         'Enable the lines below to detect old version and show update tab if an older version is installed
  106.         If (0 = IsMSKInstalled( gDBobjReg, gDBobjOS, gDBobjFS )) Then
  107.             'If an old MSK version is installed then show update page if available or knock off the tab
  108.             If ( 0 < Len(gDBobjReg.RegQueryValue(DB_REGKEY_LINK_STR, LINK_UPDATE_MSK_URL)) ) Then
  109.                szAppUrl = "mskupd.htm"
  110.             Else
  111.                 szAppUrl = ""
  112.             End If
  113.         End If
  114.  
  115.         If ("" <> szAppUrl) Then
  116.             Call AddTabInfo(-1, "MSK", "images\msk_b_40x40.gif", "images\msk_40x40.gif", "spamkiller", szAppUrl, szHelpUrl, "", "SpamKiller")
  117.         End If
  118.     End If
  119. '}
  120. End Function
  121.  
  122. ' Find a tab in the Array and return its Index
  123. Function FindTab(szAppId)
  124. '{
  125.     Dim nIndex
  126.  
  127.     FindTab = -1
  128.     For nIndex = 0 To gTabCount - 1
  129.     '{
  130.         If (0 = strcomp(szAppId, garrAppTabs(nIndex).szAppId, vbTextCompare)) Then
  131.             FindTab = nIndex
  132.         End If
  133.     '}
  134.     Next
  135. '}
  136. End Function
  137.  
  138. ' Add a Tab to the array at the specified Index or Add a new element at the end
  139. Function AddTabInfo(nIndex, szAppId, szTabImage, szSelTabImage, szTabText, szHomePageUrl, szHelpUrl, szSecurityNewsUrl, szAppName)
  140. '{
  141.     If Not (-1 < nIndex And  gTabCount > nIndex) Then
  142.         Redim Preserve garrAppTabs(gTabCount)        
  143.         nIndex = gTabCount
  144.         Set garrAppTabs(nIndex) = New CAppTab
  145.         gTabCount = gTabCount + 1
  146.     End If
  147.     
  148.     If (0 < Len(szAppId)) Then
  149.         garrAppTabs(nIndex).szAppId = szAppId
  150.     End If
  151.  
  152.     If (0 < Len(szTabImage)) Then
  153.         garrAppTabs(nIndex).szTabImage = szTabImage
  154.     End If
  155.     
  156.     If (0 < Len(szSelTabImage)) Then
  157.         garrAppTabs(nIndex).szSelTabImage = szSelTabImage
  158.     End If    
  159.  
  160.     If (0 < Len(szTabText)) Then
  161.         garrAppTabs(nIndex).szTabText = LCase(szTabText) ' For 5.0 re-branding, all the tab text are lowercase.
  162.     End If
  163.  
  164.     If (0 < Len(szHomePageUrl)) Then
  165.         garrAppTabs(nIndex).szHomePageUrl = szHomePageUrl
  166.     End If
  167.  
  168.     If (0 < Len(szHelpUrl)) Then
  169.         garrAppTabs(nIndex).szHelpUrl = szHelpUrl
  170.     End If
  171.  
  172.     If (0 < Len(szSecurityNewsUrl)) Then
  173.         garrAppTabs(nIndex).szSecurityNewsUrl = szSecurityNewsUrl
  174.     End If
  175.  
  176.     If (0 < Len(szAppName)) Then
  177.         If (1 = InStr(szAppName, "McAfee.com ")) Then
  178.             garrAppTabs(nIndex).szAppName = Mid(szAppName, 12)
  179.         ElseIf (1 = InStr(szAppName, "McAfee ")) Then
  180.             garrAppTabs(nIndex).szAppName = Mid(szAppName, 8)
  181.         Else
  182.             garrAppTabs(nIndex).szAppName = szAppName
  183.         End If
  184.     End If    
  185.  
  186. '}
  187. End Function
  188.  
  189.  
  190. ' The Tab object
  191. Class CAppTab
  192. '{
  193.  
  194.     Public   szAppId, szTabImage, szSelTabImage, szTabText, szHomePageUrl, szHelpUrl, szSecurityNewsUrl, szAppName
  195.  
  196.     Private Sub Class_Initialize()
  197.     '{
  198.         szAppId = ""
  199.         szTabImage = ""
  200.         szSelTabImage = ""
  201.         szTabText = ""
  202.         szHomePageUrl = ""
  203.         szHelpUrl = ""
  204.         szSecurityNewsUrl = ""
  205.         szAppName = ""
  206.     '}
  207.     End Sub
  208.  
  209. '}
  210. End Class
  211.