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

  1. // Alert.js
  2.  
  3. //~~--~~//~~--~~//~~--~~//~~--~~//~~--~~//~~--~~//~~--~~
  4. // HTML pages that include Alert.js
  5. //  must also include SymAlertStatic.js
  6. //~~--~~//~~--~~//~~--~~//~~--~~//~~--~~//~~--~~//~~--~~
  7.  
  8. // Disable Drag-and-drop support
  9. document.ondragstart = function(){return false;}
  10.  
  11. //
  12. // Help IDS
  13. //
  14. var IDH_NAV_ALERT_WARNING_SUBSCRIPT = 11561;
  15. var IDH_NAV_ALERT_EXPIRED_SUBSCRIPT = 11560;
  16. var IDH_NAV_ALERT_EXPIRED_SUBSCRIPT_ONSCAN = 12100;
  17. var IDH_NAV_ALERT_EXPIRED_VIRUSDEFS = 12150;
  18. var IDH_NAV_ALERT_EXPIRED_VIRUSDEFS_ONSCAN = 12151;
  19. var IDH_NAV_ALERT_ALU_DISABLED = 12152;
  20.  
  21. var g_DefAlert;
  22. var g_Launcher;
  23.  
  24. g_ModuleID = 3028;
  25.  
  26. var IDS_VENDOR_NAME = 116;
  27.  
  28. var CYCLE_SUBSEXPIRED    = "SECycle";
  29. var CYCLE_DEFSOUTOFDATE = "DefsCycle";    
  30. var CYCLE_LICWARNING    = "LWCycle";
  31. var CYCLE_LICEXPIRED    = "LECycle";
  32. var CYCLE_SCANSUBSEXPIRED    = "S_SECyc";
  33. var CYCLE_SCANDEFSOUTOFDATE = "S_DCyc";
  34.  
  35. var _1_DAY = 86400; // in seconds
  36.  
  37. var iTimerID;
  38. var bTimerRunning = false;
  39. // 2 minute timeout
  40. var TIMEOUT = 120000;
  41.  
  42. // ========================================== 
  43. //            Helper functions
  44. // ========================================== 
  45.  
  46. function createDefAlertObjects()
  47. {
  48.     try
  49.     {
  50.         g_DefAlert = new ActiveXObject ("DefAlert.SymNavDefAlert");
  51.     }
  52.     catch(err)
  53.     {
  54.         var msg = document.frames("Errors").document.all.ERR_MSG_NO_DEFALERT.innerText;
  55.         var id = document.frames("Errors").document.all.ERR_ID_NO_DEFALERT.innerText;
  56.         g_ErrorHandler.DisplayNAVError (msg, id);
  57.         return;
  58.     }
  59.     
  60.     try
  61.     {
  62.         g_Launcher = new ActiveXObject ("Symantec.Norton.AntiVirus.AppLauncher");
  63.     }
  64.     catch(err)
  65.     {
  66.         var msg = document.frames("Errors").document.all.ERR_MSG_NO_LAUNCHER.innerText;
  67.         var id = document.frames("Errors").document.all.ERR_ID_NO_LAUNCHER.innerText;
  68.         g_ErrorHandler.DisplayNAVError (msg, id);
  69.         return;
  70.     }
  71. }
  72.  
  73. function Init()
  74. {
  75.     window.returnValue = SYMALERT_RESULT_CANCEL;        
  76.     
  77.     createDefAlertObjects();
  78.     
  79.     try
  80.     {
  81.         if(g_DefAlert.IsHighContrast()) 
  82.             document.body.scroll = "yes";        
  83.     }
  84.     catch(err)
  85.     {
  86.     }
  87. }
  88.  
  89. function DisableNotifyOption()
  90. {
  91.     days.disabled = true;
  92. }
  93.  
  94. function EnableNotifyOption()
  95. {
  96.     days.disabled = false;
  97. }
  98.  
  99. function DisableNotifyAndDontShowOptions()
  100. {
  101.     days.disabled = true;
  102.     DontShowBtn.disabled = true;
  103. }
  104.  
  105. function EnableNotifyAndDontShowOptions()
  106. {
  107.     days.disabled = false;
  108.     DontShowBtn.disabled = false;
  109. }
  110.  
  111. function OnHelpClick( TopicID )
  112. {
  113.     try
  114.     {    
  115.         g_Launcher.LaunchHelp( TopicID );
  116.     }
  117.     catch(err)
  118.     {
  119.         g_Launcher.NAVError.LogAndDisplay(0);
  120.     }
  121.  
  122.     return false;
  123. }
  124.  
  125. function OnClose()
  126. {
  127.     CancelTimer();
  128.     location.href = "res://closeme.xyz/";
  129. }
  130.  
  131. function AlertOnLoad()
  132. {
  133.     Init();
  134. }
  135.  
  136. function CancelTimer()
  137. {
  138.     // If the timer is running
  139.     if (bTimerRunning == true)
  140.     {
  141.         // cancel the timer
  142.         clearInterval(iTimerID);
  143.         bTimerRunning = false;
  144.     }
  145. }
  146.  
  147. // ========================================== 
  148. //            ALUDisabled functions 
  149. // ========================================== 
  150.  
  151. function ALUDisabledOnClickOK()
  152. {
  153.     if(EnableALUBtn.checked == true)
  154.         window.returnValue = SYMALERT_RESULT_ENABLEALU;        
  155.         
  156.     OnClose();
  157. }
  158.  
  159. // ========================================== 
  160. //            DefsOutOfDates functions 
  161. // ========================================== 
  162.  
  163. function DefsOutOfDateOnLoad()
  164. {    
  165.     Init();
  166.  
  167.     // Set default users' selections. 
  168.     //  Assume they selected "Notify me in 1 day".
  169.     try
  170.     {
  171.         g_DefAlert.SetAlertDword(CYCLE_DEFSOUTOFDATE, _1_DAY);        
  172.     }
  173.     catch(err)
  174.     {
  175.         g_DefAlert.NAVError.LogAndDisplay(0);
  176.     }
  177. }
  178.  
  179. function DefsOutOfDateOnClickOK()
  180. {
  181.     // Update the DefsOutOfDate cycle anyway in case the user
  182.     //  selects LU but then cancels it later.
  183.  
  184.     try
  185.     {
  186.         g_DefAlert.SetAlertDword(CYCLE_DEFSOUTOFDATE, (days.value * _1_DAY));            
  187.     }
  188.     catch(err)
  189.     {
  190.         g_DefAlert.NAVError.LogAndDisplay(0);
  191.     }
  192.  
  193.     if (LUBtn.checked == true)
  194.         window.returnValue = SYMALERT_RESULT_LAUNCHLU;        
  195.  
  196.     OnClose();
  197. }
  198.  
  199. // ========================================== 
  200. //       Scanner DefsOutOfDates functions 
  201. // ========================================== 
  202.  
  203. function Scan_DefsOutOfDateOnLoad()
  204. {
  205.     window.returnValue = SYMALERT_RESULT_CANCEL;    
  206.     
  207.     // Start the timer to close the window in 2 minutes
  208.     iTimerID = setInterval("OnClose()", TIMEOUT);
  209.     bTimerRunning = true;
  210.     
  211.     createDefAlertObjects();
  212.  
  213.     try
  214.     {
  215.         if(g_DefAlert.IsHighContrast()) 
  216.             document.body.scroll = "yes";        
  217.     }
  218.     catch(err)
  219.     {
  220.     }
  221.  
  222.     // Set default users' selections.
  223.     // Set the value to 0 days so it appears again in case the user missed it
  224.     g_DefAlert.SetAlertDword(CYCLE_SCANDEFSOUTOFDATE, 0);        
  225. }
  226.  
  227. function Scan_DefsOutOfDateOnClickOK()
  228. {
  229.     CancelTimer();
  230.     
  231.     try
  232.     {
  233.         if (LUBtn.checked == true)
  234.         {
  235.             window.returnValue = SYMALERT_RESULT_LAUNCHLU;
  236.         }
  237.         else
  238.         {
  239.             g_DefAlert.SetAlertDword(CYCLE_SCANDEFSOUTOFDATE, (days.value * _1_DAY));            
  240.         }
  241.     }
  242.     catch(err)
  243.     {
  244.         g_DefAlert.NAVError.LogAndDisplay(0);
  245.     }
  246.  
  247.     OnClose();
  248. }
  249.  
  250. // ========================================== 
  251. //            Subscription Warning
  252. // ========================================== 
  253.  
  254. function SubWarningOnLoad()
  255. {
  256.     Init();
  257.     
  258.     try
  259.     {
  260.         var iDaysLeft = g_DefAlert.GetVirusDefSubDaysLeft();
  261.         daysLeft.innerText = iDaysLeft;
  262.     }
  263.     catch(err)
  264.     {
  265.         g_DefAlert.NAVError.LogAndDisplay(0);
  266.     }    
  267.     
  268.     try
  269.     {
  270.         // Check for admin rights.
  271.         var NAVLicenseObj = new ActiveXObject("NAVLicense.NAVLicenseInfo");
  272.         
  273.         if(NAVLicenseObj.CanRenewSubscription == false)
  274.         {
  275.             table2_row_RenewNow.style.display = "none";    
  276.             table2_row_RenewLater.style.display = "none";
  277.             table2_row_space.style.display = "none";
  278.             RenewBtn.checked = false;            
  279.             table2_row_AdminRights.style.display = "";    
  280.         }
  281.     }
  282.     catch(err)
  283.     {
  284.     }
  285. }
  286.  
  287. function SubWarningOnClickOK()
  288. {
  289.     if(RenewBtn.checked == true)
  290.         window.returnValue = SYMALERT_RESULT_RENEWSUBS;        
  291.  
  292.     OnClose();
  293. }
  294.  
  295. // ========================================== 
  296. //            Subscription Expired
  297. // ========================================== 
  298.  
  299. function SubExpiredOnLoad()
  300. {
  301.     // Set default users' selections. 
  302.     // 1. Assume users cancel the alert
  303.     // 2. Assume they selected "Notify me in 1 day".    
  304.     Init();
  305.                 
  306.     try
  307.     {
  308.         g_DefAlert.SetAlertDword(CYCLE_SUBSEXPIRED, _1_DAY);        
  309.     }
  310.     catch(err)
  311.     {
  312.         g_DefAlert.NAVError.LogAndDisplay(0);
  313.     }
  314.     
  315.     var iDaysLeft = 0;
  316.     
  317.     try
  318.     {
  319.         iDaysLeft = g_DefAlert.GetVirusDefSubDaysLeft();
  320.     }
  321.     catch(err)
  322.     {
  323.         g_DefAlert.NAVError.LogAndDisplay(0);
  324.     }
  325.     
  326.     if(iDaysLeft < 0)
  327.     {
  328.         var iDaysExpired = Math.abs(iDaysLeft);
  329.         if(iDaysExpired >= 30)
  330.         {
  331.             DontShowTxt.style.display = "";
  332.             DontShowBtn.style.display = "";
  333.             DontShowBtn.disabled = true;
  334.             days15.selected = true;
  335.             days1.selected = false;
  336.         }        
  337.     }
  338.     
  339.     try
  340.     {
  341.         // Check for admin rights.
  342.         var NAVLicenseObj = new ActiveXObject("NAVLicense.NAVLicenseInfo");
  343.         
  344.         if(NAVLicenseObj.CanRenewSubscription == false)
  345.         {
  346.             table2_row_RenewNow.style.display = "none";    
  347.             table2_row_RenewLater.style.display = "none";
  348.             table2_row_space1.style.display = "none";
  349.             table2_row_space2.style.display = "none";
  350.             table2_row_DontShowAgain.style.display = "none";
  351.             RenewBtn.checked = false;            
  352.             table2_row_AdminRights.style.display = "";    
  353.         }
  354.     }
  355.     catch(err)
  356.     {
  357.     }
  358. }
  359.  
  360. function SubExpiredOnClickOK()
  361. {
  362.     if(RenewBtn.checked == true)
  363.     {
  364.         window.returnValue = SYMALERT_RESULT_RENEWSUBS;            
  365.     }
  366.     else
  367.     {
  368.         if(DontShowBtn.checked == true)
  369.         {
  370.             try
  371.             {
  372.                 g_DefAlert.SetAlertDword(CYCLE_SUBSEXPIRED, -1);        
  373.             }
  374.             catch(err)
  375.             {
  376.                 g_DefAlert.NAVError.LogAndDisplay(0);
  377.             }            
  378.         }
  379.         else
  380.         {
  381.             try
  382.             {
  383.                 g_DefAlert.SetAlertDword(CYCLE_SUBSEXPIRED, days.value * _1_DAY);        
  384.             }
  385.             catch(err)
  386.             {
  387.                 g_DefAlert.NAVError.LogAndDisplay(0);
  388.             }
  389.         }            
  390.     }
  391.  
  392.     OnClose();
  393. }
  394.  
  395. // ========================================== 
  396. //        Scanner    Subscription Expired
  397. // ========================================== 
  398.  
  399. function Scan_SubExpiredOnLoad()
  400. {
  401.     // Set default users' selections. 
  402.     // 1. Assume users cancel the alert
  403.     // 2. Set the value to 0 days so it appears again in case the user missed it
  404.     window.returnValue = SYMALERT_RESULT_CANCEL;    
  405.     
  406.     // Start the timer to close the window in 2 minutes
  407.     iTimerID = setInterval("OnClose()", TIMEOUT);
  408.     bTimerRunning = true;
  409.     
  410.     createDefAlertObjects();
  411.  
  412.     try
  413.     {
  414.         if(g_DefAlert.IsHighContrast()) 
  415.             document.body.scroll = "yes";        
  416.     }
  417.     catch(err)
  418.     {
  419.     }
  420.             
  421.     try
  422.     {
  423.         g_DefAlert.SetAlertDword(CYCLE_SCANSUBSEXPIRED, 0);    
  424.     }
  425.     catch(err)
  426.     {
  427.         g_DefAlert.NAVError.LogAndDisplay(0);
  428.         return;
  429.     }
  430.     
  431.     var iDaysLeft = 0;
  432.     
  433.     try
  434.     {
  435.         iDaysLeft = g_DefAlert.GetVirusDefSubDaysLeft();
  436.     }
  437.     catch(err)
  438.     {
  439.         g_DefAlert.NAVError.LogAndDisplay(0);
  440.         return;
  441.     }
  442.     
  443.     if(iDaysLeft < 0)
  444.     {
  445.         var iDaysExpired = Math.abs(iDaysLeft);
  446.         if(iDaysExpired >= 30)
  447.         {
  448.             DontShowTxt.style.display = "";
  449.             DontShowBtn.style.display = "";
  450.             DontShowBtn.disabled = true;
  451.             days15.selected = true;
  452.             days1.selected = false;
  453.         }
  454.         
  455.     }
  456.     try
  457.     {
  458.         // Check for admin rights.
  459.         var NAVLicenseObj = new ActiveXObject("NAVLicense.NAVLicenseInfo");
  460.         
  461.         if(NAVLicenseObj.CanRenewSubscription == false)
  462.         {
  463.             table2_row_RenewNow.style.display = "none";    
  464.             table2_row_RenewLater.style.display = "none";
  465.             table2_row_space1.style.display = "none";
  466.             table2_row_space2.style.display = "none";
  467.             table2_row_DontShowAgain.style.display = "none";
  468.             RenewBtn.checked = false;        
  469.             table2_row_AdminRights.style.display = "";    
  470.         }
  471.     }
  472.     catch(err)
  473.     {
  474.     }
  475. }
  476.  
  477. function Scan_SubExpiredOnClickOK()
  478. {
  479.     CancelTimer();
  480.     
  481.     if(RenewBtn.checked == true)
  482.     {
  483.         window.returnValue = SYMALERT_RESULT_RENEWSUBS;            
  484.     }
  485.     else
  486.     {
  487.         if(DontShowBtn.checked == true)
  488.         {
  489.             try
  490.             {
  491.                 g_DefAlert.SetAlertDword(CYCLE_SCANSUBSEXPIRED, -1);        
  492.             }
  493.             catch(err)
  494.             {
  495.                 g_DefAlert.NAVError.LogAndDisplay(0);
  496.             }
  497.         }
  498.         else
  499.         {
  500.             try
  501.             {
  502.                 g_DefAlert.SetAlertDword(CYCLE_SCANSUBSEXPIRED, days.value * _1_DAY);        
  503.             }
  504.             catch(err)
  505.             {
  506.                 g_DefAlert.NAVError.LogAndDisplay(0);
  507.             }
  508.         }
  509.     }
  510.  
  511.     OnClose();
  512. }
  513.  
  514. // ========================================== 
  515. //            Licensing 
  516. // ========================================== 
  517.  
  518. function LicensingOnClickOK()
  519. {
  520.     if(ResolveBtn.checked == true)
  521.     {
  522.         window.returnValue = SYMALERT_RESULT_RESOLVELICENSE;        
  523.     }
  524.     
  525.     OnClose();
  526. }
  527.  
  528. function LicensingPreActiveExpiredOnClickOK()
  529. {
  530.     if(ResolveBtn.checked == true)
  531.     {
  532.         window.returnValue = SYMALERT_RESULT_ACTIVATE_SERVICE;        
  533.     }
  534.     else if(SignupBtn.checked == true)
  535.     {
  536.         window.returnValue = SYMALERT_RESULT_SIGNUP_SERVICE;        
  537.     }
  538.     
  539.     OnClose();
  540. }
  541.  
  542. function LicensingPreActiveExpiredSSOnClickOK()
  543. {
  544.     if(ResolveBtn.checked == true)
  545.     {
  546.         window.returnValue = SYMALERT_RESULT_ACTIVATE_SERVICE;        
  547.     }
  548.     
  549.     OnClose();
  550. }
  551.  
  552. function LicensingCanceledOnClickOK()
  553. {
  554.     if(ResolveBtn.checked == true)
  555.     {
  556.         window.returnValue = SYMALERT_RESULT_RESOLVELICENSE;        
  557.     }
  558.     else if(OptionsBtn.checked == true)
  559.     {
  560.         // Yes, we perform the same task as if users
  561.         //  click ResolveBtn since the back end web process
  562.         //  will change dynamically according to the licensing
  563.         //  status.
  564.         window.returnValue = SYMALERT_RESULT_RESOLVELICENSE;        
  565.     }
  566.     else if(UninstallBtn.checked == true)
  567.     {
  568.         window.returnValue = SYMALERT_RESULT_UNINSTALL;        
  569.     }
  570.     
  571.     OnClose();
  572. }
  573.  
  574. // ================================================
  575. // Licensing alerts with "Notify me again" options
  576. // ================================================
  577.  
  578. function LicensingWithRemindMeOnLoad(strRemindMeCycle)
  579. {
  580.     // Set default users' selections. 
  581.     //    1. Assume they dont want to resolve license
  582.     //  2. Assume they selected "Notify me in 1 day".
  583.     // 
  584.     Init();
  585.     
  586.     try
  587.     {
  588.         g_DefAlert.SetAlertDword(strRemindMeCycle, _1_DAY);
  589.     }
  590.     catch(err)
  591.     {
  592.         g_DefAlert.NAVError.LogAndDisplay(0);
  593.     }
  594. }
  595.  
  596. function LicensingWithRemindMeOnClickOK(strRemindMeCycle)
  597. {
  598.     if(ResolveBtn.checked == true)
  599.     {
  600.         window.returnValue = SYMALERT_RESULT_RESOLVELICENSE;        
  601.     }
  602.     else
  603.     {
  604.         try
  605.         {
  606.             g_DefAlert.SetAlertDword(strRemindMeCycle, days.value * _1_DAY);        
  607.         }
  608.         catch(err)
  609.         {
  610.             g_DefAlert.NAVError.LogAndDisplay(0);
  611.         }
  612.     }
  613.  
  614.     OnClose();
  615. }