home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2004 July / APC0407D1.iso / powerkit / firewall / files / NPF2004.exe / Setup / ISCommon / APP / fwUI.dll / HTML / ADAPTERS-POPUP.JS < prev    next >
Encoding:
Text File  |  2003-09-06  |  5.1 KB  |  237 lines

  1. ////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
  4. //
  5. // NAME:    Adapters-Popup.js (Javascript file for Adapters-popup.HTM)
  6. //
  7. // Copyright (c) 2001 by Symantec Corporation. All rights reserved.
  8. //
  9. ////////////////////////////////////////////////////////////////////////////////////////////
  10.  
  11. returnValue = null;
  12. var g_ipList = null;
  13.  
  14. function Page_OnLoad()
  15. {
  16.     UIIPLoad(window.dialogArguments[1]);
  17.     IPSetText(window.dialogArguments[0]);
  18.  
  19.     UserManager.WatchForFREIntegStart();
  20.  
  21.     //
  22.     // Register special handlers
  23.     //
  24.     IPAdd.onclick = IPAdd_OnClick;
  25.     IPRemove.onclick = IPRemove_OnClick;
  26.     
  27.     OKB.focus();
  28. }
  29.  
  30. function UserManager_OnFREIntegratorStart()
  31. {
  32.      window.navigate('res://closeme.xyz');
  33. }
  34.  
  35. ////////////////////////////////////////////////////////////////////////////////////
  36. //  Local Sites/Zones to Block page
  37. //
  38.  
  39. var currentActionState = null;
  40.  
  41. function IPList_OnClick()
  42. {
  43.     // Enable the modify/delete buttons
  44.     EnableButton(IPRemove,true);
  45. }
  46.  
  47. function IPCtlsEnabled(enable)
  48. {
  49.  
  50.     EnableButton(IPAdd,enable);
  51.  
  52.     //
  53.     // Only allow this button to be disabled. Be sure to remove
  54.     // selection too.
  55.     //
  56.     if (!enable)
  57.     {
  58.         EnableButton(IPRemove,enable);
  59.         IPList.SetCurSel(-1);
  60.     }
  61.  
  62.     //
  63.     // Enable radio buttons appropriately.
  64.     //
  65.     Addresses[0].checked = !enable;
  66.     Addresses[1].checked = enable;
  67. }
  68.  
  69. function UIIPLoad(ipList)
  70. {
  71.     IPList_OnLoad();
  72.  
  73.     g_ipList = ipList;
  74.     
  75.     refreshIPList();
  76. }
  77.  
  78. function refreshIPList()
  79. {
  80.     //
  81.     // Reset the list control
  82.     //
  83.     IPList.DeleteAllRows();
  84.     IPList.SetColumnCount(2);
  85.  
  86.     var bEnableList = false;
  87.  
  88.     var curIP = g_ipList.GetFirst();
  89.  
  90.     while(null != curIP)
  91.     {        
  92.         // If the ip item is a Network...
  93.         if(curIP.Type == 3)
  94.         {
  95.             var text = StrID("IP") + ": " + curIP.NetworkIP + "<BR>" + StrID("Mask") + ": " + curIP.NetworkMask;
  96.  
  97.             pRow = IPList.InsertRow(-1);
  98.             IPList.SetCellTextPtr(pRow, 0, StrID("NetworkAddress"));
  99.             IPList.SetCellTextPtr(pRow, 1, text);
  100.         }
  101.         // If the IP item is a range...
  102.         else if(curIP.Type == 2)
  103.         {
  104.             var text = StrID("From") + ": " + curIP.RangeStart + "<BR>" + StrID("To") + ": " + curIP.RangeEnd;
  105.  
  106.             pRow = IPList.InsertRow(-1);
  107.             IPList.SetCellTextPtr(pRow, 0, StrID("AddressRange"));
  108.             IPList.SetCellTextPtr(pRow, 1, text);
  109.         }
  110.         // If the IP item is a named item...
  111.         else if(curIP.Type == 1)
  112.         {
  113.             var text = StrID("Name") + ": " + curIP.NamedIP;
  114.  
  115.             pRow = IPList.InsertRow(-1);
  116.             IPList.SetCellTextPtr(pRow, 0, StrID("SingleAddress"));
  117.             IPList.SetCellTextPtr(pRow, 1, text);
  118.         }
  119.         // If the IP item is an address...
  120.         else if(curIP.Type == 0)
  121.         {
  122.             var text = StrID("IP") + ": " + curIP.RawIP;
  123.  
  124.             pRow = IPList.InsertRow(-1);
  125.             IPList.SetCellTextPtr(pRow, 0, StrID("SingleAddress"));
  126.             IPList.SetCellTextPtr(pRow, 1, text);
  127.         }            
  128.  
  129.         curIP = g_ipList.GetNext();
  130.     }
  131.  
  132.     if(g_ipList.ItemCount > 0)
  133.         bEnableList = true;
  134.  
  135.     IPCtlsEnabled(bEnableList);
  136. }
  137.  
  138. function IPAdd_OnClick()
  139. {
  140.     var Params = new Array;
  141.  
  142.     Params[0] = currentActionState;
  143.     Params[1] = null;
  144.     Params[2] = g_ipList;
  145.  
  146.     webWnd.SetIcon2("res://NisRes.dll/105");
  147.     var newIPList = webWnd.showModalDialog('res://fwui.dll/IP-Popup.htm', 450, 350, Params);
  148.  
  149.     if(null != newIPList)
  150.     {
  151.         var curIP = newIPList.GetFirst();
  152.  
  153.         while(null != curIP)
  154.         {
  155.             g_ipList.LastError = 0;
  156.             g_ipList.AppendItem(curIP);
  157.             if(HandleListError(g_ipList.LastError, 1008, 102))
  158.                 break;
  159.                 
  160.             curIP = newIPList.GetNext();
  161.         }
  162.     }
  163.  
  164.     refreshIPList();
  165.     IPRemove.disabled = true;  
  166. }
  167.  
  168. function IPRemove_OnClick()
  169. {
  170.     var nSel = IPList.GetCurSel();
  171.     var rule = g_ipList.GetItem(nSel);
  172.  
  173.     if(null != rule)
  174.         g_ipList.DeleteItem(rule);
  175.  
  176.     refreshIPList();
  177.  
  178.     if(IPList.GetRowCount() <= nSel)
  179.         nSel = IPList.GetRowCount()-1;
  180.     IPList.SetCurSel(nSel);    
  181. }
  182.  
  183. function IPList_OnLoad()
  184. {
  185.     IPList.SetTableClass("ListBoxClass");
  186.     IPList.OnClick = IPList_OnClick;
  187. }
  188.  
  189. function IPSetText(action)
  190. {
  191.     currentActionState = action;
  192.     switch (action)
  193.     {
  194.         case "permit":
  195.             IPPermitRule.style.display = "";
  196.             IPBlockRule.style.display = "none";
  197.             IPMonitorRule.style.display = "none";
  198.             break;
  199.         case "block":
  200.             IPPermitRule.style.display = "none";
  201.             IPBlockRule.style.display = "";
  202.             IPMonitorRule.style.display = "none";
  203.             break;
  204.         case "monitor":
  205.             IPPermitRule.style.display = "none";
  206.             IPBlockRule.style.display = "none";
  207.             IPMonitorRule.style.display = "";
  208.             break;
  209.     }
  210. }
  211.  
  212. function OKB_OnClick()
  213. {
  214.     if (Addresses[1].checked && g_ipList.ItemCount == 0)
  215.     {
  216.         webWnd.MsgBox(StrID("AdapterListError"), UserManager.AppTitle, MB_OK | MB_ICONEXCLAMATION);        
  217.     }
  218.     else
  219.     {
  220.         if(Addresses[0].checked)
  221.         {
  222.             var ipList = new ActiveXObject("ccFWSettg.IPList");
  223.  
  224.             returnValue = ipList;
  225.         }
  226.         else
  227.             returnValue = g_ipList;
  228.  
  229.         window.navigate("res://closeme.xyz");
  230.     }
  231. }
  232.  
  233. function CancelB_OnClick()
  234. {
  235.     returnValue = null;
  236.     window.navigate("res://closeme.xyz");
  237. }