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

  1. g_ModuleID = 3002;
  2.  
  3. // Disable Drag-and-drop support
  4. document.ondragstart = function(){return false;}
  5.  
  6. // The g_fStartingScan variable is used to disable the launching of new scans
  7. // for a bit after it has been pressed.  It's a hack to get around not knowing
  8. // when we are currently executing a scan.
  9. var g_fStartingScan = false;
  10.  
  11. // Currently selected row, if any.
  12. //
  13. var g_CurrentRow;
  14.  
  15. // MessageBox() Flags
  16. var MB_OK =                     0x00000000;
  17. var MB_OKCANCEL =               0x00000001;
  18. var MB_ABORTRETRYIGNORE =       0x00000002;
  19. var MB_YESNOCANCEL =            0x00000003;
  20. var MB_YESNO =                  0x00000004;
  21. var MB_RETRYCANCEL =            0x00000005;
  22.  
  23. var MB_ICONHAND =               0x00000010;
  24. var MB_ICONQUESTION =           0x00000020;
  25. var MB_ICONEXCLAMATION =        0x00000030;
  26. var MB_ICONASTERISK  =          0x00000040;
  27.  
  28. var MB_USERICON =               0x00000080;
  29. var MB_ICONWARNING =            MB_ICONEXCLAMATION;
  30. var MB_ICONERROR =              MB_ICONHAND;
  31.  
  32. var MB_ICONINFORMATION =        MB_ICONASTERISK;
  33. var MB_ICONSTOP =               MB_ICONHAND;
  34.  
  35. var IDOK =              1;
  36. var IDCANCEL =          2;
  37. var IDABORT =           3;
  38. var IDRETRY =           4;
  39. var IDIGNORE =          5;
  40. var IDYES =             6;
  41. var IDNO =              7;
  42.  
  43. var g_strScanTasksInterface = "Symantec.Norton.AntiVirus.ScanTasks";
  44. var g_strWebWndInterface = "CcWebWnd.ccWebWindow";
  45. var g_strNAVTaskSchedulerInterface = "NAVTasks.Scheduler";
  46. var g_NAVScanTasks;
  47. var g_webWnd;
  48. var g_bSchedulerInstalled = 0;
  49.  
  50. function onLoad ()
  51. {
  52.     try
  53.     {
  54.         g_NAVScanTasks = new ActiveXObject (g_strScanTasksInterface);
  55.     }
  56.     catch (err)
  57.     {
  58.         var msg = document.frames("Errors").document.all.ERR_MSG_NO_NAVTASKS.innerText;
  59.         var id = document.frames("Errors").document.all.ERR_ID_NO_NAVTASKS.innerText;
  60.         g_ErrorHandler.DisplayNAVError (msg, id);
  61.         DisableUI();
  62.         return;
  63.     }
  64.  
  65.     try
  66.     {
  67.         g_webWnd = new ActiveXObject (g_strWebWndInterface);
  68.     }
  69.     catch(err)
  70.     {
  71.         var msg = document.frames("Errors").document.all.ERR_MSG_NO_WEBWND.innerText;
  72.         var id = document.frames("Errors").document.all.ERR_ID_NO_WEBWND.innerText;
  73.         g_ErrorHandler.DisplayNAVError (msg, id);
  74.         DisableUI();
  75.         return;
  76.     }
  77.  
  78.     try
  79.     {
  80.         g_Scheduler = new ActiveXObject (g_strNAVTaskSchedulerInterface);
  81.     }
  82.     catch (err)
  83.     {
  84.         var msg = document.frames("Errors").document.all.ERR_MSG_NO_SCHEDULER.innerText;
  85.         var id = document.frames("Errors").document.all.ERR_ID_NO_SCHEDULER.innerText;
  86.         g_ErrorHandler.DisplayNAVError (msg, id);
  87.         DisableUI();
  88.         return;
  89.     }
  90.  
  91.     try
  92.     {
  93.         g_bSchedulerInstalled = g_Scheduler.Installed;
  94.     }
  95.     catch (err)
  96.     {
  97.         g_Scheduler.NAVError.LogAndDisplay(0);
  98.         DisableUI();
  99.         return;
  100.     }
  101.  
  102.     // Make sure all objects are create BEFORE loading the scan_list.js code.
  103.     // We do this by calling the onLoad () manually, rather than from the scan_list HTML.
  104.     //    
  105.     document.frames("frmScanTasksList").onLoad();
  106.  
  107.     ListFocus();
  108. }    
  109.  
  110.  
  111. function onNew()
  112. {
  113.     document.frames("frmScanTasksList").createTask ();
  114. }
  115.  
  116. function onEdit()
  117. {
  118.     // We store the tasks by name, but that can change here. So we 
  119.     // store the row number, which won't change, then rebuild the
  120.     // row.
  121.     //
  122.     try
  123.     {
  124.         var iTaskIndex = g_NAVScanTasks.TaskIndex(g_CurrentRow.strScanTask);
  125.         g_NAVScanTasks(g_CurrentRow.strScanTask).Edit();
  126.         document.frames("frmScanTasksList").clearRow ( g_CurrentRow );
  127.         var strNewName = g_NAVScanTasks(iTaskIndex).TaskName;
  128.         document.frames("frmScanTasksList").makeTask ( strNewName, g_CurrentRow );
  129.     }
  130.     catch(err)
  131.     {
  132.         g_NAVScanTasks.NAVError.LogAndDisplay(0);    
  133.     }
  134. }
  135.  
  136. function onDelete()
  137. {
  138.     // Prompt users to see if they really want to delete the task
  139.     //
  140.     iMsgBoxReturn = g_webWnd.MsgBox(strAreYouSureDeleteTask.innerText, strNortonAntiVirus.innerText, MB_YESNO | MB_ICONINFORMATION);
  141.  
  142.     if (iMsgBoxReturn == IDYES)
  143.     {
  144.         document.frames("frmScanTasksList").deleteTask ( g_CurrentRow );
  145.     }
  146. }
  147.  
  148. function onSchedule()
  149. {
  150.     try
  151.     {
  152.         g_NAVScanTasks(g_CurrentRow.strScanTask).Schedule(false);
  153.     }
  154.     catch(err)
  155.     {
  156.         g_NAVScanTasks(g_CurrentRow.strScanTask).NAVError.LogAndDisplay(0);    
  157.     }
  158.  
  159.     document.frames("frmScanTasksList").clearRow ( g_CurrentRow );
  160.     document.frames("frmScanTasksList").makeTask ( g_CurrentRow.strScanTask, g_CurrentRow );
  161. }
  162.  
  163. function ListFocus () 
  164. {
  165.     var row = document.frames("frmScanTasksList").ScanTasksList.rows.item(0);
  166.  
  167.     if ( row )
  168.     {
  169.         row.onclick ();
  170.         //row.cells(1).focus (); // doesn't work anyway
  171.     }
  172. }
  173.  
  174. function ScanDisableDelay()
  175. {
  176.    // Let the scan now button be pressed again.
  177.    g_fStartingScan = false;
  178. }
  179.  
  180. function onScan ()
  181. {
  182.    if (!g_fStartingScan)
  183.    {
  184.       // Disable the button for until our timeout happens.
  185.       // This prevents people from clicking the button again and
  186.       // launching another scan.  It's not perfect but it deters
  187.       // the customer from pressing it again for a bit.
  188.       g_fStartingScan = true;
  189.                
  190.        
  191.       try
  192.       {
  193.          g_NAVScanTasks(g_CurrentRow.strScanTask).Scan();
  194.       }
  195.  
  196.         catch(err)
  197.       {
  198.          g_NAVScanTasks.NAVError.LogAndDisplay(0);    
  199.       }
  200.  
  201.       window.setTimeout("ScanDisableDelay()",1000)
  202.     }
  203. }
  204.  
  205. function DisableUI ()
  206. {
  207.     TaskCommandsOn.style.display = "none";
  208.     TaskCommandsOff.style.display = "none";
  209.     TaskCommandsDisabled.style.display = "block";
  210.  
  211.     ScheduleButtonOn.style.display = "none";
  212.     ScheduleButtonOff.style.display = "block";
  213. }