home *** CD-ROM | disk | FTP | other *** search
- ////////////////////////////////////////////////////////////////////////////////////////////
- //
- // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
- //
- // NAME: Adapters-Popup.js (Javascript file for Adapters-popup.HTM)
- //
- // Copyright (c) 2001 by Symantec Corporation. All rights reserved.
- //
- ////////////////////////////////////////////////////////////////////////////////////////////
-
- var xmlIPList = null;
- var xmlIPListPrivate = new ActiveXObject("Microsoft.XMLDOM");
- returnValue = null;
-
- function Page_OnLoad()
- {
- UIIPLoad(window.dialogArguments);
- IPSetText(getElem(xmlIPList.parentNode, "Action").toLowerCase());
-
- //
- // Register special handlers
- //
- IPAdd.onclick = IPAdd_OnClick;
- IPRemove.onclick = IPRemove_OnClick;
-
- OKB.focus();
- }
-
- ////////////////////////////////////////////////////////////////////////////////////
- // Local Sites/Zones to Block page
- //
-
- var currentActionState = null;
-
- function IPList_OnClick()
- {
- // Enable the modify/delete buttons
- EnableButton(IPRemove,true);
- }
-
- function IPCtlsEnabled(enable)
- {
-
- EnableButton(IPAdd,enable);
-
- //
- // Only allow this button to be disabled. Be sure to remove
- // selection too.
- //
- if (!enable)
- {
- EnableButton(IPRemove,enable);
- IPList.SetCurSel(-1);
- }
-
- //
- // Enable radio buttons appropriately.
- //
- Addresses[0].checked = !enable;
- Addresses[1].checked = enable;
- }
-
- function UIIPLoad(xml)
- {
- IPList_OnLoad();
-
- xmlIPList = xml;
- xmlIPListPrivate.documentElement = xml.cloneNode(true);
-
- refreshIPList();
- }
-
- function refreshIPList()
- {
- //
- // Reset the list control
- //
- IPList.DeleteAllRows();
- IPList.SetColumnCount(2);
-
- var addressNodeList = xmlIPListPrivate.selectNodes(".//(Address|NamedAddress|AddressRange|MaskedAddress|ZoneName)");
- var ChildCount = 0;
- var bEnableList = false;
-
- for(ChildCount = 0; ChildCount < addressNodeList.length; ChildCount++)
- {
- var addressChildNode = addressNodeList.item(ChildCount);
-
- if(stricmp(addressChildNode.nodeName, "MaskedAddress") == 0)
- {
- bEnableList = true;
- var chunks = addressChildNode.nodeTypedValue.split(":");
- var text = StrID("IP") + ": " + chunks[0] + "<BR>" + StrID("Mask") + ": " + chunks[1];
-
- pRow = IPList.InsertRow(-1);
- IPList.SetCellTextPtr(pRow, 0, StrID("NetworkAddress"));
- IPList.SetCellTextPtr(pRow, 1, text);
- }
- else if(stricmp(addressChildNode.nodeName, "AddressRange") == 0)
- {
- bEnableList = true;
- var chunks = addressChildNode.nodeTypedValue.split(":");
- var text = StrID("From") + ": " + chunks[0] + "<BR>" + StrID("To") + ": " + chunks[1];
-
- pRow = IPList.InsertRow(-1);
- IPList.SetCellTextPtr(pRow, 0, StrID("AddressRange"));
- IPList.SetCellTextPtr(pRow, 1, text);
- }
- else if(stricmp(addressChildNode.nodeName, "NamedAddress") == 0)
- {
- bEnableList = true;
- var text = StrID("Name") + ": " + addressChildNode.nodeTypedValue;
-
- pRow = IPList.InsertRow(-1);
- IPList.SetCellTextPtr(pRow, 0, StrID("SingleAddress"));
- IPList.SetCellTextPtr(pRow, 1, text);
- }
- else if(stricmp(addressChildNode.nodeName, "Address") == 0)
- {
- bEnableList = true;
- var text = StrID("IP") + ": " + addressChildNode.nodeTypedValue;
-
- pRow = IPList.InsertRow(-1);
- IPList.SetCellTextPtr(pRow, 0, StrID("SingleAddress"));
- IPList.SetCellTextPtr(pRow, 1, text);
- }
- }
-
- IPCtlsEnabled(bEnableList);
- }
-
- function IPAdd_OnClick()
- {
- var xmlOut = webWnd.showModalDialog('res://fwui.dll/IP-Popup.htm', 450, 330, currentActionState);
- if (null != xmlOut)
- {
- var nodes = xmlOut.selectNodes("/*/*");
- for (var nElem = 0; nodes.length > nElem; nElem++)
- {
- var appendTo = xmlIPListPrivate.selectSingleNode(".");
- if (null == xmlIPListPrivate.ownerDocument)
- appendTo = xmlIPListPrivate.selectSingleNode("*");
- appendTo.appendChild(nodes[nElem].cloneNode(true));
-
- }
- refreshIPList();
- IPRemove.disabled = true;
- }
- }
-
- function IPRemove_OnClick()
- {
- var nSel = IPList.GetCurSel();
- var nodes = xmlIPListPrivate.selectNodes(".//(Address|NamedAddress|AddressRange|MaskedAddress)");
- if (nodes.length <= nSel)
- {
- IPList.SetCurSel(-1);
- return;
- }
- var nodeRemove = nodes[nSel];
- nodeRemove.parentNode.removeChild(nodeRemove);
- refreshIPList();
-
- if (IPList.GetRowCount() <= nSel)
- nSel = IPList.GetRowCount()-1;
- IPList.SetCurSel(nSel);
- }
-
- function IPList_OnLoad()
- {
- IPList.SetTableClass("ListBoxClass");
- IPList.OnClick = IPList_OnClick;
- }
-
- function IPSetText(action)
- {
- currentActionState = action;
- switch (action)
- {
- case "permit":
- IPPermitRule.style.display = "";
- IPBlockRule.style.display = "none";
- IPMonitorRule.style.display = "none";
- break;
- case "block":
- IPPermitRule.style.display = "none";
- IPBlockRule.style.display = "";
- IPMonitorRule.style.display = "none";
- break;
- case "monitor":
- IPPermitRule.style.display = "none";
- IPBlockRule.style.display = "none";
- IPMonitorRule.style.display = "";
- break;
- }
- }
-
- function OKB_OnClick()
- {
- // if the user specified any adapter, nuke the list
- if (Addresses[0].checked)
- {
- xmlIPListPrivate.loadXML("<LocalAddresses/>");
- }
- returnValue = xmlIPListPrivate.documentElement.cloneNode(true);
- xmlIPList.parentNode.replaceChild(returnValue, xmlIPList);
- window.navigate("res://closeme.xyz");
- }
-
- function CancelB_OnClick()
- {
- returnValue = null;
- window.navigate("res://closeme.xyz");
- }