<%@ page import="com.atlassian.johnson.JohnsonEventContainer,
                 java.util.Collection,
                 java.util.Iterator,
                 com.atlassian.johnson.event.Event,
                 com.atlassian.johnson.event.EventType"%>

<html>
	<head>
	<title>Errors</title>
	</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <table border="0" cellpadding="0" cellspacing="0" width=100%>
        <tr>
            <td height = 10></td>
            <%
                JohnsonEventContainer appEventContainer = JohnsonEventContainer.get(pageContext.getServletContext());
                //if there are Events outstanding then display them in a table
                if (appEventContainer != null && appEventContainer.hasEvents() ) {
            %>
                        <content tag="headsection">
                            <meta http-equiv="Refresh" content="1;"/>
                        </content>

                        <font color="cc0000">You cannot access Confluence at present. Look at the table below to identify the reasons</font>
                        <p></p>
                    <br>
                    <table align=center bgcolor="bbbbbb" border="0" cellpadding="0" cellspacing="0" width=100%>
                    <tr>
                        <td>
                            <table  border="0" cellpadding="3" cellspacing="1" width=100%>

                                <tr bgcolor="#f0f0f0">
                                    <td class="colHeaderLink" nowrap>
                                        <b>Time</b>
                                    </td>
                                    <td class="colHeaderLink">
                                        <b>Level</b>
                                    </td>
                                    <td class="colHeaderLink">
                                        <b>Type</b>
                                    </td>
                                    <td class="colHeaderLink" width=40%>
                                        <b>Description</b>
                                    </td>
                                    <td class="colHeaderLink" width=40%>
                                        <b>Exception</b>
                                    </td>
                                </tr>

                                <%
                                    Collection events  = appEventContainer.getEvents();
                                    int counter = 1;
                                    for (Iterator iterator = events.iterator(); iterator.hasNext();)
                                    {
                                        Event event = (Event) iterator.next();

                                        if (counter % 2 == 1) {
                                        %>
                                            <tr bgcolor="#fffff0">
                                        <%} else { %>
                                            <tr bgcolor="#ffffff">
                                        <% } %>
                                            <td nowrap><%=event.getDate()%></td>
                                            <td nowrap><%=event.getLevel()%> </td>
                                            <td nowrap><%=event.getKey()%></td>
                                            <td><%=event.getDesc()%></td>
                                            <td><pre><%=event.getException()==null?"":event.getException()%></pre></td>
                                        </tr>

                                        <% counter++;
                                        }

                                    %>
                            </table>
                        </td>
                    </tr>
                    </table>
                    <br>
                <% } else { %>
                        <p>There are no problems accessing Confluence at present.</p>
                 <% } %>
        </tr>
    </table>
    </body>
</html>
