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.

173 lines
5.0 KiB

  1. <!-- #include file="sh_page.asp" -->
  2. <%
  3. '----------------------------------------------------------------------------
  4. '
  5. ' Function : GetHighestAlert
  6. '
  7. ' Synopsis : Returns the level of the highest alert that is active
  8. '
  9. ' Arguments: None
  10. '
  11. ' Returns : Alert level
  12. '
  13. ' Copyright (c) Microsoft Corporation. All rights reserved.
  14. '
  15. '----------------------------------------------------------------------------
  16. Function GetHighestAlert()
  17. on error resume next
  18. Err.Clear
  19. Dim objElement
  20. Dim objElementCol
  21. Dim intCurrentAlertType
  22. Dim intHighestAlertType
  23. Dim iAlertType
  24. intHighestAlertType = 0
  25. Set objElementCol = GetElements("SA_Alerts")
  26. If objElementCol.Count=0 or Err.Number <> 0 Then
  27. Call SA_TraceOut(SA_GetScriptFileName(), "No alerts found...")
  28. Err.Clear
  29. Else
  30. For Each objElement in objElementCol
  31. iAlertType = objElement.GetProperty("AlertType")
  32. If ( Err.Number <> 0 ) Then
  33. Call SA_TraceOut(SA_GetScriptFileName(), "objElement.GetProperty(AlertType) Error: " + CStr(Hex(Err.Number)) + " " + Err.Description)
  34. Call SA_TraceOut(SA_GetScriptFileName(), "For Alert ElementID: " + CStr(objElement.GetProperty("ElementID")))
  35. Err.Clear
  36. Else
  37. 'Call SA_TraceOut(SA_GetScriptFileName(), "AlertType: " + CStr(iAlertType))
  38. Select Case (iAlertType)
  39. Case 0
  40. intCurrentAlertType = 2 'warning
  41. Case 1
  42. intCurrentAlertType = 1 'critical
  43. Case 2
  44. intCurrentAlertType = 3 'informational
  45. Case else
  46. intCurrentAlertType = 3 'informational
  47. Call SA_TraceOut(SA_GetScriptFileName(), "Unexpected AlertType: " + CStr(iAlertType))
  48. End Select
  49. If intHighestAlertType = 0 Then
  50. intHighestAlertType = intCurrentAlertType
  51. Else
  52. If intHighestAlertType > intCurrentAlertType Then
  53. intHighestAlertType = intCurrentAlertType
  54. End If
  55. End If
  56. End If
  57. Next
  58. End If
  59. Set objElement = Nothing
  60. Set objElementCol = Nothing
  61. GetHighestAlert = intHighestAlertType
  62. End Function
  63. Dim imagePath
  64. Dim StatusText
  65. Dim StatusClass
  66. Dim L_NORMAL_TEXT
  67. Dim L_CRITICAL_TEXT
  68. Dim L_WARNING_TEXT
  69. Dim L_INFORMATION_TEXT
  70. Dim L_STATUS_TEXT
  71. Dim L_PAGETITLE_TEXT
  72. Dim L_PAGE_STATUS_TEXT
  73. L_PAGETITLE_TEXT = GetLocString("sacoremsg.dll", "40200BBF", "")
  74. L_PAGE_STATUS_TEXT = SA_EncodeQuotes(GetLocString("sacoremsg.dll", "40200BC0", ""))
  75. L_NORMAL_TEXT = GetLocString("sacoremsg.dll", "40200BC1", "")
  76. L_CRITICAL_TEXT = GetLocString("sacoremsg.dll", "40200BC2", "")
  77. L_WARNING_TEXT = GetLocString("sacoremsg.dll", "40200BC3", "")
  78. L_INFORMATION_TEXT = GetLocString("sacoremsg.dll", "40200BC4", "")
  79. L_STATUS_TEXT = GetLocString("sacoremsg.dll", "40200BC5", "")
  80. Dim iHighestAlert
  81. iHighestAlert = GetHighestAlert()
  82. 'Call SA_TraceOut(SA_GetScriptFileName(), "Highest AlertType: " + CStr(iHighestAlert))
  83. Select Case iHighestAlert
  84. Case 0 'none
  85. imagePath = ""
  86. StatusText = L_NORMAL_TEXT
  87. StatusClass = "StatusNormal"
  88. Case 1 'critical
  89. imagePath = "images/critical_error.gif"
  90. StatusText = L_CRITICAL_TEXT
  91. StatusClass = "StatusCritical"
  92. Case 2 'warning
  93. imagePath = "images/alert.gif"
  94. StatusText = L_WARNING_TEXT
  95. StatusClass = "StatusWarning"
  96. Case 3 'informational
  97. imagePath = "images/information.gif"
  98. StatusText = L_INFORMATION_TEXT
  99. StatusClass = "StatusInformational"
  100. Case Else
  101. Call SA_TraceOut(SA_GetScriptFileName(), "Unexpected alert type: " + CStr(iHighestAlert))
  102. imagePath = ""
  103. StatusText = L_NORMAL_TEXT
  104. StatusClass = "StatusNormal"
  105. End Select
  106. Dim strStatusPageURL
  107. strStatusPageURL = "/admin/statuspage.asp?Tab1=TabsStatus&" & _
  108. SAI_FLD_PAGEKEY & "=" & SAI_GetPageKey()
  109. %>
  110. <!-- Copyright (c) Microsoft Corporation. All rights reserved.-->
  111. <HTML>
  112. <meta http-equiv="Content-Type" content="text/html; charset=<%=GetCharSet()%>">
  113. <HEAD>
  114. <meta HTTP-EQUIV="Refresh" CONTENT="30">
  115. <%
  116. Call SA_EmitAdditionalStyleSheetReferences("")
  117. %>
  118. <TITLE><%=L_PAGETITLE_TEXT%></TITLE>
  119. <SCRIPT LANGUAGE="JavaScript" SRC="<%=m_VirtualRoot%>sh_page.js"></SCRIPT>
  120. <SCRIPT LANGUAGE="JavaScript">
  121. function ShowExampleStatus(description)
  122. {
  123. window.status = description;
  124. return true;
  125. }
  126. </SCRIPT>
  127. </HEAD>
  128. <BODY class=StatusBar marginWidth="0" marginHeight="0" onDragDrop="return false;" topmargin="0" LEFTMARGIN="0" xoncontextmenu="//return false;">
  129. <SCRIPT LANGUAGE=javascript>
  130. function OkayToChangeTabs()
  131. {
  132. SA_IsOkToChangePage();
  133. }
  134. </SCRIPT>
  135. <table title="<%=Server.HTMLEncode(L_PAGETITLE_TEXT)%>" border=0 cellspacing=0 onmouseover="return ShowExampleStatus('<%=L_PAGE_STATUS_TEXT%>' );" onmouseout="return ShowExampleStatus('');" ><tr>
  136. <% If imagePath <> "" Then %>
  137. <td><a href='<%=strStatusPageURL%>' target="_top" onclick="return OkayToChangeTabs()" class="<%=StatusClass%>">
  138. <img border=0 src="<%=imagePath%>"></a></td>
  139. <% End If %>
  140. <td><a href='<%=strStatusPageURL%>' target="_top" onclick="return OkayToChangeTabs()" class="<%=StatusClass%>">
  141. <%=L_STATUS_TEXT%>:&nbsp;<%=StatusText%></a></td>
  142. </tr></table>
  143. </BODY>
  144. </HTML>