home *** CD-ROM | disk | FTP | other *** search
- ////////////////////////////////////////////////////////////////////////////////////////////
- //
- // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
- //
- // NAME: wiz-ALEs.js (Javascript file for wiz-ALEs.HTM)
- //
- // Copyright (c) 2001 by Symantec Corporation. All rights reserved.
- //
- ////////////////////////////////////////////////////////////////////////////////////////////
-
- IE4 = document.all;
- var g_LocationAwarenessOffText;
-
- ///////////////////////////////////////////////////////
- /////////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 OnLoad()
- {
- g_LocationAwarenessOffText = LocationAwarenessIsOffText.innerText;
- FoundList.SetOnCheckedChangedCallback(foundList_OnCheckStateChanged);
- }
-
- function driveList_OnSpace(nRow)
- {
- //
- // Swap the state of the check box for this item
- //
- var CheckBox = driveList.GetCellPtr(nRow, 0).children[0];
- CheckBox.checked = !CheckBox.checked;
- }
-
- function initDriveList()
- {
- driveList.OnSpace = driveList_OnSpace;
- driveList.DeleteAllRows();
- driveList.SetColumnCount(2);
- driveList.SetColumnWidth(0, "50px");
- driveList.SetColumnWidth(1, "83px");
-
- var szDrives = NetScan.DriveList;
-
- for(var i = 0; i < szDrives.length; ++i)
- {
- var pRow = driveList.InsertRow(-1);
- driveList.SetCellTextPtr(pRow, 0, "<input type=\"checkbox\" checked>");
- driveList.SetCellTextPtr(pRow, 1, szDrives.substring(i, i+1) + ":\\");
- }
-
- driveList.SetOnClickHandler(CheckBox_OnClick);
- }
-
- function CheckBox_OnClick()
- {
- // Get a count of checked items... if zero are checked, disable the next btn
- var nCount = driveList.GetRowCount();
-
- var nChecked = 0;
- for(var nRow = 0; nRow < nCount; ++nRow)
- {
- var CheckBox = driveList.GetCellPtr(nRow, 0).children[0];
- if(CheckBox.checked)
- {
- nChecked++;
- }
- }
-
- if(nChecked == 0)
- NextBtn.disabled = true;
- else
- NextBtn.disabled = false;
- }
-
- function saveDriveList()
- {
- var nCount = driveList.GetRowCount();
-
- szDrives = "";
- for(var nRow = 0; nRow < nCount; ++nRow)
- {
- var CheckBox = driveList.GetCellPtr(nRow, 0).children[0];
- if(CheckBox.checked)
- {
- szDrives += driveList.GetCellPtr(nRow, 1).innerText.substring(0, 1);
- }
- }
-
- NetScan.DriveList = szDrives;
- }
-
- function NextBtn_OnClick()
- {
- // Find the active page, back to front (if we are not disabled)
- if(PageD.style.display == "")
- {
- ConfigInfo.AleScanRun = true;
- returnValue = "";
- AleWiz_Body.style.cursor = "wait";
- BackBtn.disabled = true;
- FinishBtn.disabled = true;
- Cancel.disabled = true;
- locationSelectAll.disabled = true;
- locationSelectNone.disabled = true;
- locationList.Enabled(false);
- locationList.LTable.style.cursor = "wait";
- EnableCloseButton(false);
-
- // save the items in the list
- var arrayLocations = UILocation_GetSelectedLocations();
-
- for(var i = 0; i < arrayLocations.length; i++)
- {
- var checkbox = locationList.GetCellPtr(i,0);
- checkbox.disabled = true;
- FoundList.AddALEScanLocation(arrayLocations[i]);
- }
-
- FoundList.MergeItemsAsync(OnMergeItemsComplete);
- }
-
- if(PageC.style.display == "")
- {
- PageC.style.display = "none";
- PageD.style.display = "";
-
- //set location awareness text
- var RLevelStatus = new ActiveXObject("RLevel.NISStatusInfo");
- var bLAIsOn = RLevelStatus.LocationAwarenessEnabled;
- if(bLAIsOn)
- LocationAwarenessIsOffText.innerText = " ";
- else
- LocationAwarenessIsOffText.innerText = g_LocationAwarenessOffText;
- initLocationList();
-
- FixBtnText(true);
- window.focus();
- }
-
- if(PageB.style.display == "")
- {
- // setup PageC
- PageB.style.display = "none";
- PageC.style.display = "";
-
- window.focus();
-
- //copy the file list
- if(g_bFoundListLoaded)
- {
- SetFileListIsLoading(true);
-
- //turn off buttons
- BackBtn.disabled = true;
- NextBtn.disabled = true;
- Cancel.disabled = true;
- EnableCloseButton(false);
-
- FoundList.PutFileListAsync(NetScan.FileList,OnPutFileListComplete,SetPutFileListProgress);
- }
- }
-
- if(PageA.style.display == "")
- {
- PageA.style.display = "none";
- PageB.style.display = "";
-
- // setup PageB
- NextBtn.disabled = true;
- Cancel.disabled = true;
- StopBtn.disabled = false;
- EnableCloseButton(false);
-
- ScanDone.style.display = "none";
- ScanStopped.style.display = "none"
- Scanning.style.display = "";
- Filename.style.display = "";
- ScanFound.innerHTML = "0";
- SetProgress(0);
- pctdone.innerHTML = "0";
- pctdone_text.style.display = "";
-
- saveDriveList();
- g_bScanStarted = true;
- NetScan.StartScan();
-
- FixBtnText(false);
- }
- }
-
- function OnPutFileListComplete(result)
- {
- SetFileListIsLoading(false);
-
- // This was put in to fix defect 410860. It selects all applications by default. It could significantly
- // slow down NIS. If it needs to be pulled, remove the follwing line and change the TIP text in
- // wiz-ALEs.htm.
- // The decision was since reversed, and thus the code has been removed. If it's re-reversed, un-comment
- // the following code and change the html text.
- //FoundList.SelectAll();
-
- g_bFoundListLoaded = true;
-
- BackBtn.disabled = false;
- //Leave the next button off because no items are selected
- //NextBtn.disabled = false;
- Cancel.disabled = false;
- EnableCloseButton(true);
-
- //Save the xml
- //NetScan.FileList.save("C:\x.xml")
- }
-
- function SetFileListIsLoading(bLoading)
- {
- SetPutFileListProgress(0);
-
- //progress bar
- if (bLoading) FoundListLoading.style.display = "";
- else FoundListLoading.style.display = "none";
-
- //internet-enabled programs
- if (bLoading) FoundList.style.display = "none";
- else FoundList.style.display = "";
-
- //title
- if (bLoading)
- {
- IDS_ALESCANTEXT12.style.display = "none";
- IDS_ALESCANTEXT13.style.display = "";
- }
- else
- {
- IDS_ALESCANTEXT12.style.display = "";
- IDS_ALESCANTEXT13.style.display = "none";
- }
-
- //buttons
- CheckAll.disabled = bLoading;
- UncheckAll.disabled = bLoading;
- Add.disabled = bLoading;
- Modify.disabled = bLoading;
- }
-
- function OnMergeItemsComplete(result)
- {
- if(HandleAleScanError(result, 1014, 1))
- {
- // This means that the user needs to be sent back to
- // PageC to de-select some applications.
- if(PageA.style.display == "")
- PageA.style.display = "none"
- if(PageB.style.display == "")
- PageB.style.display = "none"
- if(PageD.style.display == "")
- PageD.style.display = "none"
-
- PageC.style.display = "";
-
- window.focus();
-
- // Reset the values on the location page.
- locationSelectAll.disabled = false;
- locationSelectNone.disabled = false;
- locationList.Enabled(true);
- locationList.LTable.style.cursor = "";
- // re-enable the items in the list
- var arrayLocations = UILocation_GetSelectedLocations();
- for(var i = 0; i < arrayLocations.length; i++)
- {
- var checkbox = locationList.GetCellPtr(i,0);
- checkbox.disabled = false;
- }
-
- // Reset the buttons.
- FinishBtn.disabled = false;
- NextBtn.disabled = false;
- BackBtn.disabled = false;
- Cancel.disabled = false;
- FixBtnText(false);
- EnableCloseButton(true);
-
- // And the cursor
- AleWiz_Body.style.cursor = "";
- }
- else
- {
- AleWiz_Body.style.cursor = "";
- window.navigate("res://closeme.xyz");
- }
- }
-
- function SetProgress(nPct)
- {
- SetProgressImpl(ProgDone,ProgRemain,pctdone,nPct);
- }
-
- function SetPutFileListProgress(nPct)
- {
- SetProgressImpl(FoundListLoadComplete,FoundListLoadRemain,FoundListPctDone,nPct);
- }
-
- function SetProgressImpl(complete,remaining,text,nPct)
- {
- // We must special case 0 otherwise we get "invalid property"... arrrgggg!
- var nRemain = 100 - nPct;
- text.innerHTML = nPct;
-
- if(nPct > 0)
- {
- complete.style.display = "";
- complete.width = nPct + "%";
- }
- else
- {
- complete.style.display = "none";
- }
-
- if(nRemain > 0)
- {
- remaining.style.display = "";
- remaining.width = nRemain + "%";
- }
- else
- {
- remaining.style.display = "none";
- }
- }
-
- function Elipse_Path(nMaxLen, szPath)
- {
- var szItems = szPath.split("\\");
- var nItem = 0;
- var nLastStart = 1;
- var szOutput = szPath;
- while(szOutput.length > nMaxLen)
- {
- szOutput = szItems[0];
- szOutput = szOutput + "\\" + "...";
-
- for(nItem = nLastStart; nItem < szItems.length; nItem++)
- {
- szOutput = szOutput + "\\" + szItems[nItem];
- }
-
- nLastStart++;
- }
-
- return szOutput;
- }
-
- function CheckUserType()
- {
- var type = UserManager.CurrentUserType;
- var product = UserManager.ProductType;
-
- if((product == "PT_SCF") || (product == "PT_NPF") || (product == "PT_SDF"))
- {
- if(type == "UT_RESTRICTED")
- {
- newAlert(StrID("ALEScanAdministrator"), UserManager.AppTitle, 3, 0, 0, 0);
- window.navigate("res://closeme.xyz");
- }
- }
- else
- {
- if(type != "UT_SUPERVISOR")
- {
- newAlert(StrID("ALEScanSupervisor"), UserManager.AppTitle, 3, 0, 0, 0);
- window.navigate("res://closeme.xyz");
- }
- }
- }
-
- function OnAdd()
- {
- FoundList.Add();
- foundList_OnCheckStateChanged(true);
- }
-
- function OnModify()
- {
- FoundList.Modify();
- }
-
- function OnCheckAll()
- {
- FoundList.SelectAll();
- }
-
- function OnUncheckAll()
- {
- FoundList.UnselectAll();
- }
-
- function foundList_OnCheckStateChanged(bAnySelected)
- {
- NextBtn.disabled = !bAnySelected;
- }
-
- function OnKeyDownHandler()
- {
- // Last Control Tab over to the <back, next, close> button.
- var VK_ESCAPE = 27;
-
- if (window.event.keyCode == VK_ESCAPE && !Cancel.disabled)
- {
- // 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.DeleteAllRows();
- locationList.SetColumnCount(2);
- locationList.SetColumnWidth(0, "15px");
- locationList.SetColumnWidth(1, "100px");
-
- // populate list
- AleWiz_Body.style.cursor = "wait";
-
- 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)
- {
- // ejp comment out this code, but do not remove it
- /*
- for(var i = 0; i < 25; i++)
- {
- var pRow = locationList.InsertRow(-1);
- var Enabled = "checked=yes";
-
- var checkboxString = "<input type=checkbox " + Enabled + ">";
- locationList.SetCellTextPtr(pRow, 0, checkboxString);
-
- var locationName = "Fake location" + i;
- var divID = "";
- if(i % 3 == 1)
- {
- 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);
- }
- */
- }
-
- AleWiz_Body.style.cursor = "";
- }
-
- 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)
- {
- FinishBtn.disabled = false;
- }
- else
- {
- FinishBtn.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;
- }
-
- function UserManager_OnFREIntegratorStart()
- {
- if(g_bScanStarted)
- StopBtn_OnClick();
-
- window.navigate('res://closeme.xyz');
- }
-
- function EnableCloseButton(bEnabled)
- {
- //turn off webWnd's close button
- var webWnd = window.external.ObjectArg;
- webWnd.CloseButton = bEnabled;
- }