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

<%
    EAIServerManager   manager   = EAIServerManager.getInstance();
    String[]           alls      = manager.getAllEaiSvrInstNm();
    String             action    = request.getParameter("actionType");
 
    String selectedKey = request.getParameter("selectedKey");
    if(selectedKey == null && alls.length>=1) {
    	selectedKey = alls[0];
    }
    
    EAIServerVO vo = null;
        
    if(selectedKey!=null) {
        vo = manager.getEAIServer(selectedKey);        
    }
%>

<html>
    <head>
        <title>
            EAIServer Manager
        </title>
        <script>
        function doAction() {
            document.frm.submit();
        }
        function doSearch(){
        	var searchValue = document.frm.searchTxt.value;
        	document.frm.selectedKey.value = searchValue;
        	document.frm.submit();
        } 
        function enterEvent(){
        	if(window.event.keyCode==13){
        		doSearch();
        	}
        }
        </script>
    </head>
    <body>
        <p style="font-size:12pt;">
        <b>서버 관리</b> <br><br>
        </p>
        <form name="frm" action="">
        <input type="hidden" name="actionType" value="">
        <table width="800" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td align='right' rowspan=2 width='350' bgcolor="#ccccff">EAI Server 인스턴스명 :&nbsp;&nbsp;</td>
            <td align='left' colspan=2>&nbsp;<select name=selectedKey onchange="doAction();">
            <%
                for(int i=0;i<alls.length;i++) {
            %>
                <option value="<%=alls[i]%>" <%= (alls[i].equals(selectedKey)) ? "selected" : "" %>><%=alls[i]%>
            <%           
                }
            %></select>
            </td>
        </tr>
        <tr bgcolor='white'>
            <td align='left' >&nbsp;<input type="edit"   name="searchTxt" onkeydown="enterEvent()" value="<%=selectedKey%>" style="width:98%" /></td> 
            <td colspan="2" align="center" ><input type="button" name="search" value="search" onClick="doSearch()" /></td>
        </tr>        
        </table><br>
        <table width="800" border=0 bgcolor='black' cellpadding="1" cellspacing="1">
        <tr bgcolor='white'>
            <td align='right' colspan=2 bgcolor="#003366">&nbsp; <font color="yellow"><b>내용</b> &nbsp;</font></td>
        </tr>
<%
    if(vo != null) {
%>  
        <tr bgcolor='white'>                                                                                                                                                                
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 서버 인스턴스명 : &nbsp;</td>                                                                                              
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="name" styel="width:98%" value="<%=vo.getName()%>" readonly></td>                                                              
        </tr>  
        
        <tr bgcolor='white'>                                                                                                                                                                
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 서버 아이피 : &nbsp;</td>                                                                                              
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="address" styel="width:98%" value="<%=vo.getAddress()%>" readonly></td>                                                              
        </tr>                 
        
        <tr bgcolor='white'>                                                                                                                                                                
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 서버 포트 : &nbsp;</td>                                                                                              
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="port" styel="width:98%" value="<%=vo.getPort()%>"></td>                                                              
        </tr> 
        
        <tr bgcolor='white'>                                                                                                                                                                
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 장애극복서버명 : &nbsp;</td>                                                                                              
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="failoverSvr" styel="width:98%" value="<%=vo.getFailoverSvr()%>" ></td>                                                              
        </tr>   
        
        <tr bgcolor='white'>                                                                                                                                                                
            <td align='right' width='350' bgcolor="#ccccff">&nbsp; 호스트명 : &nbsp;</td>                                                                                              
            <td align='left' style="height:40px;">&nbsp;<input type="text" name="failoverSvr" styel="width:98%" value="<%=vo.getHostName()%>" ></td>                                                              
        </tr>   

 <% 
    } 
%>    
        </table>
        </form>
    </body>
</html>