home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 January / 01_03.iso / software / snpf / NPF / NPF.MSI / pcwiz.dll / HTML / WIZ-CREATEACCOUNTS.JS < prev    next >
Encoding:
JavaScript  |  2002-09-21  |  4.8 KB  |  171 lines

  1. ////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
  4. //
  5. // NAME:    wiz-CreateAccounts (Javascript file for wiz-CreateAccounts.HTM)
  6. //
  7. // Copyright (c) 2001 by Symantec Corporation. All rights reserved.
  8. //
  9. ////////////////////////////////////////////////////////////////////////////////////////////
  10.  
  11.  
  12.  
  13. function OnLoad()
  14. {
  15.     AccountName1.focus();
  16. }
  17.  
  18. function Page_GoNext()
  19. {
  20.     var iAccountIndex =  0;
  21.     // Verify Names
  22.  
  23.     if (AccountName1.value.length > 0)
  24.     {
  25.         // Fix Defect#361885, make sure account names entered are unique and not duplicated
  26.         if ((stricmp(AccountName1.value, AccountName2.value) == 0) ||
  27.             (stricmp(AccountName1.value, AccountName3.value) == 0) ||
  28.             (stricmp(AccountName1.value, AccountName4.value) == 0) ||
  29.             (stricmp(AccountName1.value, AccountName5.value) == 0))
  30.         {
  31.             alert("You have entered an account name more then once.  Please make sure that the account names are unique.");
  32.             return false;        
  33.         }
  34.         
  35.         // Fix Defect#362860.  Making sure that account name is valid, i.e. not already used and valid account name
  36.         var reason = 0;
  37.         var validName = parent.UserManager.VerifyUserName(AccountName1.value, true, null, reason);
  38.         
  39.         if(!validName)
  40.             return false;
  41.         
  42.         parent.window.SetAccountInfo(iAccountIndex, AccountName1.value, null, select1.value);
  43.         iAccountIndex++;
  44.     }
  45.  
  46.     if (AccountName2.value.length > 0)
  47.     {
  48.  
  49.         if( (stricmp(AccountName2.value, AccountName1.value)==0) ||
  50.             (stricmp(AccountName2.value, AccountName3.value)==0) ||
  51.             (stricmp(AccountName2.value, AccountName4.value)==0) ||
  52.             (stricmp(AccountName2.value, AccountName5.value)==0))
  53.         {
  54.             alert("You have entered an account name more then once.  Please make sure that the account names are unique.");
  55.             return false;
  56.         
  57.         }
  58.     
  59.         var reason = 0;
  60.         var validName = parent.UserManager.VerifyUserName(AccountName2.value, true, null, reason);
  61.         
  62.         if(!validName)
  63.             return false;
  64.     
  65.         
  66.         parent.window.SetAccountInfo(iAccountIndex, AccountName2.value, null, select2.value);
  67.         iAccountIndex++;
  68.     }
  69.  
  70.     if (AccountName3.value.length > 0)
  71.     {
  72.         if( (stricmp(AccountName3.value, AccountName1.value)==0) ||
  73.             (stricmp(AccountName3.value, AccountName2.value)==0) ||
  74.             (stricmp(AccountName3.value, AccountName4.value)==0) ||
  75.             (stricmp(AccountName3.value, AccountName5.value)==0))
  76.         {
  77.             alert("You have entered an account name more then once.  Please make sure that the account names are unique.");
  78.             return false;
  79.         
  80.         }
  81.     
  82.         var reason = 0;
  83.         var validName = parent.UserManager.VerifyUserName(AccountName3.value, true, null, reason);
  84.         
  85.         if(!validName)
  86.             return false;        
  87.         
  88.         parent.window.SetAccountInfo(iAccountIndex, AccountName3.value, null, select3.value);
  89.         iAccountIndex++;
  90.     }
  91.  
  92.     if (AccountName4.value.length > 0)
  93.     {
  94.         if( (stricmp(AccountName4.value, AccountName1.value)==0) ||
  95.             (stricmp(AccountName4.value, AccountName2.value)==0) ||
  96.             (stricmp(AccountName4.value, AccountName3.value)==0) ||
  97.             (stricmp(AccountName4.value, AccountName5.value)==0))
  98.         {
  99.             alert("You have entered an account name more then once.  Please make sure that the account names are unique.");
  100.             return false;
  101.         
  102.         }
  103.         
  104.         var reason = 0;
  105.         var validName = parent.UserManager.VerifyUserName(AccountName4.value, true, null, reason);
  106.         
  107.         if(!validName)
  108.             return false;        
  109.         
  110.         parent.window.SetAccountInfo(iAccountIndex, AccountName4.value, null, select4.value);
  111.         iAccountIndex++;
  112.     }
  113.  
  114.     if (AccountName5.value.length > 0)
  115.     {
  116.         if( (stricmp(AccountName5.value, AccountName1.value)==0) ||
  117.             (stricmp(AccountName5.value, AccountName2.value)==0) ||
  118.             (stricmp(AccountName5.value, AccountName3.value)==0) ||
  119.             (stricmp(AccountName5.value, AccountName4.value)==0))
  120.         {
  121.             alert("You have entered an account name more then once.  Please make sure that the account names are unique.");
  122.             return false;
  123.         
  124.         }
  125.         
  126.         var reason = 0;
  127.         var validName = parent.UserManager.VerifyUserName(AccountName5.value, true, null, reason);
  128.         
  129.         if(!validName)
  130.             return false;        
  131.         
  132.         parent.window.SetAccountInfo(iAccountIndex, AccountName5.value, null, select5.value);
  133.         iAccountIndex++;
  134.     }        
  135.  
  136.  
  137.     // Tell parent window, how many accounts to set
  138.     parent.window.SetAccountNum(iAccountIndex);
  139.     return true;
  140. }
  141.  
  142.  
  143. function Page_GoBack()
  144. {
  145.     return true;
  146. }
  147.  
  148. function OnKeyDownHandler()
  149. {
  150.     // Last Control Tab over to the <back, next, close> button.
  151.     var VK_ESCAPE = 27;
  152.  
  153.     if (window.event.keyCode == VK_ESCAPE)
  154.     {
  155.         // Escape key.. We want to exit out of the wizard..
  156.         parent.window.navigate("res://closeme.xyz");
  157.  
  158.     }
  159.     
  160. }
  161.  
  162. function stricmp(szA, szB)
  163. {
  164.     if(szA.toUpperCase() < szB.toUpperCase())
  165.         return -1;
  166.     else if(szA.toUpperCase() > szB.toUpperCase())
  167.         return 1;
  168.  
  169.     return 0;
  170. }
  171.