home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 May / 05_02.iso / software / nis / files / NIS / NIS.MSI / IntroWiz.exe / HTML / IW-ABOUTPRIVACYCONTROL.JS < prev    next >
Encoding:
JavaScript  |  2001-12-01  |  9.6 KB  |  372 lines

  1. ////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
  4. //
  5. // NAME:    iw-AboutPrivacyControl.js (Javascript file for iw-AboutPrivacyControl.HTM)
  6. //
  7. // Copyright (c) 2001 by Symantec Corporation. All rights reserved.
  8. //
  9. ////////////////////////////////////////////////////////////////////////////////////////////
  10.  
  11. function OnTabOverAdd()
  12. {
  13.     // Last Control Tab over to the <back, next, close> button.
  14.     // Compare it with the Tab Key Code
  15.     var VK_TAB = 9;
  16.     if (window.event.keyCode == VK_TAB && (window.event.shiftKey != true))
  17.     {
  18.         if(Back1.disabled == true)
  19.             window.parent.frames("bottom",0).focus();
  20.     }
  21. }
  22.  
  23. function OnTabOverModify()
  24. {
  25.     // Last Control Tab over to the <back, next, close> button.
  26.     var VK_TAB = 9;
  27.     if (window.event.keyCode == VK_TAB && (window.event.shiftKey != true))
  28.         window.parent.frames("bottom",0).focus();
  29. }
  30.  
  31. function OnReverseTab()
  32. {
  33.     // Reverse Tab go back to navigation page
  34.     var VK_TAB = 9;
  35.     if (window.event.keyCode == VK_TAB && (window.event.shiftKey == true))
  36.         window.parent.frames("contents",0).focus();
  37. }
  38.  
  39.  
  40. function AddConfidential()
  41. {
  42.     var iMaxDisplayChar = 13;
  43.     var iMaxDiplayTotal = iMaxDisplayChar + 3;    
  44.     
  45.     var txtArray = new Array(1);
  46.     txtArray[0]=StrID("AddConfid");
  47.     // var strConfInfo = window.showModalDialog("iw-AddConfid.htm", txtArray,'dialogWidth: 460px; dialogHeight:350px; center: yes; status: no');
  48.     var strConfInfo  = webWind.showModalDialog("res://IntroWiz.exe/iw-AddConfid.htm", 438, 288, txtArray);
  49.     
  50.     if(strConfInfo != null)
  51.     {
  52.         if (strConfInfo[3]==StrID("Reload"))
  53.         {
  54.             // Reload the entire page if we are modifying a value that exist
  55.             ConfigInfo.AddConfInfo(strConfInfo[0], strConfInfo[1], strConfInfo[2]);        // Add to the real data
  56.             ReloadListBox();
  57.         }
  58.         else
  59.         {
  60.             ListA.OnClick = OnClick;
  61.             ListA.OnDblClick = ModifyConfidential;
  62.             ListA.SetColumnCount(3);
  63.             ListA.SetColumnWidth(0, "34%");
  64.             ListA.SetColumnWidth(1, "34%");
  65.             ListA.SetColumnWidth(2, "32%");    
  66.             var pRow = null;        
  67.             pRow = ListA.InsertRow(-1);
  68.             
  69.             // If string is larger than max we will only display max chars + ..
  70.             if (strConfInfo[0].length > iMaxDiplayTotal)
  71.                 strTrimmedField1 = strConfInfo[0].substr(0, iMaxDisplayChar) + "...";
  72.             else
  73.                 strTrimmedField1 = strConfInfo[0];
  74.     
  75.             // Now display the truncated string if necessary
  76.             ListA.SetCellTextPtr(pRow, 0, strTrimmedField1);            
  77.             
  78.             ListA.SetCellTextPtr(pRow, 1, strConfInfo[1]);        
  79.             
  80.             if (strConfInfo[2].length > iMaxDiplayTotal)
  81.                 strTrimmedField2 = strConfInfo[2].substr(0, iMaxDisplayChar) + "...";
  82.             else
  83.                 strTrimmedField2 = strConfInfo[2];
  84.             
  85.             ListA.SetCellTextPtr(pRow, 2, strTrimmedField2);        // Add to the UI
  86.             ConfigInfo.AddConfInfo(strConfInfo[0], strConfInfo[1], strConfInfo[2]);        // Add to the real data
  87.         }
  88.     }
  89. }
  90.  
  91. function RemoveConfidential()
  92. {    
  93.     // MessageBox() Flags
  94.     var MB_OK =                     0x00000000;
  95.     var MB_OKCANCEL =               0x00000001;
  96.     var MB_ABORTRETRYIGNORE =       0x00000002;
  97.     var MB_YESNOCANCEL =            0x00000003;
  98.     var MB_YESNO =                  0x00000004;
  99.     var MB_RETRYCANCEL =            0x00000005;
  100.     
  101.     var MB_ICONHAND =               0x00000010;
  102.     var MB_ICONQUESTION =           0x00000020;
  103.     var MB_ICONEXCLAMATION =        0x00000030;
  104.     var MB_ICONASTERISK  =          0x00000040;
  105.     
  106.     var MB_USERICON =               0x00000080;
  107.     var MB_ICONWARNING =            MB_ICONEXCLAMATION;
  108.     var MB_ICONERROR =              MB_ICONHAND;
  109.     
  110.     var MB_ICONINFORMATION =        MB_ICONASTERISK;
  111.     var MB_ICONSTOP =               MB_ICONHAND;
  112.     
  113.     var IDOK =              1;
  114.     var IDCANCEL =          2;
  115.     var IDABORT =           3;
  116.     var IDRETRY =           4;
  117.     var IDIGNORE =          5;
  118.     var IDYES =             6;
  119.     var IDNO =              7;
  120.     
  121.     var retVal = webWind.MsgBox(StrID("RemoveConfInfoWarning"), StrID("Confirm"), MB_YESNO | MB_ICONQUESTION);
  122.  
  123.     if (retVal == IDYES)    
  124.     {
  125.         var iConfInfoCount = ConfigInfo.ConfInfoCount;
  126.         var iRow = ListA.GetCurSel();
  127.         var strName;
  128.         var strType;
  129.         
  130.         ConfigInfo.SetStartData();        
  131.         for (var i = 0; i < iConfInfoCount; i++)
  132.         {
  133.             
  134.             // Found a match 
  135.             if (i == iRow - 1)
  136.             {
  137.                 strName = ConfigInfo.strDesc;
  138.                 strType = ConfigInfo.strType;
  139.                 break;
  140.             }
  141.             
  142.             ConfigInfo.GetNextData();                
  143.         }        
  144.                 
  145.         ListA.DeleteRow(iRow);            // Delete from (ListControl Box)
  146.         ConfigInfo.DeleteConfInfo(strName, strType);    // Delete for real from data
  147.         
  148.         ToggleModifyState(false);
  149.         ToggleRemoveState(false);    
  150.     }
  151.     else
  152.         return;
  153. }
  154.  
  155. function ModifyConfidential()
  156. {
  157.     var iMaxDisplayChar = 13;
  158.     var iMaxDiplayTotal = iMaxDisplayChar + 3;    
  159.         
  160.     var strParams = new Array(4);
  161.     var iConfInfoCount = ConfigInfo.ConfInfoCount;
  162.     var iRow = ListA.GetCurSel();
  163.     
  164.     ConfigInfo.SetStartData();
  165.  
  166.     var strName;
  167.     var strData    
  168.     
  169.     ConfigInfo.SetStartData();
  170.     for (var i = 0; i < iConfInfoCount; i++)
  171.     {
  172.         
  173.         // Found a match 
  174.         if (i == iRow - 1)
  175.         {
  176.             strName = ConfigInfo.strDesc;
  177.             strData = ConfigInfo.strData;        
  178.             break;
  179.         }
  180.         
  181.         ConfigInfo.GetNextData();                
  182.     }    
  183.     
  184.     strParams[0]= StrID("ModifyConfid");
  185.     strParams[1]= strName;
  186.     strParams[2]= ListA.GetCellText(iRow, 1);
  187.     strParams[3]= strData;
  188.     
  189.     var strConfInfo =  webWind.showModalDialog("res://IntroWiz.exe/iw-AddConfid.htm", 438, 288, strParams);    
  190.  
  191.     if(strConfInfo != null)
  192.     {    
  193.         
  194.         if (strConfInfo[3]=="Reload")
  195.         {
  196.             // Reload the entire page if we are modifying a value that exist
  197.             ConfigInfo.DeleteConfInfo(strParams[1], strParams[2]);         // Delete from real data
  198.             ConfigInfo.AddConfInfo(strConfInfo[0], strConfInfo[1], strConfInfo[2]);        // Add to the real data
  199.             ReloadListBox();
  200.             
  201.         }
  202.         else
  203.         {
  204.             var strTrimmedField1;
  205.             var strTrimmedField2;
  206.             
  207.             ListA.DeleteRow(iRow);            // Delete from (ListControl Box)
  208.             ConfigInfo.DeleteConfInfo(strParams[1], strParams[2]);         // Delete from real data
  209.             
  210.             var pRow = null;        
  211.             pRow = ListA.InsertRow(-1); // Append to the end
  212.                     
  213.             // If string is larger than max we will only display max chars + ..
  214.             if (strConfInfo[0].length > iMaxDiplayTotal)
  215.                 strTrimmedField1 = strConfInfo[0].substr(0, iMaxDisplayChar) + "...";
  216.             else
  217.                 strTrimmedField1 = strConfInfo[0];
  218.     
  219.             // Now display the truncated string if necessary
  220.             ListA.SetCellTextPtr(pRow, 0, strTrimmedField1);            
  221.             
  222.             ListA.SetCellTextPtr(pRow, 1, strConfInfo[1]);        
  223.             
  224.             if (strConfInfo[2].length > iMaxDiplayTotal)
  225.                 strTrimmedField2 = strConfInfo[2].substr(0, iMaxDisplayChar) + "...";
  226.             else
  227.                 strTrimmedField2 = strConfInfo[2];
  228.             
  229.             ListA.SetCellTextPtr(pRow, 2, strTrimmedField2);        // Add to the UI
  230.             ConfigInfo.AddConfInfo(strConfInfo[0], strConfInfo[1], strConfInfo[2]);        // Add to the real data        
  231.             
  232.             ToggleModifyState(false);
  233.             ToggleRemoveState(false);
  234.         }
  235.     }
  236. }
  237.  
  238. function LaunchExample()
  239. {
  240.     event.cancelBubble = true;
  241.     event.returnValue = false;
  242.     webWind.showModalDialog("res://IntroWiz.exe/iw-confid_examples.htm", 480, 270);
  243. }
  244.  
  245. function OnLoad()
  246. {
  247.     
  248.     LaunchConfExample.focus();
  249.     var parentwnd = window.parent.frames("contents",0);
  250.     if(parentwnd)
  251.     {
  252.         window.NISTitleName.innerText=WrapNisum.ProductName;;
  253.     }
  254.     
  255.     ToggleModifyState(false);
  256.     ToggleRemoveState(false);
  257.     
  258.     ListA.OnClick = OnClick;
  259.     ListA.OnDblClick = ModifyConfidential;
  260.     
  261.     ReloadListBox();
  262.     
  263.  
  264. }
  265.  
  266. function ToggleRemoveState(bState)
  267. {
  268.     if(bState==true)
  269.     {
  270.         Back1.disabled = false;
  271.     }
  272.     else
  273.     {
  274.         Back1.disabled = true;
  275.     }
  276.  
  277.  
  278. }
  279.  
  280.  
  281. function ToggleModifyState(bState)
  282. {
  283.     if(bState==true)
  284.     {
  285.         Back2.disabled = false;        
  286.     }
  287.     else
  288.     {
  289.         Back2.disabled = true;
  290.     }
  291.  
  292. }
  293.  
  294. function OnClick(nRow)
  295. {
  296.     ToggleModifyState(true);
  297.     ToggleRemoveState(true);
  298. }
  299.  
  300. // New Function to reload the list
  301. function ReloadListBox()
  302. {
  303.     var txtArray = new Array(3);
  304.     var iMaxDisplayChar = 13;
  305.     var iMaxDiplayTotal = iMaxDisplayChar + 3;
  306.  
  307.     ListA.DeleteAllRows();    
  308.     ListA.SetColumnCount(3);
  309.     ListA.SetColumnWidth(0, "34%");
  310.     ListA.SetColumnWidth(1, "34%");
  311.     ListA.SetColumnWidth(2, "32%");    
  312.         
  313.     var strCurrentDesc;
  314.     var strCurrentType;
  315.     var strCurrentData;
  316.     
  317.     var strTrimmedField1;
  318.     var strTrimmedField2;
  319.     var pRow = null;        
  320.     pRow = ListA.InsertRow(-1);
  321.  
  322.     var iConfInfoCount = ConfigInfo.ConfInfoCount;
  323.  
  324.     // Call COM Object to get the correct amount of data
  325.     ConfigInfo.SetStartData();
  326.     for (var i = 0; i < iConfInfoCount; i++)
  327.     {
  328.         var pRow = null;        
  329.         pRow = ListA.InsertRow(-1);
  330.     
  331.         strCurrentDesc = ConfigInfo.strDesc;
  332.         strCurrentType = ConfigInfo.strType;
  333.         strCurrentData = ConfigInfo.strData;
  334.                 
  335.         // If string is larger than max we will only display max chars + ..
  336.         if (strCurrentDesc.length > iMaxDiplayTotal)
  337.             strTrimmedField1 = strCurrentDesc.substr(0, iMaxDisplayChar) + "...";
  338.         else
  339.             strTrimmedField1 = strCurrentDesc;
  340.  
  341.         // Now display the truncated string if necessary
  342.         ListA.SetCellTextPtr(pRow, 0, strTrimmedField1);            
  343.         
  344.         ListA.SetCellTextPtr(pRow, 1, strCurrentType);        
  345.         
  346.         if (strCurrentData.length > iMaxDiplayTotal)
  347.             strTrimmedField2 = strCurrentData.substr(0, iMaxDisplayChar) + "...";
  348.         else
  349.             strTrimmedField2 = strCurrentData;
  350.         
  351.         ListA.SetCellTextPtr(pRow, 2, strTrimmedField2);            
  352.             
  353.         ConfigInfo.GetNextData();                
  354.     }    
  355.  
  356.     ToggleModifyState(false);
  357.     ToggleRemoveState(false);    
  358. }
  359.  
  360. function OnKeyDownHandler()
  361. {
  362.     // Last Control Tab over to the <back, next, close> button.
  363.     var VK_ESCAPE = 27;
  364.  
  365.     if (window.event.keyCode == VK_ESCAPE)
  366.     {
  367.         // Escape key.. We want to exit out of the wizard..
  368.         parent.window.navigate("res://closeme.xyz");
  369.  
  370.     }
  371.     
  372. }