home *** CD-ROM | disk | FTP | other *** search
- ////////////////////////////////////////////////////////////////////////////////////////////
- //
- // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
- //
- // NAME: wiz-HN.js (Javascript file for wiz-HN.HTM)
- //
- // Copyright (c) 2001 by Symantec Corporation. All rights reserved.
- //
- ////////////////////////////////////////////////////////////////////////////////////////////
-
- var IE4 = document.all;
- var nHomeNetCount = 0;
- var bDetected = false;
- ///////////////////////////////////////////////////////
- /////////new alert params /////////////////////////////
- ///////////////////////////////////////////////////////
- //icon:
- // 0 = no icon
- // 1 = error
- // 2 = question
- // 3 = alert
- // 4 = info
- //
- //buts:
- // 0 = ok
- // 1 = ok, cancel
- // 2 = abort, retry, cancel
- // 3 = yes, no, cancel
- // 4 = yes, no
- // 5 = retry, cancel
- //
- //defbut
- // 0 = first
- // 1 = second
- // 2 = third
- //
- //mods:
- // 0 = app modal
- // 1 = system modal
- function newAlert(mess, title, icon, buts, defbut, mods)
- {
- if(IE4)
- makeMsgBox(title, mess, icon, buts, defbut, mods)
- else
- alert(mess);
- }
-
- function Window_OnLoad()
- {
- dialogheight = "400px";
- dialogWidth = "532px";
- returnValue = "";
- bUserStopped = 0;
- PageA.style.display = "";
- BackBtn.disabled = true;
-
- ProdNameB.innerHTML = UserManager.AppTitle;
- ProdNameC.innerHTML = UserManager.AppTitle;
- ProdNameD.innerHTML = UserManager.AppTitle;
-
- var sProductType = UserManager.ProductType;
- switch (sProductType)
- {
- case "PT_SCF":
- case "PT_PRO":
- window.WizType1.innerText = "Workgroup";
- window.WizType2.innerText = "Workgroup";
- window.WizType3.innerText = "business";
- window.WizType4.innerText = "Workgroup";
- window.WizType5.innerText = "workgroup";
- window.WizType6.innerText = "Workgroup";
- window.WizType7.innerText = "Workgroup";
- document.title = "Workgroup Network Wizard";
- break;
-
- default:
- window.WizType1.innerText = "Home";
- window.WizType2.innerText = "Home";
- window.WizType3.innerText = "home";
- window.WizType4.innerText = "Home";
- window.WizType5.innerText = "home";
- window.WizType6.innerText = "Home";
- window.WizType7.innerText = "Home";
- document.title = "Home Network Wizard";
- break;
- }
-
- var RLevelStatus = new ActiveXObject("RLevel.NISStatusInfo");
- var bLAIsOn = RLevelStatus.LocationAwarenessEnabled;
- if(bLAIsOn)
- {
- LocationAwarenessIsOffText.innerText = " ";
- }
-
- if(RLevelStatus.IsSystemInHighContrastMode)
- {
- HNetWizBody.scroll = "auto";
- }
-
-
- CheckUserType();
-
- initLocationList();
-
- FixBtnText(false);
- window.focus();
- }
-
- function CheckUserType()
- {
- var admin = HomeNetCore.WindowsAdminUser;
- if(!admin)
- {
- newAlert(StrID("HNWizardAdministrator"), UserManager.AppTitle, 3, 0, 0, 0);
- window.navigate("res://closeme.xyz");
- return;
- }
-
- var type = UserManager.CurrentUserType;
- if(type != "UT_SUPERVISOR")
- {
- newAlert(StrID("HNWizardSupervisor"), UserManager.AppTitle, 3, 0, 0, 0);
- window.navigate("res://closeme.xyz");
- }
- }
-
-
- function FinishBtn_OnClick()
- {
- // Add the selected items to the trusted zones of the selected locations
- var arrayLocations = UILocation_GetSelectedLocations();
- for(var i = 0; i < arrayLocations.length; i++)
- {
- HomeNetCore.FilterByLocation = arrayLocations[i];
- HomeNetCore.AddItems();
- }
-
-
- window.navigate("res://closeme.xyz");
- }
-
-
- function NextBtn_OnClick()
- {
- // Find the active page, back to front (if we are not disabled)
- if(PageD.style.display == "")
- {
- // Close this window
- window.navigate("res://closeme.xyz");
- }
-
- if(PageC.style.display == "")
- {
- PageC.style.display = "none";
- PageOldC.style.display = "";
-
- // setup the last page
- BackBtn.disabled = false;
- Cancel.disabled = false;
- FixBtnText(true);
- window.focus();
- }
-
- if(PageB.style.display == "")
- {
-
- PageB.style.display = "none";
- PageC.style.display = "";
-
- // Setup the locations page
- UILocation_UpdateNextButtonState();
- BackBtn.disabled = false;
- Cancel.disabled = false;
- FixBtnText(false);
- window.focus();
- }
-
- if(PageA.style.display == "")
- {
- bDetected = true;
- // Do the scan (this is very quick)
- nHomeNetCount = HomeNetCore.Detect();
- if(nHomeNetCount == 0)
- {
- PageA.style.display = "none";
- PageD.style.display = "";
-
- window.IDS_HOMENETTEXT1.innerText = StrID("HNNoneFound");
-
- // Setup the second page
- BackBtn.disabled = true;
- FixBtnText(true);
- window.focus();
- }
- else
- {
- PageA.style.display = "none";
- PageB.style.display = "";
-
- // Setup the second page
- BackBtn.disabled = false;
- FixBtnText(false);
- window.focus();
-
- if(nHomeNetCount > 1)
- {
- for(var i = 0; i < nHomeNetCount; i++)
- {
- // Get the details on the first item
- var oOption = document.createElement("OPTION");
- var szDisplayStr = HomeNetCore.GetAdapterName(i);
-
- // If string is larger than max we will only display max chars + ...
- if(szDisplayStr.length > 30)
- szDisplayStr = szDisplayStr.substr(0, 30) + "...";
-
- oOption.text = szDisplayStr;
- oOption.value = i;
- Adapters.options.add(oOption);
- }
-
- Adapters.selectedIndex = 0;
- }
- else
- {
- Adapters.style.display = "none";
- AdapterSelect.style.display = "none";
- SingleAdapter.innerHTML = HomeNetCore.GetAdapterName(0);
- }
-
- SetCheckAndDetails();
- }
- }
- }
-
- function StoreCheckBox()
- {
- var nCurOption = 0;
- if(Adapters.style.display == "")
- nCurOption = Number(Adapters.options.item(Adapters.selectedIndex).value);
-
- HomeNetCore.EnableHN(nCurOption, AddCheck.checked);
- }
-
- function SetCheckAndDetails()
- {
- var nCurOption = 0;
- if(Adapters.style.display == "")
- nCurOption = Number(Adapters.options.item(Adapters.selectedIndex).value);
-
- // Set the checkbox to this adapters state
- AddCheck.checked = HomeNetCore.IsHNEnabled(nCurOption);
-
- // Fill in the details
- SingleAdapter.innerHTML = HomeNetCore.GetAdapterName(nCurOption);
- adapterMAC.innerHTML = HomeNetCore.GetMAC(nCurOption);
- adapterIP.innerHTML = HomeNetCore.GetIPAddress(nCurOption);
- adapterMask.innerHTML = HomeNetCore.GetMask(nCurOption);
- }
-
- function OnKeyDownHandler()
- {
- // Last Control Tab over to the <back, next, close> button.
- var VK_ESCAPE = 27;
-
- if (window.event.keyCode == VK_ESCAPE)
- {
- // Escape key.. We want to exit out of the wizard..
- window.navigate("res://closeme.xyz");
-
- }
-
- }
-
-
- function initLocationList()
- {
- // Setup the list control
- locationList.SetTableClass("ListBoxClass");
- locationList.OnClick = locationList_OnClick;
- locationList.OnDblClick = locationList_OnDblClick;
- locationList.OnSpace = locationList_OnSpace;
-
- locationList.SetColumnCount(2);
- locationList.SetColumnWidth(0, "15px");
- locationList.SetColumnWidth(1, "100px");
-
- // populate list
- try
- {
- var iLocationList = new ActiveXObject("ccFWSettg.LocationList");
- var iLocation = iLocationList.GetFirst();
- while(null != iLocation)
- {
- var pRow = locationList.InsertRow(-1);
- var Enabled = "checked=yes";
-
- var checkboxString = "<input type=checkbox " + Enabled + ">";
- locationList.SetCellTextPtr(pRow, 0, checkboxString);
-
- var locationName = iLocation.Name;
- var divID = "";
- if(iLocation.Active)
- {
- locationName += " ";
- locationName += StrID("Active");
- divID = "id='ACTIVE ITEM. DO NOT MOVE THIS STRING OUT OF THE CODE.'"
- }
- var TextToAdd = "<div " + divID + " style='margin-top:6;margin-bottom:6'>" + locationName + "</div>";
- locationList.SetCellTextPtr(pRow, 1, TextToAdd);
-
- iLocation = iLocationList.GetNext();
- }
- }
- catch(e)
- {
- }
-
- }
-
- function locationList_OnSpace()
- {
- var nCurSel = locationList.GetCurSel();
- var bEnable = false;
-
- if(nCurSel < 0)
- {
- return;
- }
-
- // Swap the state of the check box for this item
- var CheckBox = locationList.GetCellPtr(nCurSel, 0).children[0];
- CheckBox.checked = !CheckBox.checked;
-
- UILocation_UpdateNextButtonState();
- }
-
- function locationList_OnClick()
- {
- UILocation_UpdateNextButtonState();
- }
-
- function UILocation_UpdateNextButtonState()
- {
- var arrayLocations = UILocation_GetSelectedLocations();
-
- if(arrayLocations.length)
- {
- NextBtn.disabled = false;
- }
- else
- {
- NextBtn.disabled = true;
- }
- }
-
- function locationList_OnDblClick()
- {
- var nCurSel = locationList.GetCurSel();
- var bEnable = false;
-
- if(nCurSel < 0)
- {
- return;
- }
-
- // Swap the state of the check box for this item
- var CheckBox = locationList.GetCellPtr(nCurSel, 0).children[0];
- CheckBox.checked = !CheckBox.checked;
-
- UILocation_UpdateNextButtonState();
- }
-
- function UILocation_SelectAll()
- {
- for(var i = locationList.GetRowCount(); i > 0; i--)
- {
- var CheckBox = locationList.GetCellPtr(i - 1, 0).children[0];
- CheckBox.checked = true;
- }
- UILocation_UpdateNextButtonState()
- }
-
- function UILocation_DeselectAll()
- {
- for(var i = locationList.GetRowCount(); i > 0; i--)
- {
- var CheckBox = locationList.GetCellPtr(i - 1, 0).children[0];
- CheckBox.checked = false;
- }
- UILocation_UpdateNextButtonState()
- }
-
- function UILocation_GetSelectedLocations()
- {
- var arrayLocations = new Array();
-
- for(var i = locationList.GetRowCount(); i > 0; i--)
- {
- var CheckBox = locationList.GetCellPtr(i - 1, 0).children[0];
- var bChecked = CheckBox.checked;
- var div = locationList.GetCellPtr(i-1, 1).children[0];
- var sLocation = div.innerText;
- if(bChecked)
- {
- if(div.id == "ACTIVE ITEM. DO NOT MOVE THIS STRING OUT OF THE CODE.")
- {
- var sTmp = sLocation.slice(0, sLocation.lastIndexOf(StrID("Active")));
- sLocation = sTmp;
- }
- sLocation = trim(sLocation);
- arrayLocations = arrayLocations.concat(sLocation);
- }
- }
- return arrayLocations;
- }
-