home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 May / 05_02.iso / software / nis / files / NIS / NIS.MSI / IntroWiz.exe / HTML / IW-NAVIGATION.JS < prev    next >
Encoding:
JavaScript  |  2001-12-01  |  10.7 KB  |  466 lines

  1. ////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
  4. //
  5. // NAME:    iw-Navigation.js (Javascript file for iw-Navigation.HTM)
  6. //
  7. // Copyright (c) 2001 by Symantec Corporation. All rights reserved.
  8. //
  9. ////////////////////////////////////////////////////////////////////////////////////////////
  10.  
  11.  
  12. // Move these global vairables to the top.
  13. var iBackOff = 0;
  14. var iBackOn = 4;
  15. var iNextOff = 0;
  16. var iNextOn = 2;
  17. var iCloseOff = 0;
  18. var iCloseOn = 1;
  19.  
  20. function dprintf(str)
  21. {
  22. }
  23.  
  24.  
  25. function OnTabOver(TabbedFrom)
  26. {
  27.     // Where are we tabbing "from"
  28.     // 0 - Back Button 
  29.     // 1 - Next Button
  30.     // 2 - Finish Button
  31.     // 3 - Close Button
  32.     var iFromBack = 0;
  33.     var iFromNext = 1;
  34.     var iFromFinish = 2;
  35.     var iFromClose = 3;
  36.     
  37.     // Last Control Tab over to the <back, next, close> button.
  38.     var VK_TAB = 9;
  39.  
  40.     
  41.     if (TabbedFrom == iFromBack)
  42.     {
  43.         // For Reverse Tab we want to tab back to previous pane
  44.         if (window.event.keyCode == VK_TAB && (window.event.shiftKey))
  45.         {
  46.             // Go To Conent Page
  47.             window.parent.frames("contents",0).focus();
  48.             return;
  49.  
  50.         }
  51.     }
  52.     
  53.     if (TabbedFrom == iFromNext || TabbedFrom == iFromNext)
  54.     {
  55.         // For Reverse Tab we want to tab back to previous pane
  56.         if (window.event.keyCode == VK_TAB && (window.event.shiftKey))
  57.         {
  58.             if(BackB.disabled == true)
  59.             {
  60.                 // Go To Conent Page
  61.                 window.parent.frames("contents",0).focus();
  62.                 return;
  63.             }
  64.         }
  65.         
  66.         // Tab we want to tab to the next Pane
  67.         if (window.event.keyCode == VK_TAB && (window.event.shiftKey))
  68.         {
  69.             if(CloseB.disabled == true)
  70.             {
  71.                 // Go To Navigation Page
  72.                 window.parent.frames("contents",0).focus();
  73.                 return;
  74.             }
  75.         }        
  76.         
  77.         
  78.     }    
  79.     
  80.     if (TabbedFrom == iFromClose)
  81.     {
  82.     
  83.         // Tab we want to tab to the next Pane    
  84.         if (window.event.keyCode == VK_TAB && (window.event.shiftKey != true))
  85.         {
  86.             // Go To Navigation Page
  87.             window.parent.frames("contents",0).focus();    
  88.         }
  89.  
  90.     }
  91.  
  92.     
  93. }
  94.  
  95. function OnFocus()
  96. {
  97.  
  98.  
  99. }
  100.  
  101. function OnLoad()
  102. {
  103.  
  104.     SetWizardButtons(iBackOff, iNextOn, iCloseOn);
  105.     
  106.     if(BackB.disabled == false)
  107.         BackB.focus();
  108.     else
  109.     {
  110.         if(!NextB.disabled)
  111.             NextB.focus();
  112.         else
  113.             FinishB.focus();
  114.         
  115.     }
  116.  
  117. }
  118.  
  119. function SetContent(pPane)
  120. {
  121.     
  122.     if (pPane  != null)    
  123.     {
  124.         SetHighlight(pPane);    
  125.         SetHeadingHighlight(pPane);
  126.         window.parent.frames("main",0).navigate(pPane.m_htm);
  127.         
  128.         // Set Next and Back Buttons
  129.         if(pPane.m_pNextLink == null)    // Remove Close, Change Next
  130.             SetWizardButtons(iBackOn, iNextOff, iCloseOff);
  131.         else  if(pPane.m_pPreviousLink == null)    // Remove Back
  132.             SetWizardButtons(iBackOff, iNextOn, iCloseOn);
  133.         else
  134.             SetWizardButtons(iBackOn, iNextOn, iCloseOn);            
  135.     
  136.     }
  137.     else
  138.         parent.window.navigate("res://closeme.xyz");
  139. }
  140.  
  141. function GoNext(docTitle)
  142. {
  143.  
  144.     // MessageBox() Flags
  145.     var MB_OK =                     0x00000000;
  146.     var MB_OKCANCEL =               0x00000001;
  147.     var MB_ABORTRETRYIGNORE =       0x00000002;
  148.     var MB_YESNOCANCEL =            0x00000003;
  149.     var MB_YESNO =                  0x00000004;
  150.     var MB_RETRYCANCEL =            0x00000005;
  151.     
  152.     var MB_ICONHAND =               0x00000010;
  153.     var MB_ICONQUESTION =           0x00000020;
  154.     var MB_ICONEXCLAMATION =        0x00000030;
  155.     var MB_ICONASTERISK  =          0x00000040;
  156.     
  157.     var MB_USERICON =               0x00000080;
  158.     var MB_ICONWARNING =            MB_ICONEXCLAMATION;
  159.     var MB_ICONERROR =              MB_ICONHAND;
  160.     
  161.     var MB_ICONINFORMATION =        MB_ICONASTERISK;
  162.     var MB_ICONSTOP =               MB_ICONHAND;
  163.     
  164.     var IDOK =              1;
  165.     var IDCANCEL =          2;
  166.     var IDABORT =           3;
  167.     var IDRETRY =           4;
  168.     var IDIGNORE =          5;
  169.     var IDYES =             6;
  170.     var IDNO =              7;
  171.  
  172.     
  173.     var iMsgBoxReturn;
  174.     var Contents = window.parent.frames("contents",0);
  175.  
  176.     if (docTitle == "Finished")
  177.     {
  178.         parent.window.navigate("res://closeme.xyz");
  179.         return
  180.     }
  181.     else if(docTitle == "Application Control")
  182.     {
  183.         var iMsgBoxReturn = IDOK;
  184.         
  185.         var sFinalMessage;
  186.         var sCarriageReturn = "\r\n\r\n";            
  187.         
  188.         sAleScanMessage1a =StrID("AleScanRun1a");
  189.         sAleScanMessage1b =StrID("AleScanRun1b");
  190.         sAleScanMessage2  =StrID("AleScanRun2");
  191.         sAleScanMessage2b =StrID("AleScanRun2b");
  192.         sAleScanMessage3  =StrID("AleScanRun3");
  193.  
  194.         sFinalMessage = sAleScanMessage1a.concat(" ", WrapNisum.ProductName, " ", 
  195.             sAleScanMessage1b, sCarriageReturn, sAleScanMessage2, " ", WrapNisum.ProductName, " ",  
  196.             sAleScanMessage2b, sCarriageReturn, sAleScanMessage3);
  197.         
  198.         // Pop Message Box;
  199.         if (ConfigInfo.AleScanRun == false)
  200.         {
  201.             // Ale Scan has not been run.. Pop a warning to tell the users why he should run it
  202.             iMsgBoxReturn = webWnd.MsgBox(sFinalMessage, WrapNisum.ProductName, MB_YESNO | MB_ICONINFORMATION); 
  203.             
  204.             if (iMsgBoxReturn == IDYES)
  205.             {
  206.                 // User clicks Yes, that he wants to proceed without scanning.. Continue on
  207.                 
  208.                 // Check to see object exist..  Need this to fix bug where objects aren't ready in other frames
  209.                 var pNextPane = Contents.FindPane(docTitle);
  210.                 if (pNextPane == null)
  211.                     return;
  212.                     
  213.                 pNextPane = pNextPane.m_pNextLink;
  214.                 SetContent(pNextPane);
  215.             }
  216.             else 
  217.                 return;    // User clicks No, "he's not sure"...Re-Show the page.
  218.         
  219.         }
  220.     
  221.         // Scan has been run.. No need for the pop message anymore.
  222.         
  223.         // Check to see object exist..  Need this to fix bug where objects aren't ready in other frames
  224.         var pNextPane = Contents.FindPane(docTitle);
  225.         if (pNextPane == null)
  226.             return;
  227.             
  228.         pNextPane = pNextPane.m_pNextLink;
  229.         SetContent(pNextPane);
  230.  
  231.         
  232.     }
  233.     else 
  234.     {
  235.         // Check to see object exist..  Need this to fix bug where objects aren't ready in other frames
  236.         var pNextPane = Contents.FindPane(docTitle);
  237.         if (pNextPane == null)
  238.             return;
  239.             
  240.         pNextPane = pNextPane.m_pNextLink;
  241.         SetContent(pNextPane);
  242.  
  243.     }
  244.     
  245. }
  246.  
  247. function GoBack(docTitle)
  248. {
  249.     var Contents = window.parent.frames("contents",0);
  250.     var pPreviousPane = Contents.FindPane(docTitle);
  251.     
  252.     if (pPreviousPane == null)
  253.         return;
  254.  
  255.     pPreviousPane = pPreviousPane.m_pPreviousLink;
  256.     SetContent(pPreviousPane);
  257.     
  258. }
  259.  
  260.  
  261. // Back:0 - Back Disabled     Back:1 - Back Enabled
  262. // Next:0 - "Finish" Button     Next:1 - Next Enabled
  263. // Close:0 - Close Disabled     Close:1 - Close Enabled
  264. // Function to Set Navigation Buttons
  265. function SetWizardButtons(iBack, iNext, iClose)
  266. {
  267.     var iWizardButtons = iBack + iNext + iClose;
  268.  
  269.     switch(iWizardButtons)
  270.  
  271.     {
  272.         case 0:
  273.             // Back:0, Next:0, Close:0
  274.             BackB.disabled = true;
  275.             
  276.             NextB.disable = true;
  277.             NextB.style.display = "none";
  278.             FinishB.disable = false;
  279.             FinishB.style.display = "";
  280.             
  281.             CloseB.disabled = true;
  282.             break;
  283.  
  284.         case 2:
  285.             // Back:0, Next:1, Close:0
  286.             BackB.disabled = true;
  287.             
  288.             NextB.disable = false;
  289.             NextB.style.display = "";            
  290.             FinishB.disable = true;
  291.             FinishB.style.display = "none";
  292.     
  293.             CloseB.disabled = true;
  294.             break;
  295.  
  296.         case 3:
  297.             // Back:0, Next:1, Close:1
  298.             BackB.disabled = true;
  299.             
  300.             NextB.disable = false;
  301.             NextB.style.display = "";            
  302.             FinishB.disable = true;
  303.             FinishB.style.display = "none";
  304.             
  305.             CloseB.disabled = false;
  306.             break;
  307.  
  308.         case 4:
  309.             // Back:1, Next:0, Close:0
  310.             BackB.disabled = false;
  311.             
  312.             NextB.disable = true;
  313.             NextB.style.display = "none";
  314.             FinishB.disable = false;
  315.             FinishB.style.display = "";    
  316.             
  317.             CloseB.disabled = true;
  318.             break;
  319.  
  320.         case 5:
  321.             // Back:1, Next:0, Close:1
  322.             BackB.disabled = false;
  323.             
  324.             NextB.disable = true;
  325.             NextB.style.display = "none";
  326.             FinishB.disable = false;
  327.             FinishB.style.display = "";    
  328.             
  329.             CloseB.disabled = false;
  330.             break;
  331.  
  332.  
  333.         case 6:
  334.             // Back:1, Next:1, Close:0
  335.             BackB.disabled = false;
  336.             
  337.             NextB.disable = false;
  338.             NextB.style.display = "";            
  339.             FinishB.disable = true;
  340.             FinishB.style.display = "none";            
  341.             
  342.             CloseB.disabled = true;
  343.             break;
  344.  
  345.         case 7:
  346.             // Back:1, Next:1, Close:1;
  347.             BackB.disabled = false;
  348.             
  349.             NextB.disable = false;
  350.             NextB.style.display = "";            
  351.             FinishB.disable = true;
  352.             FinishB.style.display = "none";        
  353.             
  354.             CloseB.disabled = false;
  355.             break;
  356.  
  357.     }
  358.  
  359. }
  360.  
  361.  
  362. function SetHeadingHighlight(pPane)
  363. {
  364.     var Contents = window.parent.frames("contents",0);
  365.     SetVisible(false, Contents.startHeadingPane);
  366.     SetVisible(false, Contents.configHeadingPane);    
  367.     SetVisible(false, Contents.learnHeadingPane);
  368.     SetVisible(false, Contents.finishedHeadingPane);
  369.     
  370.     SetVisible(true, pPane);
  371.  
  372. }
  373.  
  374. function SetHighlight(pPane)
  375. {
  376.     var Contents = window.parent.frames("contents",0);
  377.     
  378.     if (Contents.PersonalFirewallPane.m_bPageOn  ==  true)
  379.         SetVisible(false, Contents.PersonalFirewallPane);
  380.             
  381.     if (Contents.PrivacyControlPane.m_bPageOn  ==  true)        
  382.         SetVisible(false, Contents.PrivacyControlPane);
  383.  
  384.     if (Contents.ParentalControlPane.m_bPageOn  ==  true)    
  385.         SetVisible(false, Contents.ParentalControlPane);
  386.     
  387.     if (Contents.InternetStatusPane.m_bPageOn  ==  true)    
  388.         SetVisible(false, Contents.InternetStatusPane);
  389.         
  390.     if (Contents.HomeNetworkingPane.m_bPageOn  ==  true)        
  391.         SetVisible(false, Contents.HomeNetworkingPane);
  392.             
  393.     if (Contents.AlertTrackerPane.m_bPageOn  ==  true)        
  394.         SetVisible(false, Contents.AlertTrackerPane);
  395.             
  396.     if (Contents.LiveUpdatePane.m_bPageOn  ==  true)        
  397.         SetVisible(false, Contents.LiveUpdatePane);        
  398.                 
  399.     if (Contents.InternetAccessControlPane.m_bPageOn  ==  true)        
  400.         SetVisible(false, Contents.InternetAccessControlPane);
  401.         
  402.     if (Contents.AdBlockingPane.m_bPageOn  ==  true)        
  403.         SetVisible(false, Contents.AdBlockingPane);
  404.         
  405.     if (Contents.NortonAntiVirusPane.m_bPageOn  ==  true)            
  406.         SetVisible(false, Contents.NortonAntiVirusPane);
  407.  
  408.     SetVisible(true, pPane);
  409.     
  410. }
  411.  
  412.  
  413. function SetVisible(bHighlight, pPane)
  414. {
  415.     if(bHighlight)
  416.     {
  417.         pPane.m_hID.style.display = "";
  418.         pPane.m_ID.style.display = "none";
  419.         pPane.m_HLHeading.style.display = "";
  420.         pPane.m_Heading.style.display = "none";
  421.     }
  422.     else
  423.     {
  424.         pPane.m_hID.style.display = "none";
  425.         pPane.m_ID.style.display = "";
  426.         pPane.m_HLHeading.style.display = "none";
  427.         pPane.m_Heading.style.display = "";
  428.     }
  429. }
  430.  
  431. function BackB_OnClick()
  432. {
  433.     var docTitle = window.parent.frames("main",0).document.title;
  434.     GoBack(docTitle);
  435. }
  436.  
  437. function NextB_OnClick()
  438. {
  439.     GoNext(window.parent.frames("main",0).document.title);
  440. }
  441.  
  442. function CloseB_OnClick()
  443. {
  444.     parent.window.navigate("res://closeme.xyz");
  445. }
  446.  
  447. function WrapNisum_OnProductEnabledChange()
  448. {
  449.     if(WrapNisum.ProductEnabled == "unloaded")
  450.         CloseB_OnClick();
  451. }
  452.  
  453.  
  454. function OnKeyDownHandler()
  455. {
  456.     // Last Control Tab over to the <back, next, close> button.
  457.     var VK_ESCAPE = 27;
  458.  
  459.     if (window.event.keyCode == VK_ESCAPE)
  460.     {
  461.         // Escape key.. We want to exit out of the wizard..
  462.         parent.window.navigate("res://closeme.xyz");
  463.  
  464.     }
  465.     
  466. }