home *** CD-ROM | disk | FTP | other *** search
/ Chip 2009 November / Chip_2009.11_CD.iso / I386 / nusrmgr.cp_ / nusrmgr.cpl / HTML / NAME_COMMON.JS < prev    next >
Encoding:
Text File  |  2008-04-14  |  1.3 KB  |  46 lines

  1. function GetText(oTextInput)
  2. {
  3. var szValue = oTextInput.value;
  4. return szValue ? szValue.replace(/^\s+|\s+$/g,"") : '';
  5. }
  6. function IsDuplicateName(szName, fnGetName)
  7. {
  8. var szNameLower = szName.toLowerCase();
  9. var szAdmin = top.window.GetAdminName();
  10. if (szAdmin.toLowerCase() == szNameLower)
  11. return szAdmin;
  12. var oUserList = top.window.g_oUserList;
  13. var cUsers = oUserList.length;
  14. for (var i = 0; i < cUsers; i++)
  15. {
  16. var szCompare = fnGetName(oUserList(i));
  17. if (szCompare.toLowerCase() == szNameLower)
  18. return szCompare;
  19. }
  20. return null;
  21. }
  22. function GetUserLoginName(oUser)
  23. {
  24. return oUser.setting("LoginName");
  25. }
  26. function IsDuplicateLoginName(szName)
  27. {
  28. return IsDuplicateName(szName,GetUserLoginName);
  29. }
  30. function IsDuplicateDisplayName(szName)
  31. {
  32. return IsDuplicateName(szName,top.window.GetUserDisplayName);
  33. }
  34. function ValidateAccountName(szName)
  35. {
  36. var szMsg = null;
  37. var szDuplicate = IsDuplicateDisplayName(szName);
  38. if (szDuplicate)
  39. szMsg = top.window.L_AccountExists_ErrorMessage.replace(/%1/g,szDuplicate);
  40. else if (-1 != szName.search(/[]/\\\[":;\|<>\+=,\?\*]/))//"
  41. szMsg = top.window.L_NameNotValid_ErrorMessage;
  42. else if (-1 != szName.toLowerCase().search(/^(aux|com[1-9]|con|lpt[1-9]|nul|prn)(\.|$)/))
  43. szMsg = top.window.L_DOSName_ErrorMessage;
  44. return szMsg;
  45. }
  46.