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

  1. function ChangeUser()
  2. {
  3. var oUser = this.oUser;
  4. if (oUser)
  5. {
  6. top.window.g_oSelectedUser = oUser;
  7. top.window.g_Navigator.navigate("mainpage.htm");
  8. }
  9. }
  10. function SetRelativeCells(tr, td)
  11. {
  12. var iCol = td.cellIndex;
  13. if (iCol > 0)
  14. {
  15. var oLeft = tr.cells(iCol-1);
  16. td.leftElem = oLeft;
  17. oLeft.rightElem = td;
  18. }
  19. var iRow = tr.rowIndex;
  20. if (iRow > 0)
  21. {
  22. var oUp = tr.parentElement.rows(iRow-1).cells(iCol);
  23. td.upElem = oUp;
  24. oUp.downElem = td;
  25. }
  26. }
  27. function AddCell(tr, oUser, strTip, strSubtitle)
  28. {
  29. if (oUser)
  30. {
  31. if (!strTip)
  32. strTip = top.window.L_Account_ToolTip;
  33. var td = tr.insertCell();
  34. td.className = "Selectable";
  35. td.oUser = oUser;
  36. td.onclick = ChangeUser;
  37. td.tabIndex = -1;
  38. td.innerHTML = top.window.CreateUserDisplayHTML(oUser, strSubtitle);
  39. td.firstChild.title = strTip;
  40. td.title = td.firstChild.innerText + ". " + strTip;
  41. SetRelativeCells(tr, td);
  42. }
  43. }
  44. function CreateUserSelectionTable(oParent, cCols)
  45. {
  46. var oTable = document.createElement('<TABLE cellspacing=10 cellpadding=1 style="table-layout:fixed"></TABLE>');
  47. if (!oTable)
  48. {
  49. oParent.style.display = 'none';
  50. return;
  51. }
  52. var oUserList = top.window.g_oUserList;
  53. var strGuest = top.window.GetGuestName();
  54. var strLoggedOnUser = top.window.g_strLoggedOnUserName;
  55. var fIncludeSelf = (null != strLoggedOnUser);
  56. var cUsers = oUserList.length;
  57. var oGuest = null;
  58. if (!cCols || cCols < 1)
  59. cCols = 1;
  60. oTable.cols = cCols;
  61. var tr = oTable.insertRow();
  62. for (var i = 0; i < cUsers; i++)
  63. {
  64. var oUser = oUserList(i);
  65. var strLoginName = oUser.setting("LoginName").toLowerCase();
  66. if (strGuest.toLowerCase() == strLoginName)
  67. {
  68. oGuest = oUser;
  69. continue;
  70. }
  71. var bIsLoggedOnUser = strLoggedOnUser ? (strLoginName == strLoggedOnUser) : false;
  72. if (fIncludeSelf || !bIsLoggedOnUser)
  73. {
  74. if (fIncludeSelf)
  75. {
  76. if (!bIsLoggedOnUser)
  77. {
  78. oUser = oUserList.currentUser;
  79. i--;
  80. }
  81. fIncludeSelf = false;
  82. }
  83. AddCell(tr, oUser);
  84. if (tr.cells.length == cCols)
  85. tr = oTable.insertRow();
  86. }
  87. }
  88. try
  89. {
  90. if (top.window.GetLocalMachine().isGuestEnabled(1))
  91. {
  92. AddCell(tr, oGuest, top.window.L_Guest_ToolTip, top.window.L_GuestEnabled_Property);
  93. }
  94. else
  95. {
  96. var td = tr.insertCell();
  97. td.className = "Selectable";
  98. td.onclick = new Function("top.window.g_Navigator.navigate('enableguest.htm');");
  99. td.tabIndex = -1;
  100. td.innerHTML = top.window.CreateUserDisplayHTML2(strGuest, top.window.L_GuestDisabled_Property, "guest_disabled.bmp");
  101. td.firstChild.title = top.window.L_GuestEnable_ToolTip;
  102. td.title = td.firstChild.innerText + ". " + td.firstChild.title;
  103. SetRelativeCells(tr, td);
  104. }
  105. }
  106. catch (e)
  107. {
  108. }
  109. oTable.cells.item(0).tabIndex = 0;
  110. oParent.appendChild(oTable);
  111. }
  112.