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.

412 lines
14 KiB

  1. <%@ LANGUAGE="VBSCRIPT"%>
  2. <%Response.Expires = 0%>
  3. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
  4. <html>
  5. <head>
  6. <title>Main Page</title>
  7. <%
  8. Dim objElement
  9. Dim objElementCol
  10. Dim objAlertElementCol
  11. Dim objAlertElement
  12. Dim objResourceElementCol
  13. Dim objResourceElement
  14. Dim objLocMgr
  15. Dim strElementID
  16. Dim strText
  17. Dim strAlertLog
  18. Dim varReplacementStrings
  19. Dim objRetriever
  20. Dim objSaHelper
  21. Dim strCurrentIp
  22. Dim strHostName
  23. Dim strCaptions
  24. Dim strDescriptions
  25. Dim strLongDescriptions
  26. Dim intCaptionID
  27. Dim intDescriptionID
  28. Dim intLongDescriptionID
  29. Dim intResourceWidth
  30. Dim strSourceDll
  31. On Error Resume Next
  32. 'Reset tasks page settings
  33. Session("Task_CurrentPage") = ""
  34. Session("Task_CurrentTask") = ""
  35. Session("Task_FocusItem") = ""
  36. 'Get the hostname and ip address
  37. Set objSaHelper = Server.CreateObject("ServerAppliance.SAHelper")
  38. If Err.Number <> 0 Then
  39. strCurrentIp = "UNKNOWN"
  40. strHostName = "UNKNOWN"
  41. Else
  42. strCurrentIp = objSaHelper.IpAddress
  43. If Err.Number <> 0 Then
  44. strCurrentIp = "UNKNOWN"
  45. End If
  46. strHostName = objSaHelper.HostName
  47. If Err.Number <> 0 Then
  48. strHostName = "UNKNOWN"
  49. End If
  50. End If
  51. Set objSaHelper = Nothing
  52. Err.Clear
  53. 'Create elementmgr and get current alerts
  54. Set objRetriever = Server.CreateObject("Elementmgr.ElementRetriever")
  55. If Err.Number = 0 Then
  56. Set objResourceElementCol = objRetriever.GetElements(1, "LOCAL_UI_RESOURCE")
  57. intResourceWidth = 0
  58. If Err.Number = 0 Then
  59. intResourceWidth = objResourceElementCol.Count * 16
  60. End If
  61. Set objElementCol = objRetriever.GetElements(1, "SA_Alerts")
  62. If objElementCol.Count=0 or Err.Number <> 0 Then
  63. Err.Clear
  64. strCaptions = ""
  65. strDescriptions = ""
  66. strLongDescriptions = ""
  67. Else
  68. 'get alert definitions
  69. Set objAlertElementCol = objRetriever.GetElements(1,"LocalUIAlertDefinitions")
  70. 'create localization manager to get alert strings
  71. Set objLocMgr = Server.CreateObject("ServerAppliance.LocalizationManager")
  72. If (Err.Number <> 0) Then
  73. Err.Clear
  74. strCaptions = ""
  75. strDescriptions = ""
  76. strLongDescriptions = ""
  77. Else
  78. For Each objElement in objElementCol
  79. strAlertLog = objElement.GetProperty("AlertLog")
  80. strElementID = "LocalUIAlertDefinitions" & strAlertLog & Hex(objElement.GetProperty("AlertID"))
  81. strText = ""
  82. Err.Clear
  83. Set objAlertElement = objAlertElementCol.Item(strElementID)
  84. If Err <> 0 Then
  85. Set objAlertElement = Nothing
  86. Else
  87. strSourceDll = objAlertElement.GetProperty("Source")
  88. intCaptionID = "&H" & objAlertElement.GetProperty("CaptionRID")
  89. intDescriptionID = "&H" & objAlertElement.GetProperty("DescriptionRID")
  90. intLongDescriptionID = "&H" & objAlertElement.GetProperty("LongDetailRID")
  91. varReplacementStrings = objElement.GetProperty("ReplacementStrings")
  92. strText = ""
  93. strText = objLocMgr.GetString(strSourceDll, intCaptionID, varReplacementStrings)
  94. If strText<> "" Then
  95. strCaptions = strCaptions & "<option>" & strText
  96. strText = ""
  97. strText = objLocMgr.GetString(strSourceDll, intDescriptionID, varReplacementStrings)
  98. strDescriptions = strDescriptions & "<option>" & strText
  99. strText = ""
  100. strText = objLocMgr.GetString(strSourceDll, intLongDescriptionID, varReplacementStrings)
  101. strLongDescriptions = strLongDescriptions & "<option>" & strText
  102. End If
  103. End If
  104. Next
  105. End If
  106. End If
  107. End If
  108. Set objLocMgr = Nothing
  109. Set objElement = Nothing
  110. Set objElementCol = Nothing
  111. Set objAlertElement = Nothing
  112. Set objAlertElementCol = Nothing
  113. %>
  114. <SCRIPT LANGUAGE="VBScript">
  115. <!--
  116. Option Explicit
  117. public iCurrentPage
  118. public iPageCount
  119. public iFocus
  120. public iTimeOut
  121. Sub window_onload
  122. Dim objKeypad
  123. Dim iAlertCount
  124. Set objKeypad = CreateObject("Ldm.SAKeypadController")
  125. objKeypad.Setkey 0,9,TRUE
  126. objKeypad.Setkey 1,9,FALSE
  127. objKeypad.Setkey 2,37,FALSE
  128. objKeypad.Setkey 3,39,FALSE
  129. objKeypad.Setkey 4,0,FALSE
  130. objKeypad.Setkey 5,13,FALSE
  131. set objKeypad = Nothing
  132. iAlertCount = alerts.length
  133. If PageCount.value <> "" Then
  134. iPageCount = CInt(PageCount.value)
  135. Else
  136. iPageCount = 0
  137. End If
  138. If FocusItem.value <> "" Then
  139. iFocus = CInt(FocusItem.value)
  140. Else
  141. iFocus = 0
  142. End If
  143. If CurrentPage.value <> "" Then
  144. iCurrentPage = CInt(CurrentPage.value)
  145. Else
  146. iCurrentPage = 0
  147. End If
  148. If iAlertCount > 0 Then
  149. 'check if all of the alerts fit one page
  150. If iAlertCount = 1 Then
  151. iPageCount = 1
  152. alert1.innertext = alerts.options(0).text
  153. alert1.hRef = "localui_alertview.asp?Description="+longdescriptions.options(0).text
  154. If descriptions.options(0).text <> "" Then
  155. desc1.style.display = ""
  156. desc1.innertext = descriptions.options(0).text
  157. End If
  158. End If
  159. If iAlertCount = 2 Then
  160. If descriptions.options(0).text = "" or descriptions.options(1).text = "" Then
  161. iPageCount = 1
  162. alert1.innertext = alerts.options(0).text
  163. alert1.hRef = "localui_alertview.asp?Description="+longdescriptions.options(0).text
  164. If descriptions.options(0).text <> "" Then
  165. desc1.innertext = descriptions.options(0).text
  166. alert3.innertext = alerts.options(1).text
  167. alert3.hRef = "localui_alertview.asp?Description="+longdescriptions.options(1).text
  168. Else
  169. alert2.innertext = alerts.options(1).text
  170. alert2.hRef = "localui_alertview.asp?Description="+longdescriptions.options(1).text
  171. desc2.innertext = descriptions.options(1).text
  172. End If
  173. End If
  174. End If
  175. If iAlertCount = 3 Then
  176. If descriptions.options(0).text = "" and descriptions.options(1).text = "" and descriptions.options(2).text = "" Then
  177. iPageCount = 1
  178. alert1.innertext = alerts.options(0).text
  179. alert1.hRef = "localui_alertview.asp?Description="+longdescriptions.options(0).text
  180. alert2.innertext = alerts.options(1).text
  181. alert2.hRef = "localui_alertview.asp?Description="+longdescriptions.options(1).text
  182. alert3.innertext = alerts.options(2).text
  183. alert3.hRef = "localui_alertview.asp?Description="+longdescriptions.options(2).text
  184. End If
  185. End If
  186. If iPageCount <> 1 or iAlertCount > 3 Then
  187. iPageCount = iAlertCount
  188. alert1.innertext = alerts.options(iCurrentPage).text
  189. alert1.hRef = "localui_alertview.asp?Description="+longdescriptions.options(iCurrentPage).text
  190. If descriptions.options(iCurrentPage).text <> "" Then
  191. desc1.innertext = descriptions.options(iCurrentPage).text
  192. End If
  193. page.style.display = ""
  194. page.innertext = (iCurrentPage+1)&" of "&(iPageCount)
  195. End If
  196. If iFocus = 0 Then
  197. alert1.focus
  198. End If
  199. If iFocus = 1 Then
  200. alert2.focus
  201. End If
  202. If iFocus = 2 Then
  203. alert3.focus
  204. End If
  205. If iFocus = -1 Then
  206. taskslink.focus
  207. End If
  208. PageCount.value = iPageCount
  209. End If
  210. If iAlertCount = 0 Then
  211. logo.style.display = ""
  212. taskslink.focus
  213. End If
  214. iTimeOut = window.SetTimeOut("TimerSub(1)",5000)
  215. End Sub
  216. Sub TimerSub(iIndex)
  217. if iIndex = 1 then
  218. IpInfo.innertext = "<%=strCurrentIp%>"
  219. iTimeOut = window.SetTimeOut("TimerSub(0)",5000)
  220. else
  221. iTimeOut = window.SetTimeOut("TimerSub(1)",5000)
  222. IpInfo.innertext = "<%=strHostName%>"
  223. end if
  224. End Sub
  225. Sub keydown()
  226. If iPageCount > 1 Then
  227. 'right arrow
  228. If window.event.keycode = 39 Then
  229. iCurrentPage = iCurrentPage + 1
  230. if iCurrentPage = iPageCount then
  231. iCurrentPage = 0
  232. End If
  233. desc1.style.display = "none"
  234. alert1.style.display = ""
  235. alert1.innertext = alerts.options(iCurrentPage).text
  236. alert1.hRef = "localui_alertview.asp?Description="+longdescriptions.options(iCurrentPage).text
  237. If descriptions.options(iCurrentPage).text <> "" Then
  238. desc1.style.display = ""
  239. desc1.innertext = descriptions.options(iCurrentPage).text
  240. End If
  241. page.innertext = (iCurrentPage+1)&" of "&(iPageCount)
  242. PageCount.value = iPageCount
  243. CurrentPage.value = iCurrentPage
  244. End If
  245. 'left arrow
  246. If window.event.keycode = 37 Then
  247. iCurrentPage = iCurrentPage - 1
  248. if iCurrentPage = -1 then
  249. iCurrentPage = iPageCount-1
  250. End If
  251. desc1.style.display = "none"
  252. alert1.style.display = ""
  253. alert1.innertext = alerts.options(iCurrentPage).text
  254. alert1.hRef = "localui_alertview.asp?Description="+longdescriptions.options(iCurrentPage).text
  255. If descriptions.options(iCurrentPage).text <> "" Then
  256. desc1.style.display = ""
  257. desc1.innertext = descriptions.options(iCurrentPage).text
  258. End If
  259. page.innertext = (iCurrentPage+1)&" of "&(iPageCount)
  260. PageCount.value = iPageCount
  261. CurrentPage.value = iCurrentPage
  262. End If
  263. end if
  264. end sub
  265. Sub ArrowVisible(intIndex)
  266. FocusItem.value = intIndex
  267. If intIndex <> -1 Then
  268. indicator.style.top = intIndex * 12 + 1
  269. indicator.style.display = ""
  270. Else
  271. indicator.style.display = "none"
  272. End If
  273. End Sub
  274. Sub GotoTasksPage()
  275. window.event.returnValue = false
  276. window.navigate "localui_tasks.asp?PageCount="+PageCount.value+"&"+"CurrentPage="+CurrentPage.value+"&"+"FocusItem="+FocusItem.value
  277. End Sub
  278. Sub AlertNotifier_AlertStatusChanged()
  279. window.navigate "localui_main.asp"
  280. End Sub
  281. -->
  282. </SCRIPT>
  283. </head>
  284. <body RIGHTMARGIN=0 LEFTMARGIN=0>
  285. <select id="alerts" STYLE="display:none;">
  286. <%=strCaptions%>
  287. </select>
  288. <select id="descriptions" STYLE="display:none;">
  289. <%=strDescriptions%>
  290. </select>
  291. <select id="longdescriptions" STYLE="display:none;">
  292. <%=strLongDescriptions%>
  293. </select>
  294. <IMG id="logo" STYLE="position:absolute; top:0; left=0; display:none"
  295. SRC="localui_salogo.bmp" BORDER=0>
  296. <IMG id="indicator" STYLE="position:absolute; top:0; left=0; display:none"
  297. SRC="localui_indicator.bmp" BORDER=0>
  298. <A STYLE="position:absolute; top:0; left:10; font-size:10; font-family=arial;"
  299. id="alert1" OnFocus="ArrowVisible(0)" HIDEFOCUS=true onkeydown="keydown">
  300. </A>
  301. <A STYLE="position:absolute; top:12; left:10; font-size:10; font-family=arial;"
  302. id="alert2" OnFocus="ArrowVisible(1)" HIDEFOCUS=true onkeydown="keydown">
  303. </A>
  304. <A STYLE="position:absolute; top:24; left:10; font-size:10; font-family=arial;"
  305. id="alert3" OnFocus="ArrowVisible(2)" HIDEFOCUS=true onkeydown="keydown">
  306. </A>
  307. <A STYLE="position:absolute; top:12; left:10; font-size:10; font-family=arial;"
  308. id="desc1" onkeydown="keydown">
  309. </A>
  310. <A STYLE="position:absolute; top:24; left:10; font-size:10; font-family=arial;"
  311. id="desc2" onkeydown="keydown">
  312. </A>
  313. <A id="IpInfo" STYLE="position:absolute; top:36; left:0; font-size:11; font-family=arial;">
  314. <%=strHostName%>
  315. </A>
  316. <A id="page" STYLE="position:absolute; top:36; right:0; font-size:11; font-family=arial; display:none;">
  317. page info
  318. </A>
  319. <A id="taskslink" href="localui_tasks.asp" onkeydown="keydown" OnFocus="ArrowVisible(-1)" OnClick="GotoTasksPage()">
  320. <IMG STYLE="position:absolute; top:48; right=0;" SRC="localui_satask.bmp" BORDER=0>
  321. </A>
  322. <INPUT TYPE=HIDDEN Name="PageCount" value="<%=Session("Main_PageCount")%>">
  323. <INPUT TYPE=HIDDEN Name="CurrentPage" value="<%=Session("Main_CurrentPage")%>">
  324. <INPUT TYPE=HIDDEN Name="FocusItem" value="<%=Session("Main_FocusItem")%>">
  325. <OBJECT TABINDEX=-1 STYLE="display=none;"
  326. ID="AlertNotifier" CLASSID="CLSID:F9EBACD8-FE51-4dda-9742-E4D666B76C72">
  327. </OBJECT>
  328. <%
  329. If intResourceWidth <> 0 Then
  330. Response.Write "<OBJECT TABINDEX=-1 STYLE=""position:absolute; top:48; left=0;WIDTH=" & intResourceWidth & "; HEIGHT=16;"" "
  331. Response.Write "ID=""ResCtrl"" CLASSID=""CLSID:2FE9659A-53CB-4B06-9416-0276113F3106""></OBJECT>"
  332. End If
  333. %>
  334. </body>
  335. </html>