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.

273 lines
7.8 KiB

  1. <% '==================================================
  2. ' Microsoft Server Appliance
  3. ' Alert Viewer page
  4. ' Copyright (c) Microsoft Corporation. All rights reserved.
  5. '==================================================%>
  6. <!-- Copyright (c) Microsoft Corporation. All rights reserved.-->
  7. <!-- #include file="inc_framework.asp" -->
  8. <%
  9. Dim L_ALERT_DETAILS_MESSAGE
  10. Dim L_NOALERTS_MESSAGE
  11. Dim L_PAGETITLE
  12. L_PAGETITLE = Request.QueryString("Title")
  13. If ( Len(L_PAGETITLE) <= 0 ) Then
  14. L_PAGETITLE = GetLocString("sakitmsg.dll", "4001000F", "")
  15. End If
  16. L_ALERT_DETAILS_MESSAGE = GetLocString("sakitmsg.dll", "40010011", "")
  17. L_NOALERTS_MESSAGE = GetLocString("sakitmsg.dll", "40010010", "")
  18. %>
  19. <HTML>
  20. <meta http-equiv="Content-Type" content="text/html; charset=<%=GetCharSet()%>">
  21. <HEAD>
  22. <TITLE><%=Server.HtmlEncode(L_PAGETITLE)%></TITLE>
  23. <meta HTTP-EQUIV="Refresh" CONTENT="60">
  24. <%
  25. Call SA_EmitAdditionalStyleSheetReferences("")
  26. %>
  27. <SCRIPT LANGUAGE="JavaScript" SRC="<%=m_VirtualRoot%>sh_page.js"></SCRIPT>
  28. </HEAD>
  29. <BODY marginWidth="0" marginHeight="0" onDragDrop="return false;" topmargin="0" LEFTMARGIN="0" oncontextmenu="//return false;">
  30. <%
  31. Call ServeAlerts()
  32. %>
  33. </BODY>
  34. </HTML>
  35. <%
  36. '----------------------------------------------------------------------------
  37. '
  38. ' Function : ServeAlerts
  39. '
  40. ' Synopsis : Serves the messages
  41. '
  42. ' Arguments: None
  43. '
  44. ' Returns : None
  45. '
  46. '----------------------------------------------------------------------------
  47. Function ServeAlerts
  48. Call ServeStandardHeaderBar(L_PAGETITLE, "")
  49. Response.Write("<div class='PageBodyInnerIndent'>")
  50. Call ServeAlertHTML()
  51. Response.Write("</div>")
  52. End Function
  53. '----------------------------------------------------------------------------
  54. '
  55. ' Function : ServeAlertHTML
  56. '
  57. ' Synopsis : Generate HTML for the messages
  58. '
  59. ' Arguments: None
  60. '
  61. ' Returns : None
  62. '
  63. '----------------------------------------------------------------------------
  64. Function ServeAlertHTML()
  65. on error resume next
  66. Err.Clear
  67. Dim objElement
  68. Dim objElementCol
  69. Dim objAlertElementCol
  70. Dim objAlertElement
  71. Dim strElementID
  72. Dim strMsg
  73. Dim strAlertURL
  74. Dim strAlertSrc
  75. Dim arrAlerts()
  76. Dim strViewer
  77. Dim strDefaultViewer
  78. Dim strReturnURL
  79. Dim varReplacementStrings
  80. Dim i, j
  81. Dim blnSameType
  82. Dim sDefaultTarget
  83. Dim sAlertDefContainer
  84. Dim oValidator
  85. Dim oEncoder
  86. Set oValidator = New CSAValidator
  87. Set oEncoder = New CSAEncoder
  88. sDefaultTarget = Request.QueryString("ContentTarget")
  89. If ( Len(sDefaultTarget) > 0 ) Then
  90. If ( oValidator.IsValidIdentifier(sDefaultTarget) ) Then
  91. sDefaultTarget = " target='" + sDefaultTarget + "' "
  92. Else
  93. Call SA_TraceOut("sh_alertpanel.asp", "Function ServeAlertHTML detected invalid QueryString(ContentTarget) parameter: " & sDefaultTarget)
  94. sDefaultTarget = ""
  95. End If
  96. End If
  97. strReturnURL = Request.QueryString("ReturnURL")
  98. sAlertDefContainer = Request.QueryString("AlertContainer")
  99. If ( Len(sAlertDefContainer) <= 0 ) Then
  100. sAlertDefContainer = "AlertDefinitions"
  101. End If
  102. %>
  103. <table width="80%" class="PageBody" border="0" cellspacing="0">
  104. <%
  105. Set objElementCol = GetElements("SA_Alerts")
  106. If objElementCol.Count=0 or Err.Number <> 0 Then
  107. If ( Err.Number <> 0 ) Then
  108. Call SA_TraceOut("SH_ALERTVIEWER", "GetElements(SA_Alerts) failed: " + CStr(Hex(Err.Number)) + " " + Err.Description)
  109. End If
  110. Err.Clear
  111. %>
  112. <tr>
  113. <td width="30" height="28" VALIGN="middle">&nbsp;</td>
  114. <td width="25" HEIGHT="28" VALIGN="middle">&nbsp;</TD>
  115. <TD HEIGHT="28" VALIGN="middle" class="PageBody"><%=Server.HtmlEncode(L_NOALERTS_MESSAGE)%></TD>
  116. </tr>
  117. <%
  118. Else
  119. Set objAlertElementCol = GetElements(sAlertDefContainer)
  120. If ( Err.Number <> 0 ) Then
  121. Call SA_TraceOut("SH_ALERTVIEWER", "GetElements(AlertDefinitions) failed: " + CStr(Hex(Err.Number)) + " " + Err.Description)
  122. End If
  123. i = 0
  124. blnSameType = True
  125. ReDim arrAlerts(objElementCol.Count, 3)
  126. For Each objElement in objElementCol
  127. Err.Clear
  128. strAlertSrc = objElement.GetProperty("AlertLog")
  129. strElementID = strAlertSrc & Hex(objElement.GetProperty("AlertID"))
  130. strMsg = ""
  131. Err.Clear
  132. Set objAlertElement = objAlertElementCol.Item(sAlertDefContainer+strElementID)
  133. If ( Err.Number <> 0 ) Then
  134. Err.Clear
  135. Set objAlertElement = objAlertElementCol.Item(strElementID)
  136. If (Err.Number <> 0) Then
  137. Set objAlertElement = Nothing
  138. End If
  139. Else
  140. strAlertSrc = objAlertElement.GetProperty("Source")
  141. End If
  142. If ( objAlertElement <> Nothing ) Then
  143. varReplacementStrings = objElement.GetProperty("ReplacementStrings")
  144. strMsg = GetLocString(strAlertSrc, objAlertElement.GetProperty("CaptionRID"), varReplacementStrings)
  145. arrAlerts(i, 0) = strMsg
  146. arrAlerts(i, 1) = objElement.GetProperty("Cookie")
  147. arrAlerts(i, 2) = objElement.GetProperty("AlertType")
  148. arrAlerts(i, 3) = Trim(objAlertElement.GetProperty("URL"))
  149. ' adjust alert types for the current display sort order
  150. Select Case arrAlerts(i, 2)
  151. Case 0
  152. arrAlerts(i, 2) = 2
  153. Case 1
  154. arrAlerts(i, 2) = 1
  155. Case 2
  156. arrAlerts(i, 2) = 3
  157. Case Else
  158. Call SA_TraceOut(SA_GetScriptFileName(), "Unexpected AlertType: " + CStr(arrAlerts(i, 2)))
  159. arrAlerts(i, 2) = 3
  160. End Select
  161. If i > 0 Then
  162. If arrAlerts(i, 2) <> arrAlerts(i-1, 2) Then
  163. blnSameType = False
  164. End If
  165. End If
  166. i = i + 1
  167. End If
  168. Next
  169. ReDim Preserve arrAlerts(i,3)
  170. ' sort by Type if needed
  171. If Not blnSameType Then
  172. QuickSort arrAlerts, LBound(arrAlerts,1), UBound(arrAlerts,1)-1, 2
  173. End If
  174. strDefaultViewer = m_VirtualRoot & "sh_alertdetails.asp"
  175. Call SA_MungeURL( strDefaultViewer, "AlertDefinitions", sAlertDefContainer)
  176. 'strReturnURL = GetScriptPath()
  177. 'strReturnURL = ""
  178. For i = 0 To UBound(arrAlerts,1)
  179. strMsg = arrAlerts(i, 0)
  180. If strMsg <> "" Then
  181. If arrAlerts(i, 3) <> "" Then
  182. strViewer = arrAlerts(i, 3)
  183. Else
  184. strViewer = strDefaultViewer
  185. End If
  186. strAlertURL = strViewer
  187. Call SA_MungeURL( strAlertURL, "Tab1", GetTab1())
  188. Call SA_MungeURL( strAlertURL, "Tab2", GetTab2())
  189. Call SA_MungeURL( strAlertURL, "Cookie", CStr(arrAlerts(i, 1)) )
  190. Call SA_MungeURL( strAlertURL, "ReturnURL", strReturnURL)
  191. Call SA_MungeURL( strAlertURL, "R", CStr(Rnd))
  192. Call SA_MungeURL( strAlertURL, SAI_FLD_PAGEKEY, SAI_GetPageKey())
  193. %>
  194. <tr>
  195. <td class="PageBody" width="25" height="28" align=left>
  196. <img
  197. src="<% Select Case arrAlerts(i, 2)
  198. Case 2 ' 0 SA_ALERT_TYPE_MALFUNCTION,
  199. Response.Write m_VirtualRoot & "images/alert.gif"
  200. Case 1 '1 SA_ALERT_TYPE_FAILURE,
  201. Response.Write m_VirtualRoot & "images/critical_error.gif"
  202. Case 3 '2 SA_ALERT_TYPE_ATTENTION
  203. Response.Write m_VirtualRoot & "images/information.gif"
  204. Case Else
  205. Call SA_TraceOut(SA_GetScriptFileName(), "Unexpected AlerType: " + CStr(arrAlerts(i, 2)))
  206. Response.Write m_VirtualRoot & "images/information.gif"
  207. End Select %>">
  208. </td>
  209. <td class="PageBody" align=left valign=middle>
  210. <A class="PageBodyLink" <%=sDefaultTarget%> href=<%=oEncoder.EncodeAttribute(strAlertURL)%>
  211. title=<%=oEncoder.EncodeAttribute(L_ALERT_DETAILS_MESSAGE)%>
  212. onMouseOver="window.status='<%=Server.HTMLEncode(EscapeQuotes(L_ALERTDETAILS_MESSAGE))%>';return true;">
  213. <%=oEncoder.EncodeElement(arrAlerts(i,0))%>
  214. </A>
  215. </td>
  216. </tr>
  217. <% End If
  218. Next
  219. End If
  220. Response.Write "</table>"
  221. Set oEncoder = Nothing
  222. Set oValidator = Nothing
  223. Set objElement = Nothing
  224. Set objElementCol = Nothing
  225. Set objAlertElement = Nothing
  226. Set objAlertElementCol = Nothing
  227. End Function
  228. %>