home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 November / Chip_2003-11_cd2.bin / nav2004 / download / NAV / External / NORTON / APP / CfgWzRes.dll / HTML / SELECT.JS < prev    next >
Text File  |  2003-08-17  |  17KB  |  566 lines

  1. g_ModuleID = 3009;
  2.  
  3. var TimerID  = 0;
  4. var MainFrame = window.parent;
  5. var Register = true;
  6. var Activate = true;
  7. var nPanelSkippedTo = 0;
  8. var ActSkipBtnText = window.parent.frames("bottom").ASkipBtnText.innerHTML;
  9. var RegSkipBtnText = window.parent.frames("bottom").RSkipBtnText.innerHTML;
  10. var FinishBtnText = window.parent.frames("bottom").FinBtnText.innerHTML;
  11. var NextBtnText = window.parent.frames("bottom").NxtBtnText.innerHTML;
  12. var ActSkipHotKey = window.parent.frames("bottom").ASkipHotKey.innerHTML;
  13. var RegSkipHotKey = window.parent.frames("bottom").RSkipHotKey.innerHTML;
  14. var FinishHotKey = window.parent.frames("bottom").FinHotKey.innerHTML;
  15. var NextHotKey = window.parent.frames("bottom").NxtHotKey.innerHTML;
  16. var    g_HelpTopicID = 0;
  17. var SendRegData = "false";
  18.  
  19. // MessageBox() Flags
  20. var MB_OK =                     0x00000000;
  21. var MB_OKCANCEL =               0x00000001;
  22. var MB_ABORTRETRYIGNORE =       0x00000002;
  23. var MB_YESNOCANCEL =            0x00000003;
  24. var MB_YESNO =                  0x00000004;
  25. var MB_RETRYCANCEL =            0x00000005;
  26. var MB_ICONHAND =               0x00000010;
  27. var MB_ICONQUESTION =           0x00000020;
  28. var MB_ICONEXCLAMATION =        0x00000030;
  29. var MB_ICONASTERISK  =          0x00000040;
  30. var MB_USERICON =               0x00000080;
  31. var MB_ICONWARNING =            MB_ICONEXCLAMATION;
  32. var MB_ICONERROR =              MB_ICONHAND;
  33. var MB_ICONINFORMATION =        MB_ICONASTERISK;
  34. var MB_ICONSTOP =               MB_ICONHAND;
  35.  
  36. var IDOK =              1;
  37. var IDCANCEL =          2;
  38. var IDABORT =           3;
  39. var IDRETRY =           4;
  40. var IDIGNORE =          5;
  41. var IDYES =             6;
  42. var IDNO =              7;
  43.  
  44.  
  45. var DJSMAR_LicenseType_Violated     = -1;
  46. var DJSMAR_LicenseType_Retail       = 0;
  47. var DJSMAR_LicenseType_Trial        = 1;
  48. var DJSMAR_LicenseType_Rental       = 2;
  49. var DJSMAR_LicenseType_TryDie        = 3;
  50. var DJSMAR_LicenseType_Beta            = 4;
  51. var DJSMAR_LicenseType_Unlicensed    = 5;
  52. var DJSMAR_LicenseType_ESD            = 6;
  53.  
  54. var DJSMAR00_LicenseState_TRIAL        = 0;
  55. var DJSMAR00_LicenseState_PURCHASED = 1;
  56.     
  57. var DJSMAR00_QueryMode_Local                        = (0);
  58. var DJSMAR00_QueryMode_RemoteSilent                    = (1);
  59. var DJSMAR00_QueryMode_RemoteVerbose                = (2);
  60. var DJSMAR00_QueryMode_RemoteSilentBackground        = (3);
  61. var DJSMAR00_QueryMode_RemoteVerboseInstall            = (4);
  62. var DJSMAR00_QueryMode_LocalVerbose                    = (5);
  63. var DJSMAR00_QueryMode_LocalVerboseOnlyWhenExpired    = (6);
  64. var DJSMAR00_QueryMode_ForceOverride                = (7);
  65.  
  66. function DisableButtons()
  67. {
  68.     NextButton.disabled = true;
  69.     NextButton.style.visibility = "visible";
  70.     BackButton.disabled = true;
  71.     BackButton.style.visibility = "visible";
  72. }
  73.  
  74. function OnLoad()
  75. {
  76.     DisableButtons();
  77.     document.body.tabIndex=-1;
  78.     if (MainFrame.g_bRoadmapFrameLoaded == true)
  79.     {
  80.         UpdatePage();
  81.     }
  82.     else
  83.     {
  84.         TimerID = setInterval("UpdatePage()", 500);
  85.     }
  86. }
  87.  
  88. function UpdatePage()
  89. {
  90.     if (MainFrame.g_bRoadmapFrameLoaded == true)
  91.     {
  92.         clearInterval(TimerID);
  93.         
  94.         MainFrame.g_bSelectFrameLoaded = true;
  95.         HandleControlStates(MainFrame.m_nCurrentPanel);
  96.     }
  97. }
  98.  
  99. function HandleControlStates( nPanel )
  100. {    
  101.     if (nPanel == 0)
  102.         BackButton.disabled = true;
  103.         
  104.     switch (MainFrame.m_aWizardPanels[nPanel].m_sTitle)
  105.     {
  106.         case "Activation":
  107.             SkipButton.style.visibility = "visible";
  108.             SkipButton.disabled = false;
  109.             SkipButton.innerHTML = ActSkipBtnText;
  110.             SkipButton.accessKey = ActSkipHotKey;
  111.         break;
  112.         
  113.         case "Registration":
  114.             txtHelpLink.style.display = "none";
  115.             
  116.             SkipButton.style.visibility = "visible";
  117.             SkipButton.disabled = false;
  118.             SkipButton.innerHTML = RegSkipBtnText;
  119.             SkipButton.accessKey = RegSkipHotKey;
  120.             
  121.             NextButton.disabled = false;
  122.             
  123.         break;
  124.         
  125.         default:
  126.             SkipButton.style.visibility = "hidden";
  127.             //txtHelpLink.style.visibility = "hidden";
  128.         break;
  129.     }
  130. }
  131.  
  132. function InsertBackTrackPanel( nPanel )
  133. {
  134.     if( MainFrame.g_nBackPanelIndex < MainFrame.m_nMaxPanels )
  135.     {
  136.         //alert( "nPanel: " + nPanel);
  137.         
  138.         if ( nPanel == MainFrame.m_aBackTrackPanels[MainFrame.g_nBackPanelIndex] )
  139.             return;
  140.             
  141.         if ( null == MainFrame.m_aBackTrackPanels[++MainFrame.g_nBackPanelIndex] )
  142.         {
  143.             //alert( "Adding: MainFrame.m_aBackTrackPanels[" + MainFrame.g_nBackPanelIndex + "] = " + MainFrame.m_aBackTrackPanels[MainFrame.g_nBackPanelIndex] );
  144.             MainFrame.m_aBackTrackPanels[MainFrame.g_nBackPanelIndex] = nPanel;
  145.             //alert( "Now At: MainFrame.m_aBackTrackPanels[" + MainFrame.g_nBackPanelIndex + "] = " + MainFrame.m_aBackTrackPanels[MainFrame.g_nBackPanelIndex] + " " + MainFrame.m_nCurrentPanel);
  146.             return;
  147.         }
  148.     }
  149.     return;    
  150. }
  151.  
  152. function GetBackTrackPanel()
  153. {
  154.     var nPanel = 0;
  155.     
  156.     if ( MainFrame.g_nBackPanelIndex > 0 )
  157.     {
  158.         //alert( "Deleting: MainFrame.m_aBackTrackPanels[" + MainFrame.g_nBackPanelIndex + "] = " + MainFrame.m_aBackTrackPanels[MainFrame.g_nBackPanelIndex] + " " + MainFrame.m_nCurrentPanel);
  159.         MainFrame.m_aBackTrackPanels[MainFrame.g_nBackPanelIndex--] = null;
  160.         nPanel = MainFrame.m_aBackTrackPanels[MainFrame.g_nBackPanelIndex];
  161.         //alert( "Now At: MainFrame.m_aBackTrackPanels[" + MainFrame.g_nBackPanelIndex + "] = " + MainFrame.m_aBackTrackPanels[MainFrame.g_nBackPanelIndex] + " " + MainFrame.m_nCurrentPanel);
  162.     }
  163.     
  164.     return nPanel;
  165. }
  166.  
  167. function OnSkipButton()
  168. {    
  169.     try
  170.     {
  171.         // If skip is renamed to finish and summon clicks it bail out.
  172.         if( SkipButton.innerHTML == FinishBtnText )
  173.             window.parent.frames("contents").OnFinishButton();
  174.             
  175.         // Get the current panel
  176.         var nCurPanel = MainFrame.m_nCurrentPanel;
  177.         
  178.         // Roadmap frame to access objects local to him
  179.         var RMFrame = window.parent.frames("contents");
  180.             
  181.         // Get our next panel to go to    
  182.         var nNextPanel = MainFrame.m_nCurrentPanel+1;
  183.         
  184.         // If PageOb (activex that supports ICCIWNAvigation) is defined
  185.         // let him get first crack at the skip button otherwise we are in control
  186.         if((window.parent.frames("main").PageOb != null))
  187.         {
  188.             // PageOb has control - returns true
  189.             if (window.parent.frames("main").PageOb.Skip())
  190.             {
  191.                 return;
  192.             }
  193.             // PageOb gave up control - returns false
  194.             else
  195.             {
  196.                 // We have control so set the PageObject to null
  197.                 PageOb = null;
  198.                 
  199.                 // Check if we are not activated, in that case we have to 
  200.                 // do a custom action depending on layout
  201.                 if ( window.external.ObjectArg("DRM::LicenseState") != DJSMAR00_LicenseState_PURCHASED)
  202.                 {
  203.                     switch( MainFrame.g_iLicenseType )
  204.                     {
  205.                         // For retail flows skip subscription and go to postinstall
  206.                         case DJSMAR_LicenseType_Retail:
  207.                         case DJSMAR_LicenseType_Trial:
  208.                         case DJSMAR_LicenseType_Beta:
  209.                         case DJSMAR_LicenseType_ESD:
  210.                             nNextPanel=window.parent.frames("contents").nPostInstall;    
  211.                         break;
  212.                         // For rental flow we close down CfgWiz
  213.                         case DJSMAR_LicenseType_Rental:
  214.                             MainFrame.bPromptUser = false;
  215.                             window.parent.frames("contents").OnCloseButton();
  216.                             return;
  217.                         break;
  218.                         
  219.                         // All others use the next panel
  220.                         default:
  221.                         break;
  222.                     }
  223.                 }
  224.                 
  225.                 // Put our next panel in the backtrack list
  226.                 InsertBackTrackPanel( nNextPanel );
  227.                 // Load our next page
  228.                 LoadPage( nNextPanel );
  229.                 return;
  230.             }
  231.         }
  232.  
  233.         // See what panel we are on and see if we need to do custom actions 
  234.         // for skipping the current panel
  235.         switch (MainFrame.m_aWizardPanels[nCurPanel].m_sTitle)
  236.         {
  237.             // Custom actions for registration panel
  238.             case "Registration":
  239.             {
  240.                 // If we skipped registration don't send the reg data 
  241.                 // from the Activation control
  242.                 SendRegData = "false";
  243.                 nNextPanel = RMFrame.nLiveRegPanel + RegPanels;
  244.             }
  245.             break;
  246.         
  247.             default:
  248.             break;
  249.         }
  250.         // Insert the panel in the backtrack array
  251.         InsertBackTrackPanel( nNextPanel );
  252.         // load the new page
  253.         LoadPage( nNextPanel );
  254.     }
  255.     catch(err)
  256.     {
  257.         var msg = document.frames("Errors").document.all.ERR_MSG_NAVIGATION.innerText;
  258.         var id = document.frames("Errors").document.all.ID_MSG_NAVIGATION.innerText;
  259.         g_ErrorHandler.DisplayNAVError (msg, id);
  260.         return;
  261.     }
  262.     
  263. }
  264.  
  265. function OnNextButton()
  266. {
  267.     try
  268.     {    
  269.         // If skip is renamed to finish and summon clicks it bail out.
  270.         if( NextButton.innerHTML == FinishBtnText )
  271.             window.parent.frames("contents").OnFinishButton();
  272.  
  273.         // Roadmap frame to access objects local to him
  274.         var RMFrame = window.parent.frames("contents");
  275.  
  276.         // Get the next panel
  277.         var nNextPanel = MainFrame.m_nCurrentPanel + 1;
  278.         
  279.         // If we hit next on a registration page toggle flag to send registration
  280.         // info throught the activation control to true            
  281.         if(MainFrame.m_aWizardPanels[MainFrame.m_nCurrentPanel].m_sTitle == "Registration")
  282.         {
  283.             var page = MainFrame.frames("main");
  284.             SendRegData = "true";
  285.             
  286.             if (page.CanUnloadPage != null)
  287.             {
  288.                 if (!page.CanUnloadPage())
  289.                     return;
  290.             }
  291.         }
  292.         
  293.         // If PageOb (activex that supports ICCIWNAvigation) is defined
  294.         // let him get first crack at the next button otherwise we are in control
  295.         if( window.parent.frames("main").PageOb != null )
  296.         {
  297.             // PageOb has control - returns true
  298.             if (window.parent.frames("main").PageOb.Next())
  299.             {
  300.                 return;
  301.             }
  302.             // PageOb gave up control - returns false
  303.             else
  304.             {
  305.                 // We have control so set the PageObject to null
  306.                 PageOb = null;
  307.                 
  308.                 // Check if we are not activated, in that case we have to 
  309.                 // do a custom action depending on layout
  310.                 if ( window.external.ObjectArg("DRM::LicenseState") != DJSMAR00_LicenseState_PURCHASED)
  311.                 {
  312.                     switch( MainFrame.g_iLicenseType )
  313.                     {
  314.                         // For retail flows skip subscription and go to postinstall
  315.                         case DJSMAR_LicenseType_Retail:
  316.                         case DJSMAR_LicenseType_Trial:
  317.                         case DJSMAR_LicenseType_Beta:
  318.                         case DJSMAR_LicenseType_ESD:
  319.                             nNextPanel=window.parent.frames("contents").nPostInstall;    
  320.                         break;
  321.                         // For rental flow we close down CfgWiz
  322.                         case DJSMAR_LicenseType_Rental:
  323.                             MainFrame.bPromptUser = false;
  324.                             window.parent.frames("contents").OnCloseButton();
  325.                             return;
  326.                         break;
  327.                         
  328.                         // All others use the next panel
  329.                         default:
  330.                         break;
  331.                     }
  332.                 }
  333.                 
  334.                 // Put our next panel in the backtrack list
  335.                 InsertBackTrackPanel( nNextPanel );
  336.                 // Load our next page
  337.                 LoadPage( nNextPanel );
  338.                 return;
  339.             }
  340.         }
  341.         
  342.  
  343.         // Run the post action for the current panel
  344.         if (MainFrame.m_nCurrentPanel >= 0)
  345.         {
  346.             if (MainFrame.m_aWizardPanels[MainFrame.m_nCurrentPanel].m_pPostAction != null)
  347.             {
  348.                 MainFrame.m_aWizardPanels[MainFrame.m_nCurrentPanel].m_pPostAction();
  349.             }
  350.         }
  351.         
  352.         // See what panel we are on and see if we need to do custom actions 
  353.         // for clicking next on the the current panel
  354.         switch( MainFrame.m_aWizardPanels[MainFrame.m_nCurrentPanel].m_sTitle )
  355.         {
  356.             // Custom actions for the Activation selection panels
  357.             case "SELECTACTIVATION":
  358.             {
  359.                 // If we are not going to register we are going to have to skip the registration panel
  360.                 if (!Register)
  361.                 {
  362.                     if(Activate)
  363.                     {
  364.                         // If chose to activate go directly to the activation panel
  365.                         nNextPanel = RMFrame.nActivationPanel;
  366.                     }
  367.                     else
  368.                     {
  369.                         // If chose not to activate NAG THEM!!!
  370.                         
  371.                         // Get the days left in the grace period from the collection
  372.                         var DaysLeft = MainFrame.g_iDaysRemaining;
  373.                         
  374.                         if( DaysLeft > 0 )
  375.                         {
  376.                             // If the days left are greater than 0 let them know how much time they have left
  377.                             var strSkipActivation = strActLaterGrace1.innerText + " " + DaysLeft + " " + strActLaterGrace2.innerText;
  378.                         }
  379.                         else
  380.                         {
  381.                             // If the days left are 0 tell them they must activate or are not protected
  382.                             var strSkipActivation = strActLaterNoGrace.innerText;
  383.                         }    
  384.                         
  385.                         // MessageBox
  386.                         iMsgBoxReturn = MainFrame.g_WebWnd.MsgBox( strSkipActivation, MainFrame.g_strProductName, MB_YESNO | MB_ICONQUESTION);
  387.  
  388.                         // If you still want to skip goto Product Specific panel (postinstall tasks) otherwise stay on selection panel
  389.                         if (iMsgBoxReturn == IDYES)
  390.                             return;
  391.                         else
  392.                             nNextPanel = RMFrame.nPostInstall;
  393.                     }
  394.                 }
  395.             }
  396.             break;
  397.             
  398.             default:
  399.             break;
  400.         }
  401.         
  402.         for (; nNextPanel < MainFrame.m_nMaxPanels; nNextPanel++)
  403.         {    
  404.             if (MainFrame.m_aWizardPanels[nNextPanel].m_bLoadPanel == false || MainFrame.m_aWizardPanels[nNextPanel].m_bDisplayPanel == false)
  405.             {    
  406.                 // Run the pre action
  407.                 if (MainFrame.m_aWizardPanels[nNextPanel].m_pPreAction != null)
  408.                 {
  409.                     MainFrame.m_aWizardPanels[nNextPanel].m_pPreAction();
  410.                 }
  411.  
  412.                 // Run the post action
  413.                 if (MainFrame.m_aWizardPanels[nNextPanel].m_pPostAction != null)
  414.                 {
  415.                     MainFrame.m_aWizardPanels[nNextPanel].m_pPostAction();
  416.                 }
  417.                 
  418.                 continue;
  419.             }
  420.             break;
  421.         }
  422.         // alert("nNextPanel: " + nNextPanel);        
  423.         // Put our next panel in the backtrack list
  424.         InsertBackTrackPanel( nNextPanel );
  425.         // Load our next page
  426.         LoadPage(nNextPanel);
  427.     }
  428.     catch(err)
  429.     {
  430.         var msg = document.frames("Errors").document.all.ERR_MSG_NAVIGATION.innerText;
  431.         var id = document.frames("Errors").document.all.ERR_ID_NAVIGATION.innerText;
  432.         g_ErrorHandler.DisplayNAVError (msg, id);
  433.         return;
  434.     }
  435. }
  436.  
  437. function OnBackButton()
  438. {
  439.     try
  440.     {
  441.         // Get the roadmap frame
  442.         var RMFrame = window.parent.frames( "contents" );                    
  443.         // Get the previous panel from the backtrack array
  444.         var nPrevPanel = GetBackTrackPanel();
  445.         
  446.         // If PageOb (activex that supports ICCIWNAvigation) is defined
  447.         // let him get first crack at the next button otherwise we are in control
  448.         if( window.parent.frames("main").PageOb != null )
  449.         {
  450.             if( window.parent.frames("main").PageOb.Back() )
  451.             {
  452.                 // PageOb has control - returns true
  453.                 return;
  454.             }
  455.             else
  456.             {
  457.                 // PageOb has control - returns false
  458.                 PageOb = null;
  459.             }
  460.         }
  461.         LoadPage(nPrevPanel);
  462.                     
  463.         for (; nPrevPanel >= 0; nPrevPanel--)
  464.         {
  465.             if (MainFrame.m_aWizardPanels[nPrevPanel].m_bLoadPage == false || MainFrame.m_aWizardPanels[nPrevPanel].m_bDisplayPage == false)
  466.             {
  467.                 continue;
  468.             }
  469.             break;
  470.         }
  471.     }
  472.     catch(err)
  473.     {
  474.         var msg = document.frames("Errors").document.all.ERR_MSG_NAVIGATION.innerText;
  475.         var id = document.frames("Errors").document.all.ERR_ID_NAVIGATION.innerText;
  476.         g_ErrorHandler.DisplayNAVError (msg, id);
  477.         return;
  478.     }
  479. }
  480.  
  481. function LoadPage(nPanel)
  482. {
  483.  
  484.     if (nPanel > MainFrame.m_nMaxPanels - 1  || nPanel < -1)
  485.     {
  486.         return;
  487.     }
  488.  
  489.     if (MainFrame.m_nCurrentPanel >= 0)
  490.     {
  491.         // Update the "content" frame
  492.         MainFrame.m_aWizardPanels[MainFrame.m_nCurrentPanel].m_TitleID.style.backgroundImage = '';
  493.         MainFrame.m_aWizardPanels[MainFrame.m_nCurrentPanel].m_Arrow.style.display = "none";
  494.  
  495.         MainFrame.m_nCurrentPanel = nPanel;
  496.         MainFrame.m_aWizardPanels[MainFrame.m_nCurrentPanel].m_TitleID.style.backgroundImage = 'url(Current.gif)';
  497.         MainFrame.m_aWizardPanels[MainFrame.m_nCurrentPanel].m_Arrow.style.display = "";
  498.     }
  499.     else
  500.     {
  501.         MainFrame.m_nCurrentPanel = nPanel;    
  502.  
  503.         // Update the "content" frame
  504.         MainFrame.m_aWizardPanels[MainFrame.m_nCurrentPanel].m_TitleID.style.backgroundImage = 'url(Current.gif)';
  505.         MainFrame.m_aWizardPanels[MainFrame.m_nCurrentPanel].m_Arrow.style.display = "";
  506.     }
  507.     
  508.         
  509.     // Load the page into the "main" frame
  510.     MainFrame.frames("main").navigate(MainFrame.m_aWizardPanels[nPanel].m_htm);
  511.     
  512.     HandleControlStates( nPanel );
  513.     
  514.  
  515.     // Disable the Back button 
  516.     if (MainFrame.m_nCurrentPanel <= MainFrame.m_nFirstPanel && MainFrame.m_aWizardPanels[MainFrame.m_nCurrentPanel].m_bLoadPanel)
  517.     {
  518.         BackButton.disabled    = true;
  519.     }
  520.     else
  521.     {
  522.         BackButton.disabled = false;
  523.     }
  524.  
  525.     // Determine the Next and Finish button state
  526.     if (MainFrame.m_nCurrentPanel == MainFrame.m_nMaxPanels - 1)
  527.     {
  528.         // We are at the last panel.
  529.         
  530.         // Change Next to Finish.
  531.         NextButton.style.visibility = "visible";
  532.         NextButton.disabled = false;
  533.         NextButton.accessKey = FinishHotKey;
  534.         NextButton.innerHTML = FinishBtnText;
  535.         NextButton.focus();
  536.         
  537.         // Hide skip button.
  538.         SkipButton.style.visibility = "hidden";
  539.     }
  540.     else
  541.     {
  542.         // We are not at the last panel
  543.         // Set button to Next.
  544.         NextButton.style.visibility = "visible";
  545.         NextButton.disabled = false;
  546.         NextButton.accessKey = NextHotKey;
  547.         NextButton.innerHTML = NextBtnText;
  548.         NextButton.focus();    
  549.     }
  550.     
  551.     
  552.     // Run the Pre action for the panel
  553.     if (MainFrame.m_aWizardPanels[MainFrame.m_nCurrentPanel].m_pPreAction != null)
  554.         MainFrame.m_aWizardPanels[MainFrame.m_nCurrentPanel].m_pPreAction();
  555. }
  556.  
  557. function OnHelp( topicID )
  558. {
  559.     try
  560.     {
  561.         window.external.ObjectArg("CFGWIZ_BASE_METHODS").Help("SymHelp.chm", topicID);
  562.     }
  563.     catch(err)
  564.     {
  565.     }
  566. }