Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

179 lines
4.7 KiB

  1. <%@ LANGUAGE="VBSCRIPT"%>
  2. <%Response.Expires = 0%>
  3. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
  4. <HTML>
  5. <META HTTP-EQUIV="Content-Type"
  6. CONTENT="text/html; CHARSET=iso-8859-1">
  7. <META NAME="GENERATOR"
  8. CONTENT="Microsoft Frontpage 2.0">
  9. <HEAD>
  10. <TITLE>hostname entry page</TITLE>
  11. <%
  12. 'Get the values sent by tasks page and store them in session variables
  13. Dim strCurrentPage
  14. Dim strCurrentTask
  15. Dim strFocusItem
  16. Dim bPartOfDomain
  17. Dim strStatus
  18. Dim objLocMgr
  19. Dim varReplacementStrings
  20. Dim strDomainErrorText
  21. Dim strUnknownErrorText
  22. Const DOMAIN_ERROR_TEXT = "&H40020001"
  23. Const UNKNOWN_ERROR_TEXT = "&H40020004"
  24. On Error Resume Next
  25. Err.Clear
  26. Set objLocMgr = Server.CreateObject("ServerAppliance.LocalizationManager")
  27. If Err.number = 0 Then
  28. strDomainErrorText = objLocMgr.GetString("salocaluimsg.dll",DOMAIN_ERROR_TEXT,varReplacementStrings)
  29. strUnknownErrorText = objLocMgr.GetString("salocaluimsg.dll",UNKNOWN_ERROR_TEXT,varReplacementStrings)
  30. Set objLocMgr = Nothing
  31. End If
  32. If strDomainErrorText = "" Then
  33. strDomainErrorText = "Cannot change host name for domain machine. Please go to Web UI."
  34. End If
  35. If strUnknownErrorText = "" Then
  36. strUnknownErrorText = "Encountered problem in setting host name. The change has been canceled."
  37. End If
  38. Err.Clear
  39. strCurrentPage = Request.QueryString("CurrentPage")
  40. strCurrentTask = Request.QueryString("CurrentTask")
  41. strFocusItem = Request.QueryString("FocusItem")
  42. If strCurrentPage <> "" Then
  43. Session("Task_CurrentPage") = strCurrentPage
  44. End If
  45. If strCurrentTask <> "" Then
  46. Session("Task_CurrentTask") = strCurrentTask
  47. End If
  48. If strFocusItem <> "" Then
  49. Session("Task_FocusItem") = strFocusItem
  50. End If
  51. Dim objSaHelper
  52. Dim strCurrentName
  53. Set objSaHelper = Server.CreateObject("ServerAppliance.SAHelper")
  54. bPartOfDomain = objSaHelper.IsPartOfDomain
  55. If Err.Number <> 0 Then
  56. strStatus = strUnknownErrorText
  57. ElseIf bPartOfDomain = true Then
  58. strStatus = strDomainErrorText
  59. ElseIf bPartOfDomain = false Then
  60. strStatus = "WorkGroup"
  61. If Session("Hostname_Hostname") = "" Then
  62. Session("Hostname_Hostname") = objSaHelper.HostName
  63. End If
  64. End If
  65. Set objSaHelper = Nothing
  66. %>
  67. <SCRIPT LANGUAGE="VBScript">
  68. <!--
  69. Option Explicit
  70. public iIdleTimeOut
  71. Sub window_onload()
  72. Dim objKeypad
  73. Set objKeypad = CreateObject("Ldm.SAKeypadController")
  74. objKeypad.Setkey 0,38,FALSE
  75. objKeypad.Setkey 1,40,FALSE
  76. objKeypad.Setkey 2,37,FALSE
  77. objKeypad.Setkey 3,39,FALSE
  78. objKeypad.Setkey 4,27,FALSE
  79. objKeypad.Setkey 5,13,FALSE
  80. Set objKeypad = Nothing
  81. iIdleTimeOut = window.SetTimeOut("IdleHandler()",300000)
  82. If "<%=strStatus%>" = "WorkGroup" Then
  83. If (HostName.value <> "") Then
  84. HostNameEntry.HostName = HostName.value
  85. End If
  86. HostNameEntry.focus
  87. Else
  88. HostNameEntry.style.display = "none"
  89. errorText.style.display = ""
  90. End If
  91. End Sub
  92. Sub HostNameEntry_DataEntered()
  93. HostName.value = HostNameEntry.HostName
  94. window.navigate "localui_confirmreboot.asp?HostName="+HostName.value
  95. End Sub
  96. Sub HostNameEntry_OperationCanceled()
  97. window.navigate "localui_tasks.asp"
  98. End Sub
  99. Sub HostNameEntry_KeyPressed()
  100. window.clearTimeOut(iIdleTimeOut)
  101. iIdleTimeOut = window.SetTimeOut("IdleHandler()",300000)
  102. End Sub
  103. Sub IdleHandler()
  104. window.navigate "localui_main.asp"
  105. End Sub
  106. Sub keydown()
  107. If window.event.keycode = 13 or window.event.keycode = 27 Then
  108. window.navigate "localui_tasks.asp"
  109. End If
  110. window.clearTimeOut(iIdleTimeOut)
  111. iIdleTimeOut = window.SetTimeOut("IdleHandler()",300000)
  112. End Sub
  113. -->
  114. </SCRIPT>
  115. </HEAD>
  116. <BODY RIGHTMARGIN=0 LEFTMARGIN=0 OnKeyDown="keydown()">
  117. <OBJECT STYLE="position:absolute; top:0; left=0;WIDTH=128; HEIGHT=64;"
  118. ID="HostNameEntry" CLASSID="CLSID:538D1B58-8D5A-47C5-9867-4B6230A94EAC"></OBJECT>
  119. <A id="errorText" STYLE="position:absolute; top:0; left:0; font-size:10; font-family=arial; display=none;"
  120. OnKeyDown="keydown()">
  121. <%=strStatus%>
  122. </A>
  123. <INPUT TYPE=HIDDEN Name="HostName" value="<%=Session("Hostname_Hostname")%>">
  124. </BODY>
  125. </HTML>