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.

216 lines
4.3 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <%
  4. '==================================================
  5. ' Terminal Services Web Client
  6. '
  7. ' Copyright (c) Microsoft Corporation. All rights reserved.
  8. '
  9. '==================================================
  10. %>
  11. <!-- #include virtual="/admin/sh_page.asp" -->
  12. <%
  13. Function GetPathToHost()
  14. GetPathToHost = m_VirtualRoot
  15. End Function
  16. Function GetUserName()
  17. Dim domainAndUser
  18. Dim loginUser
  19. Dim user
  20. loginUser = Request.ServerVariables("LOGON_USER")
  21. domainAndUser = Split(loginUser, "\")
  22. If IsArray(domainAndUser) Then
  23. GetUserName = domainAndUser(UBound(domainAndUser))
  24. Else
  25. GetUserName = loginUser
  26. End If
  27. End Function
  28. %>
  29. <%
  30. Dim WinNTSysInfo 'Getting object
  31. Dim strComputerName(1) 'Computer name
  32. DIM L_PAGETITLE_TEXT
  33. DIM L_WINCLIENT_ERROR
  34. L_WINCLIENT_ERROR = GetLocString("tserver.dll", "40420005", "")
  35. Set WinNTSysInfo = CreateObject("WinNTSystemInfo")
  36. strComputerName(0) = WinNTSysInfo.ComputerName
  37. L_PAGETITLE_TEXT = GetLocString("tserver.dll", "40420004", strComputerName )
  38. Dim L_ERRMSG_TITLE
  39. Dim L_ERRMSG_PROMPT
  40. Dim L_TSERVER_LOADOCX_ERROR_MSG
  41. L_ERRMSG_TITLE = GetLocString("tserver.dll", "40420007", "")
  42. L_ERRMSG_PROMPT = GetLocString("tserver.dll", "40420006", strComputerName)
  43. L_TSERVER_LOADOCX_ERROR_MSG = GetLocString("tserver.dll", "40420008", "")
  44. ServePage
  45. %>
  46. <%
  47. Function ServeContent()
  48. %>
  49. <script language="JavaScript">
  50. function ValidatePage()
  51. {
  52. return true;
  53. }
  54. function Init()
  55. {
  56. }
  57. function SetData()
  58. {
  59. }
  60. </script>
  61. <%
  62. If ( IsIE() AND InStr( Request.ServerVariables("HTTP_USER_AGENT"), "Windows")) Then
  63. %>
  64. <script language="VBScript">
  65. Sub window_onLoad()
  66. on error resume next
  67. Err.Clear
  68. If not "<%Response.Write(GetServerName())%>" = "" Then
  69. srvName = "<%Response.Write(GetServerName()) %>"
  70. Else
  71. srvName = Document.location.hostname
  72. End If
  73. Dim objMsTsc
  74. objMsTsc = Document.all("MsTsc")
  75. If ( Err.Number <> 0 ) Then
  76. Else
  77. Document.all.MsTsc.Server = srvName
  78. Document.all.MsTsc.UserName = "<%=GetUserName()%>"
  79. Document.all.MsTsc.Connect()
  80. End If
  81. End Sub
  82. sub MsTsc_OnDisconnected(disconnectCode)
  83. if not disconnectCode = 2 then
  84. msgbox "<%Response.Write(L_ERRMSG_PROMPT) %>", , "<%Response.Write(L_ERRMSG_TITLE) %>"
  85. Window.close()
  86. 'Window.History.back()
  87. else
  88. Window.close()
  89. 'Window.Navigate("<%=m_VirtualRoot + "tasks.asp?tab1=TabMaintenance"%>")
  90. end if
  91. end sub
  92. </script>
  93. <%
  94. End If
  95. %>
  96. <center>
  97. <table>
  98. <tr>
  99. <%
  100. If ( IsIE() AND InStr( Request.ServerVariables("HTTP_USER_AGENT"), "Windows")) Then
  101. %>
  102. <OBJECT language="vbscript" ID="MsTsc"
  103. CLASSID="CLSID:9059f30f-4eb1-4bd2-9fdc-36f43a218f4a"
  104. CODEBASE="<%=SAI_GetTSClientCodeBase()%>"
  105. <%
  106. Dim resWidth
  107. resWidth = Request.QueryString("rW")
  108. If resWidth < 200 or resWidth > 1600 Then
  109. resWidth = 800
  110. End If
  111. Response.Write("WIDTH="+CStr(resWidth)+" ")
  112. Dim resHeight
  113. resHeight = Request.QueryString("rH")
  114. If resHeight < 200 or resHeight > 1200 Then
  115. resHeight = 600
  116. End If
  117. Response.Write("HEIGHT="+CStr(resHeight) + " " )
  118. %>
  119. </OBJECT>
  120. <%
  121. End If
  122. %>
  123. </tr>
  124. </table>
  125. </center>
  126. <%
  127. End Function
  128. %>
  129. <%
  130. Sub ServePage
  131. %>
  132. <HTML>
  133. <head>
  134. <meta http-equiv="Content-Type" content="text/html; charset=<%=GetCharSet()%>">
  135. <TITLE><%=L_PAGETITLE_TEXT%></TITLE>
  136. <%
  137. Call SA_EmitAdditionalStyleSheetReferences("")
  138. %>
  139. <SCRIPT LANGUAGE="JavaScript" SRC="<%=m_VirtualRoot%>sh_page.js"></SCRIPT>
  140. </HEAD>
  141. <BODY marginWidth ="0" marginHeight="0" onDragDrop="return false;" topmargin="0" LEFTMARGIN="0" oncontextmenu="//return false;">
  142. <%
  143. Dim bIsSupported
  144. bIsSupported = false
  145. '
  146. ' The Terminal Server ActiveX control is only supported on Windows Clients
  147. ' running Internet Explorer.
  148. '
  149. If IsIE() Then
  150. If InStr( Request.ServerVariables("HTTP_USER_AGENT"), "Windows") Then
  151. bIsSupported = true
  152. End If
  153. End If
  154. If ( bIsSupported ) Then
  155. ServeContent
  156. Else
  157. Response.Write("<br><blockquote>")
  158. Response.Write("<H2>"+Server.HTMLEncode(L_WINCLIENT_ERROR)+"</H2>")
  159. Response.Write("</blockquote>")
  160. End If
  161. %>
  162. </BODY>
  163. </HTML>
  164. <%
  165. End Sub
  166. %>