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.

187 lines
11 KiB

  1. ��<HTML>
  2. <!-- Copyright (c) Microsoft Corporation. All rights reserved.-->
  3. <HEAD>
  4. <TITLE>Dynamic Ip Setting Page</TITLE>
  5. <SCRIPT LANGUAGE="VBScript">
  6. <!--
  7. Option Explicit
  8. 'Windows constants for key codes
  9. Public Const EnterKey = 13
  10. Public Const EscapeKey = 27
  11. 'Timer for idle timeout
  12. Dim iIdleTimeOut
  13. 'Text for wait information
  14. Dim strWaitText
  15. 'Auto Ip address error text
  16. Dim strAutoIpErrorText
  17. 'Confirmation text for auto ip
  18. Dim strConfirmAutoIpText
  19. 'Flag for intial status of the page
  20. Dim bGettingAutoIp
  21. '----------------------------------------------------------------------------
  22. ' Function: Window_OnLoad
  23. ' Description: Initialization routine for the page
  24. ' Input Variables: None
  25. ' Output Variables: None
  26. ' Return Values: None
  27. ' Global Variables: strWaitText,strAutoIpErrorText,strConfirmAutoIpText,bGettingAutoIp
  28. '----------------------------------------------------------------------------
  29. Sub Window_OnLoad()
  30. 'Localization manager object
  31. Dim objLocMgr
  32. 'Replacement strings
  33. Dim varReplacementStrings
  34. 'Resource ID for wait information text
  35. Const WAIT_TEXT = "&H40020012"
  36. 'Resource ID for Ip address error text
  37. Const CONFIRM_AUTO_TEXT = "&H40020006"
  38. 'Resource ID for Ip address error text
  39. Const AUTOIP_ERROR_TEXT = "&H40020007"
  40. On Error Resume Next
  41. Err.Clear
  42. bGettingAutoIp = true
  43. 'Create the localization manager
  44. Set objLocMgr = CreateObject("ServerAppliance.LocalizationManager")
  45. If Err.number = 0 Then
  46. 'Get the strings
  47. strWaitText = objLocMgr.GetString("salocaluimsg.dll",WAIT_TEXT,varReplacementStrings)
  48. strConfirmAutoIpText = objLocMgr.GetString("salocaluimsg.dll",CONFIRM_AUTO_TEXT,varReplacementStrings)
  49. strAutoIpErrorText = objLocMgr.GetString("salocaluimsg.dll",AUTOIP_ERROR_TEXT,varReplacementStrings)
  50. Set objLocMgr = Nothing
  51. End If
  52. Err.Clear
  53. InformationText.innerText = strConfirmAutoIpText
  54. 'start the timer for idle timeout
  55. iIdleTimeOut = window.SetTimeOut("IdleHandler()",300000)
  56. On Error Resume Next
  57. Err.Clear
  58. 'set the key codes for the page
  59. Dim objKeypad
  60. Set objKeypad = CreateObject("Ldm.SAKeypadController")
  61. If Err.number = 0 Then
  62. objKeypad.Setkey 0,0,TRUE
  63. objKeypad.Setkey 1,0,FALSE
  64. objKeypad.Setkey 2,0,FALSE
  65. objKeypad.Setkey 3,0,FALSE
  66. objKeypad.Setkey 4,EscapeKey,FALSE
  67. objKeypad.Setkey 5,EnterKey,FALSE
  68. Set objKeypad = Nothing
  69. End If
  70. End Sub
  71. '----------------------------------------------------------------------------
  72. ' Function: IdleHandler
  73. ' Description: Goes back to main page when timeout expires
  74. ' Input Variables: None
  75. ' Output Variables: None
  76. ' Return Values: None
  77. ' Global Variables: None
  78. '----------------------------------------------------------------------------
  79. Sub IdleHandler()
  80. window.history.go(-3)
  81. End Sub
  82. '----------------------------------------------------------------------------
  83. ' Function: KeyDown
  84. ' Description: Handles key presses
  85. ' Input Variables: None
  86. ' Output Variables: None
  87. ' Return Values: None
  88. ' Global Variables: None
  89. '----------------------------------------------------------------------------
  90. Sub KeyDown()
  91. 'SaHelper object pointer
  92. Dim objSaHelper
  93. On Error Resume Next
  94. Err.Clear
  95. 'clear the timeout and restart it
  96. window.clearTimeOut(iIdleTimeOut)
  97. iIdleTimeOut = window.SetTimeOut("IdleHandler()",300000)
  98. 'If escape key is hit, go back to network page
  99. If window.event.keycode = EscapeKey Then
  100. window.history.go(-1)
  101. End If
  102. If bGettingAutoIp = false and window.event.keycode = EnterKey Then
  103. window.history.go(-1)
  104. End If
  105. If bGettingAutoIp = true and window.event.keycode = EnterKey Then
  106. bGettingAutoIp = false
  107. InformationText.innerText = strWaitText
  108. Set objSaHelper = CreateObject("ServerAppliance.SAHelper")
  109. 'If object is successfully created
  110. If Err.Number = 0 Then
  111. objSaHelper.SetDynamicIp
  112. Set objSaHelper = Nothing
  113. End If
  114. 'Ip address successfully retrieved from DHCP
  115. If Err.Number = 0 Then
  116. 'start a timer to go back to tasks page
  117. iIdleTimeOut = window.SetTimeOut("GoBackToTasksPages",300)
  118. 'Something failed, display error information
  119. Else
  120. InformationText.innerText = strAutoIpErrorText
  121. End If
  122. End If
  123. End Sub
  124. Sub GoBackToTasksPages()
  125. window.history.go(-1)
  126. End Sub
  127. -->
  128. </SCRIPT>
  129. </HEAD>
  130. <BODY RIGHTMARGIN=0 LEFTMARGIN=0 OnKeydown="KeyDown">
  131. <A ID="InformationText" OnKeydown="KeyDown"
  132. STYLE="position:absolute; top:0; left:0; font-size:10; font-family=arial;" >
  133. </A>
  134. </BODY>
  135. </HTML>