home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2004 July / APC0407D1.iso / powerkit / firewall / files / NPF2004.exe / Setup / ISCommon / APP / fwUI.dll / HTML / DELETERULESELECTLOCATIONS.JS < prev    next >
Encoding:
Text File  |  2003-09-06  |  3.5 KB  |  133 lines

  1. ////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
  4. //
  5. // NAME:     DeleteRuleSelectLocations.js (Javascript file for  DeleteRuleSelectLocations.HTM)
  6. //
  7. // Copyright (c) 2003 by Symantec Corporation. All rights reserved.
  8. //
  9. ////////////////////////////////////////////////////////////////////////////////////////////
  10.  
  11. window.returnValue = null;
  12.  
  13. function OnLoad()
  14. {
  15.     // Set the title...
  16.     window.title = UserManager.ProductName;
  17.  
  18.     var bLAIsOn = RLevel.LocationAwarenessEnabled;
  19.     if(bLAIsOn)
  20.     {
  21.         LocationAwarenessIsOffText.innerText = " ";
  22.     }
  23.     
  24.     UILocationsLoad(window.dialogArguments);
  25.     UILocation_UpdateOKButtonState();
  26. }
  27.  
  28. function UILocationsLoad(aStrLocations)
  29. {
  30.     // Setup the list control
  31.     locationList.OnClick    = locationList_OnClick;
  32.     locationList.OnDblClick = locationList_OnDblClick;
  33.     locationList.OnSpace    = locationList_OnSpace;
  34.  
  35.     // populate list
  36.     DeleteRuleSelectLocations_Body.style.cursor = "wait";
  37.  
  38. //    var bCheckDefault = !RLevel.LocationAwarenessEnabled;
  39. //    var bCheckActive = RLevel.LocationAwarenessEnabled;
  40. //    Location_PopulateListBox(locationList,bCheckDefault,bCheckActive);
  41.  
  42.     // Setup the list control
  43.     locationList.SetTableClass("ListBoxClass");
  44.     locationList.SetColumnCount(2);
  45.     locationList.SetColumnWidth(0, "15px");
  46.     locationList.SetColumnWidth(1, "100px");
  47.  
  48.     locationList.DeleteAllRows();
  49.  
  50.     for(var i = 0; i < aStrLocations.length; i++)
  51.     {
  52.         var pRow = locationList.InsertRow(-1);
  53.         var Enabled = "checked=yes";
  54.         
  55.         var checkboxString = "<input type=checkbox " + Enabled + ">";
  56.         locationList.SetCellTextPtr(pRow, 0, checkboxString);
  57.         
  58.         var divID = "";
  59.         var TextToAdd = "<div " + divID + " style='margin-top:6;margin-bottom:6'>" + aStrLocations[i] + "</div>";
  60.         locationList.SetCellTextPtr(pRow, 1, TextToAdd);
  61.     }
  62.     
  63.     DeleteRuleSelectLocations_Body.style.cursor = "";
  64. }
  65.  
  66. function OKB_OnClick()
  67. {
  68.     var arrayLocations = Location_GetListBoxSelectedItems(locationList);
  69.     arrayLocations.length ? window.returnValue = arrayLocations : window.returnValue = null;
  70.     window.navigate("res://closeme.xyz");
  71. }
  72.  
  73. function CancelB_OnClick()
  74. {
  75.     window.returnValue = null;    // this should alredy be set, but let's make sure
  76.     window.navigate("res://closeme.xyz");
  77. }
  78.  
  79. function locationList_OnSpace()
  80. {
  81.     var nCurSel = locationList.GetCurSel();
  82.     var bEnable = false;
  83.  
  84.     if(nCurSel < 0)
  85.     {
  86.         return;    
  87.     }
  88.  
  89.     // Swap the state of the check box for this item
  90.     var CheckBox = locationList.GetCellPtr(nCurSel, 0).children[0];
  91.     CheckBox.checked = !CheckBox.checked;
  92.     UILocation_UpdateOKButtonState();
  93. }
  94.  
  95. function locationList_OnClick()
  96. {
  97.     UILocation_UpdateOKButtonState();
  98. }
  99.  
  100. function locationList_OnDblClick()
  101. {
  102.     var nCurSel = locationList.GetCurSel();
  103.     var bEnable = false;
  104.  
  105.     if(nCurSel < 0)
  106.     {
  107.         return;    
  108.     }
  109.  
  110.     // Swap the state of the check box for this item
  111.     var CheckBox = locationList.GetCellPtr(nCurSel, 0).children[0];
  112.     CheckBox.checked = !CheckBox.checked;
  113.     UILocation_UpdateOKButtonState();
  114. }
  115.  
  116. function UILocation_SelectAll()
  117. {
  118.     Location_SelectAllListBoxItems(locationList, true);
  119.     UILocation_UpdateOKButtonState();
  120. }
  121.  
  122. function UILocation_DeselectAll()
  123. {
  124.     Location_SelectAllListBoxItems(locationList, false);
  125.     UILocation_UpdateOKButtonState();
  126. }
  127.  
  128. function UILocation_UpdateOKButtonState()
  129. {
  130.     var arrayLocations = Location_GetListBoxSelectedItems(locationList);
  131.     arrayLocations.length ? OKB.disabled = false : OKB.disabled = true;
  132. }
  133.