<%@ page language="java" contentType="text/html;charset=euc-kr"%>
<%@ page import="com.eactive.eai.common.property.PropManager"%>
<%@ page import="com.eactive.eai.common.property.PropGroupVO"%>

<%
    
    PropManager manager  = PropManager.getInstance();

    String[] grpList = manager.getAllPropGroupNames();

    String selectedName = request.getParameter("groupName");
    if (selectedName == null && grpList.length > 1) 
        selectedName = (String)grpList[0];
    
    PropGroupVO grpVO = null;
      
    if (selectedName != null) {
        grpVO = manager.getPropGroupVO(selectedName);       
    }
    
%>

<html>
    <head>
        <title>
            Properties Informations
        </title>
        <script>
        function doAction() {
            document.frm.submit();
        }
        
        function doUpdate() {
            document.frm.flag.value="U";
            document.frm.submit();
        }
        
        function doRemove() {
            document.frm.flag.value="D";
            document.frm.submit();
        }

        </script>
    </head>
    <body>
        <p style="font-size:12pt;">
        <b>Properties Informations</b> <br><br>
        </p>

        <form name="frm" action="">
        <table border='0'>
        <tr>
        <td align='left'>
        <table border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td align='right' bgcolor="#ccccff">Adapter Group : &nbsp;</td>
            <td align='left'>&nbsp;<select name="groupName" onchange="doAction();">
            <%
                for(int i=0;i < grpList.length; i++) {
            %>
                <option value="<%= grpList[i] %>" <%= (grpList[i].equals(selectedName)) ? "selected" : "" %>><%= grpList[i] %>
            <%           
                }
            %></select>
            </td>
        </tr>
        </table>
        </td>
        </tr>
        </table><br>
        
        <%
            if (selectedName != null) {
        %>
        <table border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td align='right' bgcolor="#ccccff">&nbsp; 프라퍼티 그룹명  : &nbsp;</td>
            <td align='left'><%=grpVO.getName()%></td>
        </tr>        
        <tr bgcolor='white'>
            <td align='right' bgcolor="#ccccff">&nbsp; 프라퍼티 그룹설명  : &nbsp;</td>
            <td align='left'><%=grpVO.getDescription()%></td>
        </tr>
        </table><br>
        <%
            }
        %>
        
        <table border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td bgcolor="#003366">&nbsp;<font color="yellow">Key</font></td>
            <td bgcolor="#003366">&nbsp;<font color="yellow">Value</font></td>
        </tr>
        <%
            if (selectedName != null) {
                String[] keys = grpVO.keys();
                for ( int inx=0; inx < keys.length; inx++){
                    String value = grpVO.getProperty(keys[inx]);
        %>

        <tr bgcolor='white'>
            <td align='left'><%=keys[inx]%></td>
            <td align='left'><%=value%></td>
        </tr>        
        
        <%
                }
            }
        %>
        </table>
        </form>
    </body>
</html>