home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 May / 05_02.iso / software / nis / files / NIS / NIS.MSI / fwUI.dll / HTML / ICMP-POPUP.JS < prev    next >
Encoding:
JavaScript  |  2001-12-01  |  4.2 KB  |  166 lines

  1. ////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
  4. //
  5. // NAME:    ICMP-Popup.js (Javascript file for ICMP-POPUP.HTM)
  6. //
  7. // Copyright (c) 2001 by Symantec Corporation. All rights reserved.
  8. //
  9. ////////////////////////////////////////////////////////////////////////////////////////////
  10.  
  11. function Page_OnLoad()
  12. {
  13.     if (window.dialogArguments == "local") {
  14.         RLocal.checked = true;
  15.         RRemote.checked = false;
  16.     }
  17.     else
  18.     {
  19.         RLocal.checked = false;
  20.         RRemote.checked = true;
  21.     }
  22.     
  23.     OKB.focus();
  24. }
  25.  
  26. function getICMPInfo(row, item)
  27. {
  28.     var nCol = 0;
  29.     switch (item.toLowerCase())
  30.     {
  31.         case "checked":
  32.             nCol = 0;
  33.             break;
  34.         case "value":
  35.             nCol = 1;
  36.             break;
  37.         case "name":
  38.             nCol = 2;
  39.             break;
  40.     }
  41.     return ICMPList.MsgTypes.rows[row].cells[nCol];
  42. }
  43.  
  44. function SelIndividual_OnClick()
  45. {
  46.     Range.style.display = "none";
  47.     List.style.display = "none";
  48.     Individual.style.display = "";
  49.     RPortRange.checked = false;
  50.     RPortList.checked = false;
  51.     RSinglePort.checked = true;
  52. }
  53.  
  54. function SelList_OnClick()
  55. {
  56.     Individual.style.display = "none";
  57.     Range.style.display = "none";
  58.     List.style.display = "";
  59.     RPortRange.checked = false;
  60.     RSinglePort.checked = false;
  61.     RPortList.checked = true;
  62. }
  63.  
  64. function SelRange_OnClick()
  65. {
  66.     Individual.style.display = "none";
  67.     List.style.display = "none";
  68.     Range.style.display = "";
  69.     RSinglePort.checked = false;
  70.     RPortList.checked = false;
  71.     RPortRange.checked = true;
  72. }
  73.  
  74. function OKB_OnClick()
  75. {
  76.     //
  77.     // Prepare some variables to simplify access to objects.
  78.     //
  79.     var Error = false;
  80.     var xmlOut = new ActiveXObject("Microsoft.XMLDOM");
  81.     xmlOut.loadXML(RLocal.checked?"<LocalPorts/>":"<RemotePorts/>");
  82.     var oMsgTypes = ICMPList.MsgTypes.rows;
  83.     var nNumRecs = oMsgTypes.length;
  84.  
  85.     //
  86.     // Is this the specified ports list?
  87.     //
  88.     if (PortType[0].checked)
  89.     {
  90.         //
  91.         // Iterate over each service listed in our dialog.
  92.         //
  93.         for(var nElem = 0; 
  94.             nElem < nNumRecs;
  95.             nElem++)
  96.         {
  97.             //
  98.             // If the user checked this service (via the nested child INPUT tag), add it to our list.
  99.             //
  100.             if (getICMPInfo(nElem, "checked").children[0].checked)
  101.             {
  102.                 if (IsValidPort(getICMPInfo(nElem, "value").innerText))
  103.                     addPort_limited(xmlOut.documentElement, getICMPInfo(nElem, "value").innerText);
  104.                 else
  105.                 {
  106.             webWind.MsgBox(StrID("InvalidCommand"), UserManager.AppTitle, MB_OK | MB_ICONEXCLAMATION);
  107.                     Error = true;
  108.                     break;
  109.                 }
  110.             }
  111.         }
  112.     }
  113.     //
  114.     // Is this individually specified ports?
  115.     //
  116.     else if (PortType[1].checked)
  117.     {
  118.         var aPort = EnterPorts.value.split(" ");
  119.  
  120.         // 
  121.         // Cycle through space delimited list and add each port.
  122.         //
  123.         for(var nElem = 0; nElem < aPort.length; nElem++)
  124.         {
  125.             //
  126.             // Valid port?
  127.             //
  128.             if (IsValidPort(aPort[nElem]))
  129.             {
  130.                 addPort_limited(xmlOut.documentElement, aPort[nElem]);
  131.             }
  132.             else
  133.             {
  134.                 webWind.MsgBox(StrID("InvalidCommand"), UserManager.AppTitle, MB_OK | MB_ICONEXCLAMATION);
  135.                 Error = true;
  136.                 break;
  137.             }
  138.         
  139.         }
  140.     }
  141.     //
  142.     // Is this a port range?
  143.     //
  144.     else if (PortType[2].checked)
  145.     {
  146.         if (IsValidPort(EnterStartPort.value) && IsValidPort(EnterEndPort.value))
  147.             addPort_limited(xmlOut.documentElement, EnterStartPort.value + ":" + EnterEndPort.value);
  148.         else
  149.         {
  150.             webWind.MsgBox(StrID("InvalidCommand"), UserManager.AppTitle, MB_OK | MB_ICONEXCLAMATION);
  151.             Error = true;
  152.         }
  153.     }
  154.  
  155.     if (!Error)
  156.     {
  157.         window.returnValue = xmlOut;
  158.         window.navigate("res://closeme.xyz");
  159.     }
  160. }
  161.  
  162. function CancelB_OnClickOrReset()
  163. {
  164.     returnValue = null;
  165.     window.navigate("res://closeme.xyz");
  166. }