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.

227 lines
6.1 KiB

  1. <%@ Language=VBScript %>
  2. <% '==================================================
  3. ' Microsoft Server Appliance
  4. '
  5. ' Server Restarting Dialog
  6. '
  7. ' Copyright (c) Microsoft Corporation. All rights reserved.
  8. '================================================== %>
  9. <% Option Explicit %>
  10. <!-- Copyright (c) Microsoft Corporation. All rights reserved.-->
  11. <!-- #include file="sh_page.asp" -->
  12. <!-- #include file="sh_statusbar.asp" -->
  13. <!-- #include file="tabs.asp" -->
  14. <%
  15. Const THREE_MINUTES = 180000
  16. Const FIFTEEN_SECONDS = 15000
  17. Dim strTitle
  18. Dim strMessage
  19. Dim strTitleID
  20. Dim strMsgID
  21. Dim strMessageDLL
  22. Dim dwInitialWaitTime
  23. Dim dwWaitTime
  24. Dim strOption
  25. Randomize()
  26. Dim g_sURLAdminPage
  27. Dim g_sURLTestImage
  28. Dim sURLBase
  29. Dim L_STATUS_TEXT
  30. L_STATUS_TEXT = GetLocString("sacoremsg.dll", "40200BC5", "")
  31. sURLBase = Request.QueryString("URLBase")
  32. If ( Len(sURLBase) > 0 ) Then
  33. g_sURLAdminPage = sURLBase + "default.asp"
  34. Call SA_MungeURL(g_sURLAdminPage, "R", CStr(Int(Rnd()*10000)))
  35. g_sURLTestImage = sURLBase + "images/arrow_green.gif"
  36. Call SA_MungeURL(g_sURLTestImage, "R", CStr(Int(Rnd()*10000)))
  37. Else
  38. g_sURLAdminPage = m_VirtualRoot + "default.asp"
  39. Call SA_MungeURL(g_sURLAdminPage, "R", CStr(Int(Rnd()*10000)))
  40. g_sURLTestImage = m_VirtualRoot + "images/arrow_green.gif"
  41. Call SA_MungeURL(g_sURLTestImage, "R", CStr(Int(Rnd()*10000)))
  42. End If
  43. Call SA_MungeURL(g_sURLAdminPage, SAI_FLD_PAGEKEY, SAI_GetPageKey())
  44. strOption = Request.QueryString("Option")
  45. Select Case UCase(strOption)
  46. Case "SHUTDOWN"
  47. strTitle = GetLocString("sacoremsg.dll", "40200BEC", "")
  48. strMessage = GetLocString("sacoremsg.dll", "40200BED", "")
  49. Case "RESTART"
  50. strTitle = GetLocString("sacoremsg.dll", "40200BEA", "")
  51. strMessage = GetLocString("sacoremsg.dll", "40200BEB", "")
  52. Case "RESTARTING"
  53. strTitle = GetLocString("sacoremsg.dll", "40200BEA", "")
  54. strMessage = GetLocString("sacoremsg.dll", "40200BEB", "")
  55. Case Else
  56. Call SA_TraceErrorOut(SA_GetScriptFileName(), "Unrecognized restarting option: " + strOption)
  57. strTitle = GetLocString("sacoremsg.dll", "40200BEA", "")
  58. strMessage = GetLocString("sacoremsg.dll", "40200BEB", "")
  59. End Select
  60. strMessageDLL = Request.QueryString("Resrc")
  61. If ( Len(Trim(strMessageDLL)) > 0 ) Then
  62. strTitleID = Request.QueryString("Title")
  63. If ( Len(Trim(strTitleID)) > 0 ) Then
  64. strTitle = GetLocString(strMessageDLL, strTitleID, "")
  65. End If
  66. strMsgID = Request.QueryString("Msg")
  67. If ( Len(Trim(strMsgID)) > 0 ) Then
  68. strMessage = GetLocString(strMessageDLL, strMsgID, "")
  69. End If
  70. End If
  71. dwInitialWaitTime = 0
  72. If ( Len(Trim(Request.QueryString("T1"))) > 0 ) Then
  73. dwInitialWaitTime = Int(Trim(Request.QueryString("T1")))
  74. End If
  75. If ( dwInitialWaitTime <= 0 ) Then
  76. dwInitialWaitTime = GetDefaultInitialWaitTime()
  77. End If
  78. dwWaitTime = 0
  79. If ( Len(Trim(Request.QueryString("T2"))) > 0 ) Then
  80. dwWaitTime = Int(Trim(Request.QueryString("T2")))
  81. End If
  82. If ( dwWaitTime <= 0 ) Then
  83. dwWaitTime = GetDefaultRetryWaitTime()
  84. End If
  85. %>
  86. <html>
  87. <!-- Copyright (c) Microsoft Corporation. All rights reserved.-->
  88. <head>
  89. <meta http-equiv="Content-Type" content="text/html; charset=<%=GetCharSet()%>">
  90. <title><%=Server.HTMLEncode(strTitle)%></title>
  91. <%
  92. Call SA_EmitAdditionalStyleSheetReferences("")
  93. %>
  94. <SCRIPT LANGUAGE="JavaScript" SRC="<%=m_VirtualRoot%>sh_page.js"></SCRIPT>
  95. <SCRIPT LANGUAGE=javascript>
  96. var intTestCount = 0;
  97. var intFirstCheckDelay = <%=dwInitialWaitTime%>; // delays in milliseconds
  98. var intSubsequentCheckDelay = <%=dwWaitTime%>;
  99. var intCurrentDelay;
  100. var imgTest;
  101. window.defaultStatus='';
  102. imgTest = new Image();
  103. function Init()
  104. {
  105. intCurrentDelay = intFirstCheckDelay;
  106. window.setTimeout("CheckServer()", intCurrentDelay);
  107. }
  108. function CheckServer()
  109. {
  110. // Tests state of a hidden image, imgTest
  111. // and reloads it if it's not loaded.
  112. // currently does this forever and doesn't check
  113. // the iteration count stored in intTestCount.
  114. intTestCount += 1;
  115. if (imgTest.complete == false)
  116. {
  117. GetImage();
  118. intCurrentDelay = intSubsequentCheckDelay;
  119. window.setTimeout("CheckServer()", intSubsequentCheckDelay);
  120. }
  121. else
  122. {
  123. //
  124. // Delay to allow backend framework to startup. Otherwise
  125. // alerts are not shown when admin page is first made visible
  126. //
  127. intCurrentDelay = 30000;
  128. setTimeout("ShowAdminPage()", 30000)
  129. }
  130. }
  131. function ShowAdminPage()
  132. {
  133. top.location = "<%=g_sURLAdminPage%>";
  134. }
  135. function GetImage()
  136. {
  137. imgTest.src = "<%=g_sURLTestImage%>";
  138. }
  139. </SCRIPT>
  140. </head>
  141. <BODY onLoad='Init();' xoncontextmenu="return false;" >
  142. <%
  143. Call ServeStatusBar(False, L_STATUS_TEXT&":&nbsp;"&strTitle, "StatusCritical")
  144. Call SA_ServeEmptyTabBar()
  145. %>
  146. <div class="PageBodyIndent">
  147. <%
  148. Call ServeStandardHeaderBar(strTitle, "images/critical_error.gif")
  149. %>
  150. <div class="PageBodyInnerIndent">
  151. <table border=0 >
  152. <tr>
  153. <td class="TasksBody">&nbsp;</td></tr>
  154. <tr>
  155. <td class="TasksBody">
  156. <%=Server.HTMLEncode(strMessage)%>
  157. </td>
  158. </tr>
  159. </table>
  160. </div>
  161. </div>
  162. </BODY>
  163. </html>
  164. <%
  165. Private Function GetDefaultInitialWaitTime()
  166. on error resume next
  167. Dim oRegistry
  168. Set oRegistry = RegConnection()
  169. GetDefaultInitialWaitTime = GetRegkeyValue( objRegistry, _
  170. "SOFTWARE\Microsoft\ServerAppliance\WebFramework",_
  171. "RestartInitialDelay", CONST_DWORD)
  172. If ( GetDefaultInitialWaitTime <= 0 ) Then
  173. GetDefaultInitialWaitTime = THREE_MINUTES
  174. End If
  175. Set oRegistry = Nothing
  176. End Function
  177. Private Function GetDefaultRetryWaitTime()
  178. on error resume next
  179. Dim oRegistry
  180. Set oRegistry = RegConnection()
  181. GetDefaultRetryWaitTime = GetRegkeyValue( objRegistry, _
  182. "SOFTWARE\Microsoft\ServerAppliance\WebFramework",_
  183. "RestartRetryDelay", CONST_DWORD)
  184. If ( GetDefaultRetryWaitTime <= 0 ) Then
  185. GetDefaultRetryWaitTime = FIFTEEN_SECONDS
  186. End If
  187. Set oRegistry = Nothing
  188. End Function
  189. %>