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

  1. ////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
  4. //
  5. // NAME:    Ports-Popup.js (Javascript file for Ports-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 SelIndividual_OnClick()
  27. {
  28.     Range.style.display = "none";
  29.     List.style.display = "none";
  30.     Individual.style.display = "";
  31.     RPortRange.checked = false;
  32.     RPortList.checked = false;
  33.     RSinglePort.checked = true;
  34. }
  35.  
  36. function SelList_OnClick()
  37. {
  38.     Individual.style.display = "none";
  39.     Range.style.display = "none";
  40.     List.style.display = "";
  41.     RPortRange.checked = false;
  42.     RSinglePort.checked = false;
  43.     RPortList.checked = true;
  44. }
  45.  
  46. function SelRange_OnClick()
  47. {
  48.     Individual.style.display = "none";
  49.     List.style.display = "none";
  50.     Range.style.display = "";
  51.     RSinglePort.checked = false;
  52.     RPortList.checked = false;
  53.     RPortRange.checked = true;
  54. }
  55.  
  56. function OKB_OnClick()
  57. {
  58.     //
  59.     // Prepare some variables to simplify access to objects.
  60.     //
  61.     var Error = false;
  62.     var xmlOut = new ActiveXObject("Microsoft.XMLDOM");
  63.     xmlOut.loadXML(RLocal.checked?"<LocalPorts/>":"<RemotePorts/>");
  64.  
  65.     var oKnownPortsList = KnownPorts.KnownPortsList;
  66.  
  67.     var    nList_CheckboxOffset = 0;
  68.     var nList_PortOffset = 1;
  69.     //
  70.     // Is this the specified ports list?
  71.     //
  72.     if (PortType[0].checked)
  73.     {
  74.         //
  75.         // Iterate over each service listed in our dialog.
  76.         //
  77.         for(var i=0; i < oKnownPortsList.rows.length;i++)
  78.         {
  79.             if(oKnownPortsList.rows[i].cells[nList_CheckboxOffset].children[0].checked)
  80.             {
  81.                 if(IsValidPort(oKnownPortsList.rows[i].cells[nList_PortOffset].innerText))
  82.                     addPort_limited(xmlOut.documentElement, oKnownPortsList.rows[i].cells[nList_PortOffset].innerText);
  83.                 else
  84.                 {
  85.                     webWind.MsgBox2(StrID("InvalidPort"), UserManager.AppTitle);
  86.                     Error = true;
  87.                     break;
  88.                 }
  89.             }
  90.         }
  91.     }
  92.     //
  93.     // Is this individually specified ports?
  94.     //
  95.     else if (PortType[1].checked)
  96.     {
  97.         var aPort = EnterPorts.value.split(" ");
  98.  
  99.         // 
  100.         // Cycle through space delimited list and add each port.
  101.         //
  102.         for(var nElem = 0; nElem < aPort.length; nElem++)
  103.         {
  104.             //
  105.             // Valid port?
  106.             //
  107.             if (IsValidPort(aPort[nElem]))
  108.             {
  109.                 addPort_limited(xmlOut.documentElement, aPort[nElem]);
  110.             }
  111.             else
  112.             {
  113.         webWind.MsgBox2(StrID("InvalidPort"), UserManager.AppTitle);                
  114.                 Error = true;
  115.                 break;
  116.             }
  117.         
  118.         }
  119.     }
  120.     //
  121.     // Is this a port range?
  122.     //
  123.     else if (PortType[2].checked)
  124.     {
  125.         if (IsValidPort(EnterStartPort.value) && IsValidPort(EnterEndPort.value))
  126.             addPort_limited(xmlOut.documentElement, EnterStartPort.value + ":" + EnterEndPort.value);
  127.         else
  128.         {
  129.             webWind.MsgBox2(StrID("InvalidPort"), UserManager.AppTitle);
  130.             Error = true;
  131.         }
  132.     }
  133.  
  134.     if (!Error)
  135.     {
  136.         window.returnValue = xmlOut;
  137.         window.navigate("res://closeme.xyz");
  138.     }
  139. }
  140.  
  141. function CancelB_OnClickOrReset()
  142. {
  143.     returnValue = null;
  144.     window.navigate("res://closeme.xyz");
  145. }
  146.