home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 May / 05_02.iso / software / nis / files / NIS / NIS.MSI / ALEScan.exe / HTML / WIZ-ALES.JS < prev    next >
Encoding:
Text File  |  2001-12-01  |  5.1 KB  |  258 lines

  1. ////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
  4. //
  5. // NAME:    wiz-ALEs.js (Javascript file for wiz-ALEs.HTM)
  6. //
  7. // Copyright (c) 2001 by Symantec Corporation. All rights reserved.
  8. //
  9. ////////////////////////////////////////////////////////////////////////////////////////////
  10.  
  11. IE4 = document.all;
  12. ///////////////////////////////////////////////////////
  13. /////////new alert params /////////////////////////////
  14. ///////////////////////////////////////////////////////
  15. //icon:
  16. // 0 = no icon
  17. // 1 = error
  18. // 2 = question
  19. // 3 = alert
  20. // 4 = info
  21. //
  22. //buts:
  23. // 0 = ok
  24. // 1 = ok, cancel
  25. // 2 = abort, retry, cancel
  26. // 3 = yes, no, cancel
  27. // 4 = yes, no
  28. // 5 = retry, cancel
  29. //
  30. //defbut
  31. // 0 = first
  32. // 1 = second
  33. // 2 = third
  34. //
  35. //mods:
  36. // 0 = app modal
  37. // 1 = system modal
  38. function newAlert(mess, title, icon, buts, defbut, mods)
  39. {
  40.     if(IE4)
  41.         makeMsgBox(title, mess, icon, buts, defbut, mods)
  42.     else
  43.         alert(mess);
  44. }
  45.  
  46. function driveList_OnSpace(nRow)
  47. {
  48.     //
  49.     // Swap the state of the check box for this item
  50.     //
  51.     var CheckBox = driveList.GetCellPtr(nRow, 0).children[0];
  52.     CheckBox.checked = !CheckBox.checked;
  53. }
  54.  
  55. function initDriveList()
  56. {
  57.     driveList.OnSpace = driveList_OnSpace;
  58.     driveList.DeleteAllRows();
  59.     driveList.SetColumnCount(2);
  60.     driveList.SetColumnWidth(0, "50px");
  61.     driveList.SetColumnWidth(1, "83px");
  62.  
  63.     var szDrives = NetScan.DriveList;
  64.  
  65.     for(var i = 0; i < szDrives.length; ++i)
  66.     {
  67.         var pRow = driveList.InsertRow(-1);
  68.         driveList.SetCellTextPtr(pRow, 0, "<input type=\"checkbox\" checked OnClick=\"parent.CheckBox_OnClick()\">");
  69.         driveList.SetCellTextPtr(pRow, 1, szDrives.substring(i, i+1) + ":\\");
  70.     }
  71.  
  72. }
  73.  
  74. function CheckBox_OnClick()
  75. {
  76.     // Get a count of checked items... if zero are checked, disable the next btn
  77.     var nCount = driveList.GetRowCount();
  78.  
  79.     var nChecked = 0;
  80.     for(var nRow = 0; nRow < nCount; ++nRow)
  81.     {
  82.         var CheckBox = driveList.GetCellPtr(nRow, 0).children[0];
  83.         if(CheckBox.checked)
  84.         {
  85.             nChecked++;
  86.         }
  87.     }
  88.  
  89.     if(nChecked == 0)
  90.         NextBtn.disabled = true;
  91.     else
  92.         NextBtn.disabled = false;
  93. }
  94.  
  95. function saveDriveList()
  96. {
  97.     var nCount = driveList.GetRowCount();
  98.  
  99.     szDrives = "";
  100.     for(var nRow = 0; nRow < nCount; ++nRow)
  101.     {
  102.         var CheckBox = driveList.GetCellPtr(nRow, 0).children[0];
  103.         if(CheckBox.checked)
  104.         {
  105.             szDrives += driveList.GetCellPtr(nRow, 1).innerText.substring(0, 1);
  106.         }
  107.     }
  108.  
  109.     NetScan.DriveList = szDrives;
  110. }
  111.  
  112. function NextBtn_OnClick()
  113. {
  114. // Find the active page, back to front (if we are not disabled)
  115.     if(PageC.style.display == "")
  116.     {
  117.         ConfigInfo.AleScanRun = true;
  118.         returnValue = "";
  119.         // save the items in the list
  120.         FoundList.MergeItems();
  121.         window.navigate("res://closeme.xyz");
  122.     }
  123.  
  124.     if(PageB.style.display == "")
  125.     {
  126.         PageB.style.display = "none";
  127.         PageC.style.display = "";
  128.  
  129.         FixBtnText(true);
  130.         window.focus();
  131.         
  132.         // setup PageC
  133.         if(g_bFoundListLoaded)
  134.             FoundList.FileList = NetScan.FileList;
  135.     }
  136.  
  137.     if(PageA.style.display == "")
  138.     {
  139.         PageA.style.display = "none";
  140.         PageB.style.display = "";
  141.  
  142.         // setup PageB
  143.         NextBtn.disabled = true;
  144.         Cancel.disabled = true;
  145.         StopBtn.disabled = false;
  146.  
  147.         ScanDone.style.display = "none";
  148.         ScanStopped.style.display = "none"
  149.         Scanning.style.display = "";
  150.         Filename.style.display = "";
  151.         ScanFound.innerHTML = "0";
  152.         SetProgress(0);
  153.         pctdone.innerHTML = "0% Complete";
  154.  
  155.         saveDriveList();
  156.         NetScan.StartScan();
  157.  
  158.         FixBtnText(false);
  159.     }
  160. }
  161.  
  162.  
  163. function SetProgress(nPct)
  164. {
  165.     // We must special case 0 otherwise we get "invalid property"... arrrgggg!
  166.     var nRemain = 100 - nPct;
  167.     
  168.     if(nPct > 0)
  169.     {
  170.         ProgDone.style.display = "";
  171.         ProgDone.width = nPct + "%";
  172.     }
  173.     else
  174.     {
  175.         ProgDone.style.display = "none";
  176.     }
  177.     
  178.     if(nRemain > 0)
  179.     {
  180.         ProgRemain.style.display = "";
  181.         ProgRemain.width = nRemain + "%";
  182.     }
  183.     else
  184.     {
  185.         ProgRemain.style.display = "none";
  186.     }
  187. }
  188.  
  189. function Elipse_Path(nMaxLen, szPath)
  190. {
  191.     var szItems = szPath.split("\\");
  192.     var nItem = 0;
  193.     var nLastStart = 1;
  194.     var szOutput = szPath;
  195.     while(szOutput.length > nMaxLen)
  196.     {
  197.         szOutput = szItems[0];
  198.         szOutput = szOutput + "\\" + "...";
  199.         
  200.         for(nItem = nLastStart; nItem < szItems.length; nItem++)
  201.         {
  202.             szOutput = szOutput + "\\" + szItems[nItem];            
  203.         }
  204.         
  205.         nLastStart++;
  206.     }
  207.     
  208.     return szOutput;
  209. }
  210.  
  211. function CheckUserType()
  212. {
  213.     var type = UserManager.CurrentUserType;
  214.     if(type != "UT_SUPERVISOR")
  215.     {
  216.         newAlert(StrID("ALEScanSupervisor"), UserManager.AppTitle, 3, 0, 0, 0);
  217.         window.navigate("res://closeme.xyz");
  218.     }
  219. }
  220.  
  221. function OnAdd()
  222. {
  223.     FoundList.Add();
  224. }
  225.  
  226. function OnModify()
  227. {
  228.     FoundList.Modify();
  229. }
  230.  
  231. function OnRemove()
  232. {
  233.     FoundList.Delete();
  234. }
  235.  
  236. function OnCheckAll()
  237. {
  238.     FoundList.SelectAll();
  239. }
  240.  
  241. function OnUncheckAll()
  242. {
  243.     FoundList.UnselectAll();
  244. }
  245.  
  246. function OnKeyDownHandler()
  247. {
  248.     // Last Control Tab over to the <back, next, close> button.
  249.     var VK_ESCAPE = 27;
  250.  
  251.     if (window.event.keyCode == VK_ESCAPE)
  252.     {
  253.         // Escape key.. We want to exit out of the wizard..
  254.         window.navigate("res://closeme.xyz");
  255.  
  256.     }
  257.     
  258. }