<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ page import="java.io.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/jsp/common/include/localemessage.jsp" %>
<%@ page import="com.eactive.eai.rms.common.login.SessionManager"%>
<%@ page import="com.eactive.eai.common.util.SystemUtil"%>
<%
	response.setHeader("Pragma", "No-cache");
	response.setHeader("Cache-Control", "no-cache");
	response.setHeader("Expires", "0");

%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<jsp:include page="/jsp/common/include/css.jsp"/>
<jsp:include page="/jsp/common/include/script.jsp"/>
<script language="javascript">

var url      = '<c:url value="/onl/admin/adapter/webSocketMan.json" />';
var url_view = '<c:url value="/onl/admin/adapter/webSocketMan.view" />';

$(document).ready(function() {
	
	var gridPostData = getSearchForJqgrid("cmd","LIST"); //jqgrid에서는 object 로
	
	$('#grid').jqGrid({
		datatype : "json",
		mtype : "POST",
		url : url,
		postData : gridPostData,		
		colNames : [
			'<%= localeMessage.getString("webScktMan.userID") %>',
			'<%= localeMessage.getString("webScktMan.instNm") %>',
            '<%= localeMessage.getString("webScktMan.adptGrpNm") %>',
            '<%= localeMessage.getString("webScktMan.locScktAddr") %>',
            '<%= localeMessage.getString("webScktMan.remtScktAddr") %>',
            '소켓상태'
            ],
		colModel : [
			{ name:'loginUserId', 			align:'center', width:50 },
			{ name:'wsInstId',				align:'center', width:50 },
			{ name:'wsAdapterGroupName',  	align:'center' },
			{ name:'localSocketAddress',	align:'center' },
			{ name:'remoteSocketAddress',	align:'center' },
			{ name:'socketStatus', 			align:'center', hidden : 'true' }
			],
        jsonReader: {
             repeatitems:false
        },	          
		pager : $('#pager'),		
		rowNum : '${rmsDefaultRowNum}',
	    autoheight: true,
	    height: $("#container").height(),
		autowidth: true,
		viewrecords: true,
		rowList : eval('[${rmsDefaultRowList}]'),		
		gridComplete:function (d){
			var colModel = $(this).getGridParam("colModel");
			for(var i = 0 ; i< colModel.length; i++){
				$(this).setColProp(colModel[i].name, {sortable : false});	//그리드 헤더 화살표 삭제(정렬X)		
			}
		},		
		ondblClickRow: function(rowId) {
			/*
			var rowData = $(this).getRowData(rowId); 
            var eaiSevrInstncName = rowData['EAISEVRINSTNCNAME'];
            var url2 = url_view;
            url2 += '?cmd=DETAIL';
            url2 += '&page='+$(this).getGridParam("page");
            url2 += '&returnUrl='+getReturnUrl();
            url2 += '&menuId='+'${param.menuId}';
			//검색값
            //
            //key값
            url2 += '&eaiSevrInstncName='+eaiSevrInstncName;
            goNav(url2);
            */
        }
	});
	
	resizeJqGridWidth('grid','content_middle','1000');
	
	$("#btn_search").click(function() {
		var postData = getSearchForJqgrid("cmd","LIST"); 
		
		postData['loginUserId'] = $("input[name=loginUserId]").val();
		postData['remoteSocketAddress'] = $("input[name=remoteSocketAddress]").val();
		
		$("#grid").setGridParam({ postData: postData ,page : "1"  }).trigger("reloadGrid");
	});
	
	$("input").keydown(function(key){
		if (key.keyCode == 13){
			$("#btn_search").click();
		}
	});
	
	buttonControl();
	
});
</script>
</head>
<body>
	<div class="right_box">
		<div class="content_top">
			<ul class="path">
				<li><a href="#">${rmsMenuPath}</a></li>					
			</ul>					
		</div><!-- end content_top -->
		<div class="content_middle" id="content_middle">
			<div class="search_wrap">
				<button type="button" class="cssbtn" id="btn_search" level="R"><i class="material-icons">search</i> <%= localeMessage.getString("button.search") %></button>
<%-- 				<img src="<c:url value="/img/btn_search.png"/>" alt="" id="btn_search" level="R" />		 --%>
			</div>
			<div class="title"><%= localeMessage.getString("webScktMan.title") %></div>
			<form id="ajaxForm">
				<table class="search_condition" cellspacing=0;>
					<tbody>
						<tr>
							<th width="100px"><%= localeMessage.getString("webScktMan.userID") %></th>
							<td width="200px"><input type="text" name="loginUserId" value="${param.loginUserId}"></td>
							<th width="100px"><%= localeMessage.getString("webScktMan.remtScktAddr") %></th>
							<td><input type="text" name="remoteSocketAddress" value="${param.remoteSocketAddress}"></td>
						</tr>
					</tbody>
				</table>
			</form>
			<table id="grid" ></table>
			<div id="pager"></div>
		</div>
	</div>
</body>
</html>