<%@ page import="java.io.*, java.util.*"%>
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ page import="com.eactive.eai.common.restrict.*"%>

<%
	RestrictInfoManager manager = RestrictInfoManager.getInstance();    
	
	String action = request.getParameter("actionType");
	if("RELOAD".equals(action)) {
    	System.out.println("restrictInfo.jap - RELOAD called");
		manager.reload();
	}

	String[] names = manager.getAllCodes();
    Map<String, RestrictInfoVO> messages = manager.getAllRestrictInfos();   
    String selectedName = request.getParameter("code");
    if(selectedName == null && names.length>1) selectedName = names[0];
    
%>
<html>
    <head>
        <title>
            RestrictInfoManager
        </title>
        <script>
        function doAction() {
            document.frm.submit();
        }
        
        function doReload() {
            document.frm.actionType.value="RELOAD";
            document.frm.submit();
        }        
        </script>
    </head>
    <body>
        <p style="font-size:12pt;">
        <b>RestrictInfo</b> <br><br>
        </p>
        <form name="frm" action="">
        <input type="hidden" name="actionType" value="">
        <table width="600" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
<% if(selectedName!=null) { %>
        <tr bgcolor='white'>
            <td align='right' width='180' bgcolor="#ccccff"><label value="Code : "/>&nbsp;</td>
            <td align='left'>&nbsp;<select name="code" onchange="doAction();">
            <%
                for(int i=0;i<names.length;i++) {
            %>
                <option value="<%=names[i]%>" <%= (names[i].equals(selectedName)) ? "selected" : "" %>><%=names[i]%>
            <%           
                }
            %></select>
            </td>
        </tr>
        <tr bgcolor='white'>            
            <td align='right' width='200' bgcolor="#ccccff"><label value="EAI통제명 : "/>&nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="text" size="40" value="<%=((RestrictInfoVO)messages.get(selectedName)).getEAICtrlName()%>"></td>            
        </tr>
        <tr bgcolor='white'>            
            <td align='right' width='200' bgcolor="#ccccff"><label value="EAI통제명구분코드 : "/>&nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="text" size="40" value="<%=((RestrictInfoVO)messages.get(selectedName)).getEAICtrlNameDstcd()%>"></td>            
        </tr>
        <tr bgcolor='white'>            
            <td align='right' width='200' bgcolor="#ccccff"><label value="EAI통제구분내용 : "/>&nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="text" size="40" value="<%=((RestrictInfoVO)messages.get(selectedName)).getEAICtrlDsticCtnt()%>"></td>            
        </tr>
        <tr bgcolor='white'>            
            <td align='right' width='200' bgcolor="#ccccff"><label value="통제처리일시 : "/>&nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="text" size="40" value="<%=((RestrictInfoVO)messages.get(selectedName)).getCtrlPrcssYMS()%>"></td>            
        </tr>
        <tr bgcolor='white'>            
            <td align='right' width='200' bgcolor="#ccccff"><label value="거래제어처리명 : "/>&nbsp;</td>
            <td align='left'>&nbsp;<input type="text" name="text" size="40" value="<%=((RestrictInfoVO)messages.get(selectedName)).getTranCtrlPrcssName()%>"></td>            
        </tr>
<% } else { %>
  		      
<% } %>
        </table>
        <table border='0' width="800" >
        <tr>
        <td align='left'>
            <input type="button" value="RELOAD" onclick="doReload()">
        </td>
        </tr>
        </table><br>
        </form>
    </body>
</html>