<%@ page contentType="text/html; charset=euc-kr" %>
<jsp:directive.page import="java.util.*"/>
<jsp:directive.page import="org.kldp.ebmsh.moniter.failHandler.FailMessageManager"/>
<jsp:directive.page import="org.kldp.ebmsh.moniter.failHandler.EngineFailMessageInfo"/>

<script>
	function faultMessageSubmit(form) {
		if( form.bizboxUrl.value == "" ) {
			alert('요청 처리 주소를 입력해주세요');
			
			return false;
		}
			
		return true;
	}
</script>

<%
	// 실패 메시지 정보가 세션에 남아 있는 경우 삭제한다.
	session.removeAttribute("engineFailMessageInfoList");
	
	FailMessageManager failMessageManager = new FailMessageManager();
	
	List<EngineFailMessageInfo> faultMessageInfoList = failMessageManager.getEbxmlEngineFaultMessage();
	
	// 실패 메시지 정보를 세션에 저장합니다.
	session.setAttribute("engineFailMessageInfoList", faultMessageInfoList);
%>

<table width="100%" border="0" cellpadding="0" cellspacing="1"
	bgcolor="#CDDCED">
	<tr>
		<td
			style="PADDING-LEFT: 10px; PADDING-RIGHT: 20px; PADDING-TOP: 5px; PADDING-BOTTOM: 5px;"
			bgcolor="#FFFFFF">
			<table width="100%" border="0" align="center" cellpadding="0"
				cellspacing="0">
				<tr>
					<td width="15">
						<img src="<%=request.getContextPath()%>/image/search/icon_arrow.gif" width="11" height="11">
					</td>
					<td>
						<span class="style2">Ebxml 엔진 에러 메시지</span>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>

<br>
<table width="100%" height="39" border="0" cellpadding="0"
	cellspacing="0">
	<tr>
		<td background="sub/search_bg.gif"
			style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px;">
			총 
			<span class="style1"> <%=faultMessageInfoList.size()%> </span>건의 에러 메시지가 존재 합니다.
		</td>
	</tr>
</table>

<br>
<table width="100%" border="0" align="center" cellpadding="0"
	cellspacing="0">
	<tbody>
		<tr>
			<td width="60%" height="30" align="center"
				background="<%=request.getContextPath()%>/image/search/td_bg.gif">
				파일 이름
			</td>
			<td width="40%" align="center"
				background="<%=request.getContextPath()%>/image/search/td_bg.gif">
				저장 시간
			</td>
		</tr>

		<%
		if ( faultMessageInfoList.isEmpty() ) {
		%>
			<tr>
				<td colspan="5" style="text-align:center">
					실패 메시지가 없습니다.
				</td>
			</tr>
	
			<tr>
				<td colspan="5" align="center" bgcolor="#f0f0f0"></td>
			</tr>
		<%
			} 
			else {
				for(int i = 0; i < faultMessageInfoList.size(); i++) {
					EngineFailMessageInfo faultMessageInfo = faultMessageInfoList.get(i);
		%>
					<tr>
						<td width="60%" height="20" align="center">
							<%= faultMessageInfo.getFileName()  %>
						</td>
						
						<td width="40%" align="center">
							<%= faultMessageInfo.getFileMakeTime() %>
						</td>
					</tr>
			
					<tr>
						<td colspan="5" align="center" bgcolor="#f0f0f0"></td>
					</tr>
		<%
				}
			}
		%>
	</tbody>
</table>

<table width="100%" height="45" border="0" cellpadding="0"
	cellspacing="1">
	<tr align="center">
		<td>
			<form action="engineFailHandlerProcess.jsp" style="margin:0px;padding:0px;"
				name="failHandlerForm" onSubmit="return faultMessageSubmit(this);">
				<span style="text-align:center; width:800px">
					재처리 요청할 주소: <input name="bizboxUrl" type="text" size="100" maxlength="255" />
				</span>

				<span align="right" style="vertical-align:middle; margin-left:10px">
					<input type="submit" value="재처리 요청"> </span>
			</form>
		</td>
	</tr>
</table>
